X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/de355530ae67247cbd0da700edb3a2a1dae884c2..4452a7af2eac33dbad800bcc91f2399d62c18f53:/osfmk/ddb/db_command.c diff --git a/osfmk/ddb/db_command.c b/osfmk/ddb/db_command.c index 788cb1eeb..d8d8b5f4b 100644 --- a/osfmk/ddb/db_command.c +++ b/osfmk/ddb/db_command.c @@ -1,23 +1,29 @@ /* - * Copyright (c) 2000 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved. * - * @APPLE_LICENSE_HEADER_START@ + * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ * - * The contents of this file constitute Original Code as defined in and - * are subject to the Apple Public Source License Version 1.1 (the - * "License"). You may not use this file except in compliance with the - * License. Please obtain a copy of the License at - * http://www.apple.com/publicsource and read it before using this file. + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. The rights granted to you under the License + * may not be used to create, or enable the creation or redistribution of, + * unlawful or unlicensed copies of an Apple operating system, or to + * circumvent, violate, or enable the circumvention or violation of, any + * terms of an Apple operating system software license agreement. * - * This Original Code and all software distributed under the License are - * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the - * License for the specific language governing rights and limitations - * under the License. + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. * - * @APPLE_LICENSE_HEADER_END@ + * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ */ /* * @OSF_COPYRIGHT@ @@ -57,7 +63,6 @@ /* * Command dispatcher. */ -#include #include #ifdef AT386 #include @@ -160,8 +165,6 @@ void db_command_list( char *last_modifp, /* IN_OUT */ struct db_command *cmd_table); - - /* * Search for command prefix. */ @@ -405,9 +408,6 @@ db_command_list( extern void db_system_stats(void); struct db_command db_show_all_cmds[] = { -#if USLOCK_DEBUG - { "slocks", (db_func) db_show_all_slocks, 0, 0 }, -#endif /* USLOCK_DEBUG */ { "acts", db_show_all_acts, 0, 0 }, { "spaces", db_show_all_spaces, 0, 0 }, { "tasks", db_show_all_acts, 0, 0 }, @@ -448,7 +448,6 @@ struct db_command db_show_cmds[] = { { "kmsg", (db_func) ipc_kmsg_print, 0, 0 }, { "msg", (db_func) ipc_msg_print, 0, 0 }, { "ipc_port", db_show_port_id, 0, 0 }, - { "lock", (db_func)db_show_one_lock, 0, 0 }, #if NORMA_VM { "xmm_obj", (db_func) xmm_obj_print, 0, 0 }, { "xmm_reply", (db_func) xmm_reply_print, 0, 0 }, @@ -459,17 +458,16 @@ struct db_command db_show_cmds[] = { { "space", db_show_one_space, 0, 0 }, { "system", (db_func) db_system_stats, 0, 0 }, { "zone", db_show_one_zone, 0, 0 }, - { "simple_lock", db_show_one_simple_lock, 0, 0 }, + { "lock", (db_func)db_show_one_lock, 0, 0 }, + { "mutex_lock", (db_func)db_show_one_mutex, 0, 0 }, + { "simple_lock", (db_func)db_show_one_simple_lock, 0, 0 }, { "thread_log", (db_func)db_show_thread_log, 0, 0 }, { "shuttle", db_show_shuttle, 0, 0 }, - { "etap_log", db_show_etap_log, 0, 0 }, { (char *)0, } }; -#if NCPUS > 1 #define db_switch_cpu kdb_on extern void db_switch_cpu(int); -#endif /* NCPUS > 1 */ struct db_command db_command_table[] = { #if DB_MACHINE_COMMANDS @@ -509,21 +507,37 @@ struct db_command db_command_table[] = { { "macro", (db_func) db_def_macro_cmd, CS_OWN, 0 }, { "dmacro", (db_func) db_del_macro_cmd, CS_OWN, 0 }, { "show", 0, 0, db_show_cmds }, -#if NCPUS > 1 { "cpu", (db_func) db_switch_cpu, 0, 0 }, -#endif /* NCPUS > 1 */ + { "dr", db_display_real, CS_MORE|CS_SET_DOT, 0 }, + { "di", db_display_iokit, CS_MORE, 0 }, + { "dk", db_display_kmod, CS_MORE, 0 }, + { "reboot", (db_func) db_reboot, 0, 0 }, -#if defined(__ppc__) +#if !defined(__ppc__) + { "pm", db_pmgr, CS_MORE, 0 }, + { "na", db_nap, CS_MORE, 0 }, + { "ms", db_msr, CS_MORE, 0 }, + { "cp", db_cpuid, CS_MORE, 0 }, + { "da", db_apic, CS_MORE, 0 }, + { "ts", db_test, CS_MORE, 0 }, + { "dn", db_intcnt, CS_MORE, 0 }, + { "hp", db_hpet, CS_MORE, 0 }, + { "cf", db_cfg, CS_MORE, 0 }, + { "dt", db_dtimers, CS_MORE, 0 }, +#endif +#if defined(__ppc__) { "lt", db_low_trace, CS_MORE|CS_SET_DOT, 0 }, { "dl", db_display_long, CS_MORE|CS_SET_DOT, 0 }, - { "dr", db_display_real, CS_MORE|CS_SET_DOT, 0 }, + { "dc", db_display_char, CS_MORE|CS_SET_DOT, 0 }, { "dv", db_display_virtual, CS_MORE|CS_SET_DOT, 0 }, { "dm", db_display_mappings, CS_MORE|CS_SET_DOT, 0 }, + { "dh", db_display_hash, CS_MORE|CS_SET_DOT, 0 }, { "dp", db_display_pmap, CS_MORE, 0 }, { "ds", db_display_save, CS_MORE|CS_SET_DOT, 0 }, { "dx", db_display_xregs, CS_MORE|CS_SET_DOT, 0 }, - { "dk", db_display_kmod, CS_MORE, 0 }, { "gs", db_gsnoop, CS_MORE, 0 }, + { "cm", db_check_mappings, CS_MORE, 0 }, + { "cp", db_check_pmaps, CS_MORE, 0 }, #endif { (char *)0, } }; @@ -594,8 +608,8 @@ db_command_loop(void) boolean_t db_exec_cmd_nest( - char *cmd, - int size) + const char *cmd, + int size) { struct db_lex_context lex_context; @@ -612,20 +626,10 @@ db_exec_cmd_nest( } void -db_error(char *s) +db_error(const char *s) { extern int db_macro_level; -#if defined(__alpha) -# if KDEBUG - extern boolean_t kdebug_mode; - if (kdebug_mode) { - if (s) kprintf(DBG_DEBUG, s); - return; - } -# endif /* KDEBUG */ -#endif /* defined(__alpha) */ - db_macro_level = 0; if (db_recover) { if (s > (char *)1) @@ -651,10 +655,11 @@ db_fncall(void) { db_expr_t fn_addr; #define MAXARGS 11 - db_expr_t args[MAXARGS]; + uint32_t args[MAXARGS]; + db_expr_t argwork; int nargs = 0; - db_expr_t retval; - db_expr_t (*func)(db_expr_t, ...); + uint32_t retval; + uint32_t (*func)(uint32_t, ...); int t; if (!db_expression(&fn_addr)) { @@ -662,31 +667,33 @@ db_fncall(void) db_flush_lex(); return; } - func = (db_expr_t (*) (db_expr_t, ...)) fn_addr; + func = (uint32_t (*) (uint32_t, ...)) fn_addr; t = db_read_token(); if (t == tLPAREN) { - if (db_expression(&args[0])) { - nargs++; - while ((t = db_read_token()) == tCOMMA) { - if (nargs == MAXARGS) { - db_printf("Too many arguments\n"); - db_flush_lex(); - return; - } - if (!db_expression(&args[nargs])) { - db_printf("Argument missing\n"); - db_flush_lex(); - return; - } - nargs++; - } - db_unread_token(t); + if (db_expression(&argwork)) { + args[nargs] = (uint32_t)argwork; + nargs++; + while ((t = db_read_token()) == tCOMMA) { + if (nargs == MAXARGS) { + db_printf("Too many arguments\n"); + db_flush_lex(); + return; + } + if (!db_expression(&argwork)) { + db_printf("Argument missing\n"); + db_flush_lex(); + return; + } + args[nargs] = (uint32_t)argwork; + nargs++; + } + db_unread_token(t); } if (db_read_token() != tRPAREN) { - db_printf("?\n"); - db_flush_lex(); - return; + db_printf("?\n"); + db_flush_lex(); + return; } } while (nargs < MAXARGS) { @@ -700,8 +707,8 @@ db_fncall(void) boolean_t db_option( - char *modif, - int option) + const char *modif, + int option) { register char *p;