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 // 00002 // assembler macros to create x86 segments 00003 // 00004 00005 #define SEG_NULLASM \ 00006 .word 0, 0; \ 00007 .byte 0, 0, 0, 0 00008 00009 // The 0xC0 means the limit is in 4096-byte units 00010 // and (for executable segments) 32-bit mode. 00011 #define SEG_ASM(type,base,lim) \ 00012 .word (((lim) >> 12) & 0xffff), ((base) & 0xffff); \ 00013 .byte (((base) >> 16) & 0xff), (0x90 | (type)), \ 00014 (0xC0 | (((lim) >> 28) & 0xf)), (((base) >> 24) & 0xff) 00015 00016 #define STA_X 0x8 // Executable segment 00017 #define STA_E 0x4 // Expand down (non-executable segments) 00018 #define STA_C 0x4 // Conforming code segment (executable only) 00019 #define STA_W 0x2 // Writeable (non-executable segments) 00020 #define STA_R 0x2 // Readable (executable segments) 00021 #define STA_A 0x1 // Accessed