Changeset 1705
- Timestamp:
- 11/10/08 23:54:40 (2 months ago)
- Files:
-
- libemu/trunk/include/emu/emu_cpu_data.h (modified) (3 diffs)
- libemu/trunk/src/environment/win32/env_w32_dll_export_kernel32_hooks.c (modified) (3 diffs)
- libemu/trunk/src/functions/adc.c (modified) (3 diffs)
- libemu/trunk/src/functions/cmp.c (modified) (1 diff)
- libemu/trunk/src/functions/cmps.c (modified) (1 diff)
- libemu/trunk/src/functions/dec.c (modified) (2 diffs)
- libemu/trunk/src/functions/div.c (modified) (1 diff)
- libemu/trunk/src/functions/idiv.c (modified) (1 diff)
- libemu/trunk/src/functions/imul.c (modified) (1 diff)
- libemu/trunk/src/functions/inc.c (modified) (2 diffs)
- libemu/trunk/src/functions/mul.c (modified) (1 diff)
- libemu/trunk/src/functions/neg.c (modified) (2 diffs)
- libemu/trunk/src/functions/not.c (modified) (1 diff)
- libemu/trunk/src/functions/rcl.c (modified) (1 diff)
- libemu/trunk/src/functions/rcr.c (modified) (1 diff)
- libemu/trunk/src/functions/rol.c (modified) (1 diff)
- libemu/trunk/src/functions/ror.c (modified) (1 diff)
- libemu/trunk/src/functions/sal.c (modified) (1 diff)
- libemu/trunk/src/functions/sar.c (modified) (2 diffs)
- libemu/trunk/src/functions/sbb.c (modified) (2 diffs)
- libemu/trunk/src/functions/scas.c (modified) (1 diff)
- libemu/trunk/src/functions/shr.c (modified) (1 diff)
- libemu/trunk/src/functions/test.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
libemu/trunk/include/emu/emu_cpu_data.h
r1639 r1705 122 122 extern int64_t max_inttype_borders[][2][2]; 123 123 124 #define INT (bits) int##bits##_t125 #define UINT (bits) uint##bits##_t124 #define INTOF(bits) int##bits##_t 125 #define UINTOF(bits) uint##bits##_t 126 126 127 127 #if !defined(INSTR_CALC) 128 128 #if BYTE_ORDER == BIG_ENDIAN 129 129 #define INSTR_CALC(bits, a, b, c, operation) \ 130 UINT (bits) operand_a; \131 UINT (bits) operand_b; \130 UINTOF(bits) operand_a; \ 131 UINTOF(bits) operand_b; \ 132 132 bcopy(&(a), &operand_a, bits/8); \ 133 133 bcopy(&(b), &operand_b, bits/8); \ 134 UINT (bits) operation_result = operand_a operation operand_b; \134 UINTOF(bits) operation_result = operand_a operation operand_b; \ 135 135 bcopy(&operation_result, &(c), bits/8); 136 136 #else // ENDIAN 137 137 #define INSTR_CALC(bits, a, b, c, operation) \ 138 UINT (bits) operand_a = a; \139 UINT (bits) operand_b = b; \140 UINT (bits) operation_result = operand_a operation operand_b; \138 UINTOF(bits) operand_a = a; \ 139 UINTOF(bits) operand_b = b; \ 140 UINTOF(bits) operation_result = operand_a operation operand_b; \ 141 141 c = operation_result; 142 142 #endif // ENDIAN … … 182 182 #define INSTR_SET_FLAG_OF(cpu, operand, bits) \ 183 183 { \ 184 int64_t sx = (INT (bits))operand_a; \185 int64_t sy = (INT (bits))operand_b; \184 int64_t sx = (INTOF(bits))operand_a; \ 185 int64_t sy = (INTOF(bits))operand_b; \ 186 186 int64_t sz = 0; \ 187 187 \ … … 189 189 \ 190 190 if (sz < max_inttype_borders[sizeof(operation_result)][0][0] || sz > max_inttype_borders[sizeof(operation_result)][0][1] \ 191 || sz != (INT (bits))operation_result ) \191 || sz != (INTOF(bits))operation_result ) \ 192 192 { \ 193 193 CPU_FLAG_SET(cpu, f_of); \ libemu/trunk/src/environment/win32/env_w32_dll_export_kernel32_hooks.c
r1692 r1705 268 268 memset(si, 0, sizeof(STARTUPINFO)); 269 269 270 emu_memory_read_dword(m, p_startinfo + 1 5* 4, (uint32_t *)&si->hStdInput);271 emu_memory_read_dword(m, p_startinfo + 1 6* 4, (uint32_t *)&si->hStdOutput);272 emu_memory_read_dword(m, p_startinfo + 1 7* 4, (uint32_t *)&si->hStdError);270 emu_memory_read_dword(m, p_startinfo + 14 * 4, (uint32_t *)&si->hStdInput); 271 emu_memory_read_dword(m, p_startinfo + 15 * 4, (uint32_t *)&si->hStdOutput); 272 emu_memory_read_dword(m, p_startinfo + 16 * 4, (uint32_t *)&si->hStdError); 273 273 274 274 … … 284 284 pi->dwThreadId = 4712; 285 285 286 emu_memory_write_block(m, p_procinfo, pi, sizeof(PROCESS_INFORMATION));286 // emu_memory_write_block(m, p_procinfo, pi, sizeof(PROCESS_INFORMATION)); 287 287 emu_memory_write_dword(m, p_procinfo+0*4, pi->hProcess); 288 288 emu_memory_write_dword(m, p_procinfo+1*4, pi->hThread); … … 310 310 } 311 311 312 emu_memory_write_block(m, p_procinfo, pi, sizeof(PROCESS_INFORMATION)); 312 // emu_memory_write_block(m, p_procinfo, pi, sizeof(PROCESS_INFORMATION)); 313 emu_memory_write_dword(m, p_procinfo+0*4, pi->hProcess); 314 emu_memory_write_dword(m, p_procinfo+1*4, pi->hThread); 315 emu_memory_write_dword(m, p_procinfo+2*4, pi->dwProcessId); 316 emu_memory_write_dword(m, p_procinfo+3*4, pi->dwThreadId); 317 313 318 314 319 libemu/trunk/src/functions/adc.c
r1639 r1705 32 32 #if BYTE_ORDER == BIG_ENDIAN 33 33 #define INSTR_CALC(bits, a, b, c, operation, cpu) \ 34 UINT (bits) operand_a; \35 UINT (bits) operand_b; \34 UINTOF(bits) operand_a; \ 35 UINTOF(bits) operand_b; \ 36 36 bcopy(&(a), &operand_a, bits/8); \ 37 37 bcopy(&(b), &operand_b, bits/8); \ 38 UINT (bits) operation_result = operand_a operation operand_b operation ((cpu->eflags & (1 << f_cf))?1:0); \38 UINTOF(bits) operation_result = operand_a operation operand_b operation ((cpu->eflags & (1 << f_cf))?1:0); \ 39 39 bcopy(&operation_result, &(c), bits/8); 40 40 #else // ENDIAN 41 41 #define INSTR_CALC(bits, a, b, c, operation, cpu) \ 42 UINT (bits) operand_a = a; \43 UINT (bits) operand_b = b; \44 UINT (bits) operation_result = operand_a operation operand_b operation ((cpu->eflags & (1 << f_cf))?1:0); \42 UINTOF(bits) operand_a = a; \ 43 UINTOF(bits) operand_b = b; \ 44 UINTOF(bits) operation_result = operand_a operation operand_b operation ((cpu->eflags & (1 << f_cf))?1:0); \ 45 45 c = operation_result; 46 46 #endif // ENDIAN … … 49 49 #define INSTR_SET_FLAG_OF(cpu, operand,bits) \ 50 50 { \ 51 int64_t sx = (INT (bits))operand_a; \52 int64_t sy = (INT (bits))operand_b; \51 int64_t sx = (INTOF(bits))operand_a; \ 52 int64_t sy = (INTOF(bits))operand_b; \ 53 53 int64_t sz = 0; \ 54 54 \ … … 57 57 \ 58 58 if (sz < max_inttype_borders[sizeof(operation_result)][0][0] || sz > max_inttype_borders[sizeof(operation_result)][0][1] \ 59 || sz != (INT (bits))operation_result ) \59 || sz != (INTOF(bits))operation_result ) \ 60 60 { \ 61 61 CPU_FLAG_SET(cpu, f_of); \ libemu/trunk/src/functions/cmp.c
r1656 r1705 31 31 #if BYTE_ORDER == BIG_ENDIAN 32 32 #define INSTR_CALC(bits, a, b, operation) \ 33 UINT (bits) operand_a; \34 UINT (bits) operand_b; \33 UINTOF(bits) operand_a; \ 34 UINTOF(bits) operand_b; \ 35 35 bcopy(&(a), &operand_a, bits/8); \ 36 36 bcopy(&(b), &operand_b, bits/8); \ 37 UINT (bits) operation_result = operand_a operation operand_b;37 UINTOF(bits) operation_result = operand_a operation operand_b; 38 38 #else // ENDIAN 39 39 #define INSTR_CALC(bits, a, b, operation) \ 40 UINT (bits) operand_a = a; \41 UINT (bits) operand_b = b; \42 UINT (bits) operation_result = operand_a operation operand_b;40 UINTOF(bits) operand_a = a; \ 41 UINTOF(bits) operand_b = b; \ 42 UINTOF(bits) operation_result = operand_a operation operand_b; 43 43 #endif // ENDIAN 44 44 libemu/trunk/src/functions/cmps.c
r1317 r1705 30 30 31 31 #define INSTR_CALC(bits, a, b) \ 32 UINT (bits) operand_a = a; \33 UINT (bits) operand_b = b; \34 UINT (bits) operation_result = operand_a - operand_b;32 UINTOF(bits) operand_a = a; \ 33 UINTOF(bits) operand_b = b; \ 34 UINTOF(bits) operation_result = operand_a - operand_b; 35 35 //printf(" a %02x b %02x c %02x \n",operand_a, operand_b, operation_result); 36 36 libemu/trunk/src/functions/dec.c
r1317 r1705 29 29 30 30 #define INSTR_CALC(bits, a) \ 31 UINT (bits) operand_a = a; \32 UINT (bits) operation_result = operand_a-1; \31 UINTOF(bits) operand_a = a; \ 32 UINTOF(bits) operation_result = operand_a-1; \ 33 33 a = operation_result; 34 34 … … 37 37 #define INSTR_SET_FLAG_OF(cpu, bits) \ 38 38 { \ 39 int64_t sz = (INT (bits))operand_a; \39 int64_t sz = (INTOF(bits))operand_a; \ 40 40 \ 41 41 sz--; \ 42 42 \ 43 43 if (sz < max_inttype_borders[sizeof(operation_result)][0][0] || sz > max_inttype_borders[sizeof(operation_result)][0][1] \ 44 || sz != (INT (bits))operation_result ) \44 || sz != (INTOF(bits))operation_result ) \ 45 45 { \ 46 46 CPU_FLAG_SET(cpu, f_of); \ libemu/trunk/src/functions/div.c
r1317 r1705 38 38 return -1; \ 39 39 } \ 40 UINT (dbits) q_result = dividend / divisor; \41 UINT (dbits) r_result = dividend % divisor; \40 UINTOF(dbits) q_result = dividend / divisor; \ 41 UINTOF(dbits) r_result = dividend % divisor; \ 42 42 \ 43 43 quotient = q_result; \ libemu/trunk/src/functions/idiv.c
r1317 r1705 37 37 return -1; \ 38 38 } \ 39 INT (dbits) q_result = (INT(dbits))dividend / (INT(bits))divisor; \40 INT (dbits) r_result = (INT(dbits))dividend % (INT(bits))divisor; \39 INTOF(dbits) q_result = (INTOF(dbits))dividend / (INTOF(bits))divisor; \ 40 INTOF(dbits) r_result = (INTOF(dbits))dividend % (INTOF(bits))divisor; \ 41 41 \ 42 42 quotient = q_result; \ libemu/trunk/src/functions/imul.c
r1639 r1705 29 29 30 30 #define INSTR_CALC(inbits, outbits, cpu, a, b) \ 31 INT (inbits) operand_a = (INT(inbits))a; \32 INT (inbits) operand_b = (INT(inbits))b; \33 INT (outbits) operation_result = operand_a * operand_b; \31 INTOF(inbits) operand_a = (INTOF(inbits))a; \ 32 INTOF(inbits) operand_b = (INTOF(inbits))b; \ 33 INTOF(outbits) operation_result = operand_a * operand_b; \ 34 34 35 35 libemu/trunk/src/functions/inc.c
r1317 r1705 29 29 30 30 #define INSTR_CALC(bits, a) \ 31 UINT (bits) operand_a = a; \32 UINT (bits) operation_result = operand_a+1; \31 UINTOF(bits) operand_a = a; \ 32 UINTOF(bits) operation_result = operand_a+1; \ 33 33 a = operation_result; 34 34 … … 37 37 #define INSTR_SET_FLAG_OF(cpu, bits) \ 38 38 { \ 39 int64_t sz = (INT (bits))operand_a; \39 int64_t sz = (INTOF(bits))operand_a; \ 40 40 \ 41 41 sz++; \ 42 42 \ 43 43 if (sz < max_inttype_borders[sizeof(operation_result)][0][0] || sz > max_inttype_borders[sizeof(operation_result)][0][1] \ 44 || sz != (INT (bits))operation_result ) \44 || sz != (INTOF(bits))operation_result ) \ 45 45 { \ 46 46 CPU_FLAG_SET(cpu, f_of); \ libemu/trunk/src/functions/mul.c
r1317 r1705 31 31 32 32 #define INSTR_CALC(inbits, outbits, cpu, a, b) \ 33 UINT (inbits) operand_a = a; \34 UINT (inbits) operand_b = b; \35 UINT (outbits) operation_result = operand_a * operand_b; \33 UINTOF(inbits) operand_a = a; \ 34 UINTOF(inbits) operand_b = b; \ 35 UINTOF(outbits) operation_result = operand_a * operand_b; \ 36 36 37 37 #include "emu/emu.h" libemu/trunk/src/functions/neg.c
r1317 r1705 30 30 31 31 #define INSTR_CALC(bits, a, cpu) \ 32 UINT (bits) operand_a = a; \33 UINT (bits) operation_result = 0-operand_a;32 UINTOF(bits) operand_a = a; \ 33 UINTOF(bits) operation_result = 0-operand_a; 34 34 35 35 #define INSTR_SET_FLAG_OF(cpu, bits) \ 36 36 { \ 37 int64_t sx = (INT (bits))operand_a; \37 int64_t sx = (INTOF(bits))operand_a; \ 38 38 int64_t sz = 0; \ 39 39 \ … … 41 41 \ 42 42 if (sz < max_inttype_borders[sizeof(operation_result)][0][0] || sz > max_inttype_borders[sizeof(operation_result)][0][1] \ 43 || sz != (INT (bits))operation_result ) \43 || sz != (INTOF(bits))operation_result ) \ 44 44 { \ 45 45 CPU_FLAG_SET(cpu, f_of); \ libemu/trunk/src/functions/not.c
r1317 r1705 30 30 31 31 #define INSTR_CALC(bits, a, cpu) \ 32 UINT (bits) operand_a = a; \33 UINT (bits) operation_result = ~operand_a; \32 UINTOF(bits) operand_a = a; \ 33 UINTOF(bits) operation_result = ~operand_a; \ 34 34 a = operation_result; 35 35 libemu/trunk/src/functions/rcl.c
r1317 r1705 30 30 31 31 #define INSTR_CALC(bits, a, b, cpu) \ 32 UINT (bits) operation_result = (a); \32 UINTOF(bits) operation_result = (a); \ 33 33 uint8_t operand_b = (b); \ 34 34 { \ libemu/trunk/src/functions/rcr.c
r1317 r1705 30 30 31 31 #define INSTR_CALC(bits, a, b, cpu) \ 32 UINT (bits) operation_result = (a); \32 UINTOF(bits) operation_result = (a); \ 33 33 uint8_t operand_b = (b); \ 34 34 { \ libemu/trunk/src/functions/rol.c
r1317 r1705 30 30 31 31 #define INSTR_CALC(bits, a, b, cpu) \ 32 UINT (bits) operation_result = (a); \32 UINTOF(bits) operation_result = (a); \ 33 33 uint8_t operand_b = (b); \ 34 34 { \ libemu/trunk/src/functions/ror.c
r1317 r1705 30 30 31 31 #define INSTR_CALC(bits, a, b, cpu) \ 32 UINT (bits) operation_result = (a); \32 UINTOF(bits) operation_result = (a); \ 33 33 uint8_t operand_b = (b); \ 34 34 { \ libemu/trunk/src/functions/sal.c
r1317 r1705 30 30 31 31 #define INSTR_CALC(bits, a, b, cpu) \ 32 UINT (bits) operation_result = (a); \32 UINTOF(bits) operation_result = (a); \ 33 33 uint8_t operand_b = (b); \ 34 34 { \ libemu/trunk/src/functions/sar.c
r1317 r1705 30 30 31 31 #define INSTR_CALC(bits, a, b, cpu) \ 32 UINT (bits) operation_result = (a); \32 UINTOF(bits) operation_result = (a); \ 33 33 uint8_t operand_b = (b); \ 34 34 { \ … … 40 40 CPU_FLAG_SET(cpu, f_cf); \ 41 41 } \ 42 operation_result = (UINT (bits))((INT(bits))operation_result >> operand_b); \42 operation_result = (UINTOF(bits))((INTOF(bits))operation_result >> operand_b); \ 43 43 if( operand_b == 1 ) \ 44 44 { \ libemu/trunk/src/functions/sbb.c
r1317 r1705 29 29 30 30 #define INSTR_CALC(bits, a, b, c, operation, cpu) \ 31 UINT (bits) operand_a = a; \32 UINT (bits) operand_b = b; \33 UINT (bits) operation_result = operand_a operation operand_b operation ((cpu->eflags & (1 << f_cf))?1:0); \31 UINTOF(bits) operand_a = a; \ 32 UINTOF(bits) operand_b = b; \ 33 UINTOF(bits) operation_result = operand_a operation operand_b operation ((cpu->eflags & (1 << f_cf))?1:0); \ 34 34 c = operation_result; 35 35 36 36 #define INSTR_SET_FLAG_OF(cpu, operand,bits) \ 37 37 { \ 38 int64_t sx = (INT (bits))operand_a; \39 int64_t sy = (INT (bits))operand_b; \38 int64_t sx = (INTOF(bits))operand_a; \ 39 int64_t sy = (INTOF(bits))operand_b; \ 40 40 int64_t sz = 0; \ 41 41 \ … … 44 44 \ 45 45 if (sz < max_inttype_borders[sizeof(operation_result)][0][0] || sz > max_inttype_borders[sizeof(operation_result)][0][1] \ 46 || sz != (INT (bits))operation_result ) \46 || sz != (INTOF(bits))operation_result ) \ 47 47 { \ 48 48 CPU_FLAG_SET(cpu, f_of); \ libemu/trunk/src/functions/scas.c
r1317 r1705 30 30 31 31 #define INSTR_CALC(bits, a, b) \ 32 UINT (bits) operation_result = (a) - (b); \33 UINT (bits) operand_a = a; \34 UINT (bits) operand_b = b;32 UINTOF(bits) operation_result = (a) - (b); \ 33 UINTOF(bits) operand_a = a; \ 34 UINTOF(bits) operand_b = b; 35 35 36 36 libemu/trunk/src/functions/shr.c
r1317 r1705 30 30 31 31 #define INSTR_CALC(bits, a, b, cpu) \ 32 UINT (bits) operation_result = (a); \32 UINTOF(bits) operation_result = (a); \ 33 33 uint8_t operand_b = (b); \ 34 34 { \ libemu/trunk/src/functions/test.c
r1317 r1705 30 30 31 31 #define INSTR_CALC(bits, a, b) \ 32 UINT (bits) operand_a = a; \33 UINT (bits) operand_b = b; \34 UINT (bits) operation_result = operand_a & operand_b;32 UINTOF(bits) operand_a = a; \ 33 UINTOF(bits) operand_b = b; \ 34 UINTOF(bits) operation_result = operand_a & operand_b; 35 35 36 36
