You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
746 B

7 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. #ifndef __BASIC_MEMORY_OPERATION_H_INCL__
  2. #define __BASIC_MEMORY_OPERATION_H_INCL__
  3. #include <stdio.h>
  4. #include <malloc.h>
  5. #include <unistd.h>
  6. #include <sys/mman.h>
  7. #include <sys/types.h>
  8. #include <sys/stat.h>
  9. #include <errno.h>
  10. #include <fcntl.h>
  11. #include <stdint.h>
  12. #define S32_BIT_OPERATIONS
  13. #ifdef S32_BIT_OPERATIONS
  14. #define PAGEMAP_ENTRY 8
  15. #define GET_BIT(X,Y) (X & ((uint64_t)1<<Y)) >> Y
  16. #define GET_PFN(X) X & 0x7FFFFFFFFFFFFF
  17. uint32_t getPhysicalAddr( uint32_t VirtualAddr );
  18. #else
  19. #define PAGEMAP_ENTRY 8
  20. #define GET_BIT(X,Y) (X & ((uint64_t)1<<Y)) >> Y
  21. #define GET_PFN(X) X & 0x7FFFFFFFFFFFFF
  22. uint64_t getPhysicalAddr( uint64_t VirtualAddr );
  23. #endif
  24. #endif // __BASIC_MEMORY_OPERATION_H_INCL__