📄 dbdisasm.c
字号:
* ******************************************************************************/voidacpi_db_display_namestring ( NATIVE_CHAR *name){ u32 seg_count; if (!name) { acpi_os_printf ("<NULL NAME PTR>"); return; } /* Handle all Scope Prefix operators */ while (acpi_ps_is_prefix_char (ACPI_GET8 (name))) { /* Append prefix character */ acpi_os_printf ("%1c", ACPI_GET8 (name)); name++; } switch (ACPI_GET8 (name)) { case 0: seg_count = 0; break; case AML_DUAL_NAME_PREFIX: seg_count = 2; name++; break; case AML_MULTI_NAME_PREFIX_OP: seg_count = (u32) ACPI_GET8 (name + 1); name += 2; break; default: seg_count = 1; break; } while (seg_count) { /* Append Name segment */ acpi_os_printf ("%4.4s", name); seg_count--; if (seg_count) { /* Not last name, append dot separator */ acpi_os_printf ("."); } name += ACPI_NAME_SIZE; }}/******************************************************************************* * * FUNCTION: Acpi_db_display_path * * PARAMETERS: Op - Named Op whose path is to be constructed * * RETURN: None * * DESCRIPTION: Walk backwards from current scope and display the name * of each previous level of scope up to the root scope * (like "pwd" does with file systems) * ******************************************************************************/voidacpi_db_display_path ( acpi_parse_object *op){ acpi_parse_object *prev; acpi_parse_object *search; u32 name; u8 do_dot = FALSE; acpi_parse_object *name_path; const acpi_opcode_info *op_info; /* We are only interested in named objects */ op_info = acpi_ps_get_opcode_info (op->opcode); if (!(op_info->flags & AML_NSNODE)) { return; } if (op_info->flags & AML_CREATE) { /* Field creation - check for a fully qualified namepath */ if (op->opcode == AML_CREATE_FIELD_OP) { name_path = acpi_ps_get_arg (op, 3); } else { name_path = acpi_ps_get_arg (op, 2); } if ((name_path) && (name_path->value.string) && (name_path->value.string[0] == '\\')) { acpi_db_display_namestring (name_path->value.string); return; } } prev = NULL; /* Start with Root Node */ while (prev != op) { /* Search upwards in the tree to find scope with "prev" as its parent */ search = op; for (; ;) { if (search->parent == prev) { break; } /* Go up one level */ search = search->parent; } if (prev) { op_info = acpi_ps_get_opcode_info (search->opcode); if (!(op_info->flags & AML_FIELD)) { /* below root scope, append scope name */ if (do_dot) { /* append dot */ acpi_os_printf ("."); } if (op_info->flags & AML_CREATE) { if (op->opcode == AML_CREATE_FIELD_OP) { name_path = acpi_ps_get_arg (op, 3); } else { name_path = acpi_ps_get_arg (op, 2); } if ((name_path) && (name_path->value.string)) { acpi_os_printf ("%4.4s", name_path->value.string); } } else { name = acpi_ps_get_name (search); acpi_os_printf ("%4.4s", &name); } do_dot = TRUE; } } prev = search; }}/******************************************************************************* * * FUNCTION: Acpi_db_display_opcode * * PARAMETERS: Op - Op that is to be printed * * RETURN: Status * * DESCRIPTION: Store printed op in a Buffer and return its length * (or -1 if out of space) * * NOTE: Terse mode prints out ASL-like code. Verbose mode adds more info. * ******************************************************************************/voidacpi_db_display_opcode ( acpi_walk_state *walk_state, acpi_parse_object *op){ u8 *byte_data; u32 byte_count; u32 i; const acpi_opcode_info *op_info = NULL; u32 name; if (!op) { acpi_os_printf ("<NULL OP PTR>"); } /* op and arguments */ switch (op->opcode) { case AML_BYTE_OP: if (acpi_gbl_db_opt_verbose) { acpi_os_printf ("(u8) 0x%2.2X", op->value.integer8); } else { acpi_os_printf ("0x%2.2X", op->value.integer8); } break; case AML_WORD_OP: if (acpi_gbl_db_opt_verbose) { acpi_os_printf ("(u16) 0x%4.4X", op->value.integer16); } else { acpi_os_printf ("0x%4.4X", op->value.integer16); } break; case AML_DWORD_OP: if (acpi_gbl_db_opt_verbose) { acpi_os_printf ("(u32) 0x%8.8X", op->value.integer32); } else { acpi_os_printf ("0x%8.8X", op->value.integer32); } break; case AML_QWORD_OP: if (acpi_gbl_db_opt_verbose) { acpi_os_printf ("(u64) 0x%8.8X%8.8X", op->value.integer64.hi, op->value.integer64.lo); } else { acpi_os_printf ("0x%8.8X%8.8X", op->value.integer64.hi, op->value.integer64.lo); } break; case AML_STRING_OP: if (op->value.string) { acpi_os_printf ("\"%s\"", op->value.string); } else { acpi_os_printf ("<\"NULL STRING PTR\">"); } break; case AML_INT_STATICSTRING_OP: if (op->value.string) { acpi_os_printf ("\"%s\"", op->value.string); } else { acpi_os_printf ("\"<NULL STATIC STRING PTR>\""); } break; case AML_INT_NAMEPATH_OP: acpi_db_display_namestring (op->value.name); break; case AML_INT_NAMEDFIELD_OP: acpi_os_printf ("Named_field (Length 0x%8.8X) ", op->value.integer32); break; case AML_INT_RESERVEDFIELD_OP: acpi_os_printf ("Reserved_field (Length 0x%8.8X) ", op->value.integer32); break; case AML_INT_ACCESSFIELD_OP: acpi_os_printf ("Access_field (Length 0x%8.8X) ", op->value.integer32); break; case AML_INT_BYTELIST_OP: if (acpi_gbl_db_opt_verbose) { acpi_os_printf ("Byte_list (Length 0x%8.8X) ", op->value.integer32); } else { acpi_os_printf ("0x%2.2X", op->value.integer32); byte_count = op->value.integer32; byte_data = ((acpi_parse2_object *) op)->data; for (i = 0; i < byte_count; i++) { acpi_os_printf (", 0x%2.2X", byte_data[i]); } } break; default: /* Just get the opcode name and print it */ op_info = acpi_ps_get_opcode_info (op->opcode); acpi_os_printf ("%s", op_info->name);#ifndef PARSER_ONLY if ((op->opcode == AML_INT_RETURN_VALUE_OP) && (walk_state->results) && (walk_state->results->results.num_results)) { acpi_db_decode_internal_object (walk_state->results->results.obj_desc [walk_state->results->results.num_results-1]); }#endif break; } if (!op_info) { /* If there is another element in the list, add a comma */ if (op->next) { acpi_os_printf (","); } } /* * If this is a named opcode, print the associated name value */ op_info = acpi_ps_get_opcode_info (op->opcode); if (op && (op_info->flags & AML_NAMED)) { name = acpi_ps_get_name (op); acpi_os_printf (" %4.4s", &name); if ((acpi_gbl_db_opt_verbose) && (op->opcode != AML_INT_NAMEDFIELD_OP)) { acpi_ps_display_object_pathname (walk_state, op); } }}#endif /* ENABLE_DEBUGGER */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -