wok-6.x rev 20279
8086tiny: fix DAA/DAS/shift opcodes
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Fri Mar 23 13:08:29 2018 +0100 (2018-03-23) |
parents | da6d56ae54a6 |
children | 10474d9b9802 |
files | 8086tiny/receipt 8086tiny/stuff/8086tiny.u linux/stuff/linux-freeinitrd.u |
line diff
1.1 --- a/8086tiny/receipt Mon Mar 19 23:12:07 2018 +0100 1.2 +++ b/8086tiny/receipt Fri Mar 23 13:08:29 2018 +0100 1.3 @@ -23,6 +23,7 @@ 1.4 # Rules to configure and make the package. 1.5 compile_rules() 1.6 { 1.7 + patch -p0 < $stuff/8086tiny.u 1.8 case "$ARCH" in 1.9 i?86) 1.10 make CC=gcc no_graphics &&
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 2.2 +++ b/8086tiny/stuff/8086tiny.u Fri Mar 23 13:08:29 2018 +0100 2.3 @@ -0,0 +1,40 @@ 2.4 +--- 8086tiny.c 2.5 ++++ 8086tiny.c 2.6 +@@ -112,8 +112,9 @@ 2.7 + regs16[REG_AX] = op_result, \ 2.8 + set_OF(set_CF(op_result - (op_data_type)op_result))) 2.9 + #define DIV_MACRO(out_data_type,in_data_type,out_regs) (scratch_int = CAST(out_data_type)mem[rm_addr]) && !(scratch2_uint = (in_data_type)(scratch_uint = (out_regs[i_w+1] << 16) + regs16[REG_AX]) / scratch_int, scratch2_uint - (out_data_type)scratch2_uint) ? out_regs[i_w+1] = scratch_uint - scratch_int * (*out_regs = scratch2_uint) : pc_interrupt(0) 2.10 +-#define DAA_DAS(op1,op2,mask,min) set_AF((((scratch2_uint = regs8[REG_AL]) & 0x0F) > 9) || regs8[FLAG_AF]) && (op_result = regs8[REG_AL] op1 6, set_CF(regs8[FLAG_CF] || (regs8[REG_AL] op2 scratch2_uint))), \ 2.11 +- set_CF((((mask & 1 ? scratch2_uint : regs8[REG_AL]) & mask) > min) || regs8[FLAG_CF]) && (op_result = regs8[REG_AL] op1 0x60) 2.12 ++#define DAA_DAS(op1,op2) \ 2.13 ++set_AF((((scratch_uchar = regs8[REG_AL]) & 0x0F) > 9) || regs8[FLAG_AF]) && (op_result = (regs8[REG_AL] op1 6), set_CF(regs8[FLAG_CF] || (regs8[REG_AL] op2 scratch_uchar))), \ 2.14 ++set_CF((regs8[REG_AL] > 0x9f) || regs8[FLAG_CF]) && (op_result = (regs8[REG_AL] op1 0x60)) 2.15 + #define ADC_SBB_MACRO(a) OP(a##= regs8[FLAG_CF] +), \ 2.16 + set_CF(regs8[FLAG_CF] && (op_result == op_dest) || (a op_result < a(int)op_dest)), \ 2.17 + set_AF_OF_arith() 2.18 +@@ -451,7 +452,6 @@ 2.19 + OPCODE 12: // ROL|ROR|RCL|RCR|SHL|SHR|???|SAR reg/mem, 1/CL/imm (80186) 2.20 + scratch2_uint = SIGN_OF(mem[rm_addr]), 2.21 + scratch_uint = extra ? // xxx reg/mem, imm 2.22 +- ++reg_ip, 2.23 + (char)i_data1 2.24 + : // xxx reg/mem, CL 2.25 + i_d 2.26 +@@ -468,7 +468,7 @@ 2.27 + else // Rotate/shift left operations 2.28 + R_M_OP(mem[rm_addr], <<=, scratch_uint); 2.29 + if (i_reg > 3) // Shift operations 2.30 +- set_opcode(0x10); // Decode like ADC 2.31 ++ set_flags_type = FLAGS_UPDATE_SZP; // Shift instructions affect SZP 2.32 + if (i_reg > 4) // SHR or SAR 2.33 + set_CF(op_dest >> (scratch_uint - 1) & 1); 2.34 + } 2.35 +@@ -605,7 +605,7 @@ 2.36 + rep_override_en && rep_override_en++ 2.37 + OPCODE 28: // DAA/DAS 2.38 + i_w = 0; 2.39 +- extra ? DAA_DAS(-=, >=, 0xFF, 0x99) : DAA_DAS(+=, <, 0xF0, 0x90) // extra = 0 for DAA, 1 for DAS 2.40 ++ if (extra) DAA_DAS(-=, >); else DAA_DAS(+=, <) 2.41 + OPCODE 29: // AAA/AAS 2.42 + op_result = AAA_AAS(extra - 1) 2.43 + OPCODE 30: // CBW
3.1 --- a/linux/stuff/linux-freeinitrd.u Mon Mar 19 23:12:07 2018 +0100 3.2 +++ b/linux/stuff/linux-freeinitrd.u Fri Mar 23 13:08:29 2018 +0100 3.3 @@ -10,7 +10,7 @@ 3.4 + 3.5 +static void free_rootfs_mem(unsigned long start, unsigned long end) 3.6 +{ 3.7 -+ free_init_pages("", start, end); 3.8 ++ free_init_pages(NULL, start, end); 3.9 +} 3.10 + 3.11 +static void _free_initrd(unsigned long initrd_start, unsigned long initrd_end,