00001 /* ndk - [ rZero.h ] 00002 * 00003 * Interface for loading/interacting with rZero modules 00004 * 00005 * (c)2004 dcipher / neuraldk 00006 * www.neuraldk.org 00007 */ 00008 00018 #ifndef __ndk_rZero_h__ 00019 #define __ndk_rZero_h__ 00020 00021 #include "multiboot.h" 00022 #include "console.h" 00023 #include "string.h" 00024 #include "memory.h" 00025 #include "timer.h" 00026 #include "ndk.h" 00027 #include "io.h" 00028 00029 typedef struct 00030 { 00031 char *symbolName; 00032 long symbolLocation; 00033 long segmentNum; 00034 } rZeroSymbolInfo; 00035 00036 typedef struct 00037 { 00038 short type; 00039 short number; 00040 short reserved; 00041 long length; 00042 long offset; 00043 } rZeroSegment; 00044 00045 typedef struct 00046 { 00047 char *name; 00048 long version; 00049 long headerLength; 00050 long headerOffset; 00051 long length; 00052 long pos; 00053 char *mem; 00054 char *end; 00055 long numSegments; 00056 rZeroSegment segment[3]; // NOTE: temporary! Should be dynamically allocated! 00057 // or just 3 (max segs for RDOff?) 00058 } rZeroObj; 00059 00060 extern rZeroSymbolInfo rZeroExports[]; 00061 extern rZeroSymbolInfo rZeroImports[]; 00062 00063 void rZeroParse(rZeroObj * obj); 00064 void rZeroParseHeader(rZeroObj * obj); 00065 void rZeroParseSegments(rZeroObj * obj); 00066 void rZeroClearSegments(void); 00067 int rZeroFindSymbol(char *symbol, rZeroSymbolInfo * symInfo); 00068 int rZeroFindSegment(short segment, rZeroSymbolInfo * symInfo); 00069 00070 long volatile readLong(rZeroObj * obj); 00071 short volatile readShort(rZeroObj * obj); 00072 char volatile readByte(rZeroObj * obj); 00073 #endif 00074