[SOFTX86]
authorAleksandar Andrejevic <aandrejevic@reactos.org>
Wed, 19 Jun 2013 21:13:43 +0000 (21:13 +0000)
committerAleksandar Andrejevic <aandrejevic@reactos.org>
Wed, 19 Jun 2013 21:13:43 +0000 (21:13 +0000)
Fix warnings in softx86.

svn path=/branches/ntvdm/; revision=59260

include/reactos/libs/softx86/softx86.h
lib/3rdparty/softx86/softx86/CMakeLists.txt
lib/3rdparty/softx86/softx86/groupies.c
lib/3rdparty/softx86/softx86/softx86.c

index 587f7e7..7f61854 100644 (file)
@@ -3,7 +3,7 @@
 #define SOFTX86_H
 
 /* get the Softx86 configuration defines */
-#include <softx86cfg.h>
+#include <softx86/softx86cfg.h>
 
 #ifdef __cplusplus
 extern "C" {
@@ -215,16 +215,16 @@ typedef struct {
 #define SEGMENT_OFFSET_TO_LINEAR(s,o)  (SEGMENT_TO_LINEAR(x)+o)
 
 /* force a given value to fit within the specified size */
-#define MASK_BYTE_SIZE(x)              (x &= 0xFF)
-#define MASK_WORD_SIZE(x)              (x &= 0xFFFF)
-#define MASK_DWORD_SIZE(x)             (x &= 0xFFFFFFFFL)
-#define FORCE_BYTE_SIZE(x)             (x &  0xFF)
-#define FORCE_WORD_SIZE(x)             (x &  0xFFFF)
-#define FORCE_DWORD_SIZE(x)            (x &  0xFFFFFFFFL)
+#define MASK_BYTE_SIZE(x)              ((x) &= 0xFF)
+#define MASK_WORD_SIZE(x)              ((x) &= 0xFFFF)
+#define MASK_DWORD_SIZE(x)             ((x) &= 0xFFFFFFFFL)
+#define FORCE_BYTE_SIZE(x)             ((x) &  0xFF)
+#define FORCE_WORD_SIZE(x)             ((x) &  0xFFFF)
+#define FORCE_DWORD_SIZE(x)            ((x) &  0xFFFFFFFFL)
 
 /* sign-extending macros */
-#define SGNEXT8(x)                     (x | ((x & 0x80) ? 0xFFFFFF00 : 0))
-#define SGNEXT16(x)                    (x | ((x & 0x8000) ? 0xFFFF0000 : 0))
+#define SGNEXT8(x)                     ((x) | (((x) & 0x80) ? 0xFFFFFF00 : 0))
+#define SGNEXT16(x)                    ((x) | (((x) & 0x8000) ? 0xFFFF0000 : 0))
 
 /*=====================================================================================
    Softx86 bug structure
index 6d3a579..a6b6136 100644 (file)
@@ -27,4 +27,3 @@ list(APPEND SOURCE
 )
 
 add_library(softx86 ${SOURCE})
-allow_warnings(softx86)
index cbeb73c..11f72bd 100644 (file)
@@ -198,10 +198,12 @@ int Sfx86OpcodeDec_group80(sx86_ubyte opcode,softx86_ctx* ctx,char buf[128])
 
                imm16 = softx86_fetch_dec_byte(ctx);
                if (w16)
+                {
                        if (sx)
                                imm16 |= (imm16&0x80) ? 0xFF80 : 0;
                        else
                                imm16 |= softx86_fetch_dec_byte(ctx)<<8;
+                }
 
                if (reg == 0)           sprintf(buf,"ADD %s,%04Xh",op1_tmp,imm16);
                else if (reg == 1)      sprintf(buf,"OR %s,%04Xh",op1_tmp,imm16);
index a65aedf..da61501 100644 (file)
@@ -1445,8 +1445,10 @@ void sx86_exec_full_modrmonly_rw_imm(softx86_ctx* ctx,sx86_ubyte w16,sx86_ubyte
        if (mod == 3) {         /* immediate <-> register */
                imm = softx86_fetch_exec_byte(ctx);
                if (w16)
+                {
                        if (sx) imm |= (imm&0x80) ? 0xFF80 : 0;
                        else    imm |= softx86_fetch_exec_byte(ctx)<<8;
+                }
 
                // TODO: For 386+ 32-bit instructions... if (d32) {...}
                if (w16) {
@@ -1542,8 +1544,10 @@ void sx86_exec_full_modrmonly_rw_imm(softx86_ctx* ctx,sx86_ubyte w16,sx86_ubyte
 
                imm = softx86_fetch_exec_byte(ctx);
                if (w16)
+                {
                        if (sx) imm |= (imm&0x80) ? 0xFF80 : 0;
                        else    imm |= softx86_fetch_exec_byte(ctx)<<8;
+                }
 
                // TODO: For 386+ 32-bit instructions... if (d32) {...}
                if (w16) {
@@ -1742,8 +1746,10 @@ void sx86_exec_full_modrmonly_ro_imm(softx86_ctx* ctx,sx86_ubyte w16,sx86_ubyte
        if (mod == 3) {         /* immediate <-> register */
                imm = softx86_fetch_exec_byte(ctx);
                if (w16)
+                {
                        if (sx) imm |= (imm&0x80) ? 0xFF80 : 0;
                        else    imm |= softx86_fetch_exec_byte(ctx)<<8;
+                }
 
                // TODO: For 386+ 32-bit instructions... if (d32) {...}
                if (w16) {
@@ -1835,8 +1841,10 @@ void sx86_exec_full_modrmonly_ro_imm(softx86_ctx* ctx,sx86_ubyte w16,sx86_ubyte
 
                imm = softx86_fetch_exec_byte(ctx);
                if (w16)
+                {
                        if (sx) imm |= (imm&0x80) ? 0xFF80 : 0;
                        else    imm |= softx86_fetch_exec_byte(ctx)<<8;
+                }
 
                // TODO: For 386+ 32-bit instructions... if (d32) {...}
                if (w16) {
@@ -2616,7 +2624,7 @@ void sx86_exec_full_modrmonly_memx(softx86_ctx* ctx,sx86_ubyte mod,sx86_ubyte rm
 
                        lo = sx86_far_to_linear(ctx,seg,ofs);
                        softx86_fetch(ctx,NULL,lo,tmp,sz);
-                       op64(ctx,tmp,sz);
+                       op64(ctx,(char*)tmp,sz);
                }
        }
 }
@@ -2709,7 +2717,7 @@ void sx86_exec_full_modrw_memx(softx86_ctx* ctx,sx86_ubyte mod,sx86_ubyte rm,int
 
                        lo = sx86_far_to_linear(ctx,seg,ofs);
                        softx86_fetch(ctx,NULL,lo,tmp,sz);
-                       op64(ctx,tmp,sz);
+                       op64(ctx,(char*)tmp,sz);
                        softx86_write(ctx,NULL,lo,tmp,sz);
                }
        }