Changeset 2974 for trunk/kLdr/kLdrModLX.c
- Timestamp:
- Feb 14, 2007, 11:12:44 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kLdr/kLdrModLX.c
r2948 r2974 70 70 71 71 /** The offset of the LX header. */ 72 off_toffHdr;72 KLDRFOFF offHdr; 73 73 /** Copy of the LX header. */ 74 74 struct e32_exe Hdr; … … 116 116 static int kldrModLXRelocateBits(PKLDRMOD pMod, void *pvBits, KLDRADDR NewBaseAddress, KLDRADDR OldBaseAddress, 117 117 PFNKLDRMODGETIMPORT pfnGetImport, void *pvUser); 118 static int kldrModLXDoCreate(PKLDRRDR pRdr, off_toffNewHdr, PKLDRMODLX *ppModLX);118 static int kldrModLXDoCreate(PKLDRRDR pRdr, KLDRFOFF offNewHdr, PKLDRMODLX *ppModLX); 119 119 static const uint8_t *kldrModLXDoNameTableLookupByOrdinal(const uint8_t *pbNameTable, int32_t cbNameTable, uint32_t iOrdinal); 120 120 static int kldrModLXDoNameLookup(PKLDRMODLX pModLX, const char *pchSymbol, uint32_t cchSymbol, uint32_t *piSymbol); … … 133 133 static int kldrModLXDoLoadFixupSection(PKLDRMODLX pModLX); 134 134 static int32_t kldrModLXDoCall(uintptr_t uEntrypoint, uintptr_t uHandle, uint32_t uOp, void *pvReserved); 135 static int kldrModLXDoReloc(uint8_t *pbPage, int off, KLDRADDR PageAddress, const struct r32_rlc *prlc, 135 static int kldrModLXDoReloc(uint8_t *pbPage, int off, KLDRADDR PageAddress, const struct r32_rlc *prlc, 136 136 int iSelector, KLDRADDR uValue, uint32_t fKind); 137 137 … … 148 148 * @param ppMod Where to store the module instance pointer. 149 149 */ 150 static int kldrModLXCreate(PCKLDRMODOPS pOps, PKLDRRDR pRdr, off_toffNewHdr, PPKLDRMOD ppMod)150 static int kldrModLXCreate(PCKLDRMODOPS pOps, PKLDRRDR pRdr, KLDRFOFF offNewHdr, PPKLDRMOD ppMod) 151 151 { 152 152 PKLDRMODLX pModLX; … … 173 173 * simplify cleanup on failure. 174 174 */ 175 static int kldrModLXDoCreate(PKLDRRDR pRdr, off_toffNewHdr, PKLDRMODLX *ppModLX)175 static int kldrModLXDoCreate(PKLDRRDR pRdr, KLDRFOFF offNewHdr, PKLDRMODLX *ppModLX) 176 176 { 177 177 struct e32_exe Hdr; … … 208 208 209 209 /* Some rough sanity checks. */ 210 offEnd = kLdrRdrSize(pRdr) >= ( off_t)~(uint32_t)16 ? ~(uint32_t)16 : (uint32_t)kLdrRdrSize(pRdr);210 offEnd = kLdrRdrSize(pRdr) >= (KLDRFOFF)~(uint32_t)16 ? ~(uint32_t)16 : (uint32_t)kLdrRdrSize(pRdr); 211 211 if ( Hdr.e32_itermap > offEnd 212 212 || Hdr.e32_datapage > offEnd … … 249 249 && (Hdr.e32_fpagetab < off || Hdr.e32_fpagetab > offEnd)) 250 250 { 251 /* 251 /* 252 252 * wlink mixes the fixup section and the loader section. 253 253 */ … … 2105 2105 else 2106 2106 uValue = pMod->aSegments[iSeg].MapAddress; 2107 if ( (u.prlc->nr_stype & NRALIAS) 2107 if ( (u.prlc->nr_stype & NRALIAS) 2108 2108 || (pMod->aSegments[iSeg].fFlags & KLDRSEG_FLAG_16BIT)) 2109 2109 iSelector = pMod->aSegments[iSeg].Sel16bit; … … 2242 2242 2243 2243 /* common / simple */ 2244 if ( (u.prlc->nr_stype & NRSRCMASK) == NROFF32 2245 && off >= 0 2244 if ( (u.prlc->nr_stype & NRSRCMASK) == NROFF32 2245 && off >= 0 2246 2246 && off <= OBJPAGELEN - 4) 2247 2247 *(uint32_t *)&pbPage[off] = uValue; 2248 else if ( (u.prlc->nr_stype & NRSRCMASK) == NRSOFF32 2249 && off >= 0 2248 else if ( (u.prlc->nr_stype & NRSRCMASK) == NRSOFF32 2249 && off >= 0 2250 2250 && off <= OBJPAGELEN - 4) 2251 2251 *(uint32_t *)&pbPage[off] = uValue - (PageAddress + off); … … 2321 2321 /** 2322 2322 * Applies the relocation to one 'source' in a page. 2323 * 2324 * This takes care of the more esotic case while the common cases 2323 * 2324 * This takes care of the more esotic case while the common cases 2325 2325 * are dealt with seperately. 2326 2326 * … … 2331 2331 * @param fKind The target kind. 2332 2332 */ 2333 static int kldrModLXDoReloc(uint8_t *pbPage, int off, KLDRADDR PageAddress, const struct r32_rlc *prlc, 2333 static int kldrModLXDoReloc(uint8_t *pbPage, int off, KLDRADDR PageAddress, const struct r32_rlc *prlc, 2334 2334 int iSelector, KLDRADDR uValue, uint32_t fKind) 2335 2335 { 2336 static const uint8_t s_acb[16] = 2336 static const uint8_t s_acb[16] = 2337 2337 { 2338 2338 1, /* 0: NRSBYT */ … … 2340 2340 2, /* 2: NRSSEG - selector */ 2341 2341 4, /* 3: NRSPTR - 16:16 */ 2342 0, 2342 0, 2343 2343 2, /* 5: NRSOFF - 16-bit offset */ 2344 2344 6, /* 6: NRPTR48 - 16:32 */ … … 2348 2348 }; 2349 2349 #pragma pack(1) /* just to be sure */ 2350 union 2350 union 2351 2351 { 2352 2352 uint8_t ab[6]; … … 2354 2354 uint16_t off16; 2355 2355 uint8_t off8; 2356 struct 2356 struct 2357 2357 { 2358 2358 uint16_t off; 2359 2359 uint16_t Sel; 2360 2360 } Far16; 2361 struct 2361 struct 2362 2362 { 2363 2363 uint32_t off; … … 2375 2375 switch (prlc->nr_stype & NRSRCMASK) 2376 2376 { 2377 case NRSBYT: 2377 case NRSBYT: 2378 2378 uData.off8 = (uint8_t)uValue; 2379 2379 cb = 1;
Note:
See TracChangeset
for help on using the changeset viewer.