Comment
[cacao.git] / i386 / ngen.h
index 1da51ed7d0932456b832d8cfecf1d3bcc5d03cac..6d78fae3d5d60a2cc22e4092bafe39232ebf771b 100644 (file)
@@ -1,18 +1,36 @@
-/* i386/ngen.h *****************************************************************
+/* i386/ngen.h - code generation macros and definitions for i386
 
-    Copyright (c) 1997 A. Krall, R. Grafl, M. Gschwind, M. Probst
+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+   R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser,
+   M. Probst, S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck,
+   P. Tomsich, J. Wenninger
 
-    See file COPYRIGHT for information on usage and disclaimer of warranties
+   This file is part of CACAO.
 
-    Contains the machine dependent code generator definitions and macros for an
-    Alpha processor.
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
 
-    Authors: Andreas  Krall      EMAIL: cacao@complang.tuwien.ac.at
-             Reinhard Grafl      EMAIL: cacao@complang.tuwien.ac.at
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
 
-    Last Change: 1998/11/04
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA.
+
+   Contact: cacao@complang.tuwien.ac.at
+
+   Authors: Andreas Krall
+            Christian Thalinger
+
+   $Id: ngen.h 551 2003-11-01 20:35:28Z twisti $
+
+*/
 
-*******************************************************************************/
 
 #ifndef _NGEN_H
 #define _NGEN_H
@@ -34,6 +52,8 @@
 #define REG_ITMP2       I386_EDX /* temporary register and method pointer     */
 #define REG_ITMP3       I386_ECX /* temporary register                        */
 
+#define REG_NULL        -1       /* used for reg_of_var where d is not needed */
+
 #define REG_ITMP1_XPTR  I386_EAX /* exception pointer = temporary register 1  */
 #define REG_ITMP2_XPC   I386_EDX /* exception pc = temporary register 2       */
 
@@ -91,14 +111,6 @@ static u4 subnormal_bias2[3] = { 0x00000000, 0x80000000, 0x7bff };    /* 2^(+153
 
 /* macros to create code ******************************************************/
 
-#define M_OP3(op,fu,a,b,c,const) \
-do { \
-        printf("M_OP3: %d\n", __LINE__); \
-       *((s4 *) (((s4) mcodeptr)++)) = 0x0f; \
-        *((s4 *) (((s4) mcodeptr)++)) = 0x04; \
-} while (0)
-
-
 /*
  * immediate data union
  */
@@ -211,26 +223,27 @@ static const unsigned char i386_jcc_map[] = {
  * modrm and stuff
  */
 #define i386_address_byte(mod, reg, rm) \
-    *(((u1 *) mcodeptr)++) = ((((mod) & 0x03) << 6) | (((reg) & 0x07) << 3) | (((rm) & 0x07)));
+    *(mcodeptr++) = ((((mod) & 0x03) << 6) | (((reg) & 0x07) << 3) | (((rm) & 0x07)));
 
 
 #define i386_emit_reg(reg,rm) \
     i386_address_byte(3,(reg),(rm));
 
 
-#define i386_is_imm8(imm)      (((int)(imm) >= -128 && (int)(imm) <= 127))
+#define i386_is_imm8(imm) \
+    (((int)(imm) >= -128 && (int)(imm) <= 127))
 
 
 #define i386_emit_imm8(imm) \
-    *(((u1 *) mcodeptr)++) = (u1) ((imm) & 0xff);
+    *(mcodeptr++) = (u1) ((imm) & 0xff);
 
 
 #define i386_emit_imm16(imm) \
     do { \
         i386_imm_buf imb; \
         imb.i = (int) (imm); \
-        *(((u1 *) mcodeptr)++) = imb.b[0]; \
-        *(((u1 *) mcodeptr)++) = imb.b[1]; \
+        *(mcodeptr++) = imb.b[0]; \
+        *(mcodeptr++) = imb.b[1]; \
     } while (0)
 
 
@@ -238,43 +251,10 @@ static const unsigned char i386_jcc_map[] = {
     do { \
         i386_imm_buf imb; \
         imb.i = (int) (imm); \
-        *(((u1 *) mcodeptr)++) = imb.b[0]; \
-        *(((u1 *) mcodeptr)++) = imb.b[1]; \
-        *(((u1 *) mcodeptr)++) = imb.b[2]; \
-        *(((u1 *) mcodeptr)++) = imb.b[3]; \
-    } while (0)
-
-
-#define i386_emit_float32(imm) \
-    do { \
-        i386_imm_buf imb; \
-        imb.f = (float) (imm); \
-        *(((u1 *) mcodeptr)++) = imb.b[0]; \
-        *(((u1 *) mcodeptr)++) = imb.b[1]; \
-        *(((u1 *) mcodeptr)++) = imb.b[2]; \
-        *(((u1 *) mcodeptr)++) = imb.b[3]; \
-    } while (0)
-
-
-#define i386_emit_double64_low(imm) \
-    do { \
-        i386_imm_buf imb; \
-        imb.d = (double) (imm); \
-        *(((u1 *) mcodeptr)++) = imb.b[0]; \
-        *(((u1 *) mcodeptr)++) = imb.b[1]; \
-        *(((u1 *) mcodeptr)++) = imb.b[2]; \
-        *(((u1 *) mcodeptr)++) = imb.b[3]; \
-    } while (0)
-
-
-#define i386_emit_double64_high(imm) \
-    do { \
-        i386_imm_buf imb; \
-        imb.d = (double) (imm); \
-        *(((u1 *) mcodeptr)++) = imb.b[4]; \
-        *(((u1 *) mcodeptr)++) = imb.b[5]; \
-        *(((u1 *) mcodeptr)++) = imb.b[6]; \
-        *(((u1 *) mcodeptr)++) = imb.b[7]; \
+        *(mcodeptr++) = imb.b[0]; \
+        *(mcodeptr++) = imb.b[1]; \
+        *(mcodeptr++) = imb.b[2]; \
+        *(mcodeptr++) = imb.b[3]; \
     } while (0)
 
 
@@ -343,26 +323,38 @@ static const unsigned char i386_jcc_map[] = {
 
 
 
+void i386_emit_ialu(s4 alu_op, stackptr src, instruction *iptr);
+void i386_emit_ialuconst(s4 alu_op, stackptr src, instruction *iptr);
+void i386_emit_lalu(s4 alu_op, stackptr src, instruction *iptr);
+void i386_emit_laluconst(s4 alu_op, stackptr src, instruction *iptr);
+void i386_emit_ishift(s4 shift_op, stackptr src, instruction *iptr);
+void i386_emit_ishiftconst(s4 shift_op, stackptr src, instruction *iptr);
+void i386_emit_ifcc_iconst(s4 if_op, stackptr src, instruction *iptr);
+
+
+
+#if 0
+
 /*
  * mov ops
  */
 #define i386_mov_reg_reg(reg,dreg) \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0x89; \
+        *(mcodeptr++) = (u1) 0x89; \
         i386_emit_reg((reg),(dreg)); \
     } while (0)
 
 
 #define i386_mov_imm_reg(imm,reg) \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0xb8 + ((reg) & 0x07); \
+        *(mcodeptr++) = (u1) 0xb8 + ((reg) & 0x07); \
         i386_emit_imm32((imm)); \
     } while (0)
 
 
 #define i386_movb_imm_reg(imm,reg) \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0xc6; \
+        *(mcodeptr++) = (u1) 0xc6; \
         i386_emit_reg(0,(reg)); \
         i386_emit_imm8((imm)); \
     } while (0)
@@ -370,28 +362,28 @@ static const unsigned char i386_jcc_map[] = {
 
 #define i386_mov_float_reg(imm,reg) \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0xb8 + ((reg) & 0x07); \
+        *(mcodeptr++) = (u1) 0xb8 + ((reg) & 0x07); \
         i386_emit_float32((imm)); \
     } while (0)
 
 
 #define i386_mov_reg_mem(reg,mem) \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0x89; \
+        *(mcodeptr++) = (u1) 0x89; \
         i386_emit_mem((reg),(mem)); \
     } while (0)
 
 
 #define i386_mov_mem_reg(mem,reg) \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0x8b; \
+        *(mcodeptr++) = (u1) 0x8b; \
         i386_emit_mem((reg),(mem)); \
     } while (0)
 
 
 #define i386_mov_membase_reg(basereg,disp,reg) \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0x8b; \
+        *(mcodeptr++) = (u1) 0x8b; \
         i386_emit_membase((basereg),(disp),(reg)); \
     } while (0)
 
@@ -402,7 +394,7 @@ static const unsigned char i386_jcc_map[] = {
  */
 #define i386_mov_membase32_reg(basereg,disp,reg) \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0x8b; \
+        *(mcodeptr++) = (u1) 0x8b; \
         i386_address_byte(2, (reg), (basereg)); \
         i386_emit_imm32((disp)); \
     } while (0)
@@ -410,87 +402,87 @@ static const unsigned char i386_jcc_map[] = {
 
 #define i386_movw_membase_reg(basereg,disp,reg) \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0x66; \
+        *(mcodeptr++) = (u1) 0x66; \
         i386_mov_membase_reg((basereg),(disp),(reg)); \
     } while (0)
 
 
 #define i386_movb_membase_reg(basereg,disp,reg) \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0x8a; \
+        *(mcodeptr++) = (u1) 0x8a; \
         i386_emit_membase((basereg),(disp),(reg)); \
     } while (0)
 
 
 #define i386_mov_reg_membase(reg,basereg,disp) \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0x89; \
+        *(mcodeptr++) = (u1) 0x89; \
         i386_emit_membase((basereg),(disp),(reg)); \
     } while (0)
 
 
 #define i386_movw_reg_membase(reg,basereg,disp) \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0x66; \
-        *(((u1 *) mcodeptr)++) = (u1) 0x89; \
+        *(mcodeptr++) = (u1) 0x66; \
+        *(mcodeptr++) = (u1) 0x89; \
         i386_emit_membase((basereg),(disp),(reg)); \
     } while (0)
 
 
 #define i386_movb_reg_membase(reg,basereg,disp) \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0x88; \
+        *(mcodeptr++) = (u1) 0x88; \
         i386_emit_membase((basereg),(disp),(reg)); \
     } while (0)
 
 
 #define i386_mov_memindex_reg(disp,basereg,indexreg,scale,reg) \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0x8b; \
+        *(mcodeptr++) = (u1) 0x8b; \
         i386_emit_memindex((reg),(disp),(basereg),(indexreg),(scale)); \
     } while (0)
 
 
 #define i386_movw_memindex_reg(disp,basereg,indexreg,scale,reg) \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0x66; \
-        *(((u1 *) mcodeptr)++) = (u1) 0x8b; \
+        *(mcodeptr++) = (u1) 0x66; \
+        *(mcodeptr++) = (u1) 0x8b; \
         i386_emit_memindex((reg),(disp),(basereg),(indexreg),(scale)); \
     } while (0)
 
 
 #define i386_movb_memindex_reg(disp,basereg,indexreg,scale,reg) \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0x8a; \
+        *(mcodeptr++) = (u1) 0x8a; \
         i386_emit_memindex((reg),(disp),(basereg),(indexreg),(scale)); \
     } while (0)
 
 
 #define i386_mov_reg_memindex(reg,disp,basereg,indexreg,scale) \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0x89; \
+        *(mcodeptr++) = (u1) 0x89; \
         i386_emit_memindex((reg),(disp),(basereg),(indexreg),(scale)); \
     } while (0)
 
 
 #define i386_movw_reg_memindex(reg,disp,basereg,indexreg,scale) \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0x66; \
-        *(((u1 *) mcodeptr)++) = (u1) 0x89; \
+        *(mcodeptr++) = (u1) 0x66; \
+        *(mcodeptr++) = (u1) 0x89; \
         i386_emit_memindex((reg),(disp),(basereg),(indexreg),(scale)); \
     } while (0)
 
 
 #define i386_movb_reg_memindex(reg,disp,basereg,indexreg,scale) \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0x88; \
+        *(mcodeptr++) = (u1) 0x88; \
         i386_emit_memindex((reg),(disp),(basereg),(indexreg),(scale)); \
     } while (0)
 
 
 #define i386_mov_imm_membase(imm,basereg,disp) \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0xc7; \
+        *(mcodeptr++) = (u1) 0xc7; \
         i386_emit_membase((basereg),(disp),0); \
         i386_emit_imm32((imm)); \
     } while (0)
@@ -498,7 +490,7 @@ static const unsigned char i386_jcc_map[] = {
 
 #define i386_mov_float_membase(imm,basereg,disp) \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0xc7; \
+        *(mcodeptr++) = (u1) 0xc7; \
         i386_emit_membase((basereg),(disp),0); \
         i386_emit_float32((imm)); \
     } while (0)
@@ -506,7 +498,7 @@ static const unsigned char i386_jcc_map[] = {
 
 #define i386_mov_double_low_membase(imm,basereg,disp) \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0xc7; \
+        *(mcodeptr++) = (u1) 0xc7; \
         i386_emit_membase((basereg),(disp),0); \
         i386_emit_double64_low((imm)); \
     } while (0)
@@ -514,7 +506,7 @@ static const unsigned char i386_jcc_map[] = {
 
 #define i386_mov_double_high_membase(imm,basereg,disp) \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0xc7; \
+        *(mcodeptr++) = (u1) 0xc7; \
         i386_emit_membase((basereg),(disp),0); \
         i386_emit_double64_high((imm)); \
     } while (0)
@@ -522,24 +514,24 @@ static const unsigned char i386_jcc_map[] = {
 
 #define i386_movsbl_reg_reg(reg,dreg) \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0x0f; \
-        *(((u1 *) mcodeptr)++) = (u1) 0xbe; \
+        *(mcodeptr++) = (u1) 0x0f; \
+        *(mcodeptr++) = (u1) 0xbe; \
         i386_emit_reg((reg),(dreg)); \
     } while (0)
 
 
 #define i386_movswl_reg_reg(reg,dreg) \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0x0f; \
-        *(((u1 *) mcodeptr)++) = (u1) 0xbf; \
+        *(mcodeptr++) = (u1) 0x0f; \
+        *(mcodeptr++) = (u1) 0xbf; \
         i386_emit_reg((reg),(dreg)); \
     } while (0)
 
 
 #define i386_movzbl_reg_reg(reg,dreg) \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0x0f; \
-        *(((u1 *) mcodeptr)++) = (u1) 0xb6; \
+        *(mcodeptr++) = (u1) 0x0f; \
+        *(mcodeptr++) = (u1) 0xb6; \
         /* XXX: why do reg and dreg have to be exchanged */ \
         i386_emit_reg((dreg),(reg)); \
     } while (0)
@@ -547,8 +539,8 @@ static const unsigned char i386_jcc_map[] = {
 
 #define i386_movzwl_reg_reg(reg,dreg) \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0x0f; \
-        *(((u1 *) mcodeptr)++) = (u1) 0xb7; \
+        *(mcodeptr++) = (u1) 0x0f; \
+        *(mcodeptr++) = (u1) 0xb7; \
         /* XXX: why do reg and dreg have to be exchanged */ \
         i386_emit_reg((dreg),(reg)); \
     } while (0)
@@ -556,32 +548,32 @@ static const unsigned char i386_jcc_map[] = {
 
 #define i386_movsbl_memindex_reg(disp,basereg,indexreg,scale,reg) \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0x0f; \
-        *(((u1 *) mcodeptr)++) = (u1) 0xbe; \
+        *(mcodeptr++) = (u1) 0x0f; \
+        *(mcodeptr++) = (u1) 0xbe; \
         i386_emit_memindex((reg),(disp),(basereg),(indexreg),(scale)); \
     } while (0)
 
 
 #define i386_movswl_memindex_reg(disp,basereg,indexreg,scale,reg) \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0x0f; \
