Skip to contentSkip to conversation

ARM host: fix generated blocks linking

PATCH In review Laurent Desnogues 2 participants 3 messages Sep 21, 2009 – Sep 25, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ARM host: fix generated blocks linking

Hello,

this patch fixes the linking of generated blocks on an ARM host. No need to say this brings a very nice speedup :-)

Laurent

exec-all.h +3 -1
index 51519ff..daafc78 100644
@@ -208,7 +208,9 @@ static inline void tb_set_jmp_target1(unsigned long jmp_addr, unsigned long addr
 #endif
 
     /* we could use a ldr pc, [pc, #-4] kind of branch and avoid the flush */
-    *(uint32_t *)jmp_addr |= ((addr - (jmp_addr + 8)) >> 2) & 0xffffff;
+    *(uint32_t *)jmp_addr =
+        (*(uint32_t *)jmp_addr & ~0xffffff)
+        | (((addr - (jmp_addr + 8)) >> 2) & 0xffffff);
 
 #if QEMU_GNUC_PREREQ(4, 1)
     __clear_cache((char *) jmp_addr, (char *) jmp_addr + 4);
#1 lore raw
Quoted 9 lines · Laurent Desnogues

Hello,

this patch fixes the linking of generated blocks on an ARM host. No need to say this brings a very nice speedup :-)

Laurent

Thanks, applied. Do you think it also apply to stable?

Quoted 15 lines
exec-all.h +3 -1
index 51519ff..daafc78 100644
@@ -208,7 +208,9 @@ static inline void tb_set_jmp_target1(unsigned long jmp_addr, unsigned long addr
 #endif
 
     /* we could use a ldr pc, [pc, #-4] kind of branch and avoid the flush */
-    *(uint32_t *)jmp_addr |= ((addr - (jmp_addr + 8)) >> 2) & 0xffffff;
+    *(uint32_t *)jmp_addr =
+        (*(uint32_t *)jmp_addr & ~0xffffff)
+        | (((addr - (jmp_addr + 8)) >> 2) & 0xffffff);
 
 #if QEMU_GNUC_PREREQ(4, 1)
     __clear_cache((char *) jmp_addr, (char *) jmp_addr + 4);
Signature · 2 lines
Aurelien Jarno                          GPG: 1024D/F1BCDB73
[email protected]                 http://www.aurel32.net
#2 lore raw
Quoted 7 lines · Aurelien Jarno
Quoted 6 lines · Laurent Desnogues

Hello,

this patch fixes the linking of generated blocks on an ARM host. No need to say this brings a very nice speedup :-)

Quoted 5 lines
Quoted 3 lines

Laurent

Thanks, applied. Do you think it also apply to stable?

Well it used to work by accident; it's fundamentally broken since it just 'or' some new bits with existing ones (which are there due to internal relocation).

So I think, it should be applied to stable too.

Laurent

Quoted 21 lines
Quoted 5 lines
exec-all.h +0 -0
index 51519ff..daafc78 100644

exec-all.h static inline void tb_set_jmp_target1(unsigned long jmp_addr, unsigned long addr · line 216

Quoted 10 lines
exec-all.h +3 -1
@@ -208,7 +208,9 @@ static inline void tb_set_jmp_target1(unsigned long jmp_addr, unsigned long addr
  #endif
 
      /* we could use a ldr pc, [pc, #-4] kind of branch and avoid the flush */
-    *(uint32_t *)jmp_addr |= ((addr - (jmp_addr + 8)) >> 2) & 0xffffff;
+    *(uint32_t *)jmp_addr =
+        (*(uint32_t *)jmp_addr & ~0xffffff)
+        | (((addr - (jmp_addr + 8)) >> 2) & 0xffffff);
 
  #if QEMU_GNUC_PREREQ(4, 1)
      __clear_cache((char *) jmp_addr, (char *) jmp_addr + 4);

--
Aurelien Jarno                          GPG: 1024D/F1BCDB73 [email protected]                 http://www.aurel32.net