Go to the source code of this file.
Defines | |
| #define | NELEM(x) (sizeof(x)/sizeof((x)[0])) |
Functions | |
| void | binit (void) |
| struct buf * | bread (uint, uint) |
| void | brelse (struct buf *) |
| void | bwrite (struct buf *) |
| void | consoleinit (void) |
| void | cprintf (char *,...) |
| void | consoleintr (int(*)(void)) |
| void | panic (char *) __attribute__((noreturn)) |
| int | exec (char *, char **) |
| struct file * | filealloc (void) |
| void | fileclose (struct file *) |
| struct file * | filedup (struct file *) |
| void | fileinit (void) |
| int | fileread (struct file *, char *, int n) |
| int | filestat (struct file *, struct stat *) |
| int | filewrite (struct file *, char *, int n) |
| int | dirlink (struct inode *, char *, uint) |
| struct inode * | dirlookup (struct inode *, char *, uint *) |
| struct inode * | ialloc (uint, short) |
| struct inode * | idup (struct inode *) |
| void | iinit (void) |
| void | ilock (struct inode *) |
| void | iput (struct inode *) |
| void | iunlock (struct inode *) |
| void | iunlockput (struct inode *) |
| void | iupdate (struct inode *) |
| int | namecmp (const char *, const char *) |
| struct inode * | namei (char *) |
| struct inode * | nameiparent (char *, char *) |
| int | readi (struct inode *, char *, uint, uint) |
| void | stati (struct inode *, struct stat *) |
| int | writei (struct inode *, char *, uint, uint) |
| void | ideinit (void) |
| void | ideintr (void) |
| void | iderw (struct buf *) |
| void | ioapicenable (int irq, int cpu) |
| void | ioapicinit (void) |
| char * | kalloc (int) |
| void | kfree (char *, int) |
| void | kinit (void) |
| void | kbdintr (void) |
| int | cpunum (void) |
| void | lapiceoi (void) |
| void | lapicinit (int) |
| void | lapicstartap (uchar, uint) |
| void | microdelay (int) |
| int | mpbcpu (void) |
| void | mpinit (void) |
| void | mpstartthem (void) |
| void | picenable (int) |
| void | picinit (void) |
| int | pipealloc (struct file **, struct file **) |
| void | pipeclose (struct pipe *, int) |
| int | piperead (struct pipe *, char *, int) |
| int | pipewrite (struct pipe *, char *, int) |
| struct proc * | copyproc (struct proc *) |
| void | exit (void) |
| int | fork (void) |
| int | growproc (int) |
| int | kill (int) |
| void | pinit (void) |
| void | procdump (void) |
| void | scheduler (void) __attribute__((noreturn)) |
| void | ksegment (void) |
| void | usegment (void) |
| void | sleep (void *, struct spinlock *) |
| void | userinit (void) |
| int | wait (void) |
| void | wakeup (void *) |
| void | yield (void) |
| void | swtch (struct context **, struct context *) |
| void | acquire (struct spinlock *) |
| void | getcallerpcs (void *, uint *) |
| int | holding (struct spinlock *) |
| void | initlock (struct spinlock *, char *) |
| void | release (struct spinlock *) |
| void | pushcli () |
| void | popcli () |
| int | memcmp (const void *, const void *, uint) |
| void * | memmove (void *, const void *, uint) |
| void * | memset (void *, int, uint) |
| char * | safestrcpy (char *, const char *, int) |
| int | strlen (const char *) |
| int | strncmp (const char *, const char *, uint) |
| char * | strncpy (char *, const char *, int) |
| int | argint (int, int *) |
| int | argptr (int, char **, int) |
| int | argstr (int, char **) |
| int | fetchint (struct proc *, uint, int *) |
| int | fetchstr (struct proc *, uint, char **) |
| void | syscall (void) |
| void | timerinit (void) |
| void | idtinit (void) |
| void | tvinit (void) |
| void | uartinit (void) |
| void | uartintr (void) |
| void | uartputc (int) |
Variables | |
| uchar | ioapicid |
| volatile uint * | lapic |
| int | ismp |
| int | ticks |
| struct spinlock | tickslock |
| #define NELEM | ( | x | ) | (sizeof(x)/sizeof((x)[0])) |
| void acquire | ( | struct spinlock * | ) |
Definition at line 24 of file spinlock.c.
References spinlock::cpu, getcallerpcs(), holding(), spinlock::locked, panic(), spinlock::pcs, pushcli(), and xchg().
Referenced by allocproc(), bget(), brelse(), consoleintr(), consoleread(), consolewrite(), cprintf(), exit(), filealloc(), fileclose(), filedup(), ideintr(), iderw(), idup(), iget(), ilock(), iput(), iunlock(), kalloc(), kfree(), kill(), pipeclose(), piperead(), pipewrite(), scheduler(), sleep(), sys_sleep(), trap(), wait(), wakeup(), and yield().
| int argint | ( | int | , | |
| int * | ||||
| ) |
Definition at line 45 of file syscall.c.
References fetchint().
Referenced by argfd(), argptr(), argstr(), sys_exec(), sys_kill(), sys_mknod(), sys_open(), sys_read(), sys_sbrk(), sys_sleep(), and sys_write().
| int argptr | ( | int | , | |
| char ** | , | |||
| int | ||||
| ) |
Definition at line 54 of file syscall.c.
References argint().
Referenced by sys_fstat(), sys_pipe(), sys_read(), and sys_write().
| int argstr | ( | int | , | |
| char ** | ||||
| ) |
Definition at line 71 of file syscall.c.
References argint(), and fetchstr().
Referenced by sys_chdir(), sys_exec(), sys_link(), sys_mkdir(), sys_mknod(), sys_open(), and sys_unlink().
| void binit | ( | void | ) |
| void brelse | ( | struct buf * | ) |
| void bwrite | ( | struct buf * | ) |
| void consoleinit | ( | void | ) |
Definition at line 272 of file console.c.
References cons, CONSOLE, consoleread(), consolewrite(), initlock(), input, ioapicenable(), IRQ_KBD, and picenable().
Referenced by mpmain().
| void consoleintr | ( | int(*)(void) | ) |
Definition at line 180 of file console.c.
References acquire(), BACKSPACE, C, consputc(), input, INPUT_BUF, procdump(), release(), and wakeup().
Referenced by kbdintr(), and uartintr().
| void cprintf | ( | char * | , | |
| ... | ||||
| ) |
Definition at line 51 of file console.c.
References acquire(), cons, consputc(), locking, printint(), and release().
Referenced by cpunum(), ideintr(), ioapicinit(), kalloc(), kinit(), mpinit(), mpmain(), panic(), procdump(), syscall(), and trap().
| int cpunum | ( | void | ) |
Definition at line 94 of file lapic.c.
References cprintf(), FL_IF, ID, lapic, and readeflags().
Referenced by bootothers(), and ksegment().
Definition at line 497 of file fs.c.
References dirlookup(), DIRSIZ, dirent::inum, iput(), dirent::name, panic(), readi(), inode::size, strncpy(), and writei().
Referenced by create(), and sys_link().
Definition at line 465 of file fs.c.
References bmap(), bread(), brelse(), BSIZE, buf::data, inode::dev, iget(), dirent::inum, inode::inum, dirent::name, namecmp(), panic(), inode::size, T_DIR, and inode::type.
Referenced by create(), dirlink(), namex(), and sys_unlink().
| int exec | ( | char * | , | |
| char ** | ||||
| ) |
| void exit | ( | void | ) |
Definition at line 395 of file proc.c.
Referenced by bigdir(), bigfile(), cat(), concreate(), createdelete(), dirfile(), dirtest(), exectest(), exitwait(), forktest(), fourteen(), iref(), linktest(), main(), mem(), opentest(), pipe1(), rmdot(), rsect(), runcmd(), sharedfd(), subdir(), sys_exit(), trap(), twofiles(), unlinkread(), wc(), writetest(), writetest1(), and wsect().
| struct file* filealloc | ( | void | ) | [read] |
Definition at line 22 of file file.c.
References acquire(), ftable, NFILE, file::ref, and release().
Referenced by pipealloc(), and sys_open().
| void fileclose | ( | struct file * | ) |
Definition at line 52 of file file.c.
References acquire(), file::FD_INODE, file::FD_NONE, file::FD_PIPE, ftable, file::ip, iput(), panic(), file::pipe, pipeclose(), file::ref, release(), file::type, and file::writable.
Referenced by exit(), pipealloc(), sys_close(), sys_open(), and sys_pipe().
| void fileinit | ( | void | ) |
| int fileread | ( | struct file * | , | |
| char * | , | |||
| int | n | |||
| ) |
Definition at line 89 of file file.c.
References file::FD_INODE, file::FD_PIPE, ilock(), file::ip, iunlock(), file::off, panic(), file::pipe, piperead(), r, file::readable, readi(), and file::type.
Referenced by sys_read().
Definition at line 76 of file file.c.
References file::FD_INODE, ilock(), file::ip, iunlock(), stati(), and file::type.
Referenced by sys_fstat().
| int filewrite | ( | struct file * | , | |
| char * | , | |||
| int | n | |||
| ) |
Definition at line 109 of file file.c.
References file::FD_INODE, file::FD_PIPE, ilock(), file::ip, iunlock(), file::off, panic(), file::pipe, pipewrite(), r, file::type, file::writable, and writei().
Referenced by sys_write().
| int fork | ( | void | ) |
Definition at line 194 of file proc.c.
Referenced by concreate(), createdelete(), exitwait(), fork1(), forktest(), main(), mem(), pipe1(), preempt(), sharedfd(), sys_fork(), and twofiles().
| void getcallerpcs | ( | void * | , | |
| uint * | ||||
| ) |
Referenced by acquire(), panic(), and procdump().
| int growproc | ( | int | ) |
Definition at line 174 of file proc.c.
References kalloc(), kfree(), memmove(), memset(), and usegment().
Referenced by sys_sbrk().
| int holding | ( | struct spinlock * | ) |
| void ideinit | ( | void | ) |
Definition at line 45 of file ide.c.
References havedisk1, idelock, idewait(), inb(), initlock(), ioapicenable(), IRQ_IDE, ncpu, outb(), and picenable().
Referenced by mpmain().
| void ideintr | ( | void | ) |
| void iderw | ( | struct buf * | ) |
| void iinit | ( | void | ) |
| void ilock | ( | struct inode * | ) |
Definition at line 237 of file fs.c.
References acquire(), dinode::addrs, inode::addrs, bread(), brelse(), buf::data, inode::dev, inode::flags, I_BUSY, I_VALID, IBLOCK, icache, inode::inum, IPB, dinode::major, inode::major, memmove(), dinode::minor, inode::minor, dinode::nlink, inode::nlink, panic(), inode::ref, release(), dinode::size, inode::size, sleep(), dinode::type, and inode::type.
Referenced by consoleread(), consolewrite(), create(), exec(), fileread(), filestat(), filewrite(), namex(), sys_chdir(), sys_link(), sys_open(), and sys_unlink().
| void initlock | ( | struct spinlock * | , | |
| char * | ||||
| ) |
Definition at line 12 of file spinlock.c.
References spinlock::cpu, spinlock::locked, and spinlock::name.
Referenced by binit(), consoleinit(), fileinit(), ideinit(), iinit(), kinit(), pinit(), pipealloc(), and tvinit().
| void ioapicenable | ( | int | irq, | |
| int | cpu | |||
| ) |
Definition at line 71 of file ioapic.c.
References ioapicwrite(), ismp, REG_TABLE, and T_IRQ0.
Referenced by consoleinit(), ideinit(), and uartinit().
| void ioapicinit | ( | void | ) |
Definition at line 49 of file ioapic.c.
References cprintf(), INT_DISABLED, IOAPIC, ioapicid, ioapicread(), ioapicwrite(), ismp, REG_ID, REG_TABLE, REG_VER, and T_IRQ0.
Referenced by mpmain().
| void iput | ( | struct inode * | ) |
Definition at line 282 of file fs.c.
References acquire(), inode::flags, I_BUSY, I_VALID, icache, itrunc(), iupdate(), inode::nlink, panic(), inode::ref, release(), inode::type, and wakeup().
Referenced by dirlink(), exit(), fileclose(), iunlockput(), namex(), sys_chdir(), and sys_link().
| void iunlock | ( | struct inode * | ) |
Definition at line 269 of file fs.c.
References acquire(), inode::flags, I_BUSY, icache, panic(), inode::ref, release(), and wakeup().
Referenced by consoleread(), consolewrite(), fileread(), filestat(), filewrite(), iunlockput(), namex(), sys_chdir(), sys_link(), and sys_open().
| void iunlockput | ( | struct inode * | ) |
Definition at line 304 of file fs.c.
References iput(), and iunlock().
Referenced by create(), exec(), namex(), sys_chdir(), sys_link(), sys_mkdir(), sys_mknod(), sys_open(), and sys_unlink().
| void iupdate | ( | struct inode * | ) |
Definition at line 172 of file fs.c.
References inode::addrs, dinode::addrs, bread(), brelse(), bwrite(), buf::data, inode::dev, IBLOCK, inode::inum, IPB, inode::major, dinode::major, memmove(), inode::minor, dinode::minor, inode::nlink, dinode::nlink, inode::size, dinode::size, inode::type, and dinode::type.
Referenced by create(), iput(), itrunc(), sys_link(), sys_unlink(), and writei().
| char* kalloc | ( | int | ) |
Definition at line 91 of file kalloc.c.
References acquire(), cprintf(), kmem, run::len, run::next, PAGE, panic(), r, and release().
Referenced by allocproc(), bootothers(), exec(), fork(), growproc(), pipealloc(), and userinit().
| void kbdintr | ( | void | ) |
| void kfree | ( | char * | , | |
| int | ||||
| ) |
| int kill | ( | int | ) |
| void kinit | ( | void | ) |
| void ksegment | ( | void | ) |
| void lapiceoi | ( | void | ) |
| void lapicinit | ( | int | ) |
| int memcmp | ( | const void * | , | |
| const void * | , | |||
| uint | ||||
| ) |
| void* memmove | ( | void * | , | |
| const void * | , | |||
| uint | ||||
| ) |
Definition at line 28 of file string.c.
Referenced by bootothers(), cgaputc(), exec(), fmtname(), fork(), grep(), growproc(), ilock(), iupdate(), ls(), memcpy(), readi(), readsb(), skipelem(), userinit(), and writei().
| void* memset | ( | void * | , | |
| int | , | |||
| uint | ||||
| ) |
Definition at line 5 of file string.c.
Referenced by allocproc(), backcmd(), bigfile(), bzero(), cgaputc(), concreate(), exec(), execcmd(), fmtname(), getcmd(), growproc(), ialloc(), kfree(), listcmd(), pipecmd(), redircmd(), sharedfd(), sys_exec(), sys_unlink(), twofiles(), and userinit().
| void microdelay | ( | int | ) |
| void mpinit | ( | void | ) |
Definition at line 98 of file mp.c.
References mpproc::apicid, mpioapic::apicno, cprintf(), cpus, e, mpproc::flags, cpu::id, mp::imcrp, inb(), ioapicid, ismp, lapic, mpconf::lapicaddr, mpconf::length, MPBOOT, MPBUS, mpconfig(), MPIOAPIC, MPIOINTR, MPLINTR, MPPROC, ncpu, outb(), and panic().
Referenced by mpmain().
| void mpstartthem | ( | void | ) |
| int namecmp | ( | const char * | , | |
| const char * | ||||
| ) |
Definition at line 456 of file fs.c.
References DIRSIZ, and strncmp().
Referenced by dirlookup(), and sys_unlink().
| struct inode* namei | ( | char * | ) | [read] |
Definition at line 603 of file fs.c.
References DIRSIZ, name, and namex().
Referenced by exec(), sys_chdir(), sys_link(), sys_open(), and userinit().
| struct inode* nameiparent | ( | char * | , | |
| char * | ||||
| ) | [read] |
Definition at line 610 of file fs.c.
References namex().
Referenced by create(), sys_link(), and sys_unlink().
| void picenable | ( | int | ) |
Definition at line 26 of file picirq.c.
References irqmask, and picsetmask().
Referenced by consoleinit(), ideinit(), timerinit(), and uartinit().
| void picinit | ( | void | ) |
| void pinit | ( | void | ) |
Definition at line 22 of file pipe.c.
References filealloc(), fileclose(), initlock(), kalloc(), kfree(), pipe::lock, pipe::nread, pipe::nwrite, PAGE, pipe::readopen, and pipe::writeopen.
Referenced by sys_pipe().
| void pipeclose | ( | struct pipe * | , | |
| int | ||||
| ) |
Definition at line 58 of file pipe.c.
References acquire(), kfree(), pipe::lock, pipe::nread, pipe::nwrite, PAGE, pipe::readopen, release(), wakeup(), and pipe::writeopen.
Referenced by fileclose().
| int piperead | ( | struct pipe * | , | |
| char * | , | |||
| int | ||||
| ) |
Definition at line 98 of file pipe.c.
References acquire(), pipe::data, pipe::lock, pipe::nread, pipe::nwrite, PIPESIZE, release(), sleep(), wakeup(), and pipe::writeopen.
Referenced by fileread().
| int pipewrite | ( | struct pipe * | , | |
| char * | , | |||
| int | ||||
| ) |
Definition at line 76 of file pipe.c.
References acquire(), pipe::data, pipe::lock, pipe::nread, pipe::nwrite, PIPESIZE, pipe::readopen, release(), sleep(), and wakeup().
Referenced by filewrite().
| void popcli | ( | ) |
Definition at line 107 of file spinlock.c.
References FL_IF, panic(), readeflags(), and sti().
Referenced by release(), and usegment().
| void procdump | ( | void | ) |
Definition at line 30 of file proc.c.
References proc::context, cprintf(), context::ebp, EMBRYO, getcallerpcs(), proc::name, NELEM, NPROC, proc::pid, ptable, RUNNABLE, RUNNING, SLEEPING, proc::state, UNUSED, and ZOMBIE.
Referenced by consoleintr().
| void pushcli | ( | ) |
Definition at line 96 of file spinlock.c.
References cli(), FL_IF, and readeflags().
Referenced by acquire(), and usegment().
Definition at line 395 of file fs.c.
References bmap(), bread(), brelse(), BSIZE, buf::data, inode::dev, inode::major, memmove(), min, NDEV, inode::size, T_DEV, and inode::type.
Referenced by dirlink(), exec(), fileread(), and isdirempty().
| void release | ( | struct spinlock * | ) |
Definition at line 43 of file spinlock.c.
References spinlock::cpu, holding(), spinlock::locked, panic(), spinlock::pcs, popcli(), and xchg().
Referenced by allocproc(), bget(), brelse(), consoleintr(), consoleread(), consolewrite(), cprintf(), filealloc(), fileclose(), filedup(), forkret(), ideintr(), iderw(), idup(), iget(), ilock(), iput(), iunlock(), kalloc(), kfree(), kill(), pipeclose(), piperead(), pipewrite(), scheduler(), sleep(), sys_sleep(), trap(), wait(), wakeup(), and yield().
| char* safestrcpy | ( | char * | , | |
| const char * | , | |||
| int | ||||
| ) |
| void scheduler | ( | void | ) |
| void sleep | ( | void * | , | |
| struct spinlock * | ||||
| ) |
Definition at line 313 of file proc.c.
References acquire(), panic(), ptable, release(), sched(), and SLEEPING.
Referenced by bget(), consoleread(), iderw(), ilock(), main(), piperead(), pipewrite(), sys_sleep(), and wait().
Definition at line 384 of file fs.c.
References inode::dev, stat::dev, stat::ino, inode::inum, inode::nlink, stat::nlink, inode::size, stat::size, inode::type, and stat::type.
Referenced by filestat().
| int strlen | ( | const char * | ) |
| int strncmp | ( | const char * | , | |
| const char * | , | |||
| uint | ||||
| ) |
| char* strncpy | ( | char * | , | |
| const char * | , | |||
| int | ||||
| ) |
Referenced by sched(), and scheduler().
| void syscall | ( | void | ) |
| void timerinit | ( | void | ) |
Definition at line 25 of file timer.c.
References IO_TIMER1, IRQ_TIMER, outb(), picenable(), TIMER_16BIT, TIMER_DIV, TIMER_MODE, TIMER_RATEGEN, and TIMER_SEL0.
Referenced by mpmain().
| void tvinit | ( | void | ) |
| void uartinit | ( | void | ) |
Definition at line 19 of file uart.c.
References COM1, inb(), ioapicenable(), IRQ_COM1, outb(), picenable(), uart, and uartputc().
Referenced by mpmain().
| void uartintr | ( | void | ) |
Definition at line 74 of file uart.c.
References consoleintr(), and uartgetc().
Referenced by trap().
| void uartputc | ( | int | ) |
Definition at line 52 of file uart.c.
References COM1, inb(), microdelay(), outb(), and uart.
Referenced by consputc(), and uartinit().
| void usegment | ( | void | ) |
| void userinit | ( | void | ) |
Definition at line 142 of file proc.c.
References allocproc(), trapframe::cs, proc::cwd, DPL_USER, trapframe::ds, trapframe::eflags, trapframe::eip, trapframe::es, trapframe::esp, FL_IF, kalloc(), proc::mem, memmove(), memset(), proc::name, namei(), PAGE, RUNNABLE, safestrcpy(), SEG_UCODE, SEG_UDATA, trapframe::ss, proc::state, proc::sz, and proc::tf.
Referenced by mpmain().
| int wait | ( | void | ) |
Definition at line 437 of file proc.c.
Referenced by concreate(), createdelete(), exitwait(), forktest(), main(), mem(), pipe1(), preempt(), runcmd(), sharedfd(), sys_wait(), and twofiles().
| void wakeup | ( | void * | ) |
Definition at line 361 of file proc.c.
References acquire(), ptable, release(), and wakeup1().
Referenced by brelse(), consoleintr(), ideintr(), iput(), iunlock(), pipeclose(), piperead(), pipewrite(), and trap().
Definition at line 422 of file fs.c.
References bmap(), bread(), brelse(), BSIZE, bwrite(), buf::data, inode::dev, iupdate(), inode::major, MAXFILE, memmove(), min, NDEV, inode::size, T_DEV, and inode::type.
Referenced by dirlink(), filewrite(), and sys_unlink().
| void yield | ( | void | ) |
| int ismp |
Definition at line 15 of file mp.c.
Referenced by ioapicenable(), ioapicinit(), mpinit(), and mpmain().
Definition at line 38 of file lapic.c.
Referenced by cpunum(), lapiceoi(), lapicinit(), lapicw(), and mpinit().
| int ticks |
1.5.6