mirror of
https://github.com/corda/corda.git
synced 2025-01-04 04:04:27 +00:00
fix powerpc bootimage build
This commit is contained in:
parent
c11203b401
commit
6c271ac994
2
makefile
2
makefile
@ -449,7 +449,7 @@ $(bootimage-bin): $(bootimage-generator)
|
||||
$(bootimage-object): $(bootimage-bin) $(binaryToMacho)
|
||||
@echo "creating $(@)"
|
||||
ifeq ($(platform),darwin)
|
||||
$(binaryToMacho) $(<) __BOOT __boot \
|
||||
$(binaryToMacho) $(asm) $(<) __BOOT __boot \
|
||||
__binary_bootimage_bin_start __binary_bootimage_bin_end > $(@)
|
||||
else
|
||||
(wd=$$(pwd); \
|
||||
|
@ -277,6 +277,9 @@ class Assembler {
|
||||
virtual void updateCall(UnaryOperation op, bool assertAlignment,
|
||||
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 void* frameIp(void* stack) = 0;
|
||||
|
@ -27,7 +27,7 @@ vmCall();
|
||||
|
||||
namespace {
|
||||
|
||||
const bool DebugCompile = true;
|
||||
const bool DebugCompile = false;
|
||||
const bool DebugNatives = false;
|
||||
const bool DebugCallTable = false;
|
||||
const bool DebugMethodTree = false;
|
||||
@ -5627,28 +5627,33 @@ fixupHeap(MyThread* t UNUSED, uintptr_t* map, unsigned size, uintptr_t* heap)
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
Assembler::Architecture* arch = makeArchitecture(t->m->system);
|
||||
arch->acquire();
|
||||
|
||||
for (unsigned word = 0; word < size; ++word) {
|
||||
uintptr_t w = map[word];
|
||||
if (w) {
|
||||
for (unsigned bit = 0; bit < BitsPerWord; ++bit) {
|
||||
if (w & (static_cast<uintptr_t>(1) << 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;
|
||||
if (mark) {
|
||||
v = reinterpret_cast<uintptr_t>(code + (v & BootMask));
|
||||
memcpy(code + index, &v, BytesPerWord);
|
||||
arch->setConstant(code + index, reinterpret_cast<uintptr_t>
|
||||
(code + (v & BootMask)));
|
||||
} else {
|
||||
v = reinterpret_cast<uintptr_t>(heap + v - 1);
|
||||
memcpy(code + index, &v, BytesPerWord);
|
||||
arch->setConstant(code + index, reinterpret_cast<uintptr_t>
|
||||
(heap + v - 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
arch->release();
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1690,10 +1690,25 @@ class MyArchitecture: public Assembler::Architecture {
|
||||
reinterpret_cast<intptr_t>(newTarget));
|
||||
} break;
|
||||
|
||||
case LongCall:
|
||||
case LongJump: {
|
||||
updateImmediate(c.s, static_cast<uint8_t*>(returnAddress) - 12,
|
||||
reinterpret_cast<intptr_t>(newTarget), BytesPerWord);
|
||||
} break;
|
||||
|
||||
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) {
|
||||
const unsigned alignment = 16 / BytesPerWord;
|
||||
return (ceiling(sizeInWords + FrameFooterSize, alignment) * alignment);
|
||||
|
10
src/x86.cpp
10
src/x86.cpp
@ -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) {
|
||||
const unsigned alignment = 16 / BytesPerWord;
|
||||
return (ceiling(sizeInWords + FrameHeaderSize, alignment) * alignment)
|
||||
|
Loading…
Reference in New Issue
Block a user