2006-06-22 17:51:57 +02:00
|
|
|
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
|
Changes to allow use of native x86 ELF compilers, which on my
Linux 2.4 box using gcc 3.4.6 don't seem to follow the same
conventions as the i386-jos-elf-gcc compilers.
Can run make 'TOOLPREFIX=' or edit the Makefile.
curproc[cpu()] can now be NULL, indicating that no proc is running.
This seemed safer to me than having curproc[0] and curproc[1]
both pointing at proc[0] potentially.
The old implementation of swtch depended on the stack frame layout
used inside swtch being okay to return from on the other stack
(exactly the V6 you are not expected to understand this).
It also could be called in two contexts: at boot time, to schedule
the very first process, and later, on behalf of a process, to sleep
or schedule some other process.
I split this into two functions: scheduler and swtch.
The scheduler is now a separate never-returning function, invoked
by each cpu once set up. The scheduler looks like:
scheduler() {
setjmp(cpu.context);
pick proc to schedule
blah blah blah
longjmp(proc.context)
}
The new swtch is intended to be called only when curproc[cpu()] is not NULL,
that is, only on behalf of a user proc. It does:
swtch() {
if(setjmp(proc.context) == 0)
longjmp(cpu.context)
}
to save the current proc context and then jump over to the scheduler,
running on the cpu stack.
Similarly the system call stubs are now in assembly in usys.S to avoid
needing to know the details of stack frame layout used by the compiler.
Also various changes in the debugging prints.
2006-07-11 03:07:40 +02:00
|
|
|
bochs CVS after 2.2.6:
|
|
|
|
./configure --enable-smp --enable-disasm --enable-debugger --enable-all-optimizations --enable-4meg-pages --enable-global-pages --enable-pae
|
2006-06-22 17:51:57 +02:00
|
|
|
|
2006-06-12 17:22:12 +02:00
|
|
|
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
|
|
|
|
|
2006-08-16 00:18:20 +02:00
|
|
|
are interrupts turned on in the kernel? yes.
|
2006-06-12 17:22:12 +02:00
|
|
|
|
|
|
|
pass curproc explicitly, or implicit from cpu #?
|
|
|
|
e.g. argument to newproc()?
|
2006-06-15 18:02:20 +02:00
|
|
|
hmm, you need a global curproc[cpu] for trap() &c
|
2006-06-12 17:22:12 +02:00
|
|
|
|
2006-08-16 00:18:20 +02:00
|
|
|
no stack expansion
|
|
|
|
|
2006-06-12 17:22:12 +02:00
|
|
|
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?
|
|
|
|
|
|
|
|
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.
|
2006-06-13 17:50:06 +02:00
|
|
|
|
|
|
|
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?
|
2006-06-14 00:08:20 +02:00
|
|
|
|
2006-06-27 16:35:53 +02:00
|
|
|
test out-of-fd cases for creating pipe.
|
2006-07-11 19:39:45 +02:00
|
|
|
test pipe reader closes then write
|
|
|
|
test two readers, two writers.
|
|
|
|
test children being inherited by grandparent &c
|
|
|
|
|
2006-07-12 03:48:35 +02:00
|
|
|
some sleep()s should be interruptible by kill()
|
2006-07-11 19:39:45 +02:00
|
|
|
|
2006-07-12 03:48:35 +02:00
|
|
|
locks
|
|
|
|
init_lock
|
|
|
|
sequences CPU startup
|
|
|
|
proc_table_lock
|
|
|
|
also protects next_pid
|
|
|
|
per-fd lock *just* protects count read-modify-write
|
|
|
|
also maybe freeness?
|
|
|
|
memory allocator
|
|
|
|
printf
|
|
|
|
|
|
|
|
in general, the table locks protect both free-ness and
|
|
|
|
public variables of table elements
|
|
|
|
in many cases you can use table elements w/o a lock
|
|
|
|
e.g. if you are the process, or you are using an fd
|
|
|
|
|
2006-07-15 14:03:57 +02:00
|
|
|
lock order
|
|
|
|
per-pipe lock
|
|
|
|
proc_table_lock fd_table_lock kalloc_lock
|
|
|
|
console_lock
|
|
|
|
|
2006-08-16 00:18:20 +02:00
|
|
|
do you have to be holding the mutex in order to call wakeup()? yes
|
2006-07-15 14:03:57 +02:00
|
|
|
|
|
|
|
device interrupts don't clear FL_IF
|
|
|
|
so a recursive timer interrupt is possible
|
|
|
|
|
2006-07-22 00:10:40 +02:00
|
|
|
what does inode->busy mean?
|
|
|
|
might be held across disk reads
|
|
|
|
no-one is allowed to do anything to the inode
|
|
|
|
protected by inode_table_lock
|
|
|
|
inode->count counts in-memory pointers to the struct
|
|
|
|
prevents inode[] element from being re-used
|
|
|
|
protected by inode_table_lock
|
|
|
|
|
|
|
|
blocks and inodes have ad-hoc sleep-locks
|
|
|
|
provide a single mechanism?
|
|
|
|
|
|
|
|
test 14-character file names
|
|
|
|
and file arguments longer than 14
|
2006-07-29 00:33:07 +02:00
|
|
|
|
|
|
|
kalloc() can return 0; do callers handle this right?
|
2006-08-08 21:58:06 +02:00
|
|
|
|
2006-08-11 00:08:14 +02:00
|
|
|
OH! recursive interrupts will use up any amount of cpu[].stack!
|
|
|
|
underflow and wrecks *previous* cpu's struct
|
2006-08-12 19:17:35 +02:00
|
|
|
|
2006-08-13 00:34:13 +02:00
|
|
|
disk scheduling
|
|
|
|
mkdir
|
|
|
|
sh arguments
|
|
|
|
sh redirection
|
|
|
|
indirect blocks
|
2006-08-13 04:12:44 +02:00
|
|
|
is there a create/create race for same file name?
|
|
|
|
resulting in two entries w/ same name in directory?
|
2006-08-16 00:18:20 +02:00
|
|
|
why does shell often ignore first line of input?
|
2006-08-13 14:22:44 +02:00
|
|
|
|
|
|
|
test: one process unlinks a file while another links to it
|
|
|
|
test: one process opens a file while another deletes it
|
2006-08-16 00:18:20 +02:00
|
|
|
test: mkdir. deadlock d/.. vs ../d
|
|
|
|
|
|
|
|
make proc[0] runnable
|
|
|
|
cpu early tss and gdt
|
|
|
|
how do we get cpu0 scheduler() to use mpstack, not proc[0].kstack?
|
|
|
|
when iget() first sleeps, where does it longjmp to?
|
|
|
|
maybe set up proc[0] to be runnable, with entry proc0main(), then
|
|
|
|
have main() call scheduler()?
|
|
|
|
perhaps so proc[0] uses right kstack?
|
|
|
|
and scheduler() uses mpstack?
|
|
|
|
ltr sets the busy bit in the TSS, faults if already set
|
|
|
|
so gdt and TSS per cpu?
|
|
|
|
we don't want to be using some random process's gdt when it changes it.
|
|
|
|
maybe get rid of per-proc gdt and ts
|
|
|
|
one per cpu
|
|
|
|
refresh it when needed
|
|
|
|
setupsegs(proc *)
|