Changeset 28
- Timestamp:
- Mar 28, 2009, 7:37:20 PM (16 years ago)
- Location:
- trunk/kLdr
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kLdr/kLdrModLX.c
r25 r28 1075 1075 uValue = 0; /** @todo implement enumeration of forwarders properly. */ 1076 1076 fKind = KLDRSYMKIND_FORWARDER; 1077 break; 1078 1079 default: /* shut up gcc. */ 1080 uValue = 0; 1081 fKind = KLDRSYMKIND_NO_BIT | KLDRSYMKIND_NO_TYPE; 1077 1082 break; 1078 1083 } … … 1672 1677 pbSrc += cb1; 1673 1678 1674 if (off > OBJPAGELEN - cbDst)1679 if (off > OBJPAGELEN - (unsigned)cbDst) 1675 1680 return KLDR_ERR_LX_BAD_ITERDATA2; 1676 1681 cbDst -= cb2; … … 1707 1712 1708 1713 pbSrc += 2; 1709 if (off > OBJPAGELEN - cbDst)1714 if (off > OBJPAGELEN - (unsigned)cbDst) 1710 1715 return KLDR_ERR_LX_BAD_ITERDATA2; 1711 1716 cbDst -= cb; … … 1753 1758 pbSrc += cb1; 1754 1759 1755 if (off > OBJPAGELEN - cbDst)1760 if (off > OBJPAGELEN - (unsigned)cbDst) 1756 1761 return KLDR_ERR_LX_BAD_ITERDATA2; 1757 1762 cbDst -= cb2; … … 2408 2413 KLDRMODLX_ASSERT(!"NRRENT"); 2409 2414 default: 2415 iSelector = -1; 2410 2416 break; 2411 2417 } -
trunk/kLdr/kLdrModMachO.c
r25 r28 1080 1080 pSectExtra->RVA = pSect->addr; 1081 1081 pSectExtra->LinkAddress = pSect->addr; 1082 pSectExtra->offFile = pSect->offset ? pSect->offset + pModMachO->offImage : -1; 1082 if (pSect->offset) 1083 pSectExtra->offFile = pSect->offset + pModMachO->offImage; 1084 else 1085 pSectExtra->offFile = -1; 1083 1086 pSectExtra->cFixups = pSect->nreloc; 1084 1087 pSectExtra->paFixups = NULL; 1085 pSectExtra->offFixups = pSect->nreloc ? pSect->reloff + pModMachO->offImage : -1; 1088 if (pSect->nreloc) 1089 pSectExtra->offFixups = pSect->reloff + pModMachO->offImage; 1090 else 1091 pSectExtra->offFixups = -1; 1086 1092 pSectExtra->fFlags = pSect->flags; 1087 1093 pSectExtra->iSegment = pSegExtra - &pModMachO->aSegments[0]; … … 1117 1123 pSeg->Alignment = (1 << pSect->align); 1118 1124 pSeg->LinkAddress = pSect->addr; 1119 pSeg->offFile = pSect->offset ? pSect->offset + pModMachO->offImage : -1; 1120 pSeg->cbFile = pSect->offset ? pSect->size : -1; 1125 if (pSect->offset) 1126 { 1127 pSeg->offFile = pSect->offset + pModMachO->offImage; 1128 pSeg->cbFile = pSect->size; 1129 } 1130 else 1131 { 1132 pSeg->offFile = -1; 1133 pSeg->cbFile = -1; 1134 } 1121 1135 pSeg->RVA = pSect->addr - pModMachO->LinkAddress; 1122 1136 pSeg->cbMapped = 0; … … 1133 1147 { 1134 1148 /* update exiting segment */ 1135 if (pSeg[-1].Alignment < (1 <<pSect->align))1136 pSeg[-1].Alignment = (1 <<pSect->align);1149 if (pSeg[-1].Alignment < K_BIT64(pSect->align)) 1150 pSeg[-1].Alignment = K_BIT64(pSect->align); 1137 1151 if (pSect->addr < pSeg[-1].LinkAddress) 1138 1152 return KLDR_ERR_MACHO_BAD_SECTION; /** @todo move up! */ … … 1141 1155 (yes, we are very very careful here, I know.) */ 1142 1156 if ( pSect->offset 1143 && pSeg[-1].cbFile == pSeg[-1].cb)1157 && (KU64)pSeg[-1].cbFile == pSeg[-1].cb) 1144 1158 { 1145 int fOk = pSeg[-1].offFile + (pSect->addr - pSeg[-1].LinkAddress) == pSect->offset +pModMachO->offImage1159 int fOk = (KU64)pSeg[-1].offFile + (pSect->addr - pSeg[-1].LinkAddress) == pSect->offset + (KU64)pModMachO->offImage 1146 1160 && pSect[-1].offset 1147 && pSeg[-1].offFile + pSeg[-1].cbFile == pSect[-1].offset +pModMachO->offImage + pSect[-1].size;1161 && (KU64)pSeg[-1].offFile + pSeg[-1].cbFile == pSect[-1].offset + (KU64)pModMachO->offImage + pSect[-1].size; 1148 1162 /* more checks? */ 1149 1163 if (fOk) … … 1197 1211 pSectExtra->RVA = pSect->addr; 1198 1212 pSectExtra->LinkAddress = pSect->addr; 1199 pSectExtra->offFile = pSect->offset ? pSect->offset + pModMachO->offImage : -1; 1213 if (pSect->offset) 1214 pSectExtra->offFile = pSect->offset + pModMachO->offImage; 1215 else 1216 pSectExtra->offFile = -1; 1200 1217 pSectExtra->cFixups = pSect->nreloc; 1201 1218 pSectExtra->paFixups = NULL; 1202 pSectExtra->offFixups = pSect->nreloc ? pSect->reloff + pModMachO->offImage : -1; 1219 if (pSect->nreloc) 1220 pSectExtra->offFixups = pSect->reloff + pModMachO->offImage; 1221 else 1222 pSectExtra->offFixups = -1; 1203 1223 pSectExtra->fFlags = pSect->flags; 1204 1224 pSectExtra->iSegment = pSegExtra - &pModMachO->aSegments[0]; … … 1234 1254 pSeg->Alignment = (1 << pSect->align); 1235 1255 pSeg->LinkAddress = pSect->addr; 1236 pSeg->offFile = pSect->offset ? pSect->offset + pModMachO->offImage : -1; 1237 pSeg->cbFile = pSect->offset ? pSect->size : -1; 1256 if (pSect->offset) 1257 { 1258 pSeg->offFile = pSect->offset + pModMachO->offImage; 1259 pSeg->cbFile = pSect->size; 1260 } 1261 else 1262 { 1263 pSeg->offFile = -1; 1264 pSeg->cbFile = -1; 1265 } 1238 1266 pSeg->RVA = pSect->addr - pModMachO->LinkAddress; 1239 1267 pSeg->cbMapped = 0; … … 1250 1278 { 1251 1279 /* update exiting segment */ 1252 if (pSeg[-1].Alignment < (1 <<pSect->align))1253 pSeg[-1].Alignment = (1 <<pSect->align);1280 if (pSeg[-1].Alignment < K_BIT64(pSect->align)) 1281 pSeg[-1].Alignment = K_BIT64(pSect->align); 1254 1282 if (pSect->addr < pSeg[-1].LinkAddress) 1255 1283 return KLDR_ERR_MACHO_BAD_SECTION; /** @todo move up! */ … … 1258 1286 (yes, we are very very careful here, I know.) */ 1259 1287 if ( pSect->offset 1260 && pSeg[-1].cbFile == pSeg[-1].cb)1288 && (KU64)pSeg[-1].cbFile == pSeg[-1].cb) 1261 1289 { 1262 int fOk = pSeg[-1].offFile + (pSect->addr - pSeg[-1].LinkAddress) == pSect->offset +pModMachO->offImage1290 int fOk = (KU64)pSeg[-1].offFile + (pSect->addr - pSeg[-1].LinkAddress) == pSect->offset + (KU64)pModMachO->offImage 1263 1291 && pSect[-1].offset 1264 && pSeg[-1].offFile + pSeg[-1].cbFile == pSect[-1].offset +pModMachO->offImage + pSect[-1].size;1292 && (KU64)pSeg[-1].offFile + pSeg[-1].cbFile == pSect[-1].offset + (KU64)pModMachO->offImage + pSect[-1].size; 1265 1293 /* more checks? */ 1266 1294 if (fOk) … … 2566 2594 KLDRPU uFixVirgin; 2567 2595 KLDRPU uFix; 2568 KLDRADDR SymAddr ;2596 KLDRADDR SymAddr = ~(KLDRADDR)0; 2569 2597 int rc; 2570 2598 -
trunk/kLdr/kLdrModPE.c
r25 r28 1196 1196 rc = pfnCallback(pMod, iDbgInfo, 1197 1197 enmDbgInfoType, pDbgDir->MajorVersion, pDbgDir->MinorVersion, 1198 pDbgDir->PointerToRawData ? pDbgDir->PointerToRawData : -1,1198 pDbgDir->PointerToRawData ? (KLDRFOFF)pDbgDir->PointerToRawData : -1, 1199 1199 pDbgDir->AddressOfRawData ? pDbgDir->AddressOfRawData : NIL_KLDRADDR, 1200 1200 pDbgDir->SizeOfData,
Note:
See TracChangeset
for help on using the changeset viewer.