Commit 06f901a4 authored by Julian Kranz's avatar Julian Kranz

X86 Specification

- Continued to add instruction(s): CALL
- Cleanup
- Bug fixes
parent 7b76b200
...@@ -227,7 +227,7 @@ val show/instruction insn = ...@@ -227,7 +227,7 @@ val show/instruction insn =
| BLENDPD x: "BLENDPD" -++ show/arity3 x | BLENDPD x: "BLENDPD" -++ show/arity3 x
| BLENDPS x: "BLENDPS" -++ show/arity3 x | BLENDPS x: "BLENDPS" -++ show/arity3 x
| BLENDVPD x: "BLENDVPD" -++ show/arity3 x | BLENDVPD x: "BLENDVPD" -++ show/arity3 x
| BLENDVPS x: "BLENDVPS" -++ show/arity2 x | BLENDVPS x: "BLENDVPS" -++ show/arity3 x
| BOUND x: "BOUND" -++ show/arity2 x | BOUND x: "BOUND" -++ show/arity2 x
| BSF x: "BSF" -++ show/arity2 x | BSF x: "BSF" -++ show/arity2 x
| BSR x: "BSR" -++ show/arity2 x | BSR x: "BSR" -++ show/arity2 x
......
...@@ -522,6 +522,8 @@ type flowopnd = ...@@ -522,6 +522,8 @@ type flowopnd =
| REL16 of 16 | REL16 of 16
| REL32 of 32 | REL32 of 32
| REL64 of 64 | REL64 of 64
| PTR16/16 of 32
| PTR16/32 of 48
| NEARABS of opnd | NEARABS of opnd
| FARABS of opnd | FARABS of opnd
...@@ -566,7 +568,7 @@ type insn = ...@@ -566,7 +568,7 @@ type insn =
| BLENDPD of arity3 | BLENDPD of arity3
| BLENDPS of arity3 | BLENDPS of arity3
| BLENDVPD of arity3 | BLENDVPD of arity3
| BLENDVPS of arity2 | BLENDVPS of arity3
| BOUND of arity2 | BOUND of arity2
| BSF of arity2 | BSF of arity2
| BSR of arity2 | BSR of arity2
...@@ -1540,6 +1542,9 @@ val rel32 ['b1:8' 'b2:8' 'b3:8' 'b4:8'] = return (REL32 (b4 ^ b3 ^ b2 ^ b1)) ...@@ -1540,6 +1542,9 @@ val rel32 ['b1:8' 'b2:8' 'b3:8' 'b4:8'] = return (REL32 (b4 ^ b3 ^ b2 ^ b1))
val rel64 ['b1:8' 'b2:8' 'b3:8' 'b4:8' 'b5:8' 'b6:8' 'b7:8' 'b8:8'] = val rel64 ['b1:8' 'b2:8' 'b3:8' 'b4:8' 'b5:8' 'b6:8' 'b7:8' 'b8:8'] =
return (REL64 (b8 ^ b7 ^ b6 ^ b5 ^ b4 ^ b3 ^ b2 ^ b1)) return (REL64 (b8 ^ b7 ^ b6 ^ b5 ^ b4 ^ b3 ^ b2 ^ b1))
val ptr16/16 ['b1:8' 'b2:8' 'b3:8' 'b4:8'] = return (PTR16/16 (b4 ^ b3 ^ b2 ^ b1))
val ptr16/32 ['b1:8' 'b2:8' 'b3:8' 'b4:8' 'b5:8' 'b6:8'] = return (PTR16/32 (b6 ^ b5 ^ b4 ^ b3 ^ b2 ^ b1))
val imm/xmm ['r:4 b:4'] = return (xmm r) val imm/xmm ['r:4 b:4'] = return (xmm r)
val imm/ymm ['r:4 b:4'] = return (ymm r) val imm/ymm ['r:4 b:4'] = return (ymm r)
...@@ -2001,6 +2006,7 @@ val st/m64 = r/m 64 sti ...@@ -2001,6 +2006,7 @@ val st/m64 = r/m 64 sti
val m16/16 = r/m 32 reg16-rex val m16/16 = r/m 32 reg16-rex
val m16/32 = r/m 48 reg32-rex val m16/32 = r/m 48 reg32-rex
val m16/64 = r/m 80 reg64-rex val m16/64 = r/m 80 reg64-rex
val m32/32 = r/m 64 reg32-rex
val r/reg16 = reg/reg reg16-rex val r/reg16 = reg/reg reg16-rex
val r/reg32 = reg/reg reg32-rex val r/reg32 = reg/reg reg32-rex
...@@ -2147,7 +2153,12 @@ val near-rel cons giveOp = do ...@@ -2147,7 +2153,12 @@ val near-rel cons giveOp = do
return (cons {opnd1=op}) return (cons {opnd1=op})
end end
val far-abs cons giveOp = do val far-dir cons giveOp = do
op <- giveOp;
return (cons {opnd1=op})
end
val far-ind cons giveOp = do
op <- giveOp; op <- giveOp;
return (cons {opnd1=FARABS op}) return (cons {opnd1=FARABS op})
end end
...@@ -2157,23 +2168,23 @@ val one = return (IMM8 '00000001') ...@@ -2157,23 +2168,23 @@ val one = return (IMM8 '00000001')
val // a = val // a =
do b <- a; do b <- a;
return (not b) return (not b)
end end
### AAA ### AAA
### - ASCII Adjust After Addition ### - ASCII Adjust After Addition
val / [0x37] | // mode64? = arity0 AAA val / [0x37] | mode32? = arity0 AAA
### AAD ### AAD
### - ASCII Adjust AX Before Division ### - ASCII Adjust AX Before Division
val / [0xd5] | // mode64? = unop AAD imm8 val / [0xd5] | mode32? = unop AAD imm8
### AAM ### AAM
### - ASCII Adjust AX After Multiply ### - ASCII Adjust AX After Multiply
val / [0xd4] | // mode64? = unop AAM imm8 val / [0xd4] | mode32? = unop AAM imm8
### AAS ### AAS
### - ASCII Adjust AL After Subtraction ### - ASCII Adjust AL After Subtraction
val / [0x3f] | // mode64? = arity0 AAS val / [0x3f] | mode32? = arity0 AAS
### ADC ### ADC
### - Add with Carry ### - Add with Carry
...@@ -2354,8 +2365,7 @@ val /vex/0f/vexv [0x55 /r] ...@@ -2354,8 +2365,7 @@ val /vex/0f/vexv [0x55 /r]
### ARPL ### ARPL
### - Adjust RPL Field of Segment Selector ### - Adjust RPL Field of Segment Selector
### TODO: Not encodable in 64bit mode val / [0x63 /r] | mode32? = binop ARPL r/m16 r16
#val / [0x63 /r] | // mode64? = binop ARPL r/m16 r16
### BLENDPD ### BLENDPD
### - Blend Packed Double Precision Floating-Point Values ### - Blend Packed Double Precision Floating-Point Values
...@@ -2380,7 +2390,7 @@ val /vex/66/0f/3a/vexv [0x4b /r] ...@@ -2380,7 +2390,7 @@ val /vex/66/0f/3a/vexv [0x4b /r]
### BLENDVPS ### BLENDVPS
### - Variable Blend Packed Single Precision Floating-Point Values ### - Variable Blend Packed Single Precision Floating-Point Values
val /66 [0x0f 0x38 0x14 /r] = binop BLENDVPS xmm128 xmm/m128 val /66 [0x0f 0x38 0x14 /r] = ternop BLENDVPS xmm128 xmm/m128 xmm0
val /vex/66/0f/3a/vexv [0x4a /r] val /vex/66/0f/3a/vexv [0x4a /r]
| vex128? & vexw0? = varity4 VBLENDVPS xmm128 v/xmm xmm/m128 imm/xmm | vex128? & vexw0? = varity4 VBLENDVPS xmm128 v/xmm xmm/m128 imm/xmm
| vex256? & vexw0? = varity4 VBLENDVPS ymm256 v/ymm ymm/m256 imm/ymm | vex256? & vexw0? = varity4 VBLENDVPS ymm256 v/ymm ymm/m256 imm/ymm
...@@ -2388,8 +2398,8 @@ val /vex/66/0f/3a/vexv [0x4a /r] ...@@ -2388,8 +2398,8 @@ val /vex/66/0f/3a/vexv [0x4a /r]
### BOUND ### BOUND
### - Check Array Index Against Bounds ### - Check Array Index Against Bounds
val / [0x62 /r-mem] val / [0x62 /r-mem]
| opndsz? & // mode64? = binop BOUND r16 r/m16 | opndsz? & mode32? = binop BOUND r16 m16/16
| // mode64? = binop BOUND r32 r/m32 | mode32? = binop BOUND r32 m32/32
### BSF ### BSF
### - Bit Scan Forward ### - Bit Scan Forward
...@@ -2407,9 +2417,12 @@ val / [0x0f 0xbd /r] ...@@ -2407,9 +2417,12 @@ val / [0x0f 0xbd /r]
### BSWAP ### BSWAP
### - Byte Swap ### - Byte Swap
val / [0x0f '11001 r:3'] val / [0x0f /1-reg]
| rexw? = do update@{reg/opcode=r}; unop BSWAP r64/rexb end | rexw? = unop BSWAP r/reg64
| otherwise = do update@{reg/opcode=r}; unop BSWAP r32/rexb end | otherwise = unop BSWAP r/reg32
#val / [0x0f '11001 r:3']
# | rexw? = do update@{reg/opcode=r}; unop BSWAP r64/rexb end
# | otherwise = do update@{reg/opcode=r}; unop BSWAP r32/rexb end
### BT ### BT
### - Bit Test ### - Bit Test
...@@ -2460,7 +2473,17 @@ val / [0x0f 0xba /5] ...@@ -2460,7 +2473,17 @@ val / [0x0f 0xba /5]
val / [0xe8] val / [0xe8]
| opndsz? = near-rel CALL rel16 | opndsz? = near-rel CALL rel16
| otherwise = near-rel CALL rel32 | otherwise = near-rel CALL rel32
val / [0xff /2] = near-abs CALL r/m64 val / [0xff /2]
| mode64? = near-abs CALL r/m64
| opndsz? = near-abs CALL r/m16
| otherwise = near-abs CALL r/m32
val / [0x9a]
| opndsz? = far-dir CALL ptr16/16
| otherwise = far-dir CALL ptr16/32
val / [0xff /3-mem]
| opndsz? = far-ind CALL m16/16
| rexw? = far-ind CALL m16/64
| otherwise = far-ind CALL m16/32
### CBW/CWDE/CDQE ### CBW/CWDE/CDQE
### - Convert Byte to Word/Convert Word to Doubleword/Convert Doubleword to Quadword ### - Convert Byte to Word/Convert Word to Doubleword/Convert Doubleword to Quadword
...@@ -2479,12 +2502,14 @@ val / [0xfc] = arity0 CLD ...@@ -2479,12 +2502,14 @@ val / [0xfc] = arity0 CLD
### CLFLUSH ### CLFLUSH
### - Flush Cache Line ### - Flush Cache Line
val / [0x0f 0xae /7-mem] = unop CLFLUSH r/m8 val / [0x0f 0xae /7-mem] = unop CLFLUSH m8
### CLI ### CLI
### - Clear Interrupt Flag ### - Clear Interrupt Flag
val / [0xfa] = arity0 CLI val / [0xfa] = arity0 CLI
### =><=
### CLTS ### CLTS
### - Clear Task-Switched Flag in CR0 ### - Clear Task-Switched Flag in CR0
val / [0x0f 0x06] = arity0 CLTS val / [0x0f 0x06] = arity0 CLTS
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment