#include <stdlib.h>
#include <stdio.h>
#include <err.h>
#include <errno.h>
#include <sys/mman.h>
#include "defines.h"
#include <fcntl.h>void * RAM;
int main(int argc, char **argv)
{
int i = open("disk/hello", O_RDWR);
if (i == -1)
errc(errno, errno, "Unable to open file\n");
RAM = mmap(0, MEMORY_NPAGE * MEM_PAGE_SIZE,
PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE, i, 0);
if (RAM == MAP_FAILED) errc(errno, errno, "Unable to map memory\n");
printf("fd an allocated addres %d %lx\n", i, (long int)RAM);
// _Jv_RegisterClasses symbol
long unsigned int * _Jv_RegisterClasses = RAM;
*_Jv_RegisterClasses = (long unsigned int) RAM;
int (*System)(int, char**) = RAM + 0x5680; //Symbol "T main"
int j = System(10, argv);
printf("Hello return %d\n", j);
if (munmap(RAM, MEMORY_NPAGE * MEM_PAGE_SIZE) == -1)
errc(errno, errno, "Unable to umap memory\n");
return 0;
}