17c478bd9Sstevel@tonic-gate /* 27c478bd9Sstevel@tonic-gate * CDDL HEADER START 37c478bd9Sstevel@tonic-gate * 47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*ae115bc7Smrj * Common Development and Distribution License (the "License"). 6*ae115bc7Smrj * You may not use this file except in compliance with the License. 77c478bd9Sstevel@tonic-gate * 87c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 97c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 107c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 117c478bd9Sstevel@tonic-gate * and limitations under the License. 127c478bd9Sstevel@tonic-gate * 137c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 147c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 157c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 167c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 177c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 187c478bd9Sstevel@tonic-gate * 197c478bd9Sstevel@tonic-gate * CDDL HEADER END 207c478bd9Sstevel@tonic-gate */ 217c478bd9Sstevel@tonic-gate /* 22*ae115bc7Smrj * Copyright 2007 Sun Microsystems, Inc. All rights reserved. 237c478bd9Sstevel@tonic-gate * Use is subject to license terms. 247c478bd9Sstevel@tonic-gate */ 257c478bd9Sstevel@tonic-gate 267c478bd9Sstevel@tonic-gate #ifndef _KMDB_KDI_H 277c478bd9Sstevel@tonic-gate #define _KMDB_KDI_H 287c478bd9Sstevel@tonic-gate 297c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 307c478bd9Sstevel@tonic-gate 317c478bd9Sstevel@tonic-gate #include <sys/types.h> 327c478bd9Sstevel@tonic-gate #include <sys/kdi.h> 337c478bd9Sstevel@tonic-gate #include <sys/modctl.h> 347c478bd9Sstevel@tonic-gate #include <gelf.h> 357c478bd9Sstevel@tonic-gate 367c478bd9Sstevel@tonic-gate #include <kmdb/kmdb_auxv.h> 377c478bd9Sstevel@tonic-gate #include <mdb/mdb_target.h> 387c478bd9Sstevel@tonic-gate #include <kmdb/kmdb_kdi_isadep.h> 397c478bd9Sstevel@tonic-gate 407c478bd9Sstevel@tonic-gate /* 417c478bd9Sstevel@tonic-gate * The following directive tells the mapfile generator that only those 427c478bd9Sstevel@tonic-gate * prototypes and declarations ending with a "Driver OK" comment should be 437c478bd9Sstevel@tonic-gate * included in the mapfile. 447c478bd9Sstevel@tonic-gate * 457c478bd9Sstevel@tonic-gate * MAPFILE: export "Driver OK" 467c478bd9Sstevel@tonic-gate */ 477c478bd9Sstevel@tonic-gate 487c478bd9Sstevel@tonic-gate #ifdef __cplusplus 497c478bd9Sstevel@tonic-gate extern "C" { 507c478bd9Sstevel@tonic-gate #endif 517c478bd9Sstevel@tonic-gate 527c478bd9Sstevel@tonic-gate struct module; 537c478bd9Sstevel@tonic-gate 547c478bd9Sstevel@tonic-gate /* 557c478bd9Sstevel@tonic-gate * KDI initialization 567c478bd9Sstevel@tonic-gate */ 577c478bd9Sstevel@tonic-gate extern void kmdb_kdi_init(kdi_t *, kmdb_auxv_t *); 587c478bd9Sstevel@tonic-gate extern void kmdb_kdi_init_isadep(kdi_t *, kmdb_auxv_t *); 597c478bd9Sstevel@tonic-gate extern void kmdb_kdi_end_init(void); 607c478bd9Sstevel@tonic-gate 617c478bd9Sstevel@tonic-gate /* 627c478bd9Sstevel@tonic-gate * Debugger -> Kernel functions for use when the kernel is stopped 637c478bd9Sstevel@tonic-gate */ 647c478bd9Sstevel@tonic-gate extern int kmdb_kdi_mods_changed(void); 657c478bd9Sstevel@tonic-gate extern int kmdb_kdi_mod_iter(int (*)(struct modctl *, void *), void *); 667c478bd9Sstevel@tonic-gate extern int kmdb_kdi_mod_isloaded(struct modctl *); 677c478bd9Sstevel@tonic-gate extern int kmdb_kdi_mod_haschanged(struct modctl *, struct module *, 687c478bd9Sstevel@tonic-gate struct modctl *, struct module *); 697c478bd9Sstevel@tonic-gate extern ssize_t kmdb_kdi_pread(void *, size_t, physaddr_t); 707c478bd9Sstevel@tonic-gate extern ssize_t kmdb_kdi_pwrite(void *, size_t, physaddr_t); 71*ae115bc7Smrj extern void kmdb_kdi_stop_slaves(int, int); 72*ae115bc7Smrj extern void kmdb_kdi_start_slaves(void); 73*ae115bc7Smrj extern void kmdb_kdi_slave_wait(void); 74*ae115bc7Smrj extern void kmdb_kdi_kmdb_enter(void); /* Driver OK */ 757c478bd9Sstevel@tonic-gate extern void kmdb_kdi_system_claim(void); 767c478bd9Sstevel@tonic-gate extern void kmdb_kdi_system_release(void); 777c478bd9Sstevel@tonic-gate extern size_t kmdb_kdi_range_is_nontoxic(uintptr_t, size_t, int); 787c478bd9Sstevel@tonic-gate extern void kmdb_kdi_flush_caches(void); 797c478bd9Sstevel@tonic-gate extern struct cons_polledio *kmdb_kdi_get_polled_io(void); 807c478bd9Sstevel@tonic-gate extern int kmdb_kdi_vtop(uintptr_t, physaddr_t *); 817c478bd9Sstevel@tonic-gate extern kdi_dtrace_state_t kmdb_kdi_dtrace_get_state(void); 827c478bd9Sstevel@tonic-gate extern int kmdb_kdi_dtrace_set(int); 837c478bd9Sstevel@tonic-gate 847c478bd9Sstevel@tonic-gate /* 857c478bd9Sstevel@tonic-gate * Driver -> Debugger notifications 867c478bd9Sstevel@tonic-gate */ 877c478bd9Sstevel@tonic-gate 887c478bd9Sstevel@tonic-gate extern int kmdb_kdi_get_unload_request(void); /* Driver OK */ 897c478bd9Sstevel@tonic-gate extern void kmdb_kdi_set_unload_request(void); /* Driver OK */ 907c478bd9Sstevel@tonic-gate 917c478bd9Sstevel@tonic-gate #define KMDB_KDI_FL_NOMODS 0x1 927c478bd9Sstevel@tonic-gate #define KMDB_KDI_FL_NOCTF 0x2 937c478bd9Sstevel@tonic-gate 947c478bd9Sstevel@tonic-gate extern int kmdb_kdi_get_flags(void); /* Driver OK */ 957c478bd9Sstevel@tonic-gate 967c478bd9Sstevel@tonic-gate /* 977c478bd9Sstevel@tonic-gate * Debugger -> Kernel functions for use only when the kernel is running 987c478bd9Sstevel@tonic-gate */ 997c478bd9Sstevel@tonic-gate extern uintptr_t kmdb_kdi_lookup_by_name(char *, char *); 1007c478bd9Sstevel@tonic-gate 1017c478bd9Sstevel@tonic-gate #ifdef __cplusplus 1027c478bd9Sstevel@tonic-gate } 1037c478bd9Sstevel@tonic-gate #endif 1047c478bd9Sstevel@tonic-gate 1057c478bd9Sstevel@tonic-gate #endif /* _KMDB_KDI_H */ 106