-        *(((u1 *) mcodeptr)++) = (u1) 0xbf; \
+        *(mcodeptr++) = (u1) 0x0f; \
+        *(mcodeptr++) = (u1) 0xbf; \
         i386_emit_memindex((reg),(disp),(basereg),(indexreg),(scale)); \
     } while (0)
 
 
 #define i386_movzbl_memindex_reg(disp,basereg,indexreg,scale,reg) \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0x0f; \
-        *(((u1 *) mcodeptr)++) = (u1) 0xb6; \
+        *(mcodeptr++) = (u1) 0x0f; \
+        *(mcodeptr++) = (u1) 0xb6; \
         i386_emit_memindex((reg),(disp),(basereg),(indexreg),(scale)); \
     } while (0)
 
 
 #define i386_movzwl_memindex_reg(disp,basereg,indexreg,scale,reg) \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0x0f; \
-        *(((u1 *) mcodeptr)++) = (u1) 0xb7; \
+        *(mcodeptr++) = (u1) 0x0f; \
+        *(mcodeptr++) = (u1) 0xb7; \
         i386_emit_memindex((reg),(disp),(basereg),(indexreg),(scale)); \
     } while (0)
 
@@ -592,21 +584,21 @@ static const unsigned char i386_jcc_map[] = {
  */
 #define i386_alu_reg_reg(opc,reg,dreg) \
     do { \
-        *(((u1 *) mcodeptr)++) = (((u1) (opc)) << 3) + 1; \
+        *(mcodeptr++) = (((u1) (opc)) << 3) + 1; \
         i386_emit_reg((reg),(dreg)); \
     } while (0)
 
 
 #define i386_alu_reg_membase(opc,reg,basereg,disp) \
     do { \
-        *(((u1 *) mcodeptr)++) = (((u1) (opc)) << 3) + 1; \
+        *(mcodeptr++) = (((u1) (opc)) << 3) + 1; \
         i386_emit_membase((basereg),(disp),(reg)); \
     } while (0)
 
 
 #define i386_alu_membase_reg(opc,basereg,disp,reg) \
     do { \
-        *(((u1 *) mcodeptr)++) = (((u1) (opc)) << 3) + 3; \
+        *(mcodeptr++) = (((u1) (opc)) << 3) + 3; \
         i386_emit_membase((basereg),(disp),(reg)); \
     } while (0)
 
@@ -614,11 +606,11 @@ static const unsigned char i386_jcc_map[] = {
 #define i386_alu_imm_reg(opc,imm,dreg) \
     do { \
         if (i386_is_imm8(imm)) { \
-            *(((u1 *) mcodeptr)++) = (u1) 0x83; \
+            *(mcodeptr++) = (u1) 0x83; \
             i386_emit_reg((opc),(dreg)); \
             i386_emit_imm8((imm)); \
         } else { \
-            *(((u1 *) mcodeptr)++) = (u1) 0x81; \
+            *(mcodeptr++) = (u1) 0x81; \
             i386_emit_reg((opc),(dreg)); \
             i386_emit_imm32((imm)); \
         } \
@@ -628,11 +620,11 @@ static const unsigned char i386_jcc_map[] = {
 #define i386_alu_imm_membase(opc,imm,basereg,disp) \
     do { \
         if (i386_is_imm8(imm)) { \
-            *(((u1 *) mcodeptr)++) = (u1) 0x83; \
+            *(mcodeptr++) = (u1) 0x83; \
             i386_emit_membase((basereg),(disp),(opc)); \
             i386_emit_imm8((imm)); \
         } else { \
-            *(((u1 *) mcodeptr)++) = (u1) 0x81; \
+            *(mcodeptr++) = (u1) 0x81; \
             i386_emit_membase((basereg),(disp),(opc)); \
             i386_emit_imm32((imm)); \
         } \
@@ -641,14 +633,14 @@ static const unsigned char i386_jcc_map[] = {
 
 #define i386_test_reg_reg(reg,dreg) \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0x85; \
+        *(mcodeptr++) = (u1) 0x85; \
         i386_emit_reg((reg),(dreg)); \
     } while (0)
 
 
 #define i386_test_imm_reg(imm,reg) \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0xf7; \
+        *(mcodeptr++) = (u1) 0xf7; \
         i386_emit_reg(0,(reg)); \
         i386_emit_imm32((imm)); \
     } while (0)
@@ -656,8 +648,8 @@ static const unsigned char i386_jcc_map[] = {
 
 #define i386_testw_imm_reg(imm,reg) \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0x66; \
-        *(((u1 *) mcodeptr)++) = (u1) 0xf7; \
+        *(mcodeptr++) = (u1) 0x66; \
+        *(mcodeptr++) = (u1) 0xf7; \
         i386_emit_reg(0,(reg)); \
         i386_emit_imm16((imm)); \
     } while (0)
@@ -665,7 +657,7 @@ static const unsigned char i386_jcc_map[] = {
 
 #define i386_testb_imm_reg(imm,reg) \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0xf6; \
+        *(mcodeptr++) = (u1) 0xf6; \
         i386_emit_reg(0,(reg)); \
         i386_emit_imm8((imm)); \
     } while (0)
@@ -676,23 +668,23 @@ static const unsigned char i386_jcc_map[] = {
  * inc, dec operations
  */
 #define i386_inc_reg(reg) \
-    *(((u1 *) mcodeptr)++) = (u1) 0x40 + ((reg) & 0x07);
+    *(mcodeptr++) = (u1) 0x40 + ((reg) & 0x07);
 
 
 #define i386_inc_membase(basereg,disp) \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0xff; \
+        *(mcodeptr++) = (u1) 0xff; \
         i386_emit_membase((basereg),(disp),0); \
     } while (0)
 
 
 #define i386_dec_reg(reg) \
-    *(((u1 *) mcodeptr)++) = (u1) 0x48 + ((reg) & 0x07);
+    *(mcodeptr++) = (u1) 0x48 + ((reg) & 0x07);
 
         
 #define i386_dec_membase(basereg,disp) \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0xff; \
+        *(mcodeptr++) = (u1) 0xff; \
         i386_emit_membase((basereg),(disp),1); \
     } while (0)
 
@@ -700,22 +692,22 @@ static const unsigned char i386_jcc_map[] = {
 
 
 #define i386_cltd() \
-    *(((u1 *) mcodeptr)++) = (u1) 0x99;
+    *(mcodeptr++) = (u1) 0x99;
 
 
 
 #define i386_imul_reg_reg(reg,dreg) \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0x0f; \
-        *(((u1 *) mcodeptr)++) = (u1) 0xaf; \
+        *(mcodeptr++) = (u1) 0x0f; \
+        *(mcodeptr++) = (u1) 0xaf; \
         i386_emit_reg((dreg),(reg)); \
     } while (0)
 
 
 #define i386_imul_membase_reg(basereg,disp,dreg) \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0x0f; \
-        *(((u1 *) mcodeptr)++) = (u1) 0xaf; \
+        *(mcodeptr++) = (u1) 0x0f; \
+        *(mcodeptr++) = (u1) 0xaf; \
         i386_emit_membase((basereg),(disp),(dreg)); \
     } while (0)
 
@@ -723,11 +715,11 @@ static const unsigned char i386_jcc_map[] = {
 #define i386_imul_imm_reg(imm,dreg) \
     do { \
         if (i386_is_imm8((imm))) { \
-            *(((u1 *) mcodeptr)++) = (u1) 0x6b; \
+            *(mcodeptr++) = (u1) 0x6b; \
             i386_emit_reg(0,(dreg)); \
             i386_emit_imm8((imm)); \
         } else { \
-            *(((u1 *) mcodeptr)++) = (u1) 0x69; \
+            *(mcodeptr++) = (u1) 0x69; \
             i386_emit_reg(0,(dreg)); \
             i386_emit_imm32((imm)); \
         } \
@@ -737,11 +729,11 @@ static const unsigned char i386_jcc_map[] = {
 #define i386_imul_imm_reg_reg(imm,reg,dreg) \
     do { \
         if (i386_is_imm8((imm))) { \
-            *(((u1 *) mcodeptr)++) = (u1) 0x6b; \
+            *(mcodeptr++) = (u1) 0x6b; \
             i386_emit_reg((dreg),(reg)); \
             i386_emit_imm8((imm)); \
         } else { \
-            *(((u1 *) mcodeptr)++) = (u1) 0x69; \
+            *(mcodeptr++) = (u1) 0x69; \
             i386_emit_reg((dreg),(reg)); \
             i386_emit_imm32((imm)); \
         } \
@@ -751,11 +743,11 @@ static const unsigned char i386_jcc_map[] = {
 #define i386_imul_imm_membase_reg(imm,basereg,disp,dreg) \
     do { \
         if (i386_is_imm8((imm))) { \
-            *(((u1 *) mcodeptr)++) = (u1) 0x6b; \
+            *(mcodeptr++) = (u1) 0x6b; \
             i386_emit_membase((basereg),(disp),(dreg)); \
             i386_emit_imm8((imm)); \
         } else { \
-            *(((u1 *) mcodeptr)++) = (u1) 0x69; \
+            *(mcodeptr++) = (u1) 0x69; \
             i386_emit_membase((basereg),(disp),(dreg)); \
             i386_emit_imm32((imm)); \
         } \
@@ -764,39 +756,39 @@ static const unsigned char i386_jcc_map[] = {
 
 #define i386_mul_reg(reg) \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0xf7; \
+        *(mcodeptr++) = (u1) 0xf7; \
         i386_emit_reg(4,(reg)); \
     } while (0)
 
 
 #define i386_mul_membase(basereg,disp) \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0xf7; \
+        *(mcodeptr++) = (u1) 0xf7; \
         i386_emit_membase((basereg),(disp),4); \
     } while (0)
 
 
 #define i386_idiv_reg(reg) \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0xf7; \
+        *(mcodeptr++) = (u1) 0xf7; \
         i386_emit_reg(7,(reg)); \
     } while (0)
 
 
 #define i386_idiv_membase(basereg,disp) \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0xf7; \
+        *(mcodeptr++) = (u1) 0xf7; \
         i386_emit_membase((basereg),(disp),7); \
     } while (0)
 
 
 
 #define i386_ret() \
-    *(((u1 *) mcodeptr)++) = (u1) 0xc3;
+    *(mcodeptr++) = (u1) 0xc3;
 
 
 #define i386_leave() \
-    *(((u1 *) mcodeptr)++) = (u1) 0xc9;
+    *(mcodeptr++) = (u1) 0xc9;
 
 
 
@@ -805,14 +797,14 @@ static const unsigned char i386_jcc_map[] = {
  */
 #define i386_shift_reg(opc,reg) \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0xd3; \
+        *(mcodeptr++) = (u1) 0xd3; \
         i386_emit_reg((opc),(reg)); \
     } while (0)
 
 
 #define i386_shift_membase(opc,basereg,disp) \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0xd3; \
+        *(mcodeptr++) = (u1) 0xd3; \
         i386_emit_membase((basereg),(disp),(opc)); \
     } while (0)
 
@@ -820,10 +812,10 @@ static const unsigned char i386_jcc_map[] = {
 #define i386_shift_imm_reg(opc,imm,dreg) \
     do { \
         if ((imm) == 1) { \
-            *(((u1 *) mcodeptr)++) = (u1) 0xd1; \
+            *(mcodeptr++) = (u1) 0xd1; \
             i386_emit_reg((opc),(dreg)); \
         } else { \
-            *(((u1 *) mcodeptr)++) = (u1) 0xc1; \
+            *(mcodeptr++) = (u1) 0xc1; \
             i386_emit_reg((opc),(dreg)); \
             i386_emit_imm8((imm)); \
         } \
@@ -833,10 +825,10 @@ static const unsigned char i386_jcc_map[] = {
 #define i386_shift_imm_membase(opc,imm,basereg,disp) \
     do { \
         if ((imm) == 1) { \
-            *(((u1 *) mcodeptr)++) = (u1) 0xd1; \
+            *(mcodeptr++) = (u1) 0xd1; \
             i386_emit_membase((basereg),(disp),(opc)); \
         } else { \
-            *(((u1 *) mcodeptr)++) = (u1) 0xc1; \
+            *(mcodeptr++) = (u1) 0xc1; \
             i386_emit_membase((basereg),(disp),(opc)); \
             i386_emit_imm8((imm)); \
         } \
@@ -845,16 +837,16 @@ static const unsigned char i386_jcc_map[] = {
 
 #define i386_shld_reg_reg(reg,dreg) \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0x0f; \
-        *(((u1 *) mcodeptr)++) = (u1) 0xa5; \
+        *(mcodeptr++) = (u1) 0x0f; \
+        *(mcodeptr++) = (u1) 0xa5; \
         i386_emit_reg((reg),(dreg)); \
     } while (0)
 
 
 #define i386_shld_imm_reg_reg(imm,reg,dreg) \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0x0f; \
-        *(((u1 *) mcodeptr)++) = (u1) 0xa4; \
+        *(mcodeptr++) = (u1) 0x0f; \
+        *(mcodeptr++) = (u1) 0xa4; \
         i386_emit_reg((reg),(dreg)); \
         i386_emit_imm8((imm)); \
     } while (0)
@@ -862,24 +854,24 @@ static const unsigned char i386_jcc_map[] = {
 
 #define i386_shld_reg_membase(reg,basereg,disp) \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0x0f; \
-        *(((u1 *) mcodeptr)++) = (u1) 0xa5; \
+        *(mcodeptr++) = (u1) 0x0f; \
+        *(mcodeptr++) = (u1) 0xa5; \
         i386_emit_membase((basereg),(disp),(reg)); \
     } while (0)
 
 
 #define i386_shrd_reg_reg(reg,dreg) \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0x0f; \
-        *(((u1 *) mcodeptr)++) = (u1) 0xad; \
+        *(mcodeptr++) = (u1) 0x0f; \
+        *(mcodeptr++) = (u1) 0xad; \
         i386_emit_reg((reg),(dreg)); \
     } while (0)
 
 
 #define i386_shrd_imm_reg_reg(imm,reg,dreg) \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0x0f; \
-        *(((u1 *) mcodeptr)++) = (u1) 0xac; \
+        *(mcodeptr++) = (u1) 0x0f; \
+        *(mcodeptr++) = (u1) 0xac; \
         i386_emit_reg((reg),(dreg)); \
         i386_emit_imm8((imm)); \
     } while (0)
@@ -887,8 +879,8 @@ static const unsigned char i386_jcc_map[] = {
 
 #define i386_shrd_reg_membase(reg,basereg,disp) \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0x0f; \
-        *(((u1 *) mcodeptr)++) = (u1) 0xad; \
+        *(mcodeptr++) = (u1) 0x0f; \
+        *(mcodeptr++) = (u1) 0xad; \
         i386_emit_membase((basereg),(disp),(reg)); \
     } while (0)
 
@@ -899,22 +891,22 @@ static const unsigned char i386_jcc_map[] = {
  */
 #define i386_jmp_imm(imm) \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0xe9; \
+        *(mcodeptr++) = (u1) 0xe9; \
         i386_emit_imm32((imm)); \
     } while (0)
 
 
 #define i386_jmp_reg(reg) \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0xff; \
+        *(mcodeptr++) = (u1) 0xff; \
         i386_emit_reg(4,(reg)); \
     } while (0)
 
 
 #define i386_jcc(opc,imm) \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0x0f; \
-        *(((u1 *) mcodeptr)++) = (u1) (0x80 + i386_jcc_map[(opc)]); \
+        *(mcodeptr++) = (u1) 0x0f; \
+        *(mcodeptr++) = (u1) (0x80 + i386_jcc_map[(opc)]); \
         i386_emit_imm32((imm)); \
     } while (0)
 
@@ -925,16 +917,16 @@ static const unsigned char i386_jcc_map[] = {
  */
 #define i386_setcc_reg(opc,reg) \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0x0f; \
-        *(((u1 *) mcodeptr)++) = (u1) (0x90 + i386_jcc_map[(opc)]); \
+        *(mcodeptr++) = (u1) 0x0f; \
+        *(mcodeptr++) = (u1) (0x90 + i386_jcc_map[(opc)]); \
         i386_emit_reg(0,(reg)); \
     } while (0)
 
 
 #define i386_setcc_membase(opc,basereg,disp) \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0x0f; \
-        *(((u1 *) mcodeptr)++) = (u1) (0x90 + i386_jcc_map[(opc)]); \
+        *(mcodeptr++) = (u1) 0x0f; \
+        *(mcodeptr++) = (u1) (0x90 + i386_jcc_map[(opc)]); \
         i386_emit_membase((basereg),(disp),0); \
     } while (0)
 
@@ -942,50 +934,50 @@ static const unsigned char i386_jcc_map[] = {
 
 #define i386_neg_reg(reg) \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0xf7; \
+        *(mcodeptr++) = (u1) 0xf7; \
         i386_emit_reg(3,(reg)); \
     } while (0)
 
 
 #define i386_neg_mem(mem) \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0xf7; \
+        *(mcodeptr++) = (u1) 0xf7; \
         i386_emit_mem(3,(mem)); \
     } while (0)
 
 
 #define i386_neg_membase(basereg,disp) \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0xf7; \
+        *(mcodeptr++) = (u1) 0xf7; \
         i386_emit_membase((basereg),(disp),3); \
     } while (0)
 
 
 
 #define i386_push_reg(reg) \
