xv6/defs.h File Reference

Go to the source code of this file.

Defines

#define NELEM(x)   (sizeof(x)/sizeof((x)[0]))

Functions

void binit (void)
struct bufbread (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 filefilealloc (void)
void fileclose (struct file *)
struct filefiledup (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 inodedirlookup (struct inode *, char *, uint *)
struct inodeialloc (uint, short)
struct inodeidup (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 inodenamei (char *)
struct inodenameiparent (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 proccopyproc (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 uintlapic
int ismp
int ticks
struct spinlock tickslock


Define Documentation

#define NELEM (  )     (sizeof(x)/sizeof((x)[0]))

Definition at line 155 of file defs.h.

Referenced by procdump(), sys_exec(), and syscall().


Function Documentation

void acquire ( struct spinlock  ) 

int argint ( int  ,
int *   
)

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   ) 

Definition at line 40 of file bio.c.

References bcache, buf::dev, initlock(), NBUF, buf::next, and buf::prev.

Referenced by mpmain().

struct buf* bread ( uint  ,
uint   
) [read]

Definition at line 97 of file bio.c.

References B_VALID, bget(), buf::flags, and iderw().

Referenced by balloc(), bfree(), bmap(), bzero(), dirlookup(), ialloc(), ilock(), itrunc(), iupdate(), readi(), readsb(), and writei().

void brelse ( struct buf  ) 

void bwrite ( struct buf  ) 

Definition at line 109 of file bio.c.

References B_BUSY, B_DIRTY, buf::flags, iderw(), and panic().

Referenced by balloc(), bfree(), bmap(), bzero(), ialloc(), iupdate(), and writei().

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().

struct proc* copyproc ( struct proc  )  [read]

void cprintf ( char *  ,
  ... 
)

int cpunum ( void   ) 

Definition at line 94 of file lapic.c.

References cprintf(), FL_IF, ID, lapic, and readeflags().

Referenced by bootothers(), and ksegment().

int dirlink ( struct inode ,
char *  ,
uint   
)

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().

struct inode* dirlookup ( struct inode ,
char *  ,
uint  
) [read]

int exec ( char *  ,
char **   
)

Definition at line 10 of file exec.c.

Referenced by exectest(), main(), runcmd(), and sys_exec().

void exit ( void   ) 

int fetchint ( struct proc ,
uint  ,
int *   
)

Definition at line 17 of file syscall.c.

References proc::mem, and proc::sz.

Referenced by argint(), and sys_exec().

int fetchstr ( struct proc ,
uint  ,
char **   
)

Definition at line 29 of file syscall.c.

References proc::mem, and proc::sz.

Referenced by argstr(), and sys_exec().

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  ) 

struct file* filedup ( struct file  )  [read]

Definition at line 40 of file file.c.

References acquire(), ftable, panic(), file::ref, and release().

Referenced by fork(), and sys_dup().

void fileinit ( void   ) 

Definition at line 15 of file file.c.

References ftable, and initlock().

Referenced by mpmain().

int fileread ( struct file ,
char *  ,
int  n 
)

int filestat ( struct file ,
struct stat  
)

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 
)

int fork ( void   ) 

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  ) 

Definition at line 85 of file spinlock.c.

References spinlock::cpu, and spinlock::locked.

Referenced by acquire(), release(), and sched().

struct inode* ialloc ( uint  ,
short   
) [read]

Definition at line 147 of file fs.c.

References bread(), brelse(), bwrite(), buf::data, IBLOCK, iget(), inode::inum, IPB, memset(), superblock::ninodes, panic(), readsb(), and dinode::type.

Referenced by create(), and main().

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   ) 

Definition at line 91 of file ide.c.

References acquire(), B_DIRTY, B_VALID, cprintf(), buf::data, buf::flags, idelock, idestart(), idewait(), insl(), buf::qnext, release(), and wakeup().

Referenced by trap().

void iderw ( struct buf  ) 

Definition at line 124 of file ide.c.

References acquire(), B_BUSY, B_DIRTY, B_VALID, buf::dev, buf::flags, havedisk1, idelock, idestart(), panic(), buf::qnext, release(), and sleep().

Referenced by bread(), and bwrite().

void idtinit ( void   ) 

Definition at line 29 of file trap.c.

References idt, and lidt().

struct inode* idup ( struct inode  )  [read]

Definition at line 227 of file fs.c.

References acquire(), icache, inode::ref, and release().

Referenced by fork(), and namex().

void iinit ( void   ) 

Definition at line 138 of file fs.c.

References icache, and initlock().

Referenced by mpmain().

void ilock ( struct inode  ) 

void initlock ( struct spinlock ,
char *   
)

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  ) 

void iunlock ( struct inode  ) 

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  ) 

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   ) 

Definition at line 47 of file kbd.c.

References consoleintr(), and kbdgetc().

Referenced by trap().

void kfree ( char *  ,
int   
)

Definition at line 46 of file kalloc.c.

References acquire(), kmem, run::len, memset(), run::next, PAGE, panic(), r, and release().

Referenced by exec(), fork(), growproc(), kinit(), pipealloc(), pipeclose(), and wait().

int kill ( int   ) 

Definition at line 372 of file proc.c.

Referenced by main(), preempt(), and sys_kill().

void kinit ( void   ) 

