summaryrefslogtreecommitdiff
path: root/Notes
blob: d8f4869a44e9dbc0bf343fcc6a27579a515e2e99 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
bochs 2.2.6:
./configure --enable-smp --enable-disasm --enable-debugger --enable-all-optimizations --enable-4meg-pages --enable-global-pages --enable-pae --disable-reset-on-triple-fault
bochs CVS after 2.2.6:
./configure --enable-smp --enable-disasm --enable-debugger --enable-all-optimizations --enable-4meg-pages --enable-global-pages --enable-pae 

bootmain.c doesn't work right if the ELF sections aren't
sector-aligned. so you can't use ld -N. and the sections may also need
to be non-zero length, only really matters for tiny "kernels".

kernel loaded at 1 megabyte. stack same place that bootasm.S left it.

kinit() should find real mem size
  and rescue useable memory below 1 meg

no paging, no use of page table hardware, just segments

no user area: no magic kernel stack mapping
  so no copying of kernel stack during fork
  though there is a kernel stack page for each process

no kernel malloc(), just kalloc() for user core

user pointers aren't valid in the kernel

setting up first process
  we do want a process zero, as template
    but not runnable
  just set up return-from-trap frame on new kernel stack
  fake user program that calls exec

map text read-only?
shared text?

what's on the stack during a trap or sys call?
  PUSHA before scheduler switch? for callee-saved registers.
  segment contents?
  what does iret need to get out of the kernel?
  how does INT know what kernel stack to use?
 
are interrupts turned on in the kernel? probably.

per-cpu curproc
one tss per process, or one per cpu?
one segment array per cpu, or per process?

pass curproc explicitly, or implicit from cpu #?
  e.g. argument to newproc()?
  hmm, you need a global curproc[cpu] for trap() &c

test stack expansion
test running out of memory, process slots

we can't really use a separate stack segment, since stack addresses
need to work correctly as ordinary pointers. the same may be true of
data vs text. how can we have a gap between data and stack, so that
both can grow, without committing 4GB of physical memory? does this
mean we need paging?

what's the simplest way to add the paging we need?
  one page table, re-write it each time we leave the kernel?
  page table per process?
  probably need to use 0-0xffffffff segments, so that
    both data and stack pointers always work
  so is it now worth it to make a process's phys mem contiguous?
  or could use segment limits and 4 meg pages?
    but limits would prevent using stack pointers as data pointers
  how to write-protect text? not important?

perhaps have fixed-size stack, put it in the data segment?

oops, if kernel stack is in contiguous user phys mem, then moving
users' memory (e.g. to expand it) will wreck any pointers into the
kernel stack.

do we need to set fs and gs? so user processes can't abuse them?

setupsegs() may modify current segment table, is that legal?

trap() ought to lgdt on return, since currently only done in swtch()

protect hardware interrupt vectors from user INT instructions?

test out-of-fd cases for creating pipe.
test pipe reader closes then write
test two readers, two writers.
test children being inherited by grandparent &c

kill
  sleep()ing for something
  running at user level
  running in kernel
  ooh, the relevant CPU may never get a clock interrupt
  should each cpu have its own clock?
  where to check?
    loops around sleep()
    return from any trap
  rules about being killed deep inside a system call
  test above cases

cli/sti in acquire/release should nest!
  in case you acquire two locks