Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10.13) id 19ACU1-0005rb-00 for qemu-devel@nongnu.org; Mon, 28 Apr 2003 13:32:05 -0400 Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10.13) id 19ACTH-0005Fl-00 for qemu-devel@nongnu.org; Mon, 28 Apr 2003 13:31:21 -0400 Received: from mx02.uni-tuebingen.de ([134.2.3.12]) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 19ACSC-0004m4-00 for qemu-devel@nongnu.org; Mon, 28 Apr 2003 13:30:12 -0400 Received: from juist (semeai.Informatik.Uni-Tuebingen.De [134.2.15.66]) by mx02.uni-tuebingen.de (8.12.3/8.12.3) with ESMTP id h3SHU9pi022458 for ; Mon, 28 Apr 2003 19:30:10 +0200 Received: from falk by juist with local (Exim 3.36 #1 (Debian)) id 19ACS7-00009e-00 for ; Mon, 28 Apr 2003 19:30:07 +0200 Subject: Re: [Qemu-devel] Alpha support References: <87fzo35yov.fsf@student.uni-tuebingen.de> <87adeb5xwd.fsf@student.uni-tuebingen.de> From: Falk Hueffner Date: 28 Apr 2003 19:30:07 +0200 In-Reply-To: <87adeb5xwd.fsf@student.uni-tuebingen.de> Message-ID: <87znmail7k.fsf@student.uni-tuebingen.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii List-Id: List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , To: qemu-devel@nongnu.org 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