From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24122 invoked by alias); 14 Apr 2004 10:06:27 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 24053 invoked from network); 14 Apr 2004 10:06:22 -0000 Received: from unknown (HELO sohm.kpit.com) (203.129.230.82) by sources.redhat.com with SMTP; 14 Apr 2004 10:06:22 -0000 content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Subject: [PATCH-H8300] TRAPA instruction handling Date: Wed, 14 Apr 2004 10:06:00 -0000 Message-ID: <69595093233BB547BB70CF5E492B63F204A8FBD9@sohm.kpit.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: From: "Asgari J. Jinia" To: X-SW-Source: 2004-04/txt/msg00279.txt.bz2 Hi, In h8300 simulator, stack handling of TRAPA instruction is not as per hardware manual. Presently it takes 12 bytes to store CCR,PC and EXR registers on stack but it should do it with 6 bytes. Also simulation of @aa:8 addressing is broken as SBR register is initialized to zero after initialized with 0xFFFFFF00. Following patch does proper stack and @aa:8 handling. Regards, Asgari Jinia --------------------------------------------------------------------- ChangeLog sim/h8300 2004-04-13 Asgari Jinia * compile.c (sim_resume): updated stack for TRAPA as per hardware manual. (init_pointers): Initialization of h8_get_reg_buf removed as it corrupts SBR_REGNUM register, initialized in sim_state_initialize=20 function. --- sim/h8300/compile.old.c 2004-01-06 06:28:48.000000000 +0530 +++ sim/h8300/compile.c 2004-04-13 14:31:43.000000000 +0530 @@ -1808,7 +1808,6 @@ init_pointers (SIM_DESC sd) =20 h8_set_mask (sd, memory_size - 1); =20 - memset (h8_get_reg_buf (sd), 0, sizeof (((STATE_CPU (sd, 0))->regs))= ); =20 for (i =3D 0; i < 8; i++) { @@ -3584,14 +3583,13 @@ sim_resume (SIM_DESC sd, int step, int s =20 if (h8300smode) /* pop exr */ { - h8_set_exr (sd, GET_MEMORY_L (tmp)); - tmp +=3D 4; + h8_set_exr (sd, GET_MEMORY_W (tmp)); + tmp +=3D 2; } if (h8300hmode && !h8300_normal_mode) { - h8_set_ccr (sd, GET_MEMORY_L (tmp)); - tmp +=3D 4; - pc =3D GET_MEMORY_L (tmp); + h8_set_ccr (sd, (GET_MEMORY_L (tmp) >> 24)); + pc =3D GET_MEMORY_L (tmp) & 0x00FFFFFF; tmp +=3D 4; } else @@ -3671,17 +3669,16 @@ sim_resume (SIM_DESC sd, int step, int s else { tmp -=3D 4; - SET_MEMORY_L (tmp, code->next_pc); - tmp -=3D 4; - SET_MEMORY_L (tmp, h8_get_ccr (sd)); + SET_MEMORY_L (tmp, (code->next_pc & 0x00FFFFFF)+ + ((tmp, h8_get_ccr (sd))<<24)); } intMaskBit =3D 1; BUILDSR (sd); =20=20 if (h8300smode) { - tmp -=3D 4; - SET_MEMORY_L (tmp, h8_get_exr (sd)); + tmp -=3D 2; + SET_MEMORY_W (tmp, h8_get_exr (sd)); } =20 h8_set_reg (sd, SP_REGNUM, tmp);