From: Cedric A. <ced...@in...> - 2000-01-13 01:03:40
|
Jeff Dike writes: > > > Posix compatibility is definitely not enough. I think the > > > biggest problem would be the ability to intercept and modify > > > Linux system calls. Nothing works without that. > > > > Ah, a light dawns. I wondered (without wondering enough to learn the > > Linux and uml internals) how you virtualized the machine. This > > combines with the comments about debugging yourself to explain the > > fundamentals... > > Actually, with an OS that maps reasonably well to Linux, it might > not be hard > to replace the top layer (the bit that intercepts system calls) with its > equivalent. It would run its own binaries and map those syscalls > onto Linux > syscalls. > > Everything below that layer it Posix, I think. Except maybe some of the > mmaping that I do. Actually, I wondered too if uml could be ported to Windows NT, but after just running strace on uml-linux, I still don't understand perfectly how it works :-) Did you post some information about it somewhere (kernel list, newsgroup) ? Ok, a quick look at /proc/*/maps, shows that maybe you allocated a file for the physical memory and mmaped it at the right places in each thread (this is how I suggested to make a user-space freemware, using also a main process that ptraces another to catch exceptions, software interrupts, emulate specific instructions... and setting the proper memory map at each context switch). Anyway for NT, the question would rather be whether how much you need out of ANSI-C ? All what I know is the following: - NT (Windows?) has the equivalent of "ptrace" except that you only get the DLL load/unload and the exceptions (with the "debugging functions"). - NT debugging process receives an exception_event when you execute an "int 0x80". I made a test program: parent+child, where the child would execute an int 0x80, the parent would see this, get the eip address, change the "int 0x80" to "nop ; nop", and have the child going on. This works. - My Windows 98 locks instantly _sometimes_ when running the same program executing "int 0x80". Otherwise the system display a full screen fatal error, ask for enter to be pressed and stop the process normally. According to "Undocumented Windows NT", Set_PM_Int_Vector could be used to hook a software interrupt, though. - NT has some file maping and some virtual memory management functions that should provide some of the capabilities of mmap (and more). The nice thing about NT, is that it has some way to manipulate the file/memory maping of other processes, so maybe it would do. For 95, there are additionnal limitations (such as copy-on-write forced when maping files for write), that were probably the source of problems for mmap in Cygnus tools. -- Cedric |