SHARE
TWEET

Untitled

a guest Jan 29th, 2013 21 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. [@openrisc]/# ./a.out /lib/libm.so.6                                          
  2. page_size: 2000
  3. test:  30003f30
  4. test*: 6e61626c << Very wrong
  5.  
  6. [imac]$ qemu-or32 ./a.out lib/libm.so.6
  7. page_size: 2000
  8. test:  f67fbf30
  9. test*: 1 << CORRECT
  10.  
  11. #include <stdio.h>
  12. #include <sys/types.h>
  13. #include <sys/mman.h>
  14. #include <sys/stat.h>
  15. #include <fcntl.h>
  16. #include <unistd.h>
  17.  
  18. int main(int argc, char *argv[])
  19. {
  20.  
  21.   int fd = open(argv[1], O_RDONLY);
  22.   printf("page_size: %x\n", sysconf(_SC_PAGE_SIZE));
  23.   int * addr = (int *) mmap(0, 0x2000, PROT_READ, MAP_FILE|MAP_PRIVATE, fd, 0xd4000);
  24.  
  25.   printf("test:  %x\n", (int*) ((char*)addr + 0x1F30));
  26.   printf("test*: %x\n", *(int*) ((char*)addr + 0x1F30));
  27.  
  28.   return 0;
  29. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top