Created
April 14, 2016 05:01
-
-
Save amastov/8905feaf40236eca585ef7cc4286ad22 to your computer and use it in GitHub Desktop.
This file contains 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 characters
//----------------------------------------------------------------------------- | |
// Project 3 Userspace code. | |
//----------------------------------------------------------------------------- | |
#include <stdio.h> | |
#include <stdlib.h> | |
#define __NR_sys_get_addr 360 | |
int main(int argc, char* argv[]) | |
{ | |
//unsigned long vfn; | |
long pleaseWork =0 ; | |
//unsigned long physical; | |
unsigned long temp = strtoul(argv[2],NULL,16); | |
printf("Address:"); | |
if(argc == 3) | |
{ | |
//printf("before\n"); | |
pleaseWork = syscall(__NR_sys_get_addr, atoi(argv[1]),temp) ; | |
//printf("after\n"); | |
pleaseWork = ( 0xfffff000 & pleaseWork); | |
//printf("%lu\n",pleaseWork); | |
printf("0x%x\n",pleaseWork); | |
} | |
else | |
{ | |
printf("ERROR: Two Arguments expected! Number of Arguments:%d\n\n", (argc - 1)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment