qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] Alpha support


From: Falk Hueffner
Subject: Re: [Qemu-devel] Alpha support
Date: 28 Apr 2003 19:30:07 +0200
User-agent: Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.5 (cabbage)

Hi,

I'm stuck with the relocation stuff and need some input... it looks
like relocation works different on the other architectures. On Alpha,
there's the gp register, which contains a pointer to a memory area
which contains constants and addresses of objects. For example,

int x;
int f() { return x; }

results in

        ldah gp,0(pv)         !gpdisp!1
        lda gp,0(gp)          !gpdisp!1
        ldq t0,x(gp)          !literal
        ldl v0,0(t0)
        ret

The first two statements calculate the gp from the procedure value,
which contains the current function's address, since each function
might have its own gp value. I intend to force a single gp value, so
these two instructions can be nopped. The ldq loads x's address into a
register. The linker needs to insert the correct offset from the gp.
This works independent of the address of the instruction, so it should
need no frobbing from dyngen_code. I suppose this is different on
other architectures? Anyway, the problem are the __op_param
relocations. If I understand correctly, the instruction that tries to
load the value of __op_paramx needs to be changed so it loads the
literal paramx instead. However, to generate a 32 bit value on Alpha,
you need 1, 2 or 3 instructions, so I don't really know how to solve
this. Jumps are PC-relative, so I cannot just change the length of the
code (at least not without adapting the jumps). Also the ldl is not
marked, so I would have to scan where the register of the !literal ldq
gets used... this seems ugly. Does anybody have a better idea?

-- 
        Falk




reply via email to

[Prev in Thread] Current Thread [Next in Thread]