Memory.c 964 B

1234567891011121314151617181920212223242526
  1. /* This Hello World simply print out "Hello World" */
  2. #include <stdint.h>
  3. #include "pal.h"
  4. #include "pal_debug.h"
  5. int main(int argc, char** argv, char** envp) {
  6. void* p1 = (void*)DkVirtualMemoryAlloc(NULL, pal_control.alloc_align * 4, 0,
  7. PAL_PROT_READ | PAL_PROT_WRITE);
  8. void* p2 = (void*)DkVirtualMemoryAlloc(NULL, pal_control.alloc_align * 4, 0,
  9. PAL_PROT_READ | PAL_PROT_WRITE);
  10. void* p3 = (void*)DkVirtualMemoryAlloc(NULL, pal_control.alloc_align * 2, 0,
  11. PAL_PROT_READ | PAL_PROT_WRITE);
  12. DkVirtualMemoryAlloc((void*)(((uint64_t)p1 + (uint64_t)p2) / 2), pal_control.alloc_align * 4, 0,
  13. PAL_PROT_READ | PAL_PROT_WRITE);
  14. DkVirtualMemoryAlloc(p3, pal_control.alloc_align * 2, 0, PAL_PROT_READ | PAL_PROT_WRITE);
  15. DkVirtualMemoryFree(p3, pal_control.alloc_align);
  16. return 0;
  17. }