This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH/ARM] Adding support for MOVW and MOVT instructions


Hi,

This patch adds simulator support for handling the armv7 instructions 
'movw (immediate)' and 'movt'.

Compiler frequently use these instructions to load the 32bit addresses of 
global variables, string pointers etc. into the general registers. 

In absence of support of these instructions:
1. GDB run simulator fails to print even simple "hello world" string 
   on console.
2. Loading of global variable addresses into the registers fail causing 
   arithmetic operation failures.

Patch has been regression tested for arm-none-eabi (-march=armv7-a).

Can someone please review it?

gdb/sim/arm/ChangeLog:
2013-04-29  Jayant Sonar  <jayant.sonar@kpitcummins.com>
        Kaushik Phatak <Kaushik.Phatak@kpitcummins.com>

        * armemu.c (ARMul_Emulate32): Emulate instructions MOVW and MOVT.

===================================================================
--- sim/arm/armemu.c.orig       2013-04-29 14:56:15.000000000 +0530
+++ sim/arm/armemu.c    2013-04-29 14:57:36.000000000 +0530
@@ -2315,9 +2315,11 @@ check_PMUintr:
              WRITESDEST (dest);
              break;

-           case 0x30:          /* TST immed */
-             UNDEF_Test;
-             break;
+            case 0x30:          /* MOVW immed */
+              dest = BITS (0, 11);
+              dest |= (BITS (16, 19) << 12);
+              WRITEDEST (dest);
+              break;

            case 0x31:          /* TSTP immed */
              if (DESTReg == 15)
@@ -2368,9 +2370,11 @@ check_PMUintr:
                }
              break;

-           case 0x34:          /* CMP immed */
-             UNDEF_Test;
-             break;
+            case 0x34:          /* MOVT immed */
+              dest  = BITS (0, 11);
+              dest |= (BITS (16, 19) << 12);
+              DEST |= (dest << 16);
+              break;

            case 0x35:          /* CMPP immed */
              if (DESTReg == 15)
===================================================================

Regards,
Jayant



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]