Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.20) id 19lK2q-0004my-Ff for qemu-devel@nongnu.org; Fri, 08 Aug 2003 23:05:28 -0400 Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.20) id 19lK2D-0004ai-S9 for qemu-devel@nongnu.org; Fri, 08 Aug 2003 23:05:21 -0400 Received: from [66.33.209.16] (helo=gollum.dreamhost.com) by monty-python.gnu.org with esmtp (Exim 4.20) id 19lJyY-0003B7-TL for qemu-devel@nongnu.org; Fri, 08 Aug 2003 23:01:03 -0400 Received: from _HOSTNAME_ (cs2417545-42.austin.rr.com [24.175.45.42]) by gollum.dreamhost.com (Postfix) with ESMTP id 9C3765B761 for ; Fri, 8 Aug 2003 20:00:56 -0700 (PDT) From: "Jon Nall" Date: Fri, 8 Aug 2003 21:48:25 -0500 Subject: Re: [Qemu-devel] powerpc hang Message-ID: <20030809024824.GC6242@themountaingoats.net> References: <1060210228.10894.50.camel@lxws8.ad.newisys.com> <20030807220544.GA3657@themountaingoats.net> <20030808131334.GA6242@themountaingoats.net> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="Pk6IbRAofICFmK5e" Content-Disposition: inline In-Reply-To: <20030808131334.GA6242@themountaingoats.net> Reply-To: qemu-devel@nongnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org --Pk6IbRAofICFmK5e Content-Type: multipart/mixed; boundary="XF85m9dhOBO43t/C" Content-Disposition: inline --XF85m9dhOBO43t/C Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Fri, Aug 08, 2003 at 08:13:35AM -0500, Jon Nall wrote: > Question: is it safe to replace all of these with ESP since ESP should > default to env->regs[R_ESP] if there is no AREG defined for the > architecture? (or more generally, is it safe to replace env->regs[XXX] > with XXX?) i replaced all instances of env->regs[R_ESP] in helper-i386.c with ESP (see below). this allowed me to run test-i386 to completion with no errors! i'm attaching a full patch to get qemu working on ppc/gcc3, which includes this change and the changes i posted previously. NOTE: there was one instance of env->regs[E_ESP] in helper-i386.c that went unchanged -- the one in cpu_loop_exit(), since this was setting the register to ESP anyway. nall. --XF85m9dhOBO43t/C Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="qemu-ppc-gcc3.patch" Content-Transfer-Encoding: quoted-printable --- dyngen.c 11 Jul 2003 15:16:56 -0000 1.26 +++ dyngen.c 9 Aug 2003 02:52:25 -0000 @@ -687,7 +687,11 @@ =20 if (val >=3D start_offset && val < start_offset + copy= _size) { n =3D strtol(p, NULL, 10); +#if ( __GNUC__ =3D=3D 3) && defined(__powerpc__) + fprintf(outfile, " label_offsets[%d] =3D %d + (= gen_code_ptr - gen_code_buf);\n", n, val - start_offset + 4); +#else fprintf(outfile, " label_offsets[%d] =3D %d + (= gen_code_ptr - gen_code_buf);\n", n, val - start_offset); +#endif } } } --- exec.h 26 Jul 2003 12:06:08 -0000 1.13 +++ exec.h 9 Aug 2003 02:52:26 -0000 @@ -210,6 +210,7 @@ label ## n:\ T0 =3D (long)(tbparam) + (n);\ EIP =3D eip;\ + EXIT_TB();\ } while (0) =20 #else --- helper-i386.c 29 Jul 2003 20:53:01 -0000 1.11 +++ helper-i386.c 9 Aug 2003 02:52:27 -0000 @@ -285,13 +285,13 @@ =20 /* XXX: check that enough room is available */ if (new_stack) { - old_esp =3D env->regs[R_ESP]; + old_esp =3D ESP; old_ss =3D env->segs[R_SS].selector; load_seg(R_SS, ss, env->eip); } else { old_esp =3D 0; old_ss =3D 0; - esp =3D env->regs[R_ESP]; + esp =3D ESP; } if (is_int) old_eip =3D next_eip; @@ -300,7 +300,7 @@ old_cs =3D env->segs[R_CS].selector; load_seg(R_CS, selector, env->eip); env->eip =3D offset; - env->regs[R_ESP] =3D esp - push_size; + ESP =3D esp - push_size; ssp =3D env->segs[R_SS].base + esp; if (shift =3D=3D 1) { int old_eflags; @@ -374,7 +374,7 @@ ptr =3D dt->base + intno * 4; offset =3D lduw(ptr); selector =3D lduw(ptr + 2); - esp =3D env->regs[R_ESP]; + esp =3D ESP; ssp =3D env->segs[R_SS].base; if (is_int) old_eip =3D next_eip; @@ -389,7 +389,7 @@ stw(ssp + (esp & 0xffff), old_eip); =20 /* update processor state */ - env->regs[R_ESP] =3D (env->regs[R_ESP] & ~0xffff) | (esp & 0xffff); + ESP =3D (ESP & ~0xffff) | (esp & 0xffff); env->eip =3D offset; env->segs[R_CS].selector =3D selector; env->segs[R_CS].base =3D (uint8_t *)(selector << 4); @@ -784,7 +784,7 @@ =20 new_cs =3D T0; new_eip =3D T1; - esp =3D env->regs[R_ESP]; + esp =3D ESP; esp_mask =3D 0xffffffff; if (!(env->segs[R_SS].flags & DESC_B_MASK)) esp_mask =3D 0xffff; @@ -802,9 +802,9 @@ } =20 if (!(env->segs[R_SS].flags & DESC_B_MASK)) - env->regs[R_ESP] =3D (env->regs[R_ESP] & ~0xffff) | (esp & 0xffff); + ESP =3D (ESP & ~0xffff) | (esp & 0xffff); else - env->regs[R_ESP] =3D esp; + ESP =3D esp; env->eip =3D new_eip; env->segs[R_CS].selector =3D new_cs; env->segs[R_CS].base =3D (uint8_t *)(new_cs << 4); @@ -846,7 +846,7 @@ if (!(e2 & DESC_P_MASK)) raise_exception_err(EXCP0B_NOSEG, new_cs & 0xfffc); =20 - sp =3D env->regs[R_ESP]; + sp =3D ESP; if (!(env->segs[R_SS].flags & DESC_B_MASK)) sp &=3D 0xffff; ssp =3D env->segs[R_SS].base + sp; @@ -868,9 +868,9 @@ raise_exception_err(EXCP0D_GPF, new_cs & 0xfffc); /* from this point, not restartable */ if (!(env->segs[R_SS].flags & DESC_B_MASK)) - env->regs[R_ESP] =3D (env->regs[R_ESP] & 0xffff0000) | (sp & 0= xffff); + ESP =3D (ESP & 0xffff0000) | (sp & 0xffff); else - env->regs[R_ESP] =3D sp; + ESP =3D sp; env->segs[R_CS].base =3D sc1.base; env->segs[R_CS].limit =3D sc1.limit; env->segs[R_CS].flags =3D sc1.flags; @@ -938,7 +938,7 @@ param_count =3D e2 & 0x1f; push_size =3D ((param_count * 2) + 8) << shift; =20 - old_esp =3D env->regs[R_ESP]; + old_esp =3D ESP; old_ss =3D env->segs[R_SS].selector; if (!(env->segs[R_SS].flags & DESC_B_MASK)) old_esp &=3D 0xffff; @@ -995,11 +995,12 @@ load_seg(R_CS, selector, env->eip); /* from this point, not restartable if same priviledge */ if (!(env->segs[R_SS].flags & DESC_B_MASK)) - env->regs[R_ESP] =3D (env->regs[R_ESP] & 0xffff0000) | (sp & 0= xffff); + ESP =3D (ESP & 0xffff0000) | (sp & 0xffff); else - env->regs[R_ESP] =3D sp; + ESP =3D sp; EIP =3D offset; } + } =20 /* init the segment cache in vm86 mode */ @@ -1020,7 +1021,7 @@ uint8_t *ssp; int eflags_mask; =20 - sp =3D env->regs[R_ESP] & 0xffff; + sp =3D ESP & 0xffff; ssp =3D env->segs[R_SS].base + sp; if (shift =3D=3D 1) { /* 32 bits */ @@ -1034,7 +1035,7 @@ new_eip =3D lduw(ssp); } new_esp =3D sp + (6 << shift); - env->regs[R_ESP] =3D (env->regs[R_ESP] & 0xffff0000) |=20 + ESP =3D (ESP & 0xffff0000) |=20 (new_esp & 0xffff); load_seg_vm(R_CS, new_cs); env->eip =3D new_eip; @@ -1053,7 +1054,7 @@ int cpl, dpl, rpl, eflags_mask; uint8_t *ssp; =20 - sp =3D env->regs[R_ESP]; + sp =3D ESP; if (!(env->segs[R_SS].flags & DESC_B_MASK)) sp &=3D 0xffff; ssp =3D env->segs[R_SS].base + sp; @@ -1129,9 +1130,9 @@ load_seg(R_SS, new_ss, env->eip); } if (env->segs[R_SS].flags & DESC_B_MASK) - env->regs[R_ESP] =3D new_esp; + ESP =3D new_esp; else - env->regs[R_ESP] =3D (env->regs[R_ESP] & 0xffff0000) |=20 + ESP =3D (ESP & 0xffff0000) |=20 (new_esp & 0xffff); env->eip =3D new_eip; if (is_iret) { @@ -1164,7 +1165,7 @@ load_seg_vm(R_GS, new_gs); =20 env->eip =3D new_eip; - env->regs[R_ESP] =3D new_esp; + ESP =3D new_esp; } =20 void helper_iret_protected(int shift) --XF85m9dhOBO43t/C-- --Pk6IbRAofICFmK5e Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.2 (GNU/Linux) iD8DBQE/NGD4L6MPBxxYYYwRAl32AJ4yRNMztoNK6c/EW26RoLEh99K6kACeJToi bYl2y4NqM/9TL7CY5T+afqc= =TY6g -----END PGP SIGNATURE----- --Pk6IbRAofICFmK5e--