From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16660 invoked by alias); 15 Apr 2004 20:45:33 -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 16650 invoked from network); 15 Apr 2004 20:45:32 -0000 Received: from unknown (HELO mx1.redhat.com) (66.187.233.31) by sources.redhat.com with SMTP; 15 Apr 2004 20:45:32 -0000 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx1.redhat.com (8.12.10/8.12.10) with ESMTP id i3FKjVJW000675 for ; Thu, 15 Apr 2004 16:45:31 -0400 Received: from potter.sfbay.redhat.com (potter.sfbay.redhat.com [172.16.27.15]) by int-mx2.corp.redhat.com (8.11.6/8.11.6) with ESMTP id i3FKjOM07078; Thu, 15 Apr 2004 16:45:24 -0400 Received: from redhat.com (dhcp-172-16-25-160.sfbay.redhat.com [172.16.25.160]) by potter.sfbay.redhat.com (8.11.6/8.11.6) with ESMTP id i3FKjMC01507; Thu, 15 Apr 2004 13:45:23 -0700 Message-ID: <407EF462.1010001@redhat.com> Date: Thu, 15 Apr 2004 20:45:00 -0000 From: Michael Snyder Organization: Red Hat, Inc. User-Agent: Mozilla/5.0 (X11; U; Linux i686; es-ES; rv:1.4.2) Gecko/20040301 MIME-Version: 1.0 To: "Asgari J. Jinia" CC: gdb-patches@sources.redhat.com, kazu@cs.umass.edu, dvenkat@noida.hcltech.com Subject: Re: [PATCH-H8300] TRAPA instruction handling References: <69595093233BB547BB70CF5E492B63F204A8FBD9@sohm.kpit.com> In-Reply-To: <69595093233BB547BB70CF5E492B63F204A8FBD9@sohm.kpit.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-RedHat-Spam-Score: 0 X-SW-Source: 2004-04/txt/msg00327.txt.bz2 Asgari J. Jinia wrote: > 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 The implementation's good, but I can't comment on the technical correctness. Adding Kazu and Venkat to Cc: in case they can. Michael > --------------------------------------------------------------------- > > 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 > 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) > > h8_set_mask (sd, memory_size - 1); > > - memset (h8_get_reg_buf (sd), 0, sizeof (((STATE_CPU (sd, 0))->regs))); > > for (i = 0; i < 8; i++) > { > @@ -3584,14 +3583,13 @@ sim_resume (SIM_DESC sd, int step, int s > > if (h8300smode) /* pop exr */ > { > - h8_set_exr (sd, GET_MEMORY_L (tmp)); > - tmp += 4; > + h8_set_exr (sd, GET_MEMORY_W (tmp)); > + tmp += 2; > } > if (h8300hmode && !h8300_normal_mode) > { > - h8_set_ccr (sd, GET_MEMORY_L (tmp)); > - tmp += 4; > - pc = GET_MEMORY_L (tmp); > + h8_set_ccr (sd, (GET_MEMORY_L (tmp) >> 24)); > + pc = GET_MEMORY_L (tmp) & 0x00FFFFFF; > tmp += 4; > } > else > @@ -3671,17 +3669,16 @@ sim_resume (SIM_DESC sd, int step, int s > else > { > tmp -= 4; > - SET_MEMORY_L (tmp, code->next_pc); > - tmp -= 4; > - SET_MEMORY_L (tmp, h8_get_ccr (sd)); > + SET_MEMORY_L (tmp, (code->next_pc & 0x00FFFFFF)+ > + ((tmp, h8_get_ccr (sd))<<24)); > } > intMaskBit = 1; > BUILDSR (sd); > > if (h8300smode) > { > - tmp -= 4; > - SET_MEMORY_L (tmp, h8_get_exr (sd)); > + tmp -= 2; > + SET_MEMORY_W (tmp, h8_get_exr (sd)); > } > > h8_set_reg (sd, SP_REGNUM, tmp); >