Xv6 with picoc & Linkage editor
v1.0
The project delineate mutual cohesion between c library, linkage editor ( linker), interpreter and operating system by porting the same on xv6 kernel
|
00001 struct file { 00002 enum { FD_NONE, FD_PIPE, FD_INODE } type; 00003 int ref; // reference count 00004 char readable; 00005 char writable; 00006 struct pipe *pipe; 00007 struct inode *ip; 00008 uint off; 00009 }; 00010 00011 00012 // in-memory copy of an inode 00013 struct inode { 00014 uint dev; // Device number 00015 uint inum; // Inode number 00016 int ref; // Reference count 00017 int flags; // I_BUSY, I_VALID 00018 00019 short type; // copy of disk inode 00020 short major; 00021 short minor; 00022 short nlink; 00023 uint size; 00024 uint addrs[NDIRECT+1]; 00025 }; 00026 #define I_BUSY 0x1 00027 #define I_VALID 0x2 00028 00029 // table mapping major device number to 00030 // device functions 00031 struct devsw { 00032 int (*read)(struct inode*, char*, int); 00033 int (*write)(struct inode*, char*, int); 00034 }; 00035 00036 extern struct devsw devsw[]; 00037 00038 #define CONSOLE 1