[Tuxnes-devel] Use of mmap ()
Brought to you by:
tmmm
From: W. M. P. <mi...@fl...> - 2002-05-14 19:52:51
|
Could someone explain what mmap is being used for in emu.c: /* allocate space for the ROM */ if ((r = (int) mmap(ROM, 0x300000, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_FIXED | MAP_PRIVATE | MAP_ANON, -1, 0)) < 0) { perror("mmap"); exit(1); } ? The comment makes me wonder why malloc was not used. I am not familiar with the MAP_ANON option. Also, in mapper.h things like _RAM point to hard-coded addresses, in this case 0x10000000. Again, why is this done? GNU as will assume that undefined variables are, to use C's syntax, extern, so _RAM could just be defined as a char * in mapper.c. I'm trying to get the dynrec. code to lay nicely with my new emulator interface. -- Mike :wq |