| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: db_disasm.c,v 1.22 2015/05/12 23:16:47 christos Exp $ */ | | 1 | /* $NetBSD: db_disasm.c,v 1.23 2016/03/25 10:14:43 shm Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Mach Operating System | | 4 | * Mach Operating System |
5 | * Copyright (c) 1991,1990 Carnegie Mellon University | | 5 | * Copyright (c) 1991,1990 Carnegie Mellon University |
6 | * All Rights Reserved. | | 6 | * All Rights Reserved. |
7 | * | | 7 | * |
8 | * Permission to use, copy, modify and distribute this software and its | | 8 | * Permission to use, copy, modify and distribute this software and its |
9 | * documentation is hereby granted, provided that both the copyright | | 9 | * documentation is hereby granted, provided that both the copyright |
10 | * notice and this permission notice appear in all copies of the | | 10 | * notice and this permission notice appear in all copies of the |
11 | * software, derivative works or modified versions, and any portions | | 11 | * software, derivative works or modified versions, and any portions |
12 | * thereof, and that both notices appear in supporting documentation. | | 12 | * thereof, and that both notices appear in supporting documentation. |
13 | * | | 13 | * |
14 | * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" | | 14 | * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" |
| @@ -23,27 +23,27 @@ | | | @@ -23,27 +23,27 @@ |
23 | * Pittsburgh PA 15213-3890 | | 23 | * Pittsburgh PA 15213-3890 |
24 | * | | 24 | * |
25 | * any improvements or extensions that they make and grant Carnegie the | | 25 | * any improvements or extensions that they make and grant Carnegie the |
26 | * rights to redistribute these changes. | | 26 | * rights to redistribute these changes. |
27 | * | | 27 | * |
28 | * Id: db_disasm.c,v 2.3 91/02/05 17:11:03 mrt (CMU) | | 28 | * Id: db_disasm.c,v 2.3 91/02/05 17:11:03 mrt (CMU) |
29 | */ | | 29 | */ |
30 | | | 30 | |
31 | /* | | 31 | /* |
32 | * Instruction disassembler. | | 32 | * Instruction disassembler. |
33 | */ | | 33 | */ |
34 | | | 34 | |
35 | #include <sys/cdefs.h> | | 35 | #include <sys/cdefs.h> |
36 | __KERNEL_RCSID(0, "$NetBSD: db_disasm.c,v 1.22 2015/05/12 23:16:47 christos Exp $"); | | 36 | __KERNEL_RCSID(0, "$NetBSD: db_disasm.c,v 1.23 2016/03/25 10:14:43 shm Exp $"); |
37 | | | 37 | |
38 | #ifndef _KERNEL | | 38 | #ifndef _KERNEL |
39 | #include <sys/types.h> | | 39 | #include <sys/types.h> |
40 | #include <sys/time.h> | | 40 | #include <sys/time.h> |
41 | #include <sys/ksyms.h> | | 41 | #include <sys/ksyms.h> |
42 | #endif /* _KERNEL */ | | 42 | #endif /* _KERNEL */ |
43 | | | 43 | |
44 | #include <sys/param.h> | | 44 | #include <sys/param.h> |
45 | #include <sys/proc.h> | | 45 | #include <sys/proc.h> |
46 | #include <machine/db_machdep.h> | | 46 | #include <machine/db_machdep.h> |
47 | | | 47 | |
48 | #include <ddb/db_access.h> | | 48 | #include <ddb/db_access.h> |
49 | #include <ddb/db_sym.h> | | 49 | #include <ddb/db_sym.h> |
| @@ -1307,26 +1307,32 @@ db_disasm(db_addr_t loc, bool altfmt) | | | @@ -1307,26 +1307,32 @@ db_disasm(db_addr_t loc, bool altfmt) |
1307 | ip = &db_Grp9b[f_reg(rex, regmodrm)]; | | 1307 | ip = &db_Grp9b[f_reg(rex, regmodrm)]; |
1308 | i_name = ip->i_name; | | 1308 | i_name = ip->i_name; |
1309 | i_size = ip->i_size; | | 1309 | i_size = ip->i_size; |
1310 | i_mode = ip->i_mode; | | 1310 | i_mode = ip->i_mode; |
1311 | } else if (ip->i_extra == (const char *)db_Grp1 || | | 1311 | } else if (ip->i_extra == (const char *)db_Grp1 || |
1312 | ip->i_extra == (const char *)db_Grp2 || | | 1312 | ip->i_extra == (const char *)db_Grp2 || |
1313 | ip->i_extra == (const char *)db_Grp6 || | | 1313 | ip->i_extra == (const char *)db_Grp6 || |
1314 | ip->i_extra == (const char *)db_Grp7 || | | 1314 | ip->i_extra == (const char *)db_Grp7 || |
1315 | ip->i_extra == (const char *)db_Grp8 || | | 1315 | ip->i_extra == (const char *)db_Grp8 || |
1316 | ip->i_extra == (const char *)db_Grp9) { | | 1316 | ip->i_extra == (const char *)db_Grp9) { |
1317 | if (ip->i_extra == (const char *)db_Grp7 && regmodrm == 0xf8) { | | 1317 | if (ip->i_extra == (const char *)db_Grp7 && regmodrm == 0xf8) { |
1318 | i_name = "swapgs"; | | 1318 | i_name = "swapgs"; |
1319 | i_mode = 0; | | 1319 | i_mode = 0; |
| | | 1320 | } else if (ip->i_extra == (const char *)db_Grp7 && regmodrm == 0xcb) { |
| | | 1321 | i_name = "stac"; |
| | | 1322 | i_mode = 0; |
| | | 1323 | } else if (ip->i_extra == (const char *)db_Grp7 && regmodrm == 0xca) { |
| | | 1324 | i_name = "clac"; |
| | | 1325 | i_mode = 0; |
1320 | } else { | | 1326 | } else { |
1321 | i_name = ((const char * const *)ip->i_extra) | | 1327 | i_name = ((const char * const *)ip->i_extra) |
1322 | [f_reg(rex, regmodrm)]; | | 1328 | [f_reg(rex, regmodrm)]; |
1323 | } | | 1329 | } |
1324 | } else if (ip->i_extra == (const char *)db_Grp3) { | | 1330 | } else if (ip->i_extra == (const char *)db_Grp3) { |
1325 | ip = (const struct inst *)ip->i_extra; | | 1331 | ip = (const struct inst *)ip->i_extra; |
1326 | ip = &ip[f_reg(rex, regmodrm)]; | | 1332 | ip = &ip[f_reg(rex, regmodrm)]; |
1327 | i_name = ip->i_name; | | 1333 | i_name = ip->i_name; |
1328 | i_mode = ip->i_mode; | | 1334 | i_mode = ip->i_mode; |
1329 | } else if (ip->i_extra == (const char *)db_Grp4 || | | 1335 | } else if (ip->i_extra == (const char *)db_Grp4 || |
1330 | ip->i_extra == (const char *)db_Grp5) { | | 1336 | ip->i_extra == (const char *)db_Grp5) { |
1331 | ip = (const struct inst *)ip->i_extra; | | 1337 | ip = (const struct inst *)ip->i_extra; |
1332 | ip = &ip[f_reg(rex, regmodrm)]; | | 1338 | ip = &ip[f_reg(rex, regmodrm)]; |