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
memlayout.h
00001 // Memory layout
00002 
00003 #define EXTMEM  0x100000            // Start of extended memory
00004 #define PHYSTOP 0xE000000           // Top physical memory
00005 #define DEVSPACE 0xFE000000         // Other devices are at high addresses
00006 
00007 // Key addresses for address space layout (see kmap in vm.c for layout)
00008 #define KERNBASE 0x80000000         // First kernel virtual address
00009 #define KERNLINK (KERNBASE+EXTMEM)  // Address where kernel is linked
00010 
00011 #ifndef __ASSEMBLER__
00012 
00013 static inline uint v2p(void *a) { return ((uint) (a))  - KERNBASE; }
00014 static inline void *p2v(uint a) { return (void *) ((a) + KERNBASE); }
00015 
00016 #endif
00017 
00018 #define V2P(a) (((uint) (a)) - KERNBASE)
00019 #define P2V(a) (((void *) (a)) + KERNBASE)
00020 
00021 #define V2P_WO(x) ((x) - KERNBASE)    // same as V2P, but without casts
00022 #define P2V_WO(x) ((x) + KERNBASE)    // same as V2P, but without casts
 All Data Structures