-    *(((u1 *) mcodeptr)++) = (u1) 0x50 + (0x07 & (reg));
+    *(mcodeptr++) = (u1) 0x50 + (0x07 & (reg));
 
 
 #define i386_push_membase(basereg,disp) \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0xff; \
+        *(mcodeptr++) = (u1) 0xff; \
         i386_emit_membase((basereg),(disp),6); \
     } while (0)
 
 
 #define i386_push_imm(imm) \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0x68; \
+        *(mcodeptr++) = (u1) 0x68; \
         i386_emit_imm32((imm)); \
     } while (0)
 
 
 #define i386_pop_reg(reg) \
-    *(((u1 *) mcodeptr)++) = (u1) 0x58 + (0x07 & (reg));
+    *(mcodeptr++) = (u1) 0x58 + (0x07 & (reg));
 
 
 #define i386_nop() \
-    *(((u1 *) mcodeptr)++) = (u1) 0x90;
+    *(mcodeptr++) = (u1) 0x90;
 
 
 
@@ -994,14 +986,14 @@ static const unsigned char i386_jcc_map[] = {
  */
 #define i386_call_reg(reg) \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0xff; \
+        *(mcodeptr++) = (u1) 0xff; \
         i386_emit_reg(2,(reg)); \
     } while (0)
 
 
 #define i386_call_imm(imm) \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0xe8; \
+        *(mcodeptr++) = (u1) 0xe8; \
         i386_emit_imm32((imm)); \
     } while (0)
 
@@ -1012,77 +1004,77 @@ static const unsigned char i386_jcc_map[] = {
  */
 #define i386_fld1() \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0xd9; \
-        *(((u1 *) mcodeptr)++) = (u1) 0xe8; \
+        *(mcodeptr++) = (u1) 0xd9; \
+        *(mcodeptr++) = (u1) 0xe8; \
     } while (0)
 
 
 #define i386_fldz() \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0xd9; \
-        *(((u1 *) mcodeptr)++) = (u1) 0xee; \
+        *(mcodeptr++) = (u1) 0xd9; \
+        *(mcodeptr++) = (u1) 0xee; \
     } while (0)
 
 
 #define i386_fld_reg(reg) \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0xd9; \
-        *(((u1 *) mcodeptr)++) = (u1) 0xc0 + (0x07 & (reg)); \
+        *(mcodeptr++) = (u1) 0xd9; \
+        *(mcodeptr++) = (u1) 0xc0 + (0x07 & (reg)); \
     } while (0)
 
 
 #define i386_flds_mem(mem) \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0xd9; \
+        *(mcodeptr++) = (u1) 0xd9; \
         i386_emit_mem(0,(mem)); \
     } while (0)
 
 
 #define i386_fldl_mem(mem) \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0xdd; \
+        *(mcodeptr++) = (u1) 0xdd; \
         i386_emit_mem(0,(mem)); \
     } while (0)
 
 
 #define i386_fldt_mem(mem) \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0xdb; \
+        *(mcodeptr++) = (u1) 0xdb; \
         i386_emit_mem(5,(mem)); \
     } while (0)
 
 
 #define i386_flds_membase(basereg,disp) \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0xd9; \
+        *(mcodeptr++) = (u1) 0xd9; \
         i386_emit_membase((basereg),(disp),0); \
     } while (0)
 
 
 #define i386_fldl_membase(basereg,disp) \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0xdd; \
+        *(mcodeptr++) = (u1) 0xdd; \
         i386_emit_membase((basereg),(disp),0); \
     } while (0)
 
 
 #define i386_fldt_membase(basereg,disp) \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0xdb; \
+        *(mcodeptr++) = (u1) 0xdb; \
         i386_emit_membase((basereg),(disp),5); \
     } while (0)
 
 
 #define i386_flds_memindex(disp,basereg,indexreg,scale) \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0xd9; \
+        *(mcodeptr++) = (u1) 0xd9; \
         i386_emit_memindex(0,(disp),(basereg),(indexreg),(scale)); \
     } while (0)
 
 
 #define i386_fldl_memindex(disp,basereg,indexreg,scale) \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0xdd; \
+        *(mcodeptr++) = (u1) 0xdd; \
         i386_emit_memindex(0,(disp),(basereg),(indexreg),(scale)); \
     } while (0)
 
@@ -1091,21 +1083,21 @@ static const unsigned char i386_jcc_map[] = {
 
 #define i386_fildl_mem(mem) \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0xdb; \
+        *(mcodeptr++) = (u1) 0xdb; \
         i386_emit_mem(0,(mem)); \
     } while (0)
 
 
 #define i386_fildl_membase(basereg,disp) \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0xdb; \
+        *(mcodeptr++) = (u1) 0xdb; \
         i386_emit_membase((basereg),(disp),0); \
     } while (0)
 
 
 #define i386_fildll_membase(basereg,disp) \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0xdf; \
+        *(mcodeptr++) = (u1) 0xdf; \
         i386_emit_membase((basereg),(disp),5); \
     } while (0)
 
@@ -1114,49 +1106,49 @@ static const unsigned char i386_jcc_map[] = {
 
 #define i386_fst_reg(reg) \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0xdd; \
-        *(((u1 *) mcodeptr)++) = (u1) 0xd0 + (0x07 & (reg)); \
+        *(mcodeptr++) = (u1) 0xdd; \
+        *(mcodeptr++) = (u1) 0xd0 + (0x07 & (reg)); \
     } while (0)
 
 
 #define i386_fsts_mem(mem) \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0xd9; \
+        *(mcodeptr++) = (u1) 0xd9; \
         i386_emit_mem(2,(mem)); \
     } while (0)
 
 
 #define i386_fstl_mem(mem) \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0xdd; \
+        *(mcodeptr++) = (u1) 0xdd; \
         i386_emit_mem(2,(mem)); \
     } while (0)
 
 
 #define i386_fsts_membase(basereg,disp) \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0xd9; \
+        *(mcodeptr++) = (u1) 0xd9; \
         i386_emit_membase((basereg),(disp),2); \
     } while (0)
 
 
 #define i386_fstl_membase(basereg,disp) \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0xdd; \
+        *(mcodeptr++) = (u1) 0xdd; \
         i386_emit_membase((basereg),(disp),2); \
     } while (0)
 
 
 #define i386_fsts_memindex(disp,basereg,indexreg,scale) \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0xd9; \
+        *(mcodeptr++) = (u1) 0xd9; \
         i386_emit_memindex(2,(disp),(basereg),(indexreg),(scale)); \
     } while (0)
 
 
 #define i386_fstl_memindex(disp,basereg,indexreg,scale) \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0xdd; \
+        *(mcodeptr++) = (u1) 0xdd; \
         i386_emit_memindex(2,(disp),(basereg),(indexreg),(scale)); \
     } while (0)
 
@@ -1165,56 +1157,56 @@ static const unsigned char i386_jcc_map[] = {
 
 #define i386_fstp_reg(reg) \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0xdd; \
-        *(((u1 *) mcodeptr)++) = (u1) 0xd8 + (0x07 & (reg)); \
+        *(mcodeptr++) = (u1) 0xdd; \
+        *(mcodeptr++) = (u1) 0xd8 + (0x07 & (reg)); \
     } while (0)
 
 
 #define i386_fstps_mem(mem) \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0xd9; \
+        *(mcodeptr++) = (u1) 0xd9; \
         i386_emit_mem(3,(mem)); \
     } while (0)
 
 
 #define i386_fstpl_mem(mem) \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0xdd; \
+        *(mcodeptr++) = (u1) 0xdd; \
         i386_emit_mem(3,(mem)); \
     } while (0)
 
 
 #define i386_fstps_membase(basereg,disp) \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0xd9; \
+        *(mcodeptr++) = (u1) 0xd9; \
         i386_emit_membase((basereg),(disp),3); \
     } while (0)
 
 
 #define i386_fstpl_membase(basereg,disp) \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0xdd; \
+        *(mcodeptr++) = (u1) 0xdd; \
         i386_emit_membase((basereg),(disp),3); \
     } while (0)
 
 
 #define i386_fstpt_membase(basereg,disp) \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0xdb; \
+        *(mcodeptr++) = (u1) 0xdb; \
         i386_emit_membase((basereg),(disp),7); \
     } while (0)
 
 
 #define i386_fstps_memindex(disp,basereg,indexreg,scale) \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0xd9; \
+        *(mcodeptr++) = (u1) 0xd9; \
         i386_emit_memindex(3,(disp),(basereg),(indexreg),(scale)); \
     } while (0)
 
 
 #define i386_fstpl_memindex(disp,basereg,indexreg,scale) \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0xdd; \
+        *(mcodeptr++) = (u1) 0xdd; \
         i386_emit_memindex(3,(disp),(basereg),(indexreg),(scale)); \
     } while (0)
 
@@ -1223,35 +1215,35 @@ static const unsigned char i386_jcc_map[] = {
 
 #define i386_fistpl_mem(mem) \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0xdb; \
+        *(mcodeptr++) = (u1) 0xdb; \
         i386_emit_mem(3,(mem)); \
     } while (0)
 
 
 #define i386_fistpll_mem(mem) \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0xdf; \
+        *(mcodeptr++) = (u1) 0xdf; \
         i386_emit_mem(7,(mem)); \
     } while (0)
 
 
 #define i386_fistl_membase(basereg,disp) \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0xdb; \
+        *(mcodeptr++) = (u1) 0xdb; \
         i386_emit_membase((basereg),(disp),2); \
     } while (0)
 
 
 #define i386_fistpl_membase(basereg,disp) \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0xdb; \
+        *(mcodeptr++) = (u1) 0xdb; \
         i386_emit_membase((basereg),(disp),3); \
     } while (0)
 
 
 #define i386_fistpll_membase(basereg,disp) \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0xdf; \
+        *(mcodeptr++) = (u1) 0xdf; \
         i386_emit_membase((basereg),(disp),7); \
     } while (0)
 
@@ -1260,278 +1252,412 @@ static const unsigned char i386_jcc_map[] = {
 
 #define i386_fchs() \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0xd9; \
-        *(((u1 *) mcodeptr)++) = (u1) 0xe0; \
+        *(mcodeptr++) = (u1) 0xd9; \
+        *(mcodeptr++) = (u1) 0xe0; \
     } while (0)
 
 
 #define i386_faddp() \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0xde; \
-        *(((u1 *) mcodeptr)++) = (u1) 0xc1; \
+        *(mcodeptr++) = (u1) 0xde; \
+        *(mcodeptr++) = (u1) 0xc1; \
     } while (0)
 
 
 #define i386_fadd_reg_st(reg) \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0xd8; \
-        *(((u1 *) mcodeptr)++) = (u1) 0xc0 + (0x0f & (reg)); \
+        *(mcodeptr++) = (u1) 0xd8; \
+        *(mcodeptr++) = (u1) 0xc0 + (0x0f & (reg)); \
     } while (0)
 
 
 #define i386_fadd_st_reg(reg) \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0xdc; \
-        *(((u1 *) mcodeptr)++) = (u1) 0xc0 + (0x0f & (reg)); \
+        *(mcodeptr++) = (u1) 0xdc; \
+        *(mcodeptr++) = (u1) 0xc0 + (0x0f & (reg)); \
     } while (0)
 
 
 #define i386_faddp_st_reg(reg) \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0xde; \
-        *(((u1 *) mcodeptr)++) = (u1) 0xc0 + (0x0f & (reg)); \
+        *(mcodeptr++) = (u1) 0xde; \
+        *(mcodeptr++) = (u1) 0xc0 + (0x0f & (reg)); \
     } while (0)
 
 
 #define i386_fadds_membase(basereg,disp) \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0xd8; \
+        *(mcodeptr++) = (u1) 0xd8; \
         i386_emit_membase((basereg),(disp),0); \
     } while (0)
 
 
 #define i386_faddl_membase(basereg,disp) \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0xdc; \
+        *(mcodeptr++) = (u1) 0xdc; \
         i386_emit_membase((basereg),(disp),0); \
     } while (0)
 
 
 #define i386_fsub_reg_st(reg) \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0xd8; \
-        *(((u1 *) mcodeptr)++) = (u1) 0xe0 + (0x07 & (reg)); \
+        *(mcodeptr++) = (u1) 0xd8; \
+        *(mcodeptr++) = (u1) 0xe0 + (0x07 & (reg)); \
     } while (0)
 
 
 #define i386_fsub_st_reg(reg) \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0xdc; \
-        *(((u1 *) mcodeptr)++) = (u1) 0xe8 + (0x07 & (reg)); \
+        *(mcodeptr++) = (u1) 0xdc; \
+        *(mcodeptr++) = (u1) 0xe8 + (0x07 & (reg)); \
     } while (0)
 
 
 #define i386_fsubp_st_reg(reg) \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0xde; \
-        *(((u1 *) mcodeptr)++) = (u1) 0xe8 + (0x07 & (reg)); \
+        *(mcodeptr++) = (u1) 0xde; \
+        *(mcodeptr++) = (u1) 0xe8 + (0x07 & (reg)); \
     } while (0)
 
 
 #define i386_fsubp() \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0xde; \
-        *(((u1 *) mcodeptr)++) = (u1) 0xe9; \
+        *(mcodeptr++) = (u1) 0xde; \
+        *(mcodeptr++) = (u1) 0xe9; \
     } while (0)
 
 
 #define i386_fsubs_membase(basereg,disp) \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0xd8; \
+        *(mcodeptr++) = (u1) 0xd8; \
         i386_emit_membase((basereg),(disp),4); \
     } while (0)
 
 
 #define i386_fsubl_membase(basereg,disp) \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0xdc; \
+        *(mcodeptr++) = (u1) 0xdc; \
         i386_emit_membase((basereg),(disp),4); \
     } while (0)
 
 
 #define i386_fmul_reg_st(reg) \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0xd8; \
-        *(((u1 *) mcodeptr)++) = (u1) 0xc8 + (0x07 & (reg)); \
+        *(mcodeptr++) = (u1) 0xd8; \
+        *(mcodeptr++) = (u1) 0xc8 + (0x07 & (reg)); \
     } while (0)
 
 
 #define i386_fmul_st_reg(reg) \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0xdc; \
