From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27162 invoked by alias); 27 Jun 2004 05:34:02 -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 27155 invoked from network); 27 Jun 2004 05:34:01 -0000 Received: from unknown (HELO mx1.redhat.com) (66.187.233.31) by sourceware.org with SMTP; 27 Jun 2004 05:34:01 -0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.12.10/8.12.10) with ESMTP id i5R5Y1e1024304 for ; Sun, 27 Jun 2004 01:34:01 -0400 Received: from pobox.corp.redhat.com (pobox.corp.redhat.com [172.16.52.156]) by int-mx1.corp.redhat.com (8.11.6/8.11.6) with ESMTP id i5R5Y1001656 for ; Sun, 27 Jun 2004 01:34:01 -0400 Received: from livre.redhat.lsd.ic.unicamp.br (vpn64-14.boston.redhat.com [172.16.66.14]) by pobox.corp.redhat.com (8.12.8/8.12.8) with ESMTP id i5R5Y0pI007603 for ; Sun, 27 Jun 2004 01:34:01 -0400 Received: from livre.redhat.lsd.ic.unicamp.br (livre.redhat.lsd.ic.unicamp.br [127.0.0.1]) by livre.redhat.lsd.ic.unicamp.br (8.12.11/8.12.11) with ESMTP id i5R5XT2A029986 for ; Sun, 27 Jun 2004 02:33:29 -0300 Received: (from aoliva@localhost) by livre.redhat.lsd.ic.unicamp.br (8.12.11/8.12.11/Submit) id i5R5XTkX029983; Sun, 27 Jun 2004 02:33:29 -0300 To: gdb-patches@sources.redhat.com Subject: [patch] h8300 sim uses inconsistent memory sizes From: Alexandre Oliva Organization: Red Hat Global Engineering Services Compiler Team Date: Sun, 27 Jun 2004 05:34:00 -0000 Message-ID: User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-SW-Source: 2004-06/txt/msg00590.txt.bz2 --=-=-= Content-length: 543 sd->memory_size was only initialized in init_pointers(), that was called before the executable was loaded and the machine-type detection was run. Even though sim_load() duplicated most of the code in init_pointers(), it failed to update the memory_size in sd, so if we attempted to run code from a memory location not available on the original h8300, we'd get a confusing illegal-instruction error, because h8_get_cache_idx would return -1. This patch updates sim_load() such that it matches init_pointers() in this regard. Ok to install? --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=sim-h8sx-update-memory-size.patch Content-length: 776 Index: sim/ChangeLog from Alexandre Oliva * h8300/compile.c (sim_load): Update sd->memory_size. Index: sim/h8300/compile.c =================================================================== RCS file: /cvs/src/src/sim/h8300/compile.c,v retrieving revision 1.40 diff -u -p -r1.40 compile.c --- sim/h8300/compile.c 10 Jun 2004 20:22:17 -0000 1.40 +++ sim/h8300/compile.c 27 Jun 2004 05:28:19 -0000 @@ -5096,6 +5096,7 @@ sim_load (SIM_DESC sd, char *prog, bfd * calloc (sizeof (char), memory_size)); h8_set_cache_idx_buf (sd, (unsigned short *) calloc (sizeof (short), memory_size)); + sd->memory_size = memory_size; h8_set_eightbit_buf (sd, (unsigned char *) calloc (sizeof (char), 256)); /* `msize' must be a power of two. */ --=-=-= Content-length: 188 -- Alexandre Oliva http://www.ic.unicamp.br/~oliva/ Red Hat Compiler Engineer aoliva@{redhat.com, gcc.gnu.org} Free Software Evangelist oliva@{lsd.ic.unicamp.br, gnu.org} --=-=-=--