2006-06-12 15:22:12 +00:00
|
|
|
// kalloc.c
|
|
|
|
char *kalloc(int n);
|
|
|
|
void kfree(char *cp, int len);
|
2006-06-15 16:02:20 +00:00
|
|
|
void kinit(void);
|
2006-06-12 15:22:12 +00:00
|
|
|
|
|
|
|
// console.c
|
|
|
|
void cprintf(char *fmt, ...);
|
|
|
|
void panic(char *s);
|
2006-06-26 15:11:19 +00:00
|
|
|
void cons_putc(int);
|
2006-06-12 15:22:12 +00:00
|
|
|
|
|
|
|
// proc.c
|
|
|
|
struct proc;
|
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
|
|
|
struct jmpbuf;
|
2006-06-15 16:02:20 +00:00
|
|
|
void setupsegs(struct proc *);
|
|
|
|
struct proc * newproc(void);
|
2006-07-12 01:48:35 +00:00
|
|
|
void swtch(int);
|
2006-06-15 19:58:01 +00:00
|
|
|
void sleep(void *);
|
|
|
|
void wakeup(void *);
|
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
|
|
|
void scheduler(void);
|
2006-07-11 17:39:45 +00:00
|
|
|
void proc_exit(void);
|
|
|
|
void yield(void);
|
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
|
|
|
|
|
|
|
// swtch.S
|
|
|
|
struct jmpbuf;
|
|
|
|
int setjmp(struct jmpbuf*);
|
|
|
|
void longjmp(struct jmpbuf*);
|
2006-06-15 16:02:20 +00:00
|
|
|
|
|
|
|
// trap.c
|
2006-06-26 20:31:52 +00:00
|
|
|
void tvinit(void);
|
|
|
|
void idtinit(void);
|
2006-06-15 16:02:20 +00:00
|
|
|
|
|
|
|
// string.c
|
|
|
|
void * memcpy(void *dst, void *src, unsigned n);
|
|
|
|
void * memset(void *dst, int c, unsigned n);
|
2006-06-21 01:53:07 +00:00
|
|
|
int memcmp(const void *v1, const void *v2, unsigned n);
|
2006-06-22 01:28:57 +00:00
|
|
|
void *memmove(void *dst, const void *src, unsigned n);
|
2006-07-05 20:00:14 +00:00
|
|
|
int strncmp(const char *p, const char *q, unsigned n);
|
2006-06-15 16:02:20 +00:00
|
|
|
|
|
|
|
// syscall.c
|
|
|
|
void syscall(void);
|
2006-06-16 20:29:25 +00:00
|
|
|
|
|
|
|
// picirq.c
|
2006-07-05 20:00:14 +00:00
|
|
|
extern uint16_t irq_mask_8259A;
|
2006-06-16 20:29:25 +00:00
|
|
|
void irq_setmask_8259A(uint16_t mask);
|
|
|
|
void pic_init(void);
|
2006-06-21 01:53:07 +00:00
|
|
|
|
|
|
|
// mp.c
|
2006-06-22 01:28:57 +00:00
|
|
|
void mp_init(void);
|
2006-06-22 20:47:23 +00:00
|
|
|
int cpu(void);
|
2006-06-22 01:28:57 +00:00
|
|
|
int mp_isbcpu(void);
|
2006-06-28 16:35:03 +00:00
|
|
|
void lapic_init(int);
|
|
|
|
void lapic_timerinit(void);
|
|
|
|
void lapic_timerintr(void);
|
|
|
|
void lapic_enableintr(void);
|
2006-06-28 16:44:41 +00:00
|
|
|
void lapic_disableintr(void);
|
2006-06-22 01:28:57 +00:00
|
|
|
|
|
|
|
// spinlock.c
|
2006-07-12 01:48:35 +00:00
|
|
|
struct spinlock;
|
|
|
|
void acquire(struct spinlock * lock);
|
|
|
|
void release(struct spinlock * lock);
|
2006-06-21 01:53:07 +00:00
|
|
|
|
2006-06-22 20:47:23 +00:00
|
|
|
// main.c
|
|
|
|
void load_icode(struct proc *p, uint8_t *binary, unsigned size);
|
2006-06-27 14:35:53 +00:00
|
|
|
|
|
|
|
// pipe.c
|
|
|
|
struct pipe;
|
|
|
|
struct fd;
|
|
|
|
int pipe_alloc(struct fd **fd1, struct fd **fd2);
|
|
|
|
void pipe_close(struct pipe *p, int writeable);
|
|
|
|
int pipe_write(struct pipe *p, char *addr, int n);
|
|
|
|
int pipe_read(struct pipe *p, char *addr, int n);
|
|
|
|
|
|
|
|
// fd.c
|
|
|
|
int fd_ualloc();
|
|
|
|
struct fd * fd_alloc();
|
|
|
|
void fd_close(struct fd *);
|
|
|
|
int fd_read(struct fd *fd, char *addr, int n);
|
|
|
|
int fd_write(struct fd *fd, char *addr, int n);
|
2006-07-12 01:48:35 +00:00
|
|
|
void fd_reference(struct fd *fd);
|
2006-07-05 20:00:14 +00:00
|
|
|
|
|
|
|
// ide.c
|
|
|
|
void ide_init(void);
|
2006-07-10 13:08:37 +00:00
|
|
|
void ide_intr(void);
|
2006-07-10 19:06:48 +00:00
|
|
|
void* ide_start_read(uint32_t secno, void *dst, unsigned nsecs);
|
|
|
|
int ide_finish_read(void *);
|