xv6

port of xv6 to x86-64
git clone http://frotz.net/git/xv6.git
Log | Files | Refs | README | LICENSE

defs.h (5420B)


      1 struct buf;
      2 struct context;
      3 struct file;
      4 struct inode;
      5 struct pipe;
      6 struct proc;
      7 struct spinlock;
      8 struct stat;
      9 struct superblock;
     10 
     11 // bio.c
     12 void            binit(void);
     13 struct buf*     bread(uint, uint);
     14 void            brelse(struct buf*);
     15 void            bwrite(struct buf*);
     16 
     17 // console.c
     18 void            consoleinit(void);
     19 void            cprintf(char*, ...);
     20 void            consoleintr(int(*)(void));
     21 void            panic(char*) __attribute__((noreturn));
     22 
     23 // exec.c
     24 int             exec(char*, char**);
     25 
     26 // file.c
     27 struct file*    filealloc(void);
     28 void            fileclose(struct file*);
     29 struct file*    filedup(struct file*);
     30 void            fileinit(void);
     31 int             fileread(struct file*, char*, int n);
     32 int             filestat(struct file*, struct stat*);
     33 int             filewrite(struct file*, char*, int n);
     34 
     35 // fs.c
     36 void            readsb(int dev, struct superblock *sb);
     37 int             dirlink(struct inode*, char*, uint);
     38 struct inode*   dirlookup(struct inode*, char*, uint*);
     39 struct inode*   ialloc(uint, short);
     40 struct inode*   idup(struct inode*);
     41 void            iinit(void);
     42 void            ilock(struct inode*);
     43 void            iput(struct inode*);
     44 void            iunlock(struct inode*);
     45 void            iunlockput(struct inode*);
     46 void            iupdate(struct inode*);
     47 int             namecmp(const char*, const char*);
     48 struct inode*   namei(char*);
     49 struct inode*   nameiparent(char*, char*);
     50 int             readi(struct inode*, char*, uint, uint);
     51 void            stati(struct inode*, struct stat*);
     52 int             writei(struct inode*, char*, uint, uint);
     53 
     54 // ide.c
     55 void            ideinit(void);
     56 void            ideintr(void);
     57 void            iderw(struct buf*);
     58 
     59 // ioapic.c
     60 void            ioapicenable(int irq, int cpu);
     61 extern uchar    ioapicid;
     62 void            ioapicinit(void);
     63 
     64 // kalloc.c
     65 char*           kalloc(void);
     66 void            kfree(char*);
     67 void            kinit1(void*, void*);
     68 void            kinit2(void*, void*);
     69 
     70 // kbd.c
     71 void            kbdintr(void);
     72 
     73 // lapic.c
     74 int             cpunum(void);
     75 extern volatile uint*    lapic;
     76 void            lapiceoi(void);
     77 void            lapicinit(void);
     78 void            lapicstartap(uchar, uint);
     79 void            microdelay(int);
     80 
     81 // log.c
     82 void            initlog(void);
     83 void            log_write(struct buf*);
     84 void            begin_trans();
     85 void            commit_trans();
     86 
     87 // mp.c
     88 extern int      ismp;
     89 int             mpbcpu(void);
     90 void            mpinit(void);
     91 void            mpstartthem(void);
     92 
     93 // apic.c
     94 int             acpiinit(void);
     95 
     96 // picirq.c
     97 void            picenable(int);
     98 void            picinit(void);
     99 
    100 // pipe.c
    101 int             pipealloc(struct file**, struct file**);
    102 void            pipeclose(struct pipe*, int);
    103 int             piperead(struct pipe*, char*, int);
    104 int             pipewrite(struct pipe*, char*, int);
    105 
    106 //PAGEBREAK: 16
    107 // proc.c
    108 struct proc*    copyproc(struct proc*);
    109 void            exit(void);
    110 int             fork(void);
    111 int             growproc(int);
    112 int             kill(int);
    113 void            pinit(void);
    114 void            procdump(void);
    115 void            scheduler(void) __attribute__((noreturn));
    116 void            sched(void);
    117 void            sleep(void*, struct spinlock*);
    118 void            userinit(void);
    119 int             wait(void);
    120 void            wakeup(void*);
    121 void            yield(void);
    122 
    123 // swtch.S
    124 void            swtch(struct context**, struct context*);
    125 
    126 // spinlock.c
    127 void            acquire(struct spinlock*);
    128 void            getcallerpcs(void*, uintp*);
    129 void            getstackpcs(uintp*, uintp*);
    130 int             holding(struct spinlock*);
    131 void            initlock(struct spinlock*, char*);
    132 void            release(struct spinlock*);
    133 void            pushcli(void);
    134 void            popcli(void);
    135 
    136 // string.c
    137 int             memcmp(const void*, const void*, uint);
    138 void*           memmove(void*, const void*, uint);
    139 void*           memset(void*, int, uint);
    140 char*           safestrcpy(char*, const char*, int);
    141 int             strlen(const char*);
    142 int             strncmp(const char*, const char*, uint);
    143 char*           strncpy(char*, const char*, int);
    144 
    145 // syscall.c
    146 int             argint(int, int*);
    147 int             argptr(int, char**, int);
    148 int             argstr(int, char**);
    149 int             arguintp(int, uintp*);
    150 int             fetchuintp(uintp, uintp*);
    151 int             fetchstr(uintp, char**);
    152 void            syscall(void);
    153 
    154 // timer.c
    155 void            timerinit(void);
    156 
    157 // trap.c
    158 void            idtinit(void);
    159 extern uint     ticks;
    160 void            tvinit(void);
    161 extern struct spinlock tickslock;
    162 
    163 // uart.c
    164 void		uartearlyinit(void);
    165 void            uartinit(void);
    166 void            uartintr(void);
    167 void            uartputc(int);
    168 
    169 // vm.c
    170 void            seginit(void);
    171 void            kvmalloc(void);
    172 void            vmenable(void);
    173 pde_t*          setupkvm(void);
    174 char*           uva2ka(pde_t*, char*);
    175 int             allocuvm(pde_t*, uint, uint);
    176 int             deallocuvm(pde_t*, uintp, uintp);
    177 void            freevm(pde_t*);
    178 void            inituvm(pde_t*, char*, uint);
    179 int             loaduvm(pde_t*, char*, struct inode*, uint, uint);
    180 pde_t*          copyuvm(pde_t*, uint);
    181 void            switchuvm(struct proc*);
    182 void            switchkvm(void);
    183 int             copyout(pde_t*, uint, void*, uint);
    184 void            clearpteu(pde_t *pgdir, char *uva);
    185 
    186 // number of elements in fixed-size array
    187 #define NELEM(x) (sizeof(x)/sizeof((x)[0]))