This commit is contained in:
John Reiser 2008-02-26 12:17:21 -08:00
commit 9f05a873bc
2 changed files with 9 additions and 9 deletions

View File

@ -126,7 +126,7 @@ int PackVmlinuzI386::readFileHeader()
static int is_pow2(unsigned const x)
{
return !(x & (-1+ x));
return !(x & (x - 1));
}
// read full kernel into obuf[], gzip-decompress into ibuf[],
@ -169,7 +169,7 @@ int PackVmlinuzI386::decompressKernel()
&& 0==memcmp("\x89\xeb", 12+ p, 2) // movl %ebp,%ebx
&& 0==memcmp("\x81\xc3", 14+ p, 2) // addl $imm.w,%ebx
&& 0==memcmp("\x81\xe3", 20+ p, 2) // andl $imm.w,%ebx
&& is_pow2(cpa_0) && -cpa_0==cpa_1) {
&& is_pow2(cpa_0) && (0u-cpa_0)==cpa_1) {
base = (5+ p) - get_te32(8+ p);
config_physical_align = cpa_0;
}
@ -189,7 +189,7 @@ int PackVmlinuzI386::decompressKernel()
for (int j= 0; j < 0x200; ++j, ++p) {
if (0==memcmp("\x01\x9c\x0b", p, 3) // addl %ebx,d32(%ebx,%ecx)
) {
page_offset = - get_te32(3+ p);
page_offset = 0u - get_te32(3+ p);
}
if (0==memcmp("\x89\xeb", p, 2) // movl %ebp,%ebx
&& 0==memcmp("\x81\xeb", 2+ p, 2) // subl $imm32,%ebx
@ -454,10 +454,10 @@ void PackBvmlinuzI386::buildLoader(const Filter *ft)
linker->defineSymbol("compressed_length", c_len);
linker->defineSymbol("load_physical_address", physical_start); // FIXME
if (0!=config_physical_align) {
linker->defineSymbol("neg_config_physical_align", - config_physical_align);
linker->defineSymbol("neg_config_physical_align", 0u - config_physical_align);
}
linker->defineSymbol("neg_length_mov", - ALIGN_UP(c_len + l_len, 4u));
linker->defineSymbol("neg_page_offset", - page_offset);
linker->defineSymbol("neg_length_mov", 0u - ALIGN_UP(c_len + l_len, 4u));
linker->defineSymbol("neg_page_offset", 0u - page_offset);
//linker->defineSymbol("physical_start", physical_start);
linker->defineSymbol("unc_length", ph.u_len);
linker->defineSymbol("dec_offset", ph.overlap_overhead + e_len);

View File

@ -821,7 +821,7 @@ ifeq (1,1)
# info: we really need as-2.17 here
$(call tc,pp-as) -D_TARGET_LINUX_ $< -o - | $(RTRIM) > tmp/$T.i
$(call tc,as) tmp/$T.i -o tmp/$T.bin
$(call tc,gpp_mkdep) --mode=c --MMD=$@ $< --MF=tmp/$T.d
$(call tc,gpp_mkdep) --mode=c --MMD=$@ --MF=tmp/$T.d $<
else
# info: as-2.16.1 as used by gcc-4.1.1 does _not_ work
$(call tc,gcc) -c -D_TARGET_LINUX_ -Wa,-O,-mno-pdr $< -o tmp/$T.bin
@ -860,7 +860,7 @@ ifeq (1,1)
# info: we really need as-2.17 here
$(call tc,pp-as) -D_TARGET_LINUX_ $< -o - | $(RTRIM) > tmp/$T.i
$(call tc,as) tmp/$T.i -o tmp/$T.bin
$(call tc,gpp_mkdep) --mode=c --MMD=$@ $< --MF=tmp/$T.d
$(call tc,gpp_mkdep) --mode=c --MMD=$@ --MF=tmp/$T.d $<
else
# info: as-2.16.1 as used by gcc-4.1.1 does _not_ work
$(call tc,gcc) -c -D_TARGET_LINUX_ -Wa,-O,-mno-pdr $< -o tmp/$T.bin
@ -905,7 +905,7 @@ ifeq (1,1)
# info: we really need as-2.17 here
$(call tc,pp-as) -DPS1 $< -o - | $(RTRIM) > tmp/$T.i
$(call tc,as) tmp/$T.i -o tmp/$T.bin
$(call tc,gpp_mkdep) --mode=c --MMD=$@ $< --MF=tmp/$T.d
$(call tc,gpp_mkdep) --mode=c --MMD=$@ --MF=tmp/$T.d $<
else
# info: as-2.16.1 as used by gcc-4.1.1 does _not_ work
$(call tc,gcc) -c -DPS1 -Wa,-O,-mno-pdr $< -o tmp/$T.bin