Browse Source

2009-12-14 Zoltan Varga <[email protected]>

	* tramp-amd64.c (mono_arch_nullify_class_init_trampoline): Fix the LLVM support
	by merging the LLVM and !MAP_32BIT cases.

svn path=/trunk/mono/; revision=148362
Zoltan Varga 16 years ago
parent
commit
4da04a469e
2 changed files with 9 additions and 23 deletions
  1. 5 0
      mono/mini/ChangeLog
  2. 4 23
      mono/mini/tramp-amd64.c

+ 5 - 0
mono/mini/ChangeLog

@@ -1,3 +1,8 @@
+2009-12-14  Zoltan Varga  <[email protected]>
+
+	* tramp-amd64.c (mono_arch_nullify_class_init_trampoline): Fix the LLVM support
+	by merging the LLVM and !MAP_32BIT cases.
+
 2009-12-13 Jonathan Chambers <[email protected]>
 
 	* debugger-agent.c (mono_debugger_agent_thread_interrupt): Handle a NULL

+ 4 - 23
mono/mini/tramp-amd64.c

@@ -261,33 +261,14 @@ mono_arch_nullify_class_init_trampoline (guint8 *code, mgreg_t *regs)
 		*/
 
 		mono_arch_patch_callsite (code - 2, code - 2 + 5, nullified_class_init_trampoline);
-	} else if ((buf [4] == 0x41) && (buf [5] == 0xff)) {
-		/* call <REG> */
-		/* happens on machines without MAP_32BIT like freebsd */
-		/* amd64_set_reg_template is 10 bytes long */
-		guint8* buf = code - 10;
-
-		/* FIXME: Make this thread safe */
-		/* Padding code suggested by the AMD64 Opt Manual */
-		buf [0] = 0x66;
-		buf [1] = 0x66;
-		buf [2] = 0x66;
-		buf [3] = 0x90;
-		buf [4] = 0x66;
-		buf [5] = 0x66;
-		buf [6] = 0x66;
-		buf [7] = 0x90;
-		buf [8] = 0x66;
-		buf [9] = 0x66;
-		buf [10] = 0x90;
-		buf [11] = 0x66;
-		buf [12] = 0x90;
 	} else if ((buf [5] == 0xff) && x86_modrm_mod (buf [6]) == 3 && x86_modrm_reg (buf [6]) == 2) {
 		/* call *<reg> */
-		/* Generated by the LLVM JIT */
+		/* Generated by the LLVM JIT or on platforms without MAP_32BIT set */
+		guint8* buf = code;
+
 		/* FIXME: Not thread safe */
-		buf [0] = 0x90;
 		buf [1] = 0x90;
+		buf [2] = 0x90;
 	} else if (buf [4] == 0x90 || buf [5] == 0xeb || buf [6] == 0x66) {
 		/* Already changed by another thread */
 		;