diff options
author | Nicolas "Pixel" Noble <pixel@nobis-crew.org> | 2009-09-20 21:03:33 +0200 |
---|---|---|
committer | Nicolas "Pixel" Noble <pixel@nobis-crew.org> | 2009-09-20 21:03:33 +0200 |
commit | eb3bf203a14e81735d6f74467541a6500a3bdf86 (patch) | |
tree | b4dd27d9411c50a7f416d56044b2e67f4792eab1 /Database/internals/database-segment.h | |
parent | 6a653b35990e9a642dd4af9b8ee5742d5a84956c (diff) |
Removing horrible CR/LF line endings.
Diffstat (limited to 'Database/internals/database-segment.h')
-rw-r--r-- | Database/internals/database-segment.h | 144 |
1 files changed, 72 insertions, 72 deletions
diff --git a/Database/internals/database-segment.h b/Database/internals/database-segment.h index 72086a7..a08b149 100644 --- a/Database/internals/database-segment.h +++ b/Database/internals/database-segment.h @@ -1,72 +1,72 @@ -#ifndef __DATABASE_SEGMENT_H__
-#define __DATABASE_SEGMENT_H__
-
-#include "database-types.h"
-
-class SegmentRefData;
-
-/**
- * The Segment class that holds the memory and patches for a memory segment.
- *
- * This class will passively hold the memory for a segment memory. The tags
- * corresponding to each byte are also stored there. The patches are optionnal,
- * and will only be allocated if a patch is actually done.
- *
- * TODO: do in-memory hollow structure for the tags.
- */
-
-class Segment : public Base {
- public:
- /**
- * Main constructor.
- *
- * @param size is the real data size of this segment.
- * @param id is the static id for that data segment.
- * @param cpu_base is the base absolute physical address for that segment in the cpu's flat memory.
- * @param extra_size gives the size of the uninitialized memory at the end of the segment, typically the bss part.
- * @param data optionally holds the memory to use for this segment. If it's provided, the caller MUST NOT free it, as it's going to be used directly.
- */
- Segment(Uint32 size, Uint32 id, Uint64 cpu_base, Uint32 extra_size = 0, const Byte * data = 0);
- ~Segment();
- Uint32 getId() { return id; }
- /** Will return the byte for that pointer in the segment. May be patched.
- * @param ptr is the pointer for the byte to be retrieved.
- * @return the byte read, or -1 if it's inside the BSS part, or outside the whole segment.
- */
- short Read(Uint32 ptr);
- /** Will return the byte for that pointer in the segment. Will NOT be patched.
- * @param ptr is the pointer for the byte to be retrieved.
- * @return the byte read, or -1 if it's inside the BSS part, or outside the whole segment.
- */
- short RawRead(Uint32 ptr);
- /** In case you need to read the (unpatched) memory block.
- * @return the memory block of the segment.
- */
- const Byte * getPristineMemory() { return plainmemory; }
- void Patch(Uint32 ptr, Byte val);
- void Restore(Uint32 ptr);
- bool IsPatched(Uint32 ptr);
- bool IsLoaded() { return loaded; }
- /** Will load the memory segment with the provided Handle; will
- * only work if you didn't provide data during the constructor.
- * @see Segment()
- */
- void LoadMemory(Handle * src);
- void setTag(Uint32 ptr, memory_tags_t tag);
- memory_tags_t getTag(Uint32 ptr);
- Uint32 getSize() { return size; }
- Uint64 getFullSize() { return size + extra_size; }
- Uint64 getCpuBase() { return cpu_base; }
- SegmentRefData * getSegmentRefData(Uint32 ptr);
- void setSegmentRefData(Uint32 ptr, SegmentRefData * data);
- private:
- Byte * plainmemory, * patches, * patchesmap;
- SegmentRefData ** refData;
- memory_tags_t * tags;
- bool loaded, allocated;
- Uint32 size, extra_size;
- Uint32 id;
- Uint64 cpu_base;
-}
-
-#endif
+#ifndef __DATABASE_SEGMENT_H__ +#define __DATABASE_SEGMENT_H__ + +#include "database-types.h" + +class SegmentRefData; + +/** + * The Segment class that holds the memory and patches for a memory segment. + * + * This class will passively hold the memory for a segment memory. The tags + * corresponding to each byte are also stored there. The patches are optionnal, + * and will only be allocated if a patch is actually done. + * + * TODO: do in-memory hollow structure for the tags. + */ + +class Segment : public Base { + public: + /** + * Main constructor. + * + * @param size is the real data size of this segment. + * @param id is the static id for that data segment. + * @param cpu_base is the base absolute physical address for that segment in the cpu's flat memory. + * @param extra_size gives the size of the uninitialized memory at the end of the segment, typically the bss part. + * @param data optionally holds the memory to use for this segment. If it's provided, the caller MUST NOT free it, as it's going to be used directly. + */ + Segment(Uint32 size, Uint32 id, Uint64 cpu_base, Uint32 extra_size = 0, const Byte * data = 0); + ~Segment(); + Uint32 getId() { return id; } + /** Will return the byte for that pointer in the segment. May be patched. + * @param ptr is the pointer for the byte to be retrieved. + * @return the byte read, or -1 if it's inside the BSS part, or outside the whole segment. + */ + short Read(Uint32 ptr); + /** Will return the byte for that pointer in the segment. Will NOT be patched. + * @param ptr is the pointer for the byte to be retrieved. + * @return the byte read, or -1 if it's inside the BSS part, or outside the whole segment. + */ + short RawRead(Uint32 ptr); + /** In case you need to read the (unpatched) memory block. + * @return the memory block of the segment. + */ + const Byte * getPristineMemory() { return plainmemory; } + void Patch(Uint32 ptr, Byte val); + void Restore(Uint32 ptr); + bool IsPatched(Uint32 ptr); + bool IsLoaded() { return loaded; } + /** Will load the memory segment with the provided Handle; will + * only work if you didn't provide data during the constructor. + * @see Segment() + */ + void LoadMemory(Handle * src); + void setTag(Uint32 ptr, memory_tags_t tag); + memory_tags_t getTag(Uint32 ptr); + Uint32 getSize() { return size; } + Uint64 getFullSize() { return size + extra_size; } + Uint64 getCpuBase() { return cpu_base; } + SegmentRefData * getSegmentRefData(Uint32 ptr); + void setSegmentRefData(Uint32 ptr, SegmentRefData * data); + private: + Byte * plainmemory, * patches, * patchesmap; + SegmentRefData ** refData; + memory_tags_t * tags; + bool loaded, allocated; + Uint32 size, extra_size; + Uint32 id; + Uint64 cpu_base; +} + +#endif |