Created
          February 19, 2015 06:22 
        
      - 
      
 - 
        
Save run/73848de4b159539f4612 to your computer and use it in GitHub Desktop.  
Revisions
- 
        
Runzhen created this gist
Feb 19, 2015 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,32 @@ #include <sys/mman.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <stdio.h> #define PAGE_SIZE (4 * 1024) #define KERNEL_PHY_ADDR 0x77128000 int main() { char *buf; int fd; fd = open(“/dev/mem”,O_RDWR); if (fd == -1) perror(“open”); buf = mmap(0, PAGE_SIZE, PROT_READ|PROT_WRITE, MAP_SHARED, fd, KERNEL_PHY_ADDR); if (buf == MAP_FAILED) perror(“mmap”); puts(buf); munmap(buf,PAGE_SIZE); close(fd); return 0; }