- Timestamp:
- Aug 31, 2007, 4:16:27 AM (18 years ago)
- Location:
- trunk/kStuff
- Files:
-
- 1 deleted
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kStuff/include/k/kDefs.h
r3554 r3569 252 252 /** @def K_E2E_U16 253 253 * Convert the endian of an unsigned 16-bit value. */ 254 # define K_E2E_U16(u16) ( ( uint16_t) (((u16) >> 8) | ((u16) << 8)) )254 # define K_E2E_U16(u16) ( (KU16) (((u16) >> 8) | ((u16) << 8)) ) 255 255 /** @def K_E2E_U32 256 256 * Convert the endian of an unsigned 32-bit value. */ 257 # define K_E2E_U32(u32) ( ( ((u32) & UINT32_C(0xff000000)) >> 24 ) \258 | ( ((u32) & UINT32_C(0x00ff0000)) >> 8 ) \259 | ( ((u32) & UINT32_C(0x0000ff00)) << 8 ) \260 | ( ((u32) & UINT32_C(0x000000ff)) << 24 ) \257 # define K_E2E_U32(u32) ( ( ((u32) & KU32_C(0xff000000)) >> 24 ) \ 258 | ( ((u32) & KU32_C(0x00ff0000)) >> 8 ) \ 259 | ( ((u32) & KU32_C(0x0000ff00)) << 8 ) \ 260 | ( ((u32) & KU32_C(0x000000ff)) << 24 ) \ 261 261 ) 262 262 /** @def K_E2E_U64 263 263 * Convert the endian of an unsigned 64-bit value. */ 264 # define K_E2E_U64(u64) ( ( ((u64) & UINT64_C(0xff00000000000000)) >> 56 ) \265 | ( ((u64) & UINT64_C(0x00ff000000000000)) >> 40 ) \266 | ( ((u64) & UINT64_C(0x0000ff0000000000)) >> 24 ) \267 | ( ((u64) & UINT64_C(0x000000ff00000000)) >> 8 ) \268 | ( ((u64) & UINT64_C(0x00000000ff000000)) << 8 ) \269 | ( ((u64) & UINT64_C(0x0000000000ff0000)) << 24 ) \270 | ( ((u64) & UINT64_C(0x000000000000ff00)) << 40 ) \271 | ( ((u64) & UINT64_C(0x00000000000000ff)) << 56 ) \264 # define K_E2E_U64(u64) ( ( ((u64) & KU64_C(0xff00000000000000)) >> 56 ) \ 265 | ( ((u64) & KU64_C(0x00ff000000000000)) >> 40 ) \ 266 | ( ((u64) & KU64_C(0x0000ff0000000000)) >> 24 ) \ 267 | ( ((u64) & KU64_C(0x000000ff00000000)) >> 8 ) \ 268 | ( ((u64) & KU64_C(0x00000000ff000000)) << 8 ) \ 269 | ( ((u64) & KU64_C(0x0000000000ff0000)) << 24 ) \ 270 | ( ((u64) & KU64_C(0x000000000000ff00)) << 40 ) \ 271 | ( ((u64) & KU64_C(0x00000000000000ff)) << 56 ) \ 272 272 ) 273 273 -
trunk/kStuff/include/k/kLdrFmts/lx.h
r3568 r3569 13 13 #ifndef IMAGE_OS2_SIGNATURE_LX 14 14 /** LX signature ("LX") */ 15 # define IMAGE_LX_SIGNATURE K LDR_LE2H_U16('L' | ('X' << 8))15 # define IMAGE_LX_SIGNATURE K_LE2H_U16('L' | ('X' << 8)) 16 16 #endif 17 17 -
trunk/kStuff/include/k/kLdrFmts/mach-o.h
r3568 r3569 865 865 typedef struct scattered_relocation_info 866 866 { 867 #if def KLDR_LITTLE_ENDIAN867 #if K_ENDIAN == K_ENDIAN_LITTLE 868 868 KU32 r_address : 24, /**< Section relative address of the fixup. (macho_relocation_info_t::r_address) */ 869 869 r_type : 4, /**< Relocation type; 0 is standard, non-zero are machine specific. (macho_relocation_info_t::r_type) */ … … 871 871 r_pcrel : 1, /**< PC (program counter) relative fixup; subtract the fixup address. (macho_relocation_info_t::r_pcrel) */ 872 872 r_scattered : 1; /**< Set if scattered relocation, clear if normal relocation. */ 873 #elif defined(KLDR_BIG_ENDIAN)873 #elif K_ENDIAN == K_ENDIAN_BIG 874 874 KU32 r_scattered : 1, /**< Set if scattered relocation, clear if normal relocation. */ 875 875 r_pcrel : 1, /**< PC (program counter) relative fixup; subtract the fixup address. (macho_relocation_info_t::r_pcrel) */ … … 878 878 r_address : 24; /**< Section relative address of the fixup. (macho_relocation_info_t::r_address) */ 879 879 #else 880 # error "Neither K LDR_LITTLE_ENDIAN nor KLDR_BIG_ENDIAN is defined!"880 # error "Neither K_ENDIAN isn't LITTLE or BIG!" 881 881 #endif 882 882 KI32 r_value; /**< The value the fixup is refering to (without offset added). */ -
trunk/kStuff/include/k/kLdrFmts/mz.h
r3568 r3569 37 37 38 38 #ifndef IMAGE_DOS_SIGNATURE 39 # define IMAGE_DOS_SIGNATURE K LDR_LE2H_U16('M' | ('Z' << 8))39 # define IMAGE_DOS_SIGNATURE K_LE2H_U16('M' | ('Z' << 8)) 40 40 #endif 41 41 -
trunk/kStuff/include/k/kLdrFmts/pe.h
r3568 r3569 19 19 *******************************************************************************/ 20 20 #ifndef IMAGE_NT_SIGNATURE 21 # define IMAGE_NT_SIGNATURE K LDR_LE2H_U32('P' | ('E' << 8))21 # define IMAGE_NT_SIGNATURE K_LE2H_U32('P' | ('E' << 8)) 22 22 #endif 23 23 -
trunk/kStuff/kLdr/kLdr.h
r3567 r3569 35 35 * Include the base typedefs and macros. 36 36 */ 37 #include "kLdrBase.h" 37 #include <k/kDefs.h> 38 #include <k/kTypes.h> 38 39 39 40 … … 58 59 # define PRI_KLDRADDR "llx" 59 60 #endif 61 62 /** Align a KSIZE value. */ 63 #define KLDR_ALIGN_ADDR(val, align) ( ((val) + ((align) - 1)) & ~(KLDRADDR)((align) - 1) ) 60 64 61 65 -
trunk/kStuff/kLdr/kLdrDyld.c
r3567 r3569 267 267 /** @todo make sense of this default prefix/suffix stuff. */ 268 268 if (pArgs->szDefPrefix[0] != '\0') 269 kLdrHlpMemCopy(kLdrDyldDefPrefix, pArgs->szDefPrefix, K LDR_MIN(sizeof(pArgs->szDefPrefix), sizeof(kLdrDyldDefPrefix)));269 kLdrHlpMemCopy(kLdrDyldDefPrefix, pArgs->szDefPrefix, K_MIN(sizeof(pArgs->szDefPrefix), sizeof(kLdrDyldDefPrefix))); 270 270 if (pArgs->szDefSuffix[0] != '\0') 271 kLdrHlpMemCopy(kLdrDyldDefSuffix, pArgs->szDefSuffix, K LDR_MIN(sizeof(pArgs->szDefSuffix), sizeof(kLdrDyldDefSuffix)));271 kLdrHlpMemCopy(kLdrDyldDefSuffix, pArgs->szDefSuffix, K_MIN(sizeof(pArgs->szDefSuffix), sizeof(kLdrDyldDefSuffix))); 272 272 273 273 /** @todo append that path to the one for the specified search method. */ … … 275 275 /* append path */ 276 276 cbStack = sizeof(kLdrDyldLibraryPath) - kLdrHlpStrLen(kLdrDyldLibraryPath); /* borrow cbStack for a itty bit. */ 277 kLdrHlpMemCopy(kLdrDyldLibraryPath, pArgs->szLibPath, K LDR_MIN(sizeof(pArgs->szLibPath), cbStack));277 kLdrHlpMemCopy(kLdrDyldLibraryPath, pArgs->szLibPath, K_MIN(sizeof(pArgs->szLibPath), cbStack)); 278 278 kLdrDyldLibraryPath[sizeof(kLdrDyldLibraryPath) - 1] = '\0'; 279 279 -
trunk/kStuff/kLdr/kLdrDyldMod.c
r3567 r3569 1157 1157 || StackInfo.cbStack < cbDefOverride) 1158 1158 { 1159 KSIZE cbStack = (KSIZE)K LDR_MAX(StackInfo.cbStack, cbDefOverride);1159 KSIZE cbStack = (KSIZE)K_MAX(StackInfo.cbStack, cbDefOverride); 1160 1160 1161 1161 g_pvkLdrDyldMainStack = kldrDyldOSAllocStack(cbStack); … … 1232 1232 int kldrDyldModGetName(PKLDRDYLDMOD pMod, char *pszName, KSIZE cchName) 1233 1233 { 1234 KSIZE cch = K LDR_MIN(cchName, pMod->pMod->cchName + 1);1234 KSIZE cch = K_MIN(cchName, pMod->pMod->cchName + 1); 1235 1235 if (cch) 1236 1236 { … … 1252 1252 int kldrDyldModGetFilename(PKLDRDYLDMOD pMod, char *pszFilename, KSIZE cchFilename) 1253 1253 { 1254 KSIZE cch = K LDR_MIN(cchFilename, pMod->pMod->cchFilename + 1);1254 KSIZE cch = K_MIN(cchFilename, pMod->pMod->cchFilename + 1); 1255 1255 if (cch) 1256 1256 { -
trunk/kStuff/kLdr/kLdrHlpHeap.c
r3567 r3569 327 327 * Find a fitting free block. 328 328 */ 329 const KSIZE cbReq = K LDR_ALIGN_Z(cb + sizeof(KLDRHEAPBLOCK), KLDRHEAPBLOCK_ALIGNMENT);329 const KSIZE cbReq = K_ALIGN_Z(cb + sizeof(KLDRHEAPBLOCK), KLDRHEAPBLOCK_ALIGNMENT); 330 330 PKLDRHEAPFREE pCur = pHeap->pFreeHead; 331 331 while (pCur) … … 420 420 421 421 /* adjust the requested block size. */ 422 cb = K LDR_ALIGN_Z(cb, KLDRHEAPBLOCK_ALIGNMENT);422 cb = K_ALIGN_Z(cb, KLDRHEAPBLOCK_ALIGNMENT); 423 423 if (!cb) 424 424 cb = KLDRHEAPBLOCK_ALIGNMENT; … … 579 579 { 580 580 cb -= (KUPTR)pv & 31; 581 pv = K LDR_ALIGN_P(pv, KLDRHEAPBLOCK_ALIGNMENT);581 pv = K_ALIGN_P(pv, KLDRHEAPBLOCK_ALIGNMENT); 582 582 } 583 583 cb &= ~(KSIZE)(KLDRHEAPBLOCK_ALIGNMENT - 1); -
trunk/kStuff/kLdr/kLdrHlpMem.c
r3567 r3569 227 227 { 228 228 /* decommit the pages in the stub. */ 229 KSIZE cbStub = K LDR_MIN(g_cbStub - offStub, cb);229 KSIZE cbStub = K_MIN(g_cbStub - offStub, cb); 230 230 rc = DosSetMem(pv, cbStub, PAG_DECOMMIT); 231 231 if (rc) -
trunk/kStuff/kLdr/kLdrInternal.h
r3567 r3569 50 50 * @{ */ 51 51 /** ELF signature ("\x7fELF"). */ 52 #define IMAGE_ELF_SIGNATURE K LDR_LE2H_U32(0x7f | ('E' << 8) | ((KU32)'L' << 16) | ((KU32)'F' << 24))52 #define IMAGE_ELF_SIGNATURE K_LE2H_U32(0x7f | ('E' << 8) | ((KU32)'L' << 16) | ((KU32)'F' << 24)) 53 53 /** PE signature ("PE\0\0"). */ 54 #define IMAGE_NT_SIGNATURE K LDR_LE2H_U32('P' | ('E' << 8))54 #define IMAGE_NT_SIGNATURE K_LE2H_U32('P' | ('E' << 8)) 55 55 /** LX signature ("LX") */ 56 #define IMAGE_LX_SIGNATURE K LDR_LE2H_U16('L' | ('X' << 8))56 #define IMAGE_LX_SIGNATURE K_LE2H_U16('L' | ('X' << 8)) 57 57 /** LE signature ("LE") */ 58 #define IMAGE_LE_SIGNATURE K LDR_LE2H_U16('L' | ('E' << 8))58 #define IMAGE_LE_SIGNATURE K_LE2H_U16('L' | ('E' << 8)) 59 59 /** NE signature ("NE") */ 60 #define IMAGE_NE_SIGNATURE K LDR_LE2H_U16('N' | ('E' << 8))60 #define IMAGE_NE_SIGNATURE K_LE2H_U16('N' | ('E' << 8)) 61 61 /** MZ signature ("MZ"). */ 62 #define IMAGE_DOS_SIGNATURE K LDR_LE2H_U16('M' | ('Z' << 8))62 #define IMAGE_DOS_SIGNATURE K_LE2H_U16('M' | ('Z' << 8)) 63 63 /** The FAT signature (universal binaries). */ 64 64 #define IMAGE_FAT_SIGNATURE KU32_C(0xcafebabe) -
trunk/kStuff/kLdr/kLdrMod.c
r3568 r3569 158 158 && kLdrRdrSize(pRdr) > sizeof(IMAGE_DOS_HEADER)) 159 159 { 160 rc = kLdrRdrRead(pRdr, &u, sizeof(u.u32), K LDR_OFFSETOF(IMAGE_DOS_HEADER, e_lfanew));160 rc = kLdrRdrRead(pRdr, &u, sizeof(u.u32), K_OFFSETOF(IMAGE_DOS_HEADER, e_lfanew)); 161 161 if (rc) 162 162 return rc; -
trunk/kStuff/kLdr/kLdrModLX.c
r3568 r3569 268 268 */ 269 269 cchFilename = kLdrHlpStrLen(kLdrRdrName(pRdr)); 270 cb = K LDR_ALIGN_Z(sizeof(KLDRMODLX), 8)271 + K LDR_ALIGN_Z(KLDR_OFFSETOF(KLDRMOD, aSegments[Hdr.e32_objcnt + 1]), 8)272 + K LDR_ALIGN_Z(cchFilename + 1, 8)270 cb = K_ALIGN_Z(sizeof(KLDRMODLX), 8) 271 + K_ALIGN_Z(K_OFFSETOF(KLDRMOD, aSegments[Hdr.e32_objcnt + 1]), 8) 272 + K_ALIGN_Z(cchFilename + 1, 8) 273 273 + Hdr.e32_ldrsize + 2; /* +2 for two extra zeros. */ 274 274 pModLX = (PKLDRMODLX)kldrHlpAlloc(cb); … … 278 278 279 279 /* KLDRMOD */ 280 pMod = (PKLDRMOD)((KU8 *)pModLX + K LDR_ALIGN_Z(sizeof(KLDRMODLX), 8));280 pMod = (PKLDRMOD)((KU8 *)pModLX + K_ALIGN_Z(sizeof(KLDRMODLX), 8)); 281 281 pMod->pvData = pModLX; 282 282 pMod->pRdr = pRdr; … … 284 284 pMod->cSegments = Hdr.e32_objcnt; 285 285 pMod->cchFilename = cchFilename; 286 pMod->pszFilename = (char *)K LDR_ALIGN_P(&pMod->aSegments[pMod->cSegments], 8);286 pMod->pszFilename = (char *)K_ALIGN_P(&pMod->aSegments[pMod->cSegments], 8); 287 287 kLdrHlpMemCopy((char *)pMod->pszFilename, kLdrRdrName(pRdr), cchFilename + 1); 288 288 pMod->pszName = NULL; /* finalized further down */ … … 337 337 pModLX->Hdr = Hdr; 338 338 339 pModLX->pbLoaderSection = K LDR_ALIGN_P(pMod->pszFilename + pMod->cchFilename + 1, 16);339 pModLX->pbLoaderSection = K_ALIGN_P(pMod->pszFilename + pMod->cchFilename + 1, 16); 340 340 pModLX->pbLoaderSectionLast = pModLX->pbLoaderSection + pModLX->Hdr.e32_ldrsize - 1; 341 341 pModLX->paObjs = NULL; … … 459 459 || (pModLX->paObjs[i].o32_flags & OBJRSRC) 460 460 || (pModLX->paObjs[i + 1].o32_flags & OBJRSRC)) 461 pMod->aSegments[i].cbMapped = K LDR_ALIGN_Z(pModLX->paObjs[i].o32_size, OBJPAGELEN);461 pMod->aSegments[i].cbMapped = K_ALIGN_Z(pModLX->paObjs[i].o32_size, OBJPAGELEN); 462 462 else 463 463 pMod->aSegments[i].cbMapped = pModLX->paObjs[i + 1].o32_base - pModLX->paObjs[i].o32_base; -
trunk/kStuff/kLdr/kLdrModMachO.c
r3568 r3569 299 299 */ 300 300 cchFilename = kLdrHlpStrLen(kLdrRdrName(pRdr)); 301 cb = K LDR_ALIGN_Z( KLDR_OFFSETOF(KLDRMODMACHO, aSegments[cSegments])301 cb = K_ALIGN_Z( K_OFFSETOF(KLDRMODMACHO, aSegments[cSegments]) 302 302 + sizeof(KLDRMODMACHOSECT) * cSections, 16) 303 + K LDR_OFFSETOF(KLDRMOD, aSegments[cSegments])303 + K_OFFSETOF(KLDRMOD, aSegments[cSegments]) 304 304 + cchFilename + 1 305 305 + cbStringPool; … … 311 311 312 312 /* KLDRMOD */ 313 pMod = (PKLDRMOD)((KU8 *)pModMachO + K LDR_ALIGN_Z( KLDR_OFFSETOF(KLDRMODMACHO, aSegments[cSegments])313 pMod = (PKLDRMOD)((KU8 *)pModMachO + K_ALIGN_Z( K_OFFSETOF(KLDRMODMACHO, aSegments[cSegments]) 314 314 + sizeof(KLDRMODMACHOSECT) * cSections, 16)); 315 315 pMod->pvData = pModMachO; … … 470 470 if (fConvertEndian) 471 471 { 472 u.pLoadCmd->cmd = K LDR_E2E_U32(u.pLoadCmd->cmd);473 u.pLoadCmd->cmdsize = K LDR_E2E_U32(u.pLoadCmd->cmdsize);472 u.pLoadCmd->cmd = K_E2E_U32(u.pLoadCmd->cmd); 473 u.pLoadCmd->cmdsize = K_E2E_U32(u.pLoadCmd->cmdsize); 474 474 } 475 475 if (u.pLoadCmd->cmdsize > cbLeft) … … 497 497 if (fConvertEndian) 498 498 { 499 u.pSeg32->vmaddr = K LDR_E2E_U32(u.pSeg32->vmaddr);500 u.pSeg32->vmsize = K LDR_E2E_U32(u.pSeg32->vmsize);501 u.pSeg32->fileoff = K LDR_E2E_U32(u.pSeg32->fileoff);502 u.pSeg32->filesize = K LDR_E2E_U32(u.pSeg32->filesize);503 u.pSeg32->maxprot = K LDR_E2E_U32(u.pSeg32->maxprot);504 u.pSeg32->initprot = K LDR_E2E_U32(u.pSeg32->initprot);505 u.pSeg32->nsects = K LDR_E2E_U32(u.pSeg32->nsects);506 u.pSeg32->flags = K LDR_E2E_U32(u.pSeg32->flags);499 u.pSeg32->vmaddr = K_E2E_U32(u.pSeg32->vmaddr); 500 u.pSeg32->vmsize = K_E2E_U32(u.pSeg32->vmsize); 501 u.pSeg32->fileoff = K_E2E_U32(u.pSeg32->fileoff); 502 u.pSeg32->filesize = K_E2E_U32(u.pSeg32->filesize); 503 u.pSeg32->maxprot = K_E2E_U32(u.pSeg32->maxprot); 504 u.pSeg32->initprot = K_E2E_U32(u.pSeg32->initprot); 505 u.pSeg32->nsects = K_E2E_U32(u.pSeg32->nsects); 506 u.pSeg32->flags = K_E2E_U32(u.pSeg32->flags); 507 507 } 508 508 … … 537 537 if (fConvertEndian) 538 538 { 539 pSect->addr = K LDR_E2E_U32(pSect->addr);540 pSect->size = K LDR_E2E_U32(pSect->size);541 pSect->offset = K LDR_E2E_U32(pSect->offset);542 pSect->align = K LDR_E2E_U32(pSect->align);543 pSect->reloff = K LDR_E2E_U32(pSect->reloff);544 pSect->nreloc = K LDR_E2E_U32(pSect->nreloc);545 pSect->flags = K LDR_E2E_U32(pSect->flags);546 pSect->reserved1 = K LDR_E2E_U32(pSect->reserved1);547 pSect->reserved2 = K LDR_E2E_U32(pSect->reserved2);539 pSect->addr = K_E2E_U32(pSect->addr); 540 pSect->size = K_E2E_U32(pSect->size); 541 pSect->offset = K_E2E_U32(pSect->offset); 542 pSect->align = K_E2E_U32(pSect->align); 543 pSect->reloff = K_E2E_U32(pSect->reloff); 544 pSect->nreloc = K_E2E_U32(pSect->nreloc); 545 pSect->flags = K_E2E_U32(pSect->flags); 546 pSect->reserved1 = K_E2E_U32(pSect->reserved1); 547 pSect->reserved2 = K_E2E_U32(pSect->reserved2); 548 548 } 549 549 … … 659 659 if (fConvertEndian) 660 660 { 661 u.pSymTab->symoff = K LDR_E2E_U32(u.pSymTab->symoff);662 u.pSymTab->nsyms = K LDR_E2E_U32(u.pSymTab->nsyms);663 u.pSymTab->stroff = K LDR_E2E_U32(u.pSymTab->stroff);664 u.pSymTab->strsize = K LDR_E2E_U32(u.pSymTab->strsize);661 u.pSymTab->symoff = K_E2E_U32(u.pSymTab->symoff); 662 u.pSymTab->nsyms = K_E2E_U32(u.pSymTab->nsyms); 663 u.pSymTab->stroff = K_E2E_U32(u.pSymTab->stroff); 664 u.pSymTab->strsize = K_E2E_U32(u.pSymTab->strsize); 665 665 } 666 666 … … 701 701 if (fConvertEndian) 702 702 { 703 pu32[0] = K LDR_E2E_U32(pu32[0]);704 pu32[1] = K LDR_E2E_U32(pu32[1]);703 pu32[0] = K_E2E_U32(pu32[0]); 704 pu32[1] = K_E2E_U32(pu32[1]); 705 705 } 706 706 if (pu32[1] + 2 > cItemsLeft) … … 2167 2167 while (cLeft-- > 0) 2168 2168 { 2169 pSym->n_un.n_strx = K LDR_E2E_U32(pSym->n_un.n_strx);2170 pSym->n_desc = (KI16)K LDR_E2E_U16(pSym->n_desc);2171 pSym->n_value = K LDR_E2E_U32(pSym->n_value);2169 pSym->n_un.n_strx = K_E2E_U32(pSym->n_un.n_strx); 2170 pSym->n_desc = (KI16)K_E2E_U16(pSym->n_desc); 2171 pSym->n_value = K_E2E_U32(pSym->n_value); 2172 2172 pSym++; 2173 2173 } … … 2179 2179 while (cLeft-- > 0) 2180 2180 { 2181 pSym->n_un.n_strx = K LDR_E2E_U32(pSym->n_un.n_strx);2182 pSym->n_desc = (KI16)K LDR_E2E_U16(pSym->n_desc);2183 pSym->n_value = K LDR_E2E_U64(pSym->n_value);2181 pSym->n_un.n_strx = K_E2E_U32(pSym->n_un.n_strx); 2182 pSym->n_desc = (KI16)K_E2E_U16(pSym->n_desc); 2183 pSym->n_value = K_E2E_U64(pSym->n_value); 2184 2184 pSym++; 2185 2185 } … … 2238 2238 { 2239 2239 KU32 *pu32 = (KU32 *)&paFixups[iFixup]; 2240 pu32[0] = K LDR_E2E_U32(pu32[0]);2241 pu32[1] = K LDR_E2E_U32(pu32[1]);2240 pu32[0] = K_E2E_U32(pu32[0]); 2241 pu32[1] = K_E2E_U32(pu32[1]); 2242 2242 } 2243 2243 } -
trunk/kStuff/kLdr/kLdrModNative.c
r3567 r3569 301 301 */ 302 302 cchFilename = kLdrHlpStrLen(szFilename); 303 cb = K LDR_ALIGN_Z(sizeof(KLDRMODNATIVE), 16)304 + K LDR_OFFSETOF(KLDRMOD, aSegments[cSegments])303 cb = K_ALIGN_Z(sizeof(KLDRMODNATIVE), 16) 304 + K_OFFSETOF(KLDRMOD, aSegments[cSegments]) 305 305 + cchFilename + 1; 306 306 pModNative = (PKLDRMODNATIVE)kldrHlpAlloc(cb); … … 309 309 310 310 /* KLDRMOD */ 311 pMod = (PKLDRMOD)((KU8 *)pModNative + K LDR_ALIGN_Z(sizeof(KLDRMODNATIVE), 16));311 pMod = (PKLDRMOD)((KU8 *)pModNative + K_ALIGN_Z(sizeof(KLDRMODNATIVE), 16)); 312 312 pMod->pvData = pModNative; 313 313 pMod->pRdr = NULL; -
trunk/kStuff/kLdr/kLdrModPE.c
r3568 r3569 201 201 */ 202 202 cchFilename = kLdrHlpStrLen(kLdrRdrName(pRdr)); 203 cb = K LDR_ALIGN_Z(KLDR_OFFSETOF(KLDRMODPE, aShdrs[s.FileHdr.NumberOfSections]), 16)204 + K LDR_OFFSETOF(KLDRMOD, aSegments[s.FileHdr.NumberOfSections + 1])203 cb = K_ALIGN_Z(K_OFFSETOF(KLDRMODPE, aShdrs[s.FileHdr.NumberOfSections]), 16) 204 + K_OFFSETOF(KLDRMOD, aSegments[s.FileHdr.NumberOfSections + 1]) 205 205 + cchFilename + 1; 206 206 pModPE = (PKLDRMODPE)kldrHlpAlloc(cb); … … 210 210 211 211 /* KLDRMOD */ 212 pMod = (PKLDRMOD)((KU8 *)pModPE + K LDR_ALIGN_Z(KLDR_OFFSETOF(KLDRMODPE, aShdrs[s.FileHdr.NumberOfSections]), 16));212 pMod = (PKLDRMOD)((KU8 *)pModPE + K_ALIGN_Z(K_OFFSETOF(KLDRMODPE, aShdrs[s.FileHdr.NumberOfSections]), 16)); 213 213 pMod->pvData = pModPE; 214 214 pMod->pRdr = pRdr; … … 723 723 */ 724 724 iExpOrd = iSymbol - pExpDir->Base; 725 if (iExpOrd >= K LDR_MAX(pExpDir->NumberOfNames, pExpDir->NumberOfFunctions))725 if (iExpOrd >= K_MAX(pExpDir->NumberOfNames, pExpDir->NumberOfFunctions)) 726 726 return KLDR_ERR_SYMBOL_NOT_FOUND; 727 727 } … … 1403 1403 u; 1404 1404 const KU16 *poffFixup = (const KU16 *)(pBR + 1); 1405 const KU32 cbBlock = K LDR_MIN(cbLeft, pBR->SizeOfBlock) - sizeof(IMAGE_BASE_RELOCATION); /* more caution... */1405 const KU32 cbBlock = K_MIN(cbLeft, pBR->SizeOfBlock) - sizeof(IMAGE_BASE_RELOCATION); /* more caution... */ 1406 1406 KU32 cFixups = cbBlock / sizeof(poffFixup[0]); 1407 1407 uChunk.pu8 = KLDRMODPE_RVA2TYPE(pvMapping, pBR->VirtualAddress, KU8 *); -
trunk/kStuff/kLdr/kLdrRdrFile.c
r3567 r3569 544 544 KU32 i; 545 545 546 if (pRdrFile->cPreps >= K LDR_ELEMENTS(pRdrFile->aPreps))546 if (pRdrFile->cPreps >= K_ELEMENTS(pRdrFile->aPreps)) 547 547 return KLDR_ERR_TOO_MANY_MAPPINGS; 548 548
Note:
See TracChangeset
for help on using the changeset viewer.