#include <stdio.h>
#include <sys/mman.h>
#include <fcntl.h>
int main(void)
{
int fd = open("/dev/mem", O_RDWR);
void* ptr = mmap(NULL, 4096, PROT_READ,
MAP_SHARED, fd, 0x49000000);
close(fd);
if(ptr == MAP_FAILED)
{
printf("mmap failed\n");
return -1;
}
volatile unsigned* GINTSTS = (unsigned*)(ptr + 0x14);
printf("%08X \n",*GINTSTS);
munmap(ptr, 4096);
return 0;
}
#include <sys/mman.h>
#include <fcntl.h>
int main(void)
{
int fd = open("/dev/mem", O_RDWR);
void* ptr = mmap(NULL, 4096, PROT_READ,
MAP_SHARED, fd, 0x49000000);
close(fd);
if(ptr == MAP_FAILED)
{
printf("mmap failed\n");
return -1;
}
volatile unsigned* GINTSTS = (unsigned*)(ptr + 0x14);
printf("%08X \n",*GINTSTS);
munmap(ptr, 4096);
return 0;
}
댓글 없음:
댓글 쓰기