fix powerpc bootimage build

This commit is contained in:
Joel Dice 2009-03-09 18:52:09 -06:00
parent c11203b401
commit 6c271ac994
5 changed files with 41 additions and 8 deletions

View File

@ -449,7 +449,7 @@ $(bootimage-bin): $(bootimage-generator)
$(bootimage-object): $(bootimage-bin) $(binaryToMacho) $(bootimage-object): $(bootimage-bin) $(binaryToMacho)
@echo "creating $(@)" @echo "creating $(@)"
ifeq ($(platform),darwin) ifeq ($(platform),darwin)
$(binaryToMacho) $(<) __BOOT __boot \ $(binaryToMacho) $(asm) $(<) __BOOT __boot \
__binary_bootimage_bin_start __binary_bootimage_bin_end > $(@) __binary_bootimage_bin_start __binary_bootimage_bin_end > $(@)
else else
(wd=$$(pwd); \ (wd=$$(pwd); \

View File

@ -277,6 +277,9 @@ class Assembler {
virtual void updateCall(UnaryOperation op, bool assertAlignment, virtual void updateCall(UnaryOperation op, bool assertAlignment,
void* returnAddress, void* newTarget) = 0; void* returnAddress, void* newTarget) = 0;
virtual uintptr_t getConstant(const void* src) = 0;
virtual void setConstant(void* dst, uintptr_t constant) = 0;
virtual unsigned alignFrameSize(unsigned sizeInWords) = 0; virtual unsigned alignFrameSize(unsigned sizeInWords) = 0;
virtual void* frameIp(void* stack) = 0; virtual void* frameIp(void* stack) = 0;

View File

@ -27,7 +27,7 @@ vmCall();
namespace { namespace {
const bool DebugCompile = true; const bool DebugCompile = false;
const bool DebugNatives = false; const bool DebugNatives = false;
const bool DebugCallTable = false; const bool DebugCallTable = false;
const bool DebugMethodTree = false; const bool DebugMethodTree = false;
@ -5627,28 +5627,33 @@ fixupHeap(MyThread* t UNUSED, uintptr_t* map, unsigned size, uintptr_t* heap)
} }
void void
fixupCode(Thread*, uintptr_t* map, unsigned size, uint8_t* code, fixupCode(Thread* t, uintptr_t* map, unsigned size, uint8_t* code,
uintptr_t* heap) uintptr_t* heap)
{ {
Assembler::Architecture* arch = makeArchitecture(t->m->system);
arch->acquire();
for (unsigned word = 0; word < size; ++word) { for (unsigned word = 0; word < size; ++word) {
uintptr_t w = map[word]; uintptr_t w = map[word];
if (w) { if (w) {
for (unsigned bit = 0; bit < BitsPerWord; ++bit) { for (unsigned bit = 0; bit < BitsPerWord; ++bit) {
if (w & (static_cast<uintptr_t>(1) << bit)) { if (w & (static_cast<uintptr_t>(1) << bit)) {
unsigned index = indexOf(word, bit); unsigned index = indexOf(word, bit);
uintptr_t v; memcpy(&v, code + index, BytesPerWord); uintptr_t v = arch->getConstant(code + index);
uintptr_t mark = v >> BootShift; uintptr_t mark = v >> BootShift;
if (mark) { if (mark) {
v = reinterpret_cast<uintptr_t>(code + (v & BootMask)); arch->setConstant(code + index, reinterpret_cast<uintptr_t>
memcpy(code + index, &v, BytesPerWord); (code + (v & BootMask)));
} else { } else {
v = reinterpret_cast<uintptr_t>(heap + v - 1); arch->setConstant(code + index, reinterpret_cast<uintptr_t>
memcpy(code + index, &v, BytesPerWord); (heap + v - 1));
} }
} }
} }
} }
} }
arch->release();
} }
void void

View File

@ -1690,10 +1690,25 @@ class MyArchitecture: public Assembler::Architecture {
reinterpret_cast<intptr_t>(newTarget)); reinterpret_cast<intptr_t>(newTarget));
} break; } break;
case LongCall:
case LongJump: {
updateImmediate(c.s, static_cast<uint8_t*>(returnAddress) - 12,
reinterpret_cast<intptr_t>(newTarget), BytesPerWord);
} break;
default: abort(&c); default: abort(&c);
} }
} }
virtual uintptr_t getConstant(const void* src) {
const int32_t* p = static_cast<const int32_t*>(src);
return (p[0] << 16) | (p[1] & 0xFFFF);
}
virtual void setConstant(void* dst, uintptr_t constant) {
updateImmediate(c.s, dst, constant, BytesPerWord);
}
virtual unsigned alignFrameSize(unsigned sizeInWords) { virtual unsigned alignFrameSize(unsigned sizeInWords) {
const unsigned alignment = 16 / BytesPerWord; const unsigned alignment = 16 / BytesPerWord;
return (ceiling(sizeInWords + FrameFooterSize, alignment) * alignment); return (ceiling(sizeInWords + FrameFooterSize, alignment) * alignment);

View File

@ -2085,6 +2085,16 @@ class MyArchitecture: public Assembler::Architecture {
} }
} }
virtual uintptr_t getConstant(const void* src) {
uintptr_t v;
memcpy(&v, src, BytesPerWord);
return v;
}
virtual void setConstant(void* dst, uintptr_t constant) {
memcpy(dst, &constant, BytesPerWord);
}
virtual unsigned alignFrameSize(unsigned sizeInWords) { virtual unsigned alignFrameSize(unsigned sizeInWords) {
const unsigned alignment = 16 / BytesPerWord; const unsigned alignment = 16 / BytesPerWord;
return (ceiling(sizeInWords + FrameHeaderSize, alignment) * alignment) return (ceiling(sizeInWords + FrameHeaderSize, alignment) * alignment)