Skip to content

Commit e72a541

Browse files
author
H. Peter Anvin
committed
insns.dat: correct the [LD][GI]DT patterns
It is somewhat counterintuitive, but the correct flag for the memory operand is "OSIZE". The "nw" flag takes care of promoting the default operand size on 64 bits to 64. Fixes: #130 Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
1 parent f047cee commit e72a541

File tree

2 files changed

+29
-4
lines changed

2 files changed

+29
-4
lines changed

test/gdtidt.asm

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
default rel
2+
%use ifunc
3+
4+
%define BREG %selbits(bx,ebx,rbx)
5+
%define OREG %selbits(ebx,bx,ebx) ; Force a 67 prefix
6+
7+
lea BREG,lbl
8+
lgdt [BREG]
9+
sgdt [BREG]
10+
lidt [BREG]
11+
sidt [BREG]
12+
13+
lgdt [OREG]
14+
sgdt [OREG]
15+
lidt [OREG]
16+
sidt [OREG]
17+
18+
lgdt [lbl]
19+
sgdt [lbl]
20+
lidt [lbl]
21+
sidt [lbl]
22+
23+
hlt
24+
lbl:
25+
times 10 nop

x86/insns.dat

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -560,13 +560,13 @@ $wdq LSL reg#,rm_sel [rm: optd# 0f 03 /r] 286,PROT
560560
SWAPGS void [ 0f 01 f8] X86_64,LONG
561561
LKGS rm_sel [m: f2 0f 00 /6 ] LKGS,PRIV,LONG
562562

563-
$dq LGDT mem# [m: 0f 01 /2] 286,PRIV,NOLONG32
564-
$dq LIDT mem# [m: 0f 01 /3] 286,PRIV,NOLONG32
563+
$wdq LGDT mem# [m: nw o# 0f 01 /2] 286,PRIV,OSIZE
564+
$wdq LIDT mem# [m: nw o# 0f 01 /3] 286,PRIV,OSIZE
565565
$zwdq LLDT sel# [m: optw# 0f 00 /2] 286,PROT,PRIV
566566
$zwdq LTR sel# [m: optw# 0f 00 /3] 286,PROT,PRIV
567567

568-
$dq SGDT mem# [m: nw o# 0f 01 /0] 286
569-
$dq SIDT mem# [m: nw o# 0f 01 /1] 286
568+
$wdq SGDT mem# [m: nw o# 0f 01 /0] 286,OSIZE
569+
$wdq SIDT mem# [m: nw o# 0f 01 /1] 286,OSIZE
570570
$zwdq SLDT sel# [m: optd# 0f 00 /0] 286,PROT
571571
$zwdq STR sel# [m: optd# 0f 00 /1] 286,PROT
572572

0 commit comments

Comments
 (0)