]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
sim: mips: Add shadow mappings for 32-bit memory address space
authorFaraz Shahbazker <fshahbazker@wavecomp.com>
Tue, 4 May 2021 23:21:17 +0000 (04:51 +0530)
committerFaraz Shahbazker <fshahbazker@wavecomp.com>
Sat, 22 May 2021 06:02:35 +0000 (11:32 +0530)
32-bit MIPS programs run on the 64-bit simulator model in 64-bit
sign-extended space. The mapping from 64-bit sign-extended addresses to
32-bit addresses was removed by commit
26f8bf63bf36f9062a5cc1afacf71462a4abe0c8, breaking the 64-bit simulator
model. Add shadow mappings from 64-bit sign extended address space to
32-bit address spaces, in lieu of the AddressTranslation function.

2021-05-04  Faraz Shahbazker  <fshahbazker@wavecomp.com>

sim/mips/ChangeLog:
* interp.c (sim_open): Add shadow mappings from 32-bit
address space to 64-bit sign-extended address space.

sim/mips/ChangeLog
sim/mips/interp.c

index 123d722bdb56b5dd5bde2f5dbcb52768743e5ff2..0d687a9313c198dfad7ca0a8ab9ed3fe5ee22f6f 100644 (file)
@@ -1,5 +1,11 @@
 2021-05-22  Faraz Shahbazker  <fshahbazker@wavecomp.com>
 
+sim/mips/ChangeLog:
+       * interp.c (sim_open): Add shadow mappings from 32-bit
+       address space to 64-bit sign-extended address space.
+
+2021-05-22  Faraz Shahbazker  <fshahbazker@wavecomp.com>
+
 sim/mips/ChangeLog:
        * interp.c (sim_create_inferior): Only truncate sign extension
        bits for 32-bit target models.
index 6e00fd0dbf00dbebf8a021e2c374482c0e258945..00c1b632889549c3cd902469f6e12a0641970215 100644 (file)
@@ -438,6 +438,9 @@ sim_open (SIM_OPEN_KIND kind, host_callback *cb,
          /* memory alias K1BASE@1,K1SIZE%MEMSIZE,K0BASE */
          sim_do_commandf (sd, "memory alias 0x%lx@1,0x%lx%%0x%lx,0x%0x",
                           K1BASE, K1SIZE, (long)mem_size, K0BASE);
+         if (WITH_TARGET_WORD_BITSIZE == 64)
+           sim_do_commandf (sd, "memory alias 0x%x,0x%" PRIxTW ",0x%" PRIxTA,
+                            (K0BASE), mem_size, EXTENDED(K0BASE));
        }
 
       device_init(sd);
@@ -696,11 +699,16 @@ sim_open (SIM_OPEN_KIND kind, host_callback *cb,
   if (idt_monitor_base != 0)
     {
       unsigned loop;
-      unsigned idt_monitor_size = 1 << 11;
+      address_word idt_monitor_size = 1 << 11;
 
       /* the default monitor region */
-      sim_do_commandf (sd, "memory region 0x%x,0x%x",
-                      idt_monitor_base, idt_monitor_size);
+      if (WITH_TARGET_WORD_BITSIZE == 64)
+       sim_do_commandf (sd, "memory alias 0x%x,0x%" PRIxTW ",0x%" PRIxTA,
+                        idt_monitor_base, idt_monitor_size,
+                        EXTENDED (idt_monitor_base));
+      else
+       sim_do_commandf (sd, "memory region 0x%x,0x%x",
+                        idt_monitor_base, idt_monitor_size);
 
       /* Entry into the IDT monitor is via fixed address vectors, and
         not using machine instructions. To avoid clashing with use of