|
| 1 | +From ce3ea138398e68fb0529edd3df51ed2493fc4080 Mon Sep 17 00:00:00 2001 |
| 2 | +From: "H. Peter Anvin" <hpa@zytor.com> |
| 3 | +Date: Sat, 30 Aug 2025 16:16:43 -0700 |
| 4 | +Subject: [PATCH] ndisasm: make the assembler (hopefully) work again |
| 5 | + |
| 6 | +- Significantly overhauled the disassembler internals to make |
| 7 | + better use of the information already in the instruction template |
| 8 | + and to reduce the implementation differences with the assembler |
| 9 | +- Add APX support to the disassembler |
| 10 | +- Fix problem with disassembler truncating addresses of jumps |
| 11 | +- Fix generation of invalid EAs in 16-bit mode |
| 12 | +- Fix array overrun for types in a few modules |
| 13 | +- Fix invalid ND flag on near JMP |
| 14 | + |
| 15 | +Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com> |
| 16 | + |
| 17 | +Signed-off-by: Azure Linux Security Servicing Account <azurelinux-security@microsoft.com> |
| 18 | +Upstream-reference: https://github.com/netwide-assembler/nasm/commit/e05867ce3dfe303186f6c66df20251bfd828fd49 |
| 19 | +--- |
| 20 | + output/outdbg.c | 43 +++++++++++++++++++++++++++++++++++++++---- |
| 21 | + 1 file changed, 39 insertions(+), 4 deletions(-) |
| 22 | + |
| 23 | +diff --git a/output/outdbg.c b/output/outdbg.c |
| 24 | +index e7a9a4e..04cb3dd 100644 |
| 25 | +--- a/output/outdbg.c |
| 26 | ++++ b/output/outdbg.c |
| 27 | +@@ -408,9 +408,44 @@ dbg_pragma(const struct pragma *pragma) |
| 28 | + return DIRR_OK; |
| 29 | + } |
| 30 | + |
| 31 | +-static const char * const types[] = { |
| 32 | +- "unknown", "label", "byte", "word", "dword", "float", "qword", "tbyte" |
| 33 | +-}; |
| 34 | ++static const char *type_name(uint32_t type) |
| 35 | ++{ |
| 36 | ++ switch (TYM_TYPE(type)) { |
| 37 | ++ case TY_UNKNOWN: |
| 38 | ++ return "unknown"; |
| 39 | ++ case TY_LABEL: |
| 40 | ++ return "label"; |
| 41 | ++ case TY_BYTE: |
| 42 | ++ return "byte"; |
| 43 | ++ case TY_WORD: |
| 44 | ++ return "word"; |
| 45 | ++ case TY_DWORD: |
| 46 | ++ return "dword"; |
| 47 | ++ case TY_FLOAT: |
| 48 | ++ return "float"; |
| 49 | ++ case TY_QWORD: |
| 50 | ++ return "qword"; |
| 51 | ++ case TY_TBYTE: |
| 52 | ++ return "tbyte"; |
| 53 | ++ case TY_OWORD: |
| 54 | ++ return "oword"; |
| 55 | ++ case TY_YWORD: |
| 56 | ++ return "yword"; |
| 57 | ++ case TY_ZWORD: |
| 58 | ++ return "zword"; |
| 59 | ++ case TY_COMMON: |
| 60 | ++ return "common"; |
| 61 | ++ case TY_SEG: |
| 62 | ++ return "seg"; |
| 63 | ++ case TY_EXTERN: |
| 64 | ++ return "extern"; |
| 65 | ++ case TY_EQU: |
| 66 | ++ return "equ"; |
| 67 | ++ default: |
| 68 | ++ return "<invalid type code>"; |
| 69 | ++ } |
| 70 | ++} |
| 71 | ++ |
| 72 | + static void dbgdbg_init(void) |
| 73 | + { |
| 74 | + fprintf(ofile, "dbg init: debug information enabled\n"); |
| 75 | +@@ -457,7 +492,7 @@ static void dbgdbg_output(int output_type, void *param) |
| 76 | + static void dbgdbg_typevalue(int32_t type) |
| 77 | + { |
| 78 | + fprintf(ofile, "dbg typevalue: %s(%"PRIX32")\n", |
| 79 | +- types[TYM_TYPE(type) >> 3], TYM_ELEMENTS(type)); |
| 80 | ++ type_name(type), TYM_ELEMENTS(type)); |
| 81 | + } |
| 82 | + |
| 83 | + static void |
| 84 | +-- |
| 85 | +2.45.4 |
| 86 | + |
0 commit comments