Commit graph

27 commits

Author SHA1 Message Date
kaashoek
8e1d1ec934 some comment changes 2006-09-08 14:36:44 +00:00
rsc
e7a5b3c5ee comment memory barriers 2006-09-07 16:53:49 +00:00
rsc
31085bb416 more comments 2006-09-07 14:12:30 +00:00
rsc
0cfc7290e8 wrap long lines 2006-09-06 19:08:14 +00:00
rsc
9e9bcaf143 standardize various * conventions 2006-09-06 17:27:19 +00:00
rsc
a650c606fe spacing fixes: no tabs, 2-space indents (for rtm) 2006-09-06 17:04:06 +00:00
rtm
dfcc5b997c prune unneeded panics and debug output 2006-08-29 19:06:37 +00:00
rtm
2b19190c13 clean up stale error checks and panics
delete unused functions
a few comments
2006-08-29 14:45:45 +00:00
rtm
5be0039ce9 interrupts could be recursive since lapic_eoi() called before rti
so fast interrupts overflow the kernel stack
fix: cli() before lapic_eoi()
2006-08-10 22:08:14 +00:00
rtm
8a8be1b8c3 low-level keyboard input (not hooked up to /dev yet)
fix acquire() to cli() *before* incrementing nlock
make T_SYSCALL a trap gate, not an interrupt gate
sadly, various crashes if you hold down a keyboard key...
2006-08-10 02:07:10 +00:00
rtm
0e84a0ec6e fix race in holding() check in acquire()
give cpu1 a TSS and gdt for when it enters scheduler()
and a pseudo proc[] entry for each cpu
cpu0 waits for each other cpu to start up
read() for files
2006-08-08 19:58:06 +00:00
rtm
32630628a9 open() 2006-07-29 09:35:02 +00:00
rsc
0dd4253747 add ide_lock for sleep 2006-07-17 05:00:25 +00:00
rsc
b74f4b57ae Keep interrupts disabled during startup. 2006-07-16 15:50:13 +00:00
rsc
679a977cb2 remove acquire1 and release1 2006-07-16 15:38:13 +00:00
rsc
65bd8e139a New scheduler.
Removed cli and sti stack in favor of tracking
number of locks held on each CPU and explicit
conditionals in spinlock.c.
2006-07-16 01:15:28 +00:00
rtm
46bbd72f3e no more recursive locks
wakeup1() assumes you hold proc_table_lock
sleep(chan, lock) provides atomic sleep-and-release to wait for condition
ugly code in swtch/scheduler to implement new sleep
fix lots of bugs in pipes, wait, and exit
fix bugs if timer interrupt goes off in schedule()
console locks per line, not per byte
2006-07-15 12:03:57 +00:00
rtm
6eb6f10c56 passes both usertests
exit had acquire where I meant release
swtch now checks that you hold no locks
2006-07-12 15:35:33 +00:00
rtm
8148b6ee53 i think my cmpxchg use was wrong in acquire
nesting cli/sti: release shouldn't always enable interrupts
separate setup of lapic from starting of other cpus, so cpu() works earlier
flag to disable locking in console output
make locks work even when curproc==0
(still crashes in clock interrupt)
2006-07-12 11:15:38 +00:00
rtm
4e8f237be8 no more big kernel lock
succeeds at usertests.c pipe test
2006-07-12 01:48:35 +00:00
rtm
b548df152b pre-empt both user and kernel, in clock interrupt
usertest.c tests pre-emption
kill()
2006-07-11 17:39:45 +00:00
rsc
5ce9751cab 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
kaashoek
7837c71b32 disable all interrupts when acquiring lock
user program that makes a blocking system call
2006-07-06 21:47:22 +00:00
kaashoek
f7cea12b38 disable interrupts when holding kernel lock 2006-06-28 16:44:41 +00:00
rtm
bf3903612d system call arguments 2006-06-26 15:11:19 +00:00
rtm
df5cc91659 compile "user programs"
curproc array
2006-06-22 20:47:23 +00:00
kaashoek
21a88fd487 checkpoint. booting second processor. stack is messed up, but thanks to cliff
and plan 9 code, at least boots and gets into C code.
2006-06-22 01:28:57 +00:00