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 // Format of an ELF executable file 00002 00003 #define ELF_MAGIC 0x464C457FU // "\x7FELF" in little endian 00004 00005 // File header 00006 struct elfhdr { 00007 uint magic; // must equal ELF_MAGIC 00008 uchar elf[12]; 00009 ushort type; 00010 ushort machine; 00011 uint version; 00012 uint entry; 00013 uint phoff; 00014 uint shoff; 00015 uint flags; 00016 ushort ehsize; 00017 ushort phentsize; 00018 ushort phnum; 00019 ushort shentsize; 00020 ushort shnum; 00021 ushort shstrndx; 00022 }; 00023 00024 // Program section header 00025 struct proghdr { 00026 uint type; 00027 uint off; 00028 uint vaddr; 00029 uint paddr; 00030 uint filesz; 00031 uint memsz; 00032 uint flags; 00033 uint align; 00034 }; 00035 00036 // Values for Proghdr type 00037 #define ELF_PROG_LOAD 1 00038 00039 // Flag bits for Proghdr flags 00040 #define ELF_PROG_FLAG_EXEC 1 00041 #define ELF_PROG_FLAG_WRITE 2 00042 #define ELF_PROG_FLAG_READ 4