Skip to content

Commit 926980a

Browse files
author
Jasper Quirk
committed
Add RDPRU support, fix bug in SHR
1 parent 9fb095d commit 926980a

File tree

6 files changed

+17
-1
lines changed

6 files changed

+17
-1
lines changed

Makefile.am

+1
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,7 @@ TEST_ASM = \
236236
test/ptr.asm \
237237
test/push.asm \
238238
test/pxor.asm \
239+
test/rdpmc.asm \
239240
test/rdtsc.asm \
240241
test/rdtscp.asm \
241242
test/ror.asm \

src/enums.h

+1
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,7 @@ typedef enum {
217217
pxor,
218218
rcr,
219219
rdpmc,
220+
rdpru,
220221
rdtsc,
221222
rdtscp,
222223
ret,

src/instructions.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,7 @@ const struct instr_table INSTR_TABLE[] = {
233233
{"rcr", rcr, {mi, ri}, M, SHIFT, 1, 3, 4, {REX, 0xd0, REG, ib}},
234234
{{'\0'}, rcr, {NA, NA}, M, SHIFT, 1, 2, 4, {REX, 0xc1, REG, ib}},
235235
{"rdpmc", rdpmc, {n, n}, NA, OTHER, NA, NA, 2, {0x0f, 0x33}},
236+
{"rdpru", rdpru, {n, n}, NA, OTHER, NA, NA, 3, {0x0f, 0x01, 0xFD}},
236237
{"rdtsc", rdtsc, {n, n}, NA, OTHER, NA, NA, 2, {0x0f, 0x31}},
237238
{"rdtscp", rdtscp, {n, n}, NA, OTHER, NA, NA, 3, {0x0f, 0x01, 0xf9}},
238239
{"ret", ret, {n, n}, NA, CONTROL_FLOW, NA, NA, 1, {0xc3}},
@@ -287,7 +288,7 @@ const struct instr_table INSTR_TABLE[] = {
287288
{"shld", shld, {rri, mri}, MR, OTHER, NA, NA, 5, {REX, 0x0f, 0xa4, REG, ib}},
288289
{{'\0'}, shld, {rrr, mrr}, MR, OTHER, NA, NA, 4, {REX, 0x0f, 0xa5, REG}},
289290
{"shlx", shlx, {rrr, rmr}, RMV, VECTOR_EXT, NA, NA, 3, {VEX(NDS,LZ,X66,X0F38,W0_W1), 0xf7, REG}},
290-
{"shr", shr, {mi, ri}, M, SHIFT, 1, 5, 4, {REX, 0xbe, REG, ib}},
291+
{"shr", shr, {mi, ri}, M, SHIFT, 1, 5, 4, {REX, 0xd0, REG, ib}},
291292
{{'\0'}, shr, {NA, NA}, M, SHIFT, 1, 5, 4, {REX, 0xc0, REG, ib}},
292293
{{'\0'}, shr, {mr, rr}, M, SHIFT, 1, 5, 3, {REX, 0xd2, REG}},
293294
{"shrd", shrd, {mri, rri}, MR, OTHER, 2, NA, 4, {REX, 0x0f, 0xa9, REG}},

test/rdpmc.asm

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
SECTION .text
2+
GLOBAL test
3+
test:
4+
rdpmc

test/rdpru.asm

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
SECTION .text
2+
GLOBAL test
3+
test:
4+
rdpru

test/shr.asm

+5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
SECTION .text
22
GLOBAL test
33
test:
4+
shr r10, 0x1
45
shr r10, 0x13
56
shr r10, 0x14
67
shr r10, 0x15
@@ -17,6 +18,7 @@ shr r10, 0x3e
1718
shr r10, 0x3f
1819
shr r10, 0x8
1920
shr r10, 0x9
21+
shr r11, 0x1
2022
shr r11, 0x13
2123
shr r11, 0x14
2224
shr r11, 0x15
@@ -37,6 +39,7 @@ shr r11, 0x3e
3739
shr r11, 0x3f
3840
shr r11, 0x8
3941
shr r11, 0x9
42+
shr r12, 0x1
4043
shr r12, 0x14
4144
shr r12, 0x15
4245
shr r12, 0x1c
@@ -56,6 +59,7 @@ shr r12, 0x3d
5659
shr r12, 0x3e
5760
shr r12, 0x3f
5861
shr r12, 0x9
62+
shr r13, 0x1
5963
shr r13, 0x13
6064
shr r13, 0x14
6165
shr r13, 0x15
@@ -298,6 +302,7 @@ shr al, 0x13
298302
shr bl, 0x13
299303
shr cl, 0x13
300304
shr dl, 0x13
305+
shr dil, 0x1
301306
shr dil, 0x13
302307
shr r8w, 0x13
303308
shr r9w, 0x13

0 commit comments

Comments
 (0)