Received: from eggs.gnu.org ([2001:4830:134:3::10]:57008) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZCWU3-0000jq-NL for qemu-devel@nongnu.org; Tue, 07 Jul 2015 13:16:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZCWTz-00067V-Q4 for qemu-devel@nongnu.org; Tue, 07 Jul 2015 13:16:39 -0400 Received: from cantor2.suse.de ([195.135.220.15]:49730 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZCWTz-000670-KF for qemu-devel@nongnu.org; Tue, 07 Jul 2015 13:16:35 -0400 From: =?UTF-8?q?Andreas=20F=C3=A4rber?= Date: Tue, 7 Jul 2015 19:16:22 +0200 Message-Id: <1436289389-5403-16-git-send-email-afaerber@suse.de> In-Reply-To: <1436289389-5403-1-git-send-email-afaerber@suse.de> References: <1436289389-5403-1-git-send-email-afaerber@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PULL v2 15/22] microblaze: boot: Use cpu_set_pc() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: "Edgar E. Iglesias" , Peter Crosthwaite , =?UTF-8?q?Andreas=20F=C3=A4rber?= , Peter Crosthwaite From: Peter Crosthwaite Use cpu_set_pc() for setting program counters when bootloading. This removes an instance of system level code having to reach into the CPU env. Reviewed-by: Andreas F=C3=A4rber Signed-off-by: Peter Crosthwaite [AF: Avoid duplicated CPU() casts through local variable] Signed-off-by: Andreas F=C3=A4rber --- hw/microblaze/boot.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hw/microblaze/boot.c b/hw/microblaze/boot.c index 4c44317..3e8820f 100644 --- a/hw/microblaze/boot.c +++ b/hw/microblaze/boot.c @@ -48,13 +48,14 @@ static struct static void main_cpu_reset(void *opaque) { MicroBlazeCPU *cpu =3D opaque; + CPUState *cs =3D CPU(cpu); CPUMBState *env =3D &cpu->env; =20 - cpu_reset(CPU(cpu)); + cpu_reset(cs); env->regs[5] =3D boot_info.cmdline; env->regs[6] =3D boot_info.initrd_start; env->regs[7] =3D boot_info.fdt; - env->sregs[SR_PC] =3D boot_info.bootstrap_pc; + cpu_set_pc(cs, boot_info.bootstrap_pc); if (boot_info.machine_cpu_reset) { boot_info.machine_cpu_reset(cpu); } --=20 2.1.4