2006-06-22 15:51:57 +00: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 01:07:40 +00: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 15:51:57 +00:00
|
|
|
|
2006-06-12 15:22:12 +00: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
|
|
|
|
|
|
|
|
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()?
|
2006-06-15 16:02:20 +00:00
|
|
|
hmm, you need a global curproc[cpu] for trap() &c
|
2006-06-12 15:22:12 +00:00
|
|
|
|
|
|
|
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.
|
2006-06-13 15:50:06 +00: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-13 22:08:20 +00:00
|
|
|
|
|
|
|
i'm getting a curious interrupt when jumping into user space. maybe
|
|
|
|
it's IRQ 0, but it comes at a weird and changing vector (e.g. 119) if
|
|
|
|
you don't initialize the PIC. why doesn't jos see this? if i
|
|
|
|
initialize the PIC with IRQ_OFFSET 32, the interrupt arrives at vector
|
|
|
|
32.
|
2006-06-27 14:35:53 +00:00
|
|
|
|
|
|
|
test out-of-fd cases for creating pipe.
|
|
|
|
test pipe circular buffer
|
|
|
|
test pipe writer or reader closes while other active or waiting
|
|
|
|
test exit vs fd reference counts
|
|
|
|
test write of more than PIPESIZE
|
|
|
|
test reader goes first vs writer goes first
|
|
|
|
test streaming of a lot of data
|