Mercurial > hg > Members > anatofuz > CbC_xv6
view src/defs.h @ 94:d876c9a65239 default tip
impl mac os target
author | anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Wed, 23 Oct 2019 14:31:38 +0900 |
parents | fb3e5a2f76c1 |
children |
line wrap: on
line source
// // a definition of data structure/methods // #ifndef INCLUDE_DEFS_H #define INCLUDE_DEFS_H #define UMAX(a, b) ((uint)(a) > (uint)(b) ? (uint)(a):(uint)(b)) #define UMIN(a, b) ((uint)(a) > (uint)(b) ? (uint)(b):(uint)(a)) // number of elements in fixed-size array #define NELEM(x) (sizeof(x)/sizeof((x)[0])) struct buf; struct context; struct file; struct inode; struct pipe; struct proc; struct spinlock; struct stat; struct superblock; struct trapframe; typedef uint32 pte_t; typedef uint32 pde_t; extern uint32 _kernel_pgtbl; typedef void (*ISR) (struct trapframe *tf, int n); // arm.c void set_stk(uint mode, uint addr); void cli (void); void sti (void); uint spsr_usr(); int int_enabled(); void pushcli(void); void popcli(void); void getcallerpcs(void *, uint*); void* get_fp (void); void show_callstk (char *); // bio.c void binit(void); struct buf* bread(uint, uint); void brelse(struct buf*); void bwrite(struct buf*); // buddy.c void kmem_init (void); void kmem_init2(void *vstart, void *vend); void* kmalloc (int order); void kfree (void *mem, int order); void free_page(void *v); void* alloc_page (void); void kmem_test_b (void); int get_order (uint32 v); // console.c void consoleinit(void); void cprintf(char*, ...); void consoleintr(int(*)(void)); __code cbc_panic(char*) __attribute__((noreturn)); void panic(char*) __attribute__((noreturn)); // exec.c int exec(char*, char**); // file.c struct file* filealloc(void); void fileclose(struct file*); struct file* filedup(struct file*); void fileinit(void); __code cbc_fileread (struct file*, char*, int, __code (*)(int)); int fileread(struct file*, char*, int n); int filestat(struct file*, struct stat*); int filewrite(struct file*, char*, int n); // fs.c void readsb(int dev, struct superblock *sb); 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*); __code cbc_readi (struct inode*, char*, uint, uint, __code (*)(int)); int readi(struct inode*, char*, uint, uint); void stati(struct inode*, struct stat*); int writei(struct inode*, char*, uint, uint); // ide.c void ideinit(void); void iderw(struct buf*); // kalloc.c /*char* kalloc(void); void kfree(char*); void kinit1(void*, void*); void kinit2(void*, void*); void kmem_init (void);*/ // log.c void initlog(void); void log_write(struct buf*); void begin_trans(); void commit_trans(); // picirq.c void pic_enable(int, ISR); void pic_init(void*); void pic_dispatch (struct trapframe *tp); // pipe.c int pipealloc(struct file**, struct file**); void pipeclose(struct pipe*, int); int piperead(struct pipe*, char*, int); __code cbc_piperead(struct pipe*, char*, int, __code (*)(int)); int pipewrite(struct pipe*, char*, int); //PAGEBREAK: 16 // proc.c 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 sched(void); __code cbc_sleep(void*, struct spinlock*, __code(*next1)()); void sleep(void*, struct spinlock*); void userinit(void); int wait(void); __code cbc_wakeup(void*, __code(*next1)()); void wakeup(void*); void yield(void); // swtch.S void swtch(struct context**, struct context*); // spinlock.c void acquire(struct spinlock*); int holding(struct spinlock*); void initlock(struct spinlock*, char*); void release(struct spinlock*); // string.c 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); // syscall.c int argint(int, int*); int argptr(int, char**, int); int argstr(int, char**); int fetchint(uint, int*); int fetchstr(uint, char**); __code cbc_ret(int); void syscall(void); // timer.c void timer_init(int hz); extern struct spinlock tickslock; // trap.c extern uint ticks; void trap_init(void); void dump_trapframe (struct trapframe *tf); // trap_asm.S void trap_reset(void); void trap_und(void); void trap_swi(void); void trap_iabort(void); void trap_dabort(void); void trap_na(void); void trap_irq(void); void trap_fiq(void); // uart.c void uart_init(void*); void uartputc(int); int uartgetc(void); void micro_delay(int us); void uart_enable_rx(); // vm.c int allocuvm(pde_t*, uint, uint); int deallocuvm(pde_t*, uint, uint); void freevm(pde_t*); void inituvm(pde_t*, char*, uint); int loaduvm(pde_t*, char*, struct inode*, uint, uint); pde_t* copyuvm(pde_t*, uint); void switchuvm(struct proc*); int copyout(pde_t*, uint, void*, uint); void clearpteu(pde_t *pgdir, char *uva); void* kpt_alloc(void); void init_vmm (void); void kpt_freerange (uint32 low, uint32 hi); void paging_init (uint phy_low, uint phy_hi); #endif