Alpha support
Hi,
let's try the shiny new mailing list this time, maybe somebody else has some comments :)
Here's an updated Alpha support patch. I snarfed the mmap 4k/8k page handling from em86 (without really checking out in detail what it does, I admit ;), and now the mmapping seems to work. I also mark qemu as 32 bit binary, which should result in the binary mapped to the lower 31 bit of the address space. However, the stack pointer seems to remain 64 bit:
start_brk 0x080490ac end_code 0x080480aa start_code 0x08048000 end_data 0x080490ac start_stack 0x200002a9a00 brk 0x080490ac esp 0x200002a9a00 eip 0x08048074
which leads to an immediate crash, since esp is treated as 32 bit. Now I wonder what determines the stack start? Is it chosen by the kernel? It could probably be worked around easily by just allocating it manually...
Signature · 1 line
Falk
Argh. Please disregard the stack question. I made a mistake in setting the 32-bit flag.
Signature · 1 line
Falk
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)
retThe 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?
Signature · 1 line
Falk
Hi,
it's me again :)
The easiest I could think of is to declare for example
void OPPROTO op_jb_cc(void)
{
if (cc_table[CC_OP].compute_c())
EIP = PARAM1;
else
EIP = PARAM2;
FORCE_RET();
}as
void OPPROTO op_jb_cc(PARAMS2)
{
if (cc_table[CC_OP].compute_c())
EIP = PARAM1;
else
EIP = PARAM2;
FORCE_RET();
}and
#ifdef __alpha__
#define PARAMS2 int a0, int a1
#define PARAM1 a0
#define PARAM2 a1
#else
#define PARAMS2 void
#endif
and emit C code to dyngen_code that will manually emit instructions to set up a0 and a1. Added bonus is that a jump gets converted to a conditional move :) Does that sound like a good idea?
Signature · 1 line
Falk