diff options
author | Anton Lindqvist <anton@cvs.openbsd.org> | 2024-11-19 05:49:28 +0000 |
---|---|---|
committer | Anton Lindqvist <anton@cvs.openbsd.org> | 2024-11-19 05:49:28 +0000 |
commit | 59ac9330d5a4cb5723c420f4117cae7aa3628cd8 (patch) | |
tree | 1908f4b8e385704b48dbe4eccb78776584a62f32 /sys | |
parent | 3aa95df347c6d7fcfc50fa57f1b086d7029bad96 (diff) |
Teach ddb how to disassemble endbr64.
With input on prefix handling and ok jsg@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/amd64/amd64/db_disasm.c | 40 |
1 files changed, 38 insertions, 2 deletions
diff --git a/sys/arch/amd64/amd64/db_disasm.c b/sys/arch/amd64/amd64/db_disasm.c index 7b934583d2c..fe6e581ce22 100644 --- a/sys/arch/amd64/amd64/db_disasm.c +++ b/sys/arch/amd64/amd64/db_disasm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: db_disasm.c,v 1.26 2024/07/09 01:21:19 jsg Exp $ */ +/* $OpenBSD: db_disasm.c,v 1.27 2024/11/19 05:49:27 anton Exp $ */ /* $NetBSD: db_disasm.c,v 1.11 1996/05/03 19:41:58 christos Exp $ */ /* @@ -162,6 +162,17 @@ char * db_GrpC[] = { "", "", "", "" }; +struct inst db_Grp0f1e[] = { + { "", 0, NONE, 0, 0 }, + { "", 0, NONE, 0, 0 }, + { "", 0, NONE, 0, 0 }, + { "", 0, NONE, 0, 0 }, + { "", 0, NONE, 0, 0 }, + { "", 0, NONE, 0, 0 }, + { "", 0, NONE, 0, 0 }, + { "", 1, NONE, op2(MEx,2), "\0\0endbr64" }, +}; + struct inst db_inst_0f0x[] = { /*00*/ { NULL, 1, NONE, op1(Ew), db_Grp6 }, /*01*/ { "", 1, RDEP, 0, db_Grp7 }, @@ -182,6 +193,26 @@ struct inst db_inst_0f0x[] = { /*0f*/ { "", 0, NONE, 0, 0 }, }; +struct inst db_inst_0f1x[] = { +/*10*/ { "", 0, NONE, 0, 0 }, +/*11*/ { "", 0, NONE, 0, 0 }, +/*12*/ { "", 0, NONE, 0, 0 }, +/*13*/ { "", 0, NONE, 0, 0 }, +/*14*/ { "", 0, NONE, 0, 0 }, +/*15*/ { "", 0, NONE, 0, 0 }, +/*16*/ { "", 0, NONE, 0, 0 }, +/*17*/ { "", 0, NONE, 0, 0 }, + +/*18*/ { "", 0, NONE, 0, 0 }, +/*19*/ { "", 0, NONE, 0, 0 }, +/*1a*/ { "", 0, NONE, 0, 0 }, +/*1b*/ { "", 0, NONE, 0, 0 }, +/*1c*/ { "", 0, NONE, 0, 0 }, +/*1d*/ { "", 0, NONE, 0, 0 }, +/*1e*/ { "", 1, RDEP, 0, db_Grp0f1e }, +/*1f*/ { "", 0, NONE, 0, 0 }, +}; + struct inst db_inst_0f2x[] = { /*20*/ { "mov", 1, LONG, op2(CR,E), 0 }, /* use E for reg */ /*21*/ { "mov", 1, LONG, op2(DR,E), 0 }, /* since mod == 11 */ @@ -324,7 +355,7 @@ struct inst db_inst_0fcx[] = { struct inst *db_inst_0f[] = { db_inst_0f0x, - NULL, + db_inst_0f1x, db_inst_0f2x, db_inst_0f3x, NULL, @@ -1175,6 +1206,11 @@ db_disasm(vaddr_t loc, int altfmt) } while (prefix); if (segovr_grp > 1) seg = "<bad segment override prefix combination> "; + + /* prefix with escape byte, not a rep */ + if ((repe || repne) && inst == 0x0f) + repe = repne = 0; + if (repe > 0 && repne > 0) db_printf("<bad repeat prefix combination> "); else if (repe > 0) |