-        *(((u1 *) mcodeptr)++) = (u1) 0xc8 + (0x07 & (reg)); \
+        *(mcodeptr++) = (u1) 0xdc; \
+        *(mcodeptr++) = (u1) 0xc8 + (0x07 & (reg)); \
     } while (0)
 
 
 #define i386_fmulp() \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0xde; \
-        *(((u1 *) mcodeptr)++) = (u1) 0xc9; \
+        *(mcodeptr++) = (u1) 0xde; \
+        *(mcodeptr++) = (u1) 0xc9; \
     } while (0)
 
 
 #define i386_fmulp_st_reg(reg) \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0xde; \
-        *(((u1 *) mcodeptr)++) = (u1) 0xc8 + (0x07 & (reg)); \
+        *(mcodeptr++) = (u1) 0xde; \
+        *(mcodeptr++) = (u1) 0xc8 + (0x07 & (reg)); \
     } while (0)
 
 
 #define i386_fmuls_membase(basereg,disp) \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0xd8; \
+        *(mcodeptr++) = (u1) 0xd8; \
         i386_emit_membase((basereg),(disp),1); \
     } while (0)
 
 
 #define i386_fmull_membase(basereg,disp) \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0xdc; \
+        *(mcodeptr++) = (u1) 0xdc; \
         i386_emit_membase((basereg),(disp),1); \
     } while (0)
 
 
 #define i386_fdiv_reg_st(reg) \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0xd8; \
-        *(((u1 *) mcodeptr)++) = (u1) 0xf0 + (0x07 & (reg)); \
+        *(mcodeptr++) = (u1) 0xd8; \
+        *(mcodeptr++) = (u1) 0xf0 + (0x07 & (reg)); \
     } while (0)
 
 
 #define i386_fdiv_st_reg(reg) \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0xdc; \
-        *(((u1 *) mcodeptr)++) = (u1) 0xf8 + (0x07 & (reg)); \
+        *(mcodeptr++) = (u1) 0xdc; \
+        *(mcodeptr++) = (u1) 0xf8 + (0x07 & (reg)); \
     } while (0)
 
 
 #define i386_fdivp() \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0xde; \
-        *(((u1 *) mcodeptr)++) = (u1) 0xf9; \
+        *(mcodeptr++) = (u1) 0xde; \
+        *(mcodeptr++) = (u1) 0xf9; \
     } while (0)
 
 
 #define i386_fdivp_st_reg(reg) \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0xde; \
-        *(((u1 *) mcodeptr)++) = (u1) 0xf8 + (0x07 & (reg)); \
+        *(mcodeptr++) = (u1) 0xde; \
+        *(mcodeptr++) = (u1) 0xf8 + (0x07 & (reg)); \
     } while (0)
 
 
 #define i386_fxch() \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0xd9; \
-        *(((u1 *) mcodeptr)++) = (u1) 0xc9; \
+        *(mcodeptr++) = (u1) 0xd9; \
+        *(mcodeptr++) = (u1) 0xc9; \
     } while (0)
 
 
 #define i386_fxch_reg(reg) \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0xd9; \
-        *(((u1 *) mcodeptr)++) = (u1) 0xc8 + (0x07 & (reg)); \
+        *(mcodeptr++) = (u1) 0xd9; \
+        *(mcodeptr++) = (u1) 0xc8 + (0x07 & (reg)); \
     } while (0)
 
 
 #define i386_fprem() \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0xd9; \
-        *(((u1 *) mcodeptr)++) = (u1) 0xf8; \
+        *(mcodeptr++) = (u1) 0xd9; \
+        *(mcodeptr++) = (u1) 0xf8; \
     } while (0)
 
 
 #define i386_fprem1() \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0xd9; \
-        *(((u1 *) mcodeptr)++) = (u1) 0xf5; \
+        *(mcodeptr++) = (u1) 0xd9; \
+        *(mcodeptr++) = (u1) 0xf5; \
     } while (0)
 
 
 #define i386_fucom() \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0xdd; \
-        *(((u1 *) mcodeptr)++) = (u1) 0xe1; \
+        *(mcodeptr++) = (u1) 0xdd; \
+        *(mcodeptr++) = (u1) 0xe1; \
     } while (0)
 
 
 #define i386_fucom_reg(reg) \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0xdd; \
-        *(((u1 *) mcodeptr)++) = (u1) 0xe0 + (0x07 & (reg)); \
+        *(mcodeptr++) = (u1) 0xdd; \
+        *(mcodeptr++) = (u1) 0xe0 + (0x07 & (reg)); \
     } while (0)
 
 
 #define i386_fucomp_reg(reg) \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0xdd; \
-        *(((u1 *) mcodeptr)++) = (u1) 0xe8 + (0x07 & (reg)); \
+        *(mcodeptr++) = (u1) 0xdd; \
+        *(mcodeptr++) = (u1) 0xe8 + (0x07 & (reg)); \
     } while (0)
 
 
 #define i386_fucompp() \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0xda; \
-        *(((u1 *) mcodeptr)++) = (u1) 0xe9; \
+        *(mcodeptr++) = (u1) 0xda; \
+        *(mcodeptr++) = (u1) 0xe9; \
     } while (0)
 
 
 #define i386_fnstsw() \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0xdf; \
-        *(((u1 *) mcodeptr)++) = (u1) 0xe0; \
+        *(mcodeptr++) = (u1) 0xdf; \
+        *(mcodeptr++) = (u1) 0xe0; \
     } while (0)
 
 
 #define i386_sahf() \
-    *(((u1 *) mcodeptr)++) = (u1) 0x9e;
+    *(mcodeptr++) = (u1) 0x9e;
 
 
 #define i386_finit() \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0x9b; \
-        *(((u1 *) mcodeptr)++) = (u1) 0xdb; \
-        *(((u1 *) mcodeptr)++) = (u1) 0xe3; \
+        *(mcodeptr++) = (u1) 0x9b; \
+        *(mcodeptr++) = (u1) 0xdb; \
+        *(mcodeptr++) = (u1) 0xe3; \
     } while (0)
 
 
 #define i386_fldcw_mem(mem) \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0xd9; \
+        *(mcodeptr++) = (u1) 0xd9; \
         i386_emit_mem(5,(mem)); \
     } while (0)
 
 
 #define i386_fldcw_membase(basereg,disp) \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0xd9; \
+        *(mcodeptr++) = (u1) 0xd9; \
         i386_emit_membase((basereg),(disp),5); \
     } while (0)
 
 
 #define i386_wait() \
-    *(((u1 *) mcodeptr)++) = (u1) 0x9b;
+    *(mcodeptr++) = (u1) 0x9b;
 
 
 #define i386_ffree_reg(reg) \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0xdd; \
-        *(((u1 *) mcodeptr)++) = (u1) 0xc0 + (0x07 & (reg)); \
+        *(mcodeptr++) = (u1) 0xdd; \
+        *(mcodeptr++) = (u1) 0xc0 + (0x07 & (reg)); \
     } while (0)
 
 
 #define i386_fdecstp() \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0xd9; \
-        *(((u1 *) mcodeptr)++) = (u1) 0xf6; \
+        *(mcodeptr++) = (u1) 0xd9; \
+        *(mcodeptr++) = (u1) 0xf6; \
     } while (0)
 
 
 #define i386_fincstp() \
     do { \
-        *(((u1 *) mcodeptr)++) = (u1) 0xd9; \
-        *(((u1 *) mcodeptr)++) = (u1) 0xf7; \
+        *(mcodeptr++) = (u1) 0xd9; \
+        *(mcodeptr++) = (u1) 0xf7; \
     } while (0)
 
