Commit 2ba7fae2 authored by Richard Henderson's avatar Richard Henderson
Browse files

tcg: Change relocation offsets to intptr_t

parent 2f2f244d
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -88,7 +88,7 @@ static inline void reloc_pc19(void *code_ptr, tcg_target_long target)
}

static inline void patch_reloc(uint8_t *code_ptr, int type,
                               tcg_target_long value, tcg_target_long addend)
                               intptr_t value, intptr_t addend)
{
    value += addend;

+4 −4
Original line number Diff line number Diff line
@@ -108,21 +108,21 @@ static const int tcg_target_call_oarg_regs[2] = {

#define TCG_REG_TMP  TCG_REG_R12

static inline void reloc_abs32(void *code_ptr, tcg_target_long target)
static inline void reloc_abs32(void *code_ptr, intptr_t target)
{
    *(uint32_t *) code_ptr = target;
}

static inline void reloc_pc24(void *code_ptr, tcg_target_long target)
static inline void reloc_pc24(void *code_ptr, intptr_t target)
{
    uint32_t offset = ((target - ((tcg_target_long) code_ptr + 8)) >> 2);
    uint32_t offset = ((target - ((intptr_t)code_ptr + 8)) >> 2);

    *(uint32_t *) code_ptr = ((*(uint32_t *) code_ptr) & ~0xffffff)
                             | (offset & 0xffffff);
}

static void patch_reloc(uint8_t *code_ptr, int type,
                tcg_target_long value, tcg_target_long addend)
                        intptr_t value, intptr_t addend)
{
    switch (type) {
    case R_ARM_ABS32:
+3 −3
Original line number Diff line number Diff line
@@ -149,14 +149,14 @@ static int reassemble_21(int as21)
#define R_PARISC_PCREL12F  R_PARISC_NONE

static void patch_reloc(uint8_t *code_ptr, int type,
                        tcg_target_long value, tcg_target_long addend)
                        intptr_t value, intptr_t addend)
{
    uint32_t *insn_ptr = (uint32_t *)code_ptr;
    uint32_t insn = *insn_ptr;
    tcg_target_long pcrel;
    intptr_t pcrel;

    value += addend;
    pcrel = (value - ((tcg_target_long)code_ptr + 8)) >> 2;
    pcrel = (value - ((intptr_t)code_ptr + 8)) >> 2;

    switch (type) {
    case R_PARISC_PCREL12F:
+1 −1
Original line number Diff line number Diff line
@@ -112,7 +112,7 @@ static bool have_cmov;
static uint8_t *tb_ret_addr;

static void patch_reloc(uint8_t *code_ptr, int type,
                        tcg_target_long value, tcg_target_long addend)
                        intptr_t value, intptr_t addend)
{
    value += addend;
    switch(type) {
+7 −7
Original line number Diff line number Diff line
@@ -668,16 +668,16 @@ static inline uint64_t tcg_opc_x3(int qp, uint64_t opc, uint64_t imm)
 * Relocations
 */

static inline void reloc_pcrel21b (void *pc, tcg_target_long target)
static inline void reloc_pcrel21b(void *pc, intptr_t target)
{
    uint64_t imm;
    int64_t disp;
    int slot;

    slot = (tcg_target_long) pc & 3;
    pc = (void *)((tcg_target_long) pc & ~3);
    slot = (intptr_t)pc & 3;
    pc = (void *)((intptr_t)pc & ~3);

    disp = target - (tcg_target_long) pc;
    disp = target - (intptr_t)pc;
    imm = (uint64_t) disp >> 4;

    switch(slot) {
@@ -728,12 +728,12 @@ static inline uint64_t get_reloc_pcrel21b (void *pc)
    }
}

static inline void reloc_pcrel60b (void *pc, tcg_target_long target)
static inline void reloc_pcrel60b(void *pc, intptr_t target)
{
    int64_t disp;
    uint64_t imm;

    disp = target - (tcg_target_long) pc;
    disp = target - (intptr_t)pc;
    imm = (uint64_t) disp >> 4;

    *(uint64_t *)(pc + 8) = (*(uint64_t *)(pc + 8) & 0xf700000fff800000ull)
@@ -759,7 +759,7 @@ static inline uint64_t get_reloc_pcrel60b (void *pc)


static void patch_reloc(uint8_t *code_ptr, int type,
                        tcg_target_long value, tcg_target_long addend)
                        intptr_t value, intptr_t addend)
{
    value += addend;
    switch (type) {
Loading