I've seen it around when snooping through source code and mainly used as an offset from what I can tell. but I'm a little confused as to what exactly is it?
- Where exactly is it pointing too
- what would be the difference between 0x8000000000000000UL and 0x80000000 other than the UL, I know that makes it an unsigned long.
If I were to go about messing with physical memory (lets say I had a system that would let me) how would I use this in my code if its needed?
For clarification the main confusion I'm having right now is understanding how such a big value is able to be used when dealing with memory locations. I normally don't see that kind of value used when referring to offsets.
I do some programming for homebrew on the xbox 360 so thats mainly where I see it. The following is code to dump a hypervisor from memory.
dprintf("Dumping HV....\n");
UINT64 dest = 0x8000010600032500ULL;
BYTE* pbPayload = (BYTE*)XPhysicalAlloc(0x100, MAXULONG_PTR, 0, PAGE_READWRITE);
memcpy(pbPayload, hvPayload, 112);
UINT64 src = 0x8000000000000000ULL + ((DWORD)MmGetPhysicalAddress(pbPayload));
BYTE* pbHypervisor = (BYTE*)XPhysicalAlloc(0x40000, MAXULONG_PTR, 0, PAGE_READWRITE);
memset(pbHypervisor, 0, 0x40000);
UINT64 xArg = 0x8000000000000000ULL + ((DWORD)MmGetPhysicalAddress(pbHypervisor));
HvxGetVersion(0x72627472, 4, dest, src, 0x40, xArg);
dprintf("HV dumped\nSaving HV....\n");
NOTE: HvxGetVersion
reads memory
Another place I can think of that I've seen it is in libxenon, a library to help create homebrew from little to no pre-existing code.
void *target = (void*)(((unsigned long)0x8000000000000000UL) | shdr->sh_addr);
if (shdr->sh_type == SHT_NOBITS) {
memset (target, 0, shdr->sh_size);
} else {
memcpy ((void *) target,
(unsigned char *) addr + shdr->sh_offset,
shdr->sh_size);
}
flush_code (target, shdr->sh_size);
puts("done");