This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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]

Re: [patch i386]: Add support of "hotfix" -feature for x64


On 06/30/2010 04:58 AM, Kai Tietz wrote:
> Hello,
> 
> this patch adds the hot-patchabel Win32 feature used by Wine also for x64 
> targets. Additionally it adds the missing feature part of adding prefix 
> before function as hot-patchable area, as defined by win32 ABI.

I like most of this patch.  There are a few quirks...

+      while (filler_count > 0)
+        {
+	  fprintf (asm_out_file, ASM_LONG " 0x%x", filler_cc);
+	  filler_count -= 4;
+	  while ((filler_count & 0xf) != 0)
+	    {
+	      fprintf (asm_out_file, ", 0x%x", filler_cc);
+	      filler_count -= 4;
+	    }
+	  fprintf (asm_out_file, "\n");
+	}

The double loop overcomplicates things.  I think you're better off
with just a plain for-loop.

+	/* leaq [%rsp + 0], %rsp  */
+	asm_fprintf (asm_out_file, ASM_BYTE "0x48, 0x8d, 0xa4, 0x24, 0x00, 0x00, 0x00, 0x00\n");

Needs line wrap.

 	 Wine uses this to enable Windows apps to hook the Win32 API
 	 functions provided by Wine.  */
-      insn = emit_insn (gen_vswapmov (gen_rtx_REG (SImode, DI_REG),
-				      gen_rtx_REG (SImode, DI_REG)));
       push = emit_insn (gen_push (hard_frame_pointer_rtx));

The preceeding comment needs adjusting to match the new code.  Just
mentioning that the nop-move is emitted elsewhere should be enough.



r~


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