61 lines · 2.2 KB · Text
RawDownload
Plan 9 VX Hacking Guide * Make For now, 9vx lives in the vx32 distribution, so it uses a somewhatinvolved build setup comprising multiple makefile fragmentscalled Makefrags.  You shouldn't need to concern yourself withthese except to remember to open "Makefrag" instead of "Makefile"and to run "make 9vx/9vx" in the src/ directory to build 9vx.The primary benefit of this arrangement is that if you edita file anywhere in the tree (even in libvx32), make will know that9vx/9vx is out of date.  * Source layout The files in the 9vx and 9vx/x11 directories are maintained by hand.The files in the other 9vx subdirectories (9vx/a, 9vx/libsec, etc.)are automatically generated from Plan 9 sources by applying simpleed scripts (named *.ed).  This simplifies incorporating new code fromPlan 9, and also documents what the local changes are, so thatthere's some hope of pushing them back.  If someone would like totake these scripts and do the same to drawterm, I'd gladly accept the result.  (If you don't know what drawterm is, don't worry about it.)The 1,000 lines of ed scripts substitute for maintaining 40,000 linesof imported code.  (If someone would like to convert drawterm todo this, please feel free.) Unless you're fiddling with x11 or Plan 9 itself, you should be ableto restrict yourself to just editing files in this top directory.  The core of 9vx is the six files: 	main.c	mmu.c	sched.c	time.c	trap.c	vx32.c These files total about 2500 lines.  I've tried to comment them prettywell, and you should try to understand them all before hacking on 9vx.If anything isn't clear, feel free to ask, so that I can update the comments. The *dev*.c files implement access to host resources.  * Kernel changes The most pervasive change to the Plan 9 kernel in creating Plan 9 VXis that valid user addresses cannot simply be dereferenced in kernel mode.Instead they must be translated to sit relative to uzero, the base of theuser address space.  (Early versions of 9vx used uzero=0, but too manyoperating systems had problems with mapping data at address 0.)Any code that casts a user address to a pointer or vice versa is wrong.I think I've caught them all, but I might have missed some in obscurecode paths.  Russ Coxrsc@swtch.comJune 2008