1

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

pastebin.com/D5vMH5CW

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");

https://github.com/Free60Project/libxenon

weston
  • 54,145
  • 21
  • 145
  • 203
  • It is a large positive number. It's not a pointer. Your second question is like asking "what is the difference between 100 and 10000". Your question would be much improved if you could post some of this code you have seen. – M.M Mar 14 '15 at 08:12
  • 0x80000000 is a 32 bit, or 4 bytes int value where the other one is 8 bytes long – faljbour Mar 14 '15 at 08:28
  • added some source code I've seen it in @MattMcNabb – user1425470 Mar 14 '15 at 08:31
  • The difference between the numbers is that 0x8000000000000000UL is 4,294,967,296 times greater than 0x80000000. – molbdnilo Mar 14 '15 at 08:31
  • looks like it's being used as some sort of flag, perhaps it is described in the documentation for these libraries you are using. – M.M Mar 14 '15 at 09:08
  • 2
    Those are just some random memory offsets. They are specific to xbox. Maybe it's a start of user space memory (one 32 and the other 64bit)? Or, maybe this is an address where physical memory is mapped? – Piotr Praszmo Mar 14 '15 at 09:14
  • 1
    @molbdnilo To smart-ass counter your smart-ass comment: you get the difference by subtraction, not by division. :) –  Mar 14 '15 at 10:14
  • Be careful with the suffix: `0x8000000000000000UL` is an `unsigned long` whereas `0x8000000000000000ULL` is an `unsigned long long`. On some platforms (such as Windows) `unsigned long` is 32 bits (the minimum required by the C Standard), the number `0x8000000000000000UL` on these is a integer constant that overflows the type specified by the suffix, yielding `0`, hopefully with a compiler warning. The minimum for `unsigned long long` is 64 bits; `0x8000000000000000ULL` is thus portable on all platforms that support 64 bit integers. – chqrlie Mar 14 '15 at 13:03
  • 1
    This question is unclear. It's a number: *you* give it a meaning. – edmz Mar 14 '15 at 13:11

0 Answers0