mirror of
https://github.com/corda/corda.git
synced 2025-01-07 13:38:47 +00:00
fix x86->powerpc boot image cross build
This fixes the remaining cross-endian translation issues needed to build powerpc boot images on x86.
This commit is contained in:
parent
e6c780e4e8
commit
3fa4a7001d
@ -1783,6 +1783,10 @@ class MyArchitecture: public Assembler::Architecture {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual int scratch() {
|
||||||
|
return 5;
|
||||||
|
}
|
||||||
|
|
||||||
virtual int stack() {
|
virtual int stack() {
|
||||||
return StackRegister;
|
return StackRegister;
|
||||||
}
|
}
|
||||||
|
@ -329,6 +329,7 @@ class Assembler {
|
|||||||
virtual uint32_t generalRegisterMask() = 0;
|
virtual uint32_t generalRegisterMask() = 0;
|
||||||
virtual uint32_t floatRegisterMask() = 0;
|
virtual uint32_t floatRegisterMask() = 0;
|
||||||
|
|
||||||
|
virtual int scratch() = 0;
|
||||||
virtual int stack() = 0;
|
virtual int stack() = 0;
|
||||||
virtual int thread() = 0;
|
virtual int thread() = 0;
|
||||||
virtual int returnLow() = 0;
|
virtual int returnLow() = 0;
|
||||||
|
@ -672,7 +672,7 @@ makeCodeImage(Thread* t, Zone* zone, BootImage* image, uint8_t* code,
|
|||||||
expect(t, value >= code);
|
expect(t, value >= code);
|
||||||
|
|
||||||
addresses->listener->resolve
|
addresses->listener->resolve
|
||||||
(targetVW(static_cast<target_intptr_t>(value - code)), 0);
|
(static_cast<target_intptr_t>(value - code), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (; methods; methods = pairSecond(t, methods)) {
|
for (; methods; methods = pairSecond(t, methods)) {
|
||||||
@ -987,7 +987,7 @@ copy(Thread* t, object typeMaps, object p, uint8_t* dst)
|
|||||||
if (field->type == Type_object) {
|
if (field->type == Type_object) {
|
||||||
unsigned offset = field->targetOffset / TargetBytesPerWord;
|
unsigned offset = field->targetOffset / TargetBytesPerWord;
|
||||||
reinterpret_cast<uint32_t*>(mask)[offset / 32]
|
reinterpret_cast<uint32_t*>(mask)[offset / 32]
|
||||||
|= static_cast<uint32_t>(1) << (offset % 32);
|
|= targetV4(static_cast<uint32_t>(1) << (offset % 32));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1027,14 +1027,15 @@ copy(Thread* t, object typeMaps, object p, uint8_t* dst)
|
|||||||
switch (field->type) {
|
switch (field->type) {
|
||||||
case Type_object:
|
case Type_object:
|
||||||
reinterpret_cast<uint32_t*>(objectMask)[i / 32]
|
reinterpret_cast<uint32_t*>(objectMask)[i / 32]
|
||||||
|= static_cast<uint32_t>(1) << (i % 32);
|
|= targetV4(static_cast<uint32_t>(1) << (i % 32));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Type_float:
|
case Type_float:
|
||||||
case Type_double:
|
case Type_double:
|
||||||
reinterpret_cast<target_uintptr_t*>(poolMask)
|
reinterpret_cast<target_uintptr_t*>(poolMask)
|
||||||
[i / TargetBitsPerWord]
|
[i / TargetBitsPerWord]
|
||||||
|= static_cast<target_uintptr_t>(1) << (i % TargetBitsPerWord);
|
|= targetVW
|
||||||
|
(static_cast<target_uintptr_t>(1) << (i % TargetBitsPerWord));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -1083,7 +1084,7 @@ copy(Thread* t, object typeMaps, object referer, unsigned refererOffset,
|
|||||||
if (field->type == Type_object) {
|
if (field->type == Type_object) {
|
||||||
unsigned offset = field->targetOffset / TargetBytesPerWord;
|
unsigned offset = field->targetOffset / TargetBytesPerWord;
|
||||||
reinterpret_cast<uint32_t*>(dst + (TargetBytesPerWord * 2))
|
reinterpret_cast<uint32_t*>(dst + (TargetBytesPerWord * 2))
|
||||||
[offset / 32] |= static_cast<uint32_t>(1) << (offset % 32);
|
[offset / 32] |= targetV4(static_cast<uint32_t>(1) << (offset % 32));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1092,7 +1093,7 @@ copy(Thread* t, object typeMaps, object referer, unsigned refererOffset,
|
|||||||
{
|
{
|
||||||
unsigned offset = map->targetFixedSizeInWords;
|
unsigned offset = map->targetFixedSizeInWords;
|
||||||
reinterpret_cast<uint32_t*>(dst + (TargetBytesPerWord * 2))
|
reinterpret_cast<uint32_t*>(dst + (TargetBytesPerWord * 2))
|
||||||
[offset / 32] |= static_cast<uint32_t>(1) << (offset % 32);
|
[offset / 32] |= targetV4(static_cast<uint32_t>(1) << (offset % 32));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
copy(t, typeMaps, p, dst);
|
copy(t, typeMaps, p, dst);
|
||||||
|
@ -8347,8 +8347,14 @@ class MyProcessor: public Processor {
|
|||||||
#define THUNK(s) thunkTable[s##Index] = voidPointer(s);
|
#define THUNK(s) thunkTable[s##Index] = voidPointer(s);
|
||||||
#include "thunks.cpp"
|
#include "thunks.cpp"
|
||||||
#undef THUNK
|
#undef THUNK
|
||||||
|
// Set the dummyIndex entry to a constant which should require the
|
||||||
|
// maximum number of bytes to represent in assembly code
|
||||||
|
// (i.e. can't be represented by a smaller number of bytes and
|
||||||
|
// implicitly sign- or zero-extended). We'll use this property
|
||||||
|
// later to determine the maximum size of a thunk in the thunk
|
||||||
|
// table.
|
||||||
thunkTable[dummyIndex] = reinterpret_cast<void*>
|
thunkTable[dummyIndex] = reinterpret_cast<void*>
|
||||||
(~static_cast<uintptr_t>(0));
|
(static_cast<uintptr_t>(UINT64_C(0x5555555555555555)));
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Thread*
|
virtual Thread*
|
||||||
@ -9396,10 +9402,7 @@ compileCall(MyThread* t, Context* c, ThunkIndex index, bool call = true)
|
|||||||
|
|
||||||
if (processor(t)->bootImage) {
|
if (processor(t)->bootImage) {
|
||||||
Assembler::Memory table(t->arch->thread(), TargetThreadThunkTable);
|
Assembler::Memory table(t->arch->thread(), TargetThreadThunkTable);
|
||||||
// use Architecture::virtualCallTarget register here as a scratch
|
Assembler::Register scratch(t->arch->scratch());
|
||||||
// register; any register that isn't used to pass arguments would
|
|
||||||
// be acceptable:
|
|
||||||
Assembler::Register scratch(t->arch->virtualCallTarget());
|
|
||||||
a->apply(Move, TargetBytesPerWord, MemoryOperand, &table,
|
a->apply(Move, TargetBytesPerWord, MemoryOperand, &table,
|
||||||
TargetBytesPerWord, RegisterOperand, &scratch);
|
TargetBytesPerWord, RegisterOperand, &scratch);
|
||||||
Assembler::Memory proc(scratch.low, index * TargetBytesPerWord);
|
Assembler::Memory proc(scratch.low, index * TargetBytesPerWord);
|
||||||
|
@ -6953,14 +6953,14 @@ class MyCompiler: public Compiler {
|
|||||||
(c.machineCode + pad(c.machineCodeSize, TargetBytesPerWord) + i);
|
(c.machineCode + pad(c.machineCodeSize, TargetBytesPerWord) + i);
|
||||||
|
|
||||||
if (n->promise->resolved()) {
|
if (n->promise->resolved()) {
|
||||||
*target = n->promise->value();
|
*target = targetVW(n->promise->value());
|
||||||
} else {
|
} else {
|
||||||
class Listener: public Promise::Listener {
|
class Listener: public Promise::Listener {
|
||||||
public:
|
public:
|
||||||
Listener(target_intptr_t* target): target(target){ }
|
Listener(target_intptr_t* target): target(target){ }
|
||||||
|
|
||||||
virtual bool resolve(int64_t value, void** location) {
|
virtual bool resolve(int64_t value, void** location) {
|
||||||
*target = value;
|
*target = targetVW(value);
|
||||||
if (location) *location = target;
|
if (location) *location = target;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -789,14 +789,14 @@ updateImmediate(System* s, void* dst, int32_t src, unsigned size, bool address)
|
|||||||
switch (size) {
|
switch (size) {
|
||||||
case 4: {
|
case 4: {
|
||||||
int32_t* p = static_cast<int32_t*>(dst);
|
int32_t* p = static_cast<int32_t*>(dst);
|
||||||
int r = (p[1] >> 21) & 31;
|
int r = (targetV4(p[1]) >> 21) & 31;
|
||||||
|
|
||||||
if (address) {
|
if (address) {
|
||||||
p[0] = lis(r, ha16(src));
|
p[0] = targetV4(lis(r, ha16(src)));
|
||||||
p[1] |= (src & 0xFFFF);
|
p[1] |= targetV4(src & 0xFFFF);
|
||||||
} else {
|
} else {
|
||||||
p[0] = lis(r, src >> 16);
|
p[0] = targetV4(lis(r, src >> 16));
|
||||||
p[1] = ori(r, r, src);
|
p[1] = targetV4(ori(r, r, src));
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
@ -2076,6 +2076,10 @@ class MyArchitecture: public Assembler::Architecture {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual int scratch() {
|
||||||
|
return 31;
|
||||||
|
}
|
||||||
|
|
||||||
virtual int stack() {
|
virtual int stack() {
|
||||||
return StackRegister;
|
return StackRegister;
|
||||||
}
|
}
|
||||||
|
@ -2763,6 +2763,10 @@ class MyArchitecture: public Assembler::Architecture {
|
|||||||
return useSSE(&c) ? FloatRegisterMask : 0;
|
return useSSE(&c) ? FloatRegisterMask : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual int scratch() {
|
||||||
|
return rax;
|
||||||
|
}
|
||||||
|
|
||||||
virtual int stack() {
|
virtual int stack() {
|
||||||
return rsp;
|
return rsp;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user