sim: arm: add support for MOVW and MOVT instructions

From: Jayant R. Sonar <Jayant.Sonar@kpitcummins.com>

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).
This commit is contained in:
Mike Frysinger
2013-05-15 17:49:44 +00:00
parent ed0f00b834
commit 590919de6c
4 changed files with 71 additions and 4 deletions

View File

@@ -2315,8 +2315,10 @@ check_PMUintr:
WRITESDEST (dest);
break;
case 0x30: /* TST immed */
UNDEF_Test;
case 0x30: /* MOVW immed */
dest = BITS (0, 11);
dest |= (BITS (16, 19) << 12);
WRITEDEST (dest);
break;
case 0x31: /* TSTP immed */
@@ -2368,8 +2370,10 @@ check_PMUintr:
}
break;
case 0x34: /* CMP immed */
UNDEF_Test;
case 0x34: /* MOVT immed */
dest = BITS (0, 11);
dest |= (BITS (16, 19) << 12);
DEST |= (dest << 16);
break;
case 0x35: /* CMPP immed */