backend/rv64: Adjust how relocations are stored
This commit is contained in:
parent
c90c4d48d2
commit
c47dacb1de
2 changed files with 9 additions and 3 deletions
|
@ -26,7 +26,7 @@ EmittedBlockInfo EmitRV64(biscuit::Assembler& as, [[maybe_unused]] IR::Block blo
|
||||||
as.SW(a0, offsetof(A32JitState, regs) + 15 * sizeof(u32), a1);
|
as.SW(a0, offsetof(A32JitState, regs) + 15 * sizeof(u32), a1);
|
||||||
|
|
||||||
ptrdiff_t offset = reinterpret_cast<CodePtr>(as.GetCursorPointer()) - ebi.entry_point;
|
ptrdiff_t offset = reinterpret_cast<CodePtr>(as.GetCursorPointer()) - ebi.entry_point;
|
||||||
ebi.relocations[offset] = LinkTarget::ReturnFromRunCode;
|
ebi.relocations.emplace_back(Relocation{offset, LinkTarget::ReturnFromRunCode});
|
||||||
as.NOP();
|
as.NOP();
|
||||||
|
|
||||||
ebi.size = reinterpret_cast<CodePtr>(as.GetCursorPointer()) - ebi.entry_point;
|
ebi.size = reinterpret_cast<CodePtr>(as.GetCursorPointer()) - ebi.entry_point;
|
||||||
|
|
|
@ -5,8 +5,9 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
#include <mcl/stdint.hpp>
|
#include <mcl/stdint.hpp>
|
||||||
#include <tsl/robin_map.h>
|
|
||||||
|
|
||||||
namespace biscuit {
|
namespace biscuit {
|
||||||
class Assembler;
|
class Assembler;
|
||||||
|
@ -24,10 +25,15 @@ enum class LinkTarget {
|
||||||
ReturnFromRunCode,
|
ReturnFromRunCode,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct Relocation {
|
||||||
|
std::ptrdiff_t code_offset;
|
||||||
|
LinkTarget target;
|
||||||
|
};
|
||||||
|
|
||||||
struct EmittedBlockInfo {
|
struct EmittedBlockInfo {
|
||||||
CodePtr entry_point;
|
CodePtr entry_point;
|
||||||
size_t size;
|
size_t size;
|
||||||
tsl::robin_map<std::ptrdiff_t, LinkTarget> relocations;
|
std::vector<Relocation> relocations;
|
||||||
};
|
};
|
||||||
|
|
||||||
EmittedBlockInfo EmitRV64(biscuit::Assembler& as, IR::Block block);
|
EmittedBlockInfo EmitRV64(biscuit::Assembler& as, IR::Block block);
|
||||||
|
|
Loading…
Reference in a new issue