+#else
+
+/*
+ * integer instructions
+ */
+void i386_mov_reg_reg(s4 reg, s4 dreg);
+void i386_mov_imm_reg(s4 imm, s4 dreg);
+void i386_movb_imm_reg(s4 imm, s4 dreg);
+void i386_mov_membase_reg(s4 basereg, s4 disp, s4 reg);
+void i386_mov_membase32_reg(s4 basereg, s4 disp, s4 reg);
+void i386_mov_reg_membase(s4 reg, s4 basereg, s4 disp);
+void i386_mov_memindex_reg(s4 disp, s4 basereg, s4 indexreg, s4 scale, s4 reg);
+void i386_mov_reg_memindex(s4 reg, s4 disp, s4 basereg, s4 indexreg, s4 scale);
+void i386_movw_reg_memindex(s4 reg, s4 disp, s4 basereg, s4 indexreg, s4 scale);
+void i386_movb_reg_memindex(s4 reg, s4 disp, s4 basereg, s4 indexreg, s4 scale);
+void i386_mov_imm_membase(s4 imm, s4 basereg, s4 disp);
+void i386_movsbl_memindex_reg(s4 disp, s4 basereg, s4 indexreg, s4 scale, s4 reg);
+void i386_movswl_memindex_reg(s4 disp, s4 basereg, s4 indexreg, s4 scale, s4 reg);
+void i386_movzwl_memindex_reg(s4 disp, s4 basereg, s4 indexreg, s4 scale, s4 reg);
+void i386_alu_reg_reg(s4 opc, s4 reg, s4 dreg);
+void i386_alu_reg_membase(s4 opc, s4 reg, s4 basereg, s4 disp);
+void i386_alu_membase_reg(s4 opc, s4 basereg, s4 disp, s4 reg);
+void i386_alu_imm_reg(s4 opc, s4 imm, s4 reg);
+void i386_alu_imm_membase(s4 opc, s4 imm, s4 basereg, s4 disp);
+void i386_test_reg_reg(s4 reg, s4 dreg);
+void i386_test_imm_reg(s4 imm, s4 dreg);
+void i386_inc_reg(s4 reg);
+void i386_inc_membase(s4 basereg, s4 disp);
+void i386_dec_reg(s4 reg);
+void i386_dec_membase(s4 basereg, s4 disp);
+void i386_cltd();
+void i386_imul_reg_reg(s4 reg, s4 dreg);
+void i386_imul_membase_reg(s4 basereg, s4 disp, s4 dreg);
+void i386_imul_imm_reg(s4 imm, s4 reg);
+void i386_imul_imm_reg_reg(s4 imm, s4 reg, s4 dreg);
+void i386_imul_imm_membase_reg(s4 imm, s4 basereg, s4 disp, s4 dreg);
+void i386_mul_membase(s4 basereg, s4 disp);
+void i386_idiv_reg(s4 reg);
+void i386_ret();
+void i386_shift_reg(s4 opc, s4 reg);
+void i386_shift_membase(s4 opc, s4 basereg, s4 disp);
+void i386_shift_imm_reg(s4 opc, s4 imm, s4 reg);
+void i386_shift_imm_membase(s4 opc, s4 imm, s4 basereg, s4 disp);
+void i386_shld_reg_reg(s4 reg, s4 dreg);
+void i386_shld_imm_reg_reg(s4 imm, s4 reg, s4 dreg);
+void i386_shld_reg_membase(s4 reg, s4 basereg, s4 disp);
+void i386_shrd_reg_reg(s4 reg, s4 dreg);
+void i386_shrd_imm_reg_reg(s4 imm, s4 reg, s4 dreg);
+void i386_shrd_reg_membase(s4 reg, s4 basereg, s4 disp);
+void i386_jmp_imm(s4 imm);
+void i386_jmp_reg(s4 reg);
+void i386_jcc(s4 opc, s4 imm);
+void i386_setcc_reg(s4 opc, s4 reg);
+void i386_setcc_membase(s4 opc, s4 basereg, s4 disp);
+void i386_neg_reg(s4 reg);
+void i386_neg_membase(s4 basereg, s4 disp);
+void i386_push_imm(s4 imm);
+void i386_pop_reg(s4 reg);
+void i386_nop();
+void i386_call_reg(s4 reg);
+void i386_call_imm(s4 imm);
+
+
+
+/*
+ * floating point instructions
+ */
+void i386_fld1();
+void i386_fldz();
+void i386_fld_reg(s4 reg);
+void i386_flds_membase(s4 basereg, s4 disp);
+void i386_fldl_membase(s4 basereg, s4 disp);
+void i386_fldt_membase(s4 basereg, s4 disp);
+void i386_flds_memindex(s4 disp, s4 basereg, s4 indexreg, s4 scale);
+void i386_fldl_memindex(s4 disp, s4 basereg, s4 indexreg, s4 scale);
+void i386_fildl_membase(s4 basereg, s4 disp);
+void i386_fildll_membase(s4 basereg, s4 disp);
+void i386_fst_reg(s4 reg);
+void i386_fsts_membase(s4 basereg, s4 disp);
+void i386_fstl_membase(s4 basereg, s4 disp);
+void i386_fsts_memindex(s4 disp, s4 basereg, s4 indexreg, s4 scale);
+void i386_fstl_memindex(s4 disp, s4 basereg, s4 indexreg, s4 scale);
+void i386_fstp_reg(s4 reg);
+void i386_fstps_membase(s4 basereg, s4 disp);
+void i386_fstpl_membase(s4 basereg, s4 disp);
+void i386_fstpt_membase(s4 basereg, s4 disp);
+void i386_fstps_memindex(s4 disp, s4 basereg, s4 indexreg, s4 scale);
+void i386_fstpl_memindex(s4 disp, s4 basereg, s4 indexreg, s4 scale);
+void i386_fistl_membase(s4 basereg, s4 disp);
+void i386_fistpl_membase(s4 basereg, s4 disp);
+void i386_fistpll_membase(s4 basereg, s4 disp);
+void i386_fchs();
+void i386_faddp();
+void i386_fadd_reg_st(s4 reg);
+void i386_fadd_st_reg(s4 reg);
+void i386_faddp_st_reg(s4 reg);
+void i386_fadds_membase(s4 basereg, s4 disp);
+void i386_faddl_membase(s4 basereg, s4 disp);
+void i386_fsub_reg_st(s4 reg);
+void i386_fsub_st_reg(s4 reg);
+void i386_fsubp_st_reg(s4 reg);
+void i386_fsubp();
+void i386_fsubs_membase(s4 basereg, s4 disp);
+void i386_fsubl_membase(s4 basereg, s4 disp);
+void i386_fmul_reg_st(s4 reg);
+void i386_fmul_st_reg(s4 reg);
+void i386_fmulp();
+void i386_fmulp_st_reg(s4 reg);
+void i386_fmuls_membase(s4 basereg, s4 disp);
+void i386_fmull_membase(s4 basereg, s4 disp);
+void i386_fdiv_reg_st(s4 reg);
+void i386_fdiv_st_reg(s4 reg);
+void i386_fdivp();
+void i386_fdivp_st_reg(s4 reg);
+void i386_fxch();
+void i386_fxch_reg(s4 reg);
+void i386_fprem();
+void i386_fprem1();
+void i386_fucom();
+void i386_fucom_reg(s4 reg);
+void i386_fucomp_reg(s4 reg);
+void i386_fucompp();
+void i386_fnstsw();
+void i386_sahf();
+void i386_finit();
+void i386_fldcw_mem(s4 mem);
+void i386_fldcw_membase(s4 basereg, s4 disp);
+void i386_wait();
+void i386_ffree_reg(s4 reg);
+void i386_fdecstp();
+void i386_fincstp();
+
+#endif
+
 
 
 /* function gen_resolvebranch **************************************************
@@ -1547,6 +1673,4 @@ static const unsigned char i386_jcc_map[] = {
 #define gen_resolvebranch(ip,so,to) \
     *((void **) ((ip) - 4)) = (void **) ((to) - (so));
 
-#define SOFTNULLPTRCHECK       /* soft null pointer check supportet as option */
-
 #endif