2006-06-12 15:22:12 +00:00
|
|
|
// kalloc.c
|
2006-09-06 17:27:19 +00:00
|
|
|
char* kalloc(int);
|
2006-09-06 17:10:00 +00:00
|
|
|
void kfree(char*, int);
|
2006-06-15 16:02:20 +00:00
|
|
|
void kinit(void);
|
2006-06-12 15:22:12 +00:00
|
|
|
|
|
|
|
// console.c
|
2006-08-10 02:07:10 +00:00
|
|
|
void console_init(void);
|
2006-09-06 17:10:00 +00:00
|
|
|
void cprintf(char*, ...);
|
|
|
|
void panic(char*);
|
2006-08-10 02:07:10 +00:00
|
|
|
void kbd_intr(void);
|
2006-06-12 15:22:12 +00:00
|
|
|
|
|
|
|
// proc.c
|
2006-08-10 22:08:14 +00:00
|
|
|
void pinit(void);
|
2006-06-12 15:22:12 +00:00
|
|
|
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-09-06 17:10:00 +00:00
|
|
|
void setupsegs(struct proc*);
|
|
|
|
struct proc* copyproc(struct proc*);
|
2006-07-15 12:03:57 +00:00
|
|
|
struct spinlock;
|
2006-09-07 14:13:26 +00:00
|
|
|
int growproc(int);
|
2006-09-06 17:10:00 +00:00
|
|
|
void sleep(void*, struct spinlock*);
|
2006-09-06 17:27:19 +00:00
|
|
|
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);
|
2006-07-15 17:24:54 +00:00
|
|
|
int proc_kill(int);
|
|
|
|
int proc_wait(void);
|
2006-07-11 17:39:45 +00:00
|
|
|
void yield(void);
|
2006-09-07 15:45:38 +00:00
|
|
|
void procdump(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
|
|
|
|
2006-09-08 14:40:51 +00:00
|
|
|
// setjmp.S
|
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;
|
|
|
|
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
|
2006-09-06 17:27:19 +00:00
|
|
|
void* memset(void*, int, uint);
|
2006-09-06 17:10:00 +00:00
|
|
|
int memcmp(const void*, const void*, uint);
|
2006-09-06 17:27:19 +00:00
|
|
|
void* memmove(void*, const void*, uint);
|
2006-09-06 17:10:00 +00:00
|
|
|
int strncmp(const char*, const char*, uint);
|
2006-06-15 16:02:20 +00:00
|
|
|
|
|
|
|
// syscall.c
|
|
|
|
void syscall(void);
|
2006-09-06 18:19:11 +00:00
|
|
|
int fetchint(struct proc*, uint, int*);
|
2006-09-07 14:13:26 +00:00
|
|
|
int fetchstr(struct proc*, uint, char**);
|
|
|
|
int argint(int, int*);
|
|
|
|
int argptr(int, char**, int);
|
|
|
|
int argstr(int, char**);
|
2006-06-16 20:29:25 +00:00
|
|
|
|
|
|
|
// picirq.c
|
|
|
|
void pic_init(void);
|
2006-09-07 15:29:54 +00:00
|
|
|
void irq_enable(int);
|
2006-09-07 01:37:58 +00:00
|
|
|
|
|
|
|
// 8253pit.c
|
|
|
|
void pit8253_timerinit(void);
|
2006-06-21 01:53:07 +00:00
|
|
|
|
|
|
|
// mp.c
|
2006-09-07 01:37:58 +00:00
|
|
|
extern int ismp;
|
2006-06-22 01:28:57 +00:00
|
|
|
void mp_init(void);
|
2006-07-12 11:15:38 +00:00
|
|
|
void mp_startthem(void);
|
2006-07-12 17:00:54 +00:00
|
|
|
int mp_bcpu(void);
|
|
|
|
|
2006-09-08 14:40:51 +00:00
|
|
|
// lapic.c
|
2006-07-20 09:07:53 +00:00
|
|
|
extern uint *lapicaddr;
|
2006-06-28 16:35:03 +00:00
|
|
|
void lapic_init(int);
|
2006-07-20 09:07:53 +00:00
|
|
|
void lapic_startap(uchar, int);
|
2006-06-28 16:35:03 +00:00
|
|
|
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-08-04 18:12:31 +00:00
|
|
|
void lapic_eoi(void);
|
2006-07-12 17:00:54 +00:00
|
|
|
int cpu(void);
|
2006-06-22 01:28:57 +00:00
|
|
|
|
2006-09-08 14:40:51 +00:00
|
|
|
// ioapic.c
|
2006-08-04 18:12:31 +00:00
|
|
|
extern uchar ioapic_id;
|
|
|
|
void ioapic_init(void);
|
2006-09-06 17:10:00 +00:00
|
|
|
void ioapic_enable(int irq, int cpu);
|
2006-08-04 18:12:31 +00:00
|
|
|
|
2006-06-22 01:28:57 +00:00
|
|
|
// spinlock.c
|
2006-07-12 01:48:35 +00:00
|
|
|
struct spinlock;
|
2006-09-06 17:10:00 +00:00
|
|
|
void initlock(struct spinlock*, char*);
|
2006-07-17 05:00:25 +00:00
|
|
|
void acquire(struct spinlock*);
|
|
|
|
void release(struct spinlock*);
|
|
|
|
int holding(struct spinlock*);
|
2006-09-07 16:54:23 +00:00
|
|
|
void getcallerpcs(void*, uint*);
|
2006-06-21 01:53:07 +00:00
|
|
|
|
2006-06-22 20:47:23 +00:00
|
|
|
// main.c
|
2006-09-06 17:10:00 +00:00
|
|
|
void load_icode(struct proc*, uchar*, uint);
|
2006-06-27 14:35:53 +00:00
|
|
|
|
|
|
|
// pipe.c
|
|
|
|
struct pipe;
|
2006-09-06 18:38:56 +00:00
|
|
|
struct file;
|
|
|
|
int pipe_alloc(struct file**, struct file**);
|
2006-09-06 17:10:00 +00:00
|
|
|
void pipe_close(struct pipe*, int);
|
|
|
|
int pipe_write(struct pipe*, char*, int);
|
|
|
|
int pipe_read(struct pipe*, char*, int);
|
2006-06-27 14:35:53 +00:00
|
|
|
|
2006-09-06 19:47:07 +00:00
|
|
|
// file.c
|
2006-08-12 04:33:50 +00:00
|
|
|
struct stat;
|
2006-09-06 18:43:45 +00:00
|
|
|
void fileinit(void);
|
|
|
|
struct file* filealloc(void);
|
|
|
|
void fileclose(struct file*);
|
|
|
|
int fileread(struct file*, char*, int n);
|
|
|
|
int filewrite(struct file*, char*, int n);
|
|
|
|
int filestat(struct file*, struct stat*);
|
|
|
|
void fileincref(struct file*);
|
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-09-07 15:29:54 +00:00
|
|
|
void ide_rw(int, uint, void*, uint, int);
|
2006-07-16 01:47:40 +00:00
|
|
|
|
2006-07-21 13:18:04 +00:00
|
|
|
// bio.c
|
2006-08-10 22:08:14 +00:00
|
|
|
void binit(void);
|
2006-07-21 13:18:04 +00:00
|
|
|
struct buf;
|
2006-09-06 17:10:00 +00:00
|
|
|
struct buf* getblk(uint dev, uint sector);
|
|
|
|
struct buf* bread(uint, uint);
|
|
|
|
void bwrite(struct buf*, uint);
|
|
|
|
void brelse(struct buf*);
|
2006-07-21 13:18:04 +00:00
|
|
|
|
|
|
|
// fs.c
|
2006-08-15 15:53:46 +00:00
|
|
|
extern uint rootdev;
|
2006-08-10 22:08:14 +00:00
|
|
|
void iinit(void);
|
2006-09-06 17:10:00 +00:00
|
|
|
struct inode* iget(uint, uint);
|
|
|
|
void ilock(struct inode*);
|
|
|
|
void iunlock(struct inode*);
|
|
|
|
void itrunc(struct inode*);
|
|
|
|
void idecref(struct inode*);
|
|
|
|
void iincref(struct inode*);
|
|
|
|
void iput(struct inode*);
|
|
|
|
struct inode* namei(char*, int, uint*, char**, struct inode**);
|
|
|
|
void stati(struct inode*, struct stat*);
|
|
|
|
int readi(struct inode*, char*, uint, uint);
|
|
|
|
int writei(struct inode*, char*, uint, uint);
|
|
|
|
struct inode* mknod(char*, short, short, short);
|
|
|
|
struct inode* mknod1(struct inode*, char*, short, short, short);
|
|
|
|
int unlink(char*);
|
|
|
|
void iupdate(struct inode*);
|
|
|
|
int link(char*, char*);
|