Definition at line 28 of file kalloc.c.

References cprintf(), initlock(), kfree(), kmem, run::len, and PAGE.

Referenced by mpmain().

void ksegment ( void   ) 

Definition at line 65 of file proc.c.

References cpu::cpu, cpunum(), cpus, cpu::gdt, lgdt(), loadgs(), SEG, SEG_KCODE, SEG_KCPU, SEG_KDATA, STA_R, STA_W, and STA_X.

Referenced by mpmain().

void lapiceoi ( void   ) 

Definition at line 115 of file lapic.c.

References EOI, lapic, and lapicw().

Referenced by trap().

void lapicinit ( int   ) 

Definition at line 48 of file lapic.c.

References BCAST, DELIVS, ENABLE, EOI, ERROR, ESR, ICRHI, ICRLO, INIT, IRQ_ERROR, IRQ_SPURIOUS, IRQ_TIMER, lapic, lapicw(), LEVEL, LINT0, LINT1, MASKED, PCINT, PERIODIC, SVR, T_IRQ0, TDCR, TICR, TIMER, TPR, VER, and X1.

Referenced by mpmain().

void lapicstartap ( uchar  ,
uint   
)

Definition at line 134 of file lapic.c.

References ASSERT, ICRHI, ICRLO, INIT, IO_RTC, lapicw(), LEVEL, microdelay(), outb(), and STARTUP.

Referenced by bootothers().

int memcmp ( const void *  ,
const void *  ,
uint   
)

Definition at line 12 of file string.c.

Referenced by mpconfig().

void* memmove ( void *  ,
const void *  ,
uint   
)

void* memset ( void *  ,
int  ,
uint   
)

void microdelay ( int   ) 

Definition at line 124 of file lapic.c.

Referenced by lapicstartap(), and uartputc().

int mpbcpu ( void   ) 

Definition at line 20 of file mp.c.

References cpus.

Referenced by mpmain().

void mpinit ( void   ) 

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 panic ( char *   ) 

Definition at line 101 of file console.c.

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   ) 

Definition at line 33 of file picirq.c.

References IO_PIC1, IO_PIC2, IRQ_SLAVE, irqmask, outb(), picsetmask(), and T_IRQ0.

Referenced by mpmain().

void pinit ( void   ) 

Definition at line 21 of file proc.c.

References initlock(), and ptable.

Referenced by mpmain().

int pipealloc ( struct file **  ,
struct file **   
)

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   ) 

void pushcli (  ) 

Definition at line 96 of file spinlock.c.

References cli(), FL_IF, and readeflags().

Referenced by acquire(), and usegment().

int readi ( struct inode ,
char *  ,
uint  ,
uint   
)

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  ) 

char* safestrcpy ( char *  ,
const char *  ,
int   
)

Definition at line 78 of file string.c.

Referenced by exec(), and userinit().

void scheduler ( void   ) 

Definition at line 237 of file proc.c.

References acquire(), NPROC, ptable, release(), RUNNABLE, RUNNING, proc::state, sti(), swtch(), and usegment().

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().

void stati ( struct inode ,
struct stat  
)

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 *   ) 

Definition at line 92 of file string.c.

Referenced by exec(), fmtname(), ls(), main(), parsecmd(), and printf().

int strncmp ( const char *  ,
const char *  ,
uint   
)

Definition at line 54 of file string.c.

Referenced by namecmp().

char* strncpy ( char *  ,
const char *  ,
int   
)

Definition at line 64 of file string.c.

Referenced by dirlink(), and main().

void swtch ( struct context **  ,
struct context  
)

Referenced by sched(), and scheduler().

void syscall ( void   ) 

Definition at line 124 of file syscall.c.

References cprintf(), NELEM, and syscalls.

Referenced by trap().

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   ) 

Definition at line 17 of file trap.c.

References DPL_USER, idt, initlock(), SEG_KCODE, SETGATE, T_SYSCALL, tickslock, and vectors.

Referenced by mpmain().

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   ) 

Definition at line 83 of file proc.c.

References DPL_USER, KSTACKSIZE, ltr(), popcli(), pushcli(), SEG, SEG16, SEG_KDATA, SEG_TSS, SEG_UCODE, SEG_UDATA, STA_R, STA_W, STA_X, and STS_T32A.

Referenced by exec(), growproc(), and scheduler().

void userinit ( void   ) 

int wait ( void   ) 

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().

int writei ( struct inode ,
char *  ,
uint  ,
uint   
)

void yield ( void   ) 

Definition at line 291 of file proc.c.

References acquire(), ptable, release(), RUNNABLE, and sched().

Referenced by trap().


Variable Documentation

Definition at line 17 of file mp.c.

Referenced by ioapicinit(), and mpinit().

int ismp

Definition at line 15 of file mp.c.

Referenced by ioapicenable(), ioapicinit(), mpinit(), and mpmain().

volatile uint* lapic

Definition at line 38 of file lapic.c.

Referenced by cpunum(), lapiceoi(), lapicinit(), lapicw(), and mpinit().

int ticks

Definition at line 14 of file trap.c.

Referenced by sys_sleep(), and trap().

Definition at line 13 of file trap.c.

Referenced by sys_sleep(), trap(), and tvinit().


Generated on Fri Jan 7 12:25:49 2011 for xv6 by  doxygen 1.5.6