Skip to content

Instantly share code, notes, and snippets.

@amastov
Created April 14, 2016 05:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amastov/8905feaf40236eca585ef7cc4286ad22 to your computer and use it in GitHub Desktop.
Save amastov/8905feaf40236eca585ef7cc4286ad22 to your computer and use it in GitHub Desktop.
//-----------------------------------------------------------------------------
// 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