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 3bochs CVS after 2.2.6: 4./configure --enable-smp --enable-disasm --enable-debugger --enable-all-optimizations --enable-4meg-pages --enable-global-pages --enable-pae 5 6bootmain.c doesn't work right if the ELF sections aren't 7sector-aligned. so you can't use ld -N. and the sections may also need 8to be non-zero length, only really matters for tiny "kernels". 9 10kernel loaded at 1 megabyte. stack same place that bootasm.S left it. 11 12kinit() should find real mem size 13 and rescue useable memory below 1 meg 14 15no paging, no use of page table hardware, just segments 16 17no user area: no magic kernel stack mapping 18 so no copying of kernel stack during fork 19 though there is a kernel stack page for each process 20 21no kernel malloc(), just kalloc() for user core 22 23user pointers aren't valid in the kernel 24 25are interrupts turned on in the kernel? yes. 26 27pass curproc explicitly, or implicit from cpu #? 28 e.g. argument to newproc()? 29 hmm, you need a global curproc[cpu] for trap() &c 30 31no stack expansion 32 33test running out of memory, process slots 34 35we can't really use a separate stack segment, since stack addresses 36need to work correctly as ordinary pointers. the same may be true of 37data vs text. how can we have a gap between data and stack, so that 38both can grow, without committing 4GB of physical memory? does this 39mean we need paging? 40 41perhaps have fixed-size stack, put it in the data segment? 42 43oops, if kernel stack is in contiguous user phys mem, then moving 44users' memory (e.g. to expand it) will wreck any pointers into the 45kernel stack. 46 47do we need to set fs and gs? so user processes can't abuse them? 48 49setupsegs() may modify current segment table, is that legal? 50 51trap() ought to lgdt on return, since currently only done in swtch() 52 53protect hardware interrupt vectors from user INT instructions? 54 55test out-of-fd cases for creating pipe. 56test pipe reader closes then write 57test two readers, two writers. 58test children being inherited by grandparent &c 59 60some sleep()s should be interruptible by kill() 61 62locks 63 init_lock 64 sequences CPU startup 65 proc_table_lock 66 also protects next_pid 67 per-fd lock *just* protects count read-modify-write 68 also maybe freeness? 69 memory allocator 70 printf 71 72in general, the table locks protect both free-ness and 73 public variables of table elements 74 in many cases you can use table elements w/o a lock 75 e.g. if you are the process, or you are using an fd 76 77lock order 78 per-pipe lock 79 proc_table_lock fd_table_lock kalloc_lock 80 console_lock 81 82do you have to be holding the mutex in order to call wakeup()? yes 83 84device interrupts don't clear FL_IF 85 so a recursive timer interrupt is possible 86 87what does inode->busy mean? 88 might be held across disk reads 89 no-one is allowed to do anything to the inode 90 protected by inode_table_lock 91inode->count counts in-memory pointers to the struct 92 prevents inode[] element from being re-used 93 protected by inode_table_lock 94 95blocks and inodes have ad-hoc sleep-locks 96 provide a single mechanism? 97 98test 14-character file names 99and file arguments longer than 14 100 101kalloc() can return 0; do callers handle this right? 102 103OH! recursive interrupts will use up any amount of cpu[].stack! 104 underflow and wrecks *previous* cpu's struct 105 106disk scheduling 107mkdir 108sh arguments 109sh redirection 110indirect blocks 111is there a create/create race for same file name? 112 resulting in two entries w/ same name in directory? 113why does shell often ignore first line of input? 114 115test: one process unlinks a file while another links to it 116test: one process opens a file while another deletes it 117test: mkdir. deadlock d/.. vs ../d 118test: sub-sub directories. mkdir("d1/d2") 119test: dup() shared fd->off 120test: indirect blocks. files and directories. 121test: sbrk 122test: does echo foo > x truncate x? 123 124make proc[0] runnable 125cpu early tss and gdt 126how do we get cpu0 scheduler() to use mpstack, not proc[0].kstack? 127when iget() first sleeps, where does it longjmp to? 128maybe set up proc[0] to be runnable, with entry proc0main(), then 129 have main() call scheduler()? 130 perhaps so proc[0] uses right kstack? 131 and scheduler() uses mpstack? 132ltr sets the busy bit in the TSS, faults if already set 133 so gdt and TSS per cpu? 134 we don't want to be using some random process's gdt when it changes it. 135maybe get rid of per-proc gdt and ts 136 one per cpu 137 refresh it when needed 138 setupsegs(proc *) 139 140why do we get 0 characters from keyboard? 141are the locks in the right place in keyboardintr? 142 143sh: support pipes? leave it for the class? 144sh: dynamic memory allocation? 145sh: should sh support ; () & --- need malloc 146sh: stop stdin on ctrl-d (for cat > y) 147 148really should have bdwrite() for file content 149 and make some inode updates async 150 so soft updates make sense 151