Skip to contentSkip to conversation

[4610] Implement ARM magic kernel page and TLS register.

Qemu-devel Paul Brook 1 participant 1 message May 29, 2008

lore
Share & tools
lore

Paul Brook

author
#0 lore raw

Revision: 4610

          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=4610
Author:   pbrook
Date:     2008-05-29 00:20:44 +0000 (Thu, 29 May 2008)

Log Message:
-----------
Implement ARM magic kernel page and TLS register.

Modified Paths:
--------------
trunk/linux-user/arm/syscall.h
trunk/linux-user/main.c
trunk/target-arm/cpu.h
trunk/target-arm/translate.c

Modified: trunk/linux-user/arm/syscall.h
===================================================================

linux-user/arm/syscall.h +3 -1
@@ -28,7 +28,9 @@
 #define ARM_SYSCALL_BASE	0x900000
 #define ARM_THUMB_SYSCALL	0
 
-#define ARM_NR_cacheflush (ARM_SYSCALL_BASE + 0xf0000 + 2)
+#define ARM_NR_BASE	  0xf0000
+#define ARM_NR_cacheflush (ARM_NR_BASE + 2)
+#define ARM_NR_set_tls	  (ARM_NR_BASE + 5)
 
 #define ARM_NR_semihosting	  0x123456
 #define ARM_NR_thumb_semihosting  0xAB

Modified: trunk/linux-user/main.c
===================================================================

linux-user/main.c +78 -8

104 lines not on this page · raw message

Modified: trunk/target-arm/cpu.h
===================================================================

target-arm/cpu.h +5 -0
@@ -38,6 +38,7 @@
 #define EXCP_FIQ             6
 #define EXCP_BKPT            7
 #define EXCP_EXCEPTION_EXIT  8   /* Return from v7M exception.  */
+#define EXCP_KERNEL_TRAP     9   /* Jumped to kernel code page.  */
 
 #define ARMV7M_EXCP_RESET   1
 #define ARMV7M_EXCP_NMI     2
@@ -216,6 +217,10 @@
 
 void cpu_lock(void);
 void cpu_unlock(void);
+static inline void cpu_set_tls(CPUARMState *env, target_ulong newtls)
+{
+  env->cp15.c13_tls2 = newtls;
+}
 
 #define CPSR_M (0x1f)
 #define CPSR_T (1 << 5)

Modified: trunk/target-arm/translate.c
===================================================================

target-arm/translate.c +10 -1
@@ -8583,7 +8583,16 @@
         store_cpu_field(tmp, condexec_bits);
       }
     do {
-#ifndef CONFIG_USER_ONLY
+#ifdef CONFIG_USER_ONLY
+        /* Intercept jump to the magic kernel page.  */
+        if (dc->pc >= 0xffff0000) {
+            /* We always get here via a jump, so know we are not in a
+               conditional execution block.  */
+            gen_exception(EXCP_KERNEL_TRAP);
+            dc->is_jmp = DISAS_UPDATE;
+            break;
+        }
+#else
         if (dc->pc >= 0xfffffff0 && IS_M(env)) {
             /* We always get here via a jump, so know we are not in a
                conditional execution block.  */