1bochs 2.2.6: 2./configure --enable-smp --enable-disasm --enable-debugger --enable-all-optimizations --enable-4meg-pages --enable-global-pages --enable-pae --disable-reset-on-triple-fault 3 4bootmain.c doesn't work right if the ELF sections aren't 5sector-aligned. so you can't use ld -N. and the sections may also need 6to be non-zero length, only really matters for tiny "kernels". 7 8kernel loaded at 1 megabyte. stack same place that bootasm.S left it. 9 10kinit() should find real mem size 11 and rescue useable memory below 1 meg 12 13no paging, no use of page table hardware, just segments 14 15no user area: no magic kernel stack mapping 16 so no copying of kernel stack during fork 17 though there is a kernel stack page for each process 18 19no kernel malloc(), just kalloc() for user core 20 21user pointers aren't valid in the kernel 22 23setting up first process 24 we do want a process zero, as template 25 but not runnable 26 just set up return-from-trap frame on new kernel stack 27 fake user program that calls exec 28 29map text read-only? 30shared text? 31 32what's on the stack during a trap or sys call? 33 PUSHA before scheduler switch? for callee-saved registers. 34 segment contents? 35 what does iret need to get out of the kernel? 36 how does INT know what kernel stack to use? 37 38are interrupts turned on in the kernel? probably. 39 40per-cpu curproc 41one tss per process, or one per cpu? 42one segment array per cpu, or per process? 43 44pass curproc explicitly, or implicit from cpu #? 45 e.g. argument to newproc()? 46 hmm, you need a global curproc[cpu] for trap() &c 47 48test stack expansion 49test running out of memory, process slots 50 51we can't really use a separate stack segment, since stack addresses 52need to work correctly as ordinary pointers. the same may be true of 53data vs text. how can we have a gap between data and stack, so that 54both can grow, without committing 4GB of physical memory? does this 55mean we need paging? 56 57what's the simplest way to add the paging we need? 58 one page table, re-write it each time we leave the kernel? 59 page table per process? 60 probably need to use 0-0xffffffff segments, so that 61 both data and stack pointers always work 62 so is it now worth it to make a process's phys mem contiguous? 63 or could use segment limits and 4 meg pages? 64 but limits would prevent using stack pointers as data pointers 65 how to write-protect text? not important? 66 67perhaps have fixed-size stack, put it in the data segment? 68 69oops, if kernel stack is in contiguous user phys mem, then moving 70users' memory (e.g. to expand it) will wreck any pointers into the 71kernel stack. 72 73do we need to set fs and gs? so user processes can't abuse them? 74 75setupsegs() may modify current segment table, is that legal? 76 77trap() ought to lgdt on return, since currently only done in swtch() 78 79protect hardware interrupt vectors from user INT instructions? 80 81i'm getting a curious interrupt when jumping into user space. maybe 82it's IRQ 0, but it comes at a weird and changing vector (e.g. 119) if 83you don't initialize the PIC. why doesn't jos see this? if i 84initialize the PIC with IRQ_OFFSET 32, the interrupt arrives at vector 8532. 86 87test out-of-fd cases for creating pipe. 88test pipe circular buffer 89test pipe writer or reader closes while other active or waiting 90test exit vs fd reference counts 91test write of more than PIPESIZE 92test reader goes first vs writer goes first 93test streaming of a lot of data 94