How can I put some data at virtual address 0? Is it possible at all? Both OMF and COFF object file formats seem to allow the absolute address of a section to be specified, I just need a compiler/assembler/linker/whatever that can create EXEs with such a section.
Posted on 2002-07-19 22:24:15 by VP_
Even if your compiler/linker will allow that - the loader will (hopefully) prevent it. Page 0 is read- and write protected in win32. And whats the benefit of that at all?
Posted on 2002-07-19 23:49:46 by japheth
I'm writing an emulator ? la WINE or LINE.
If I can't use page 0 in the address space created by Windows, how can I create my own address spaces?
Posted on 2002-07-20 03:44:38 by VP_
You can't really create "your own address space" - windows does that
for you when it loads your executable. I also doubt you can access page
0 under linux.
Posted on 2002-07-20 06:18:34 by f0dder
Ok, what about my own ring 0 driver that creates it? Or a whole VM? Anything?

BTW: I'm not going to emulate Linux. And in Linux, access to page 0 is trivial:


#include <unistd.h>
#include <sys/mman.h>
main() {
void *i = mmap(0, 4096, PROT_READ | PROT_WRITE,
MAP_FIXED | MAP_PRIVATE | MAP_ANONYMOUS, 0, 0);
printf("%x\n", i);
if (i != MAP_FAILED) printf("%x\n", munmap(i, 4096));
}
Posted on 2002-07-20 07:50:09 by VP_