mra@searchtech.com (Michael Almond) (05/24/91)
Are there any packages that emulate VxWorks under unix? -- Michael R. Almond (Georgia Tech Alumnus) mra@srchtec.uucp (registered) search technology, inc. mra@searchtech.com 4725 peachtree corners cir., suite 200 uupsi!srchtec!mra norcross, georgia 30092 (404) 441-1457 (office)
smeg@laguna.uucp (Maarten Koning) (05/24/91)
In article <1991May23.181023.24493@searchtech.com> mra@searchtech.com (Michael Almond) writes: >Are there any packages that emulate VxWorks under unix? I have ported vxWorks 4.0.2 to run under SunOS as a single process. This paradigm seems to works well, particularily if you want to run multiple vxWorks kernels in one Unix machine. The basic recipe for a 'Unix board support package' is as follows: - Solve the naming collisions between the Unix functions you need and the vxWorks calls of the same name (read, malloc etc). One simple solution (this is what I did) is to upper case the Unix calls. I put a small hack into nm to upper case externals and ran it on copies of Unix libraries. - Change the wind kernel (which is what vxWorks is based upon) to use the light weight process (LWP) library to do the context dispatching. (I added an LWP thread id to the vxWorks TCB). The vxWorks scheduling algorthims are used to pick the next task to dispatch, but instead of doing the dispatch in assembler, you just suspend the current LWP and resume the next (in the opposite order, of course). - Re-write any vxWorks assembler code in C for easy debugging and maintaining (the scheduler was an example of this) - At startup, spawn some LWP's to handle console IO (Unix standard in and out become the console), timers (I tick 50 times a second), and signal handlers (its handy to trap bus errors and segmentation violations) - Add networking: This one was fun - I wrote a loadable SunOS device driver that gives a file descriptor interface to IP networking. ie. you open /dev/ip and an interface gets added in the kernel (similar to SLIP) with an ip address in the 127 network. You can then read and write IP packets from user level. Since the driver supports asynch IO, non-blocking IO and select, you can spawn a LWP under vxWorks (under Unix) to simulate the ethernet interrupts by having it block on /dev/ip. - Add a main routine that does MALLOC (from Unix) of a few hundred K to use as the heap (poor man's virtual memory under vxWorks?) - stir and cook for six weeks. Once networking is done, you can really go to town. I currently have vxWorks running under SunOS 4.1.1 on a sparcstation complete with an NFS file system (mounted from the host Unix machine) and you can rlogin or telnet into it. I also have dynamic loading (for sparc) working. It sure confuses onlookers when you rlogin to something running on the same machine... Unfortunately, you need a vxWorks source licence to do this. I am, however, planning to discuss with Wind River if they would be interested in productizing (and maintaining - which would be our motive) this stuff. It sure is handy for fast application development (especially when you don't have working hardware available) since you can debug the whole kernel as a normal Unix application (I use gdb etc, here). ...Maarten -- //include1 pgm=disclaimer,parm='my opinions only' Maarten Koning | Internet: smeg@bnr.ca | Phone: (613) 763-8796 BNR Ltd. | UUCP: smeg@bigsur.UUCP | FAX: (613) 763-2626