Return to BSD News archive
Path: sserve!manuel!munnari.oz.au!uunet!mcsun!news.funet.fi!hydra!klaava!torvalds From: torvalds@klaava.Helsinki.FI (Linus Torvalds) Newsgroups: comp.unix.bsd Subject: Re: vm86 system call Message-ID: <1992Sep29.103334.18402@klaava.Helsinki.FI> Date: 29 Sep 92 10:33:34 GMT References: <1992Sep28.054649.15131@lugb.latrobe.edu.au> Organization: University of Helsinki Lines: 38 In article <1992Sep28.054649.15131@lugb.latrobe.edu.au> lurch@ee.latrobe.edu.au (Geoffrey Liersch) writes: > >Has anyone got any comments on where to start the implementation of the >vm86 system call such as the system call number, parameters, header files to >be changed or any other hints/documentation that I should be aware of as I >am looking at implementing such a call? A vm86 system call has the rather bad point of resulting in some fundamental changes in how interrupts/exceptions are handled: the supervisor stack looks different when the exception happened in vm86 mode. I don't know how 386bsd handles this state information, but it could be potentially ugly (ie needing a lot of small changes to some fundamental routines.) Assuming that isn't a problem, you might look at the way I did it (with comments/suggestions from others) for linux: as far as I am concerned, the linux VM86 code can be used freely for 386bsd if you can get it to work (under similar conditions as the math emulator. See the copyright on that one). Whatever you do, you need a good understanding of the vm86 mode. If you decide to use code from linux, just drop me a line, and we can make it official (ie don't take the above as "do anything you like with my code" - but I'm flexible about the copyleft). The linux vm86() code assumes all special cases are handled by the user-level DOS emulator - the kernel does nothing at all when an exception occurs, and only sends the process the correct signal which will then be processed in "normal" 32-bit mode. That means the vm86() interface is only about 100 lines (might even be less) of C code (and a couple of checks in "ret_from_sys_call" which is written in assembler). I'll be happy to answer (intelligent) questions about the linux implementation in case somebody wants to do something similar for 386bsd. It is entirely possible that the linux way of doing things simply won't work under 386bsd: the vm86() system call does some "interesting" simplifications by playing around with the supervisor stack addresses etc. Linus