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
722 B

#ifndef __BASIC_MEMORY_OPERATION_H_INCL__
#define __BASIC_MEMORY_OPERATION_H_INCL__
#include <errno.h>
#include <fcntl.h>
#include <malloc.h>
#include <stdint.h>
#include <stdio.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#define S32_BIT_OPERATIONS
#ifdef S32_BIT_OPERATIONS
#define PAGEMAP_ENTRY 8
#define GET_BIT(X, Y) (X & ((uint64_t) 1 << Y)) >> Y
#define GET_PFN(X) X & 0x7FFFFFFFFFFFFF
uint32_t getPhysicalAddr(uint32_t VirtualAddr);
#else
#define PAGEMAP_ENTRY 8
#define GET_BIT(X, Y) (X & ((uint64_t) 1 << Y)) >> Y
#define GET_PFN(X) X & 0x7FFFFFFFFFFFFF
uint64_t getPhysicalAddr(uint64_t VirtualAddr);
#endif
#endif // __BASIC_MEMORY_OPERATION_H_INCL__