xref: /freebsd/sys/amd64/include/kdb.h (revision 95ee2897)
146280ae7SWarner Losh /*-
24d846d26SWarner Losh  * SPDX-License-Identifier: BSD-2-Clause
3c49761ddSPedro F. Giffuni  *
4cbc17435SMarcel Moolenaar  * Copyright (c) 2004 Marcel Moolenaar
5cbc17435SMarcel Moolenaar  * All rights reserved.
6cbc17435SMarcel Moolenaar  *
7cbc17435SMarcel Moolenaar  * Redistribution and use in source and binary forms, with or without
8cbc17435SMarcel Moolenaar  * modification, are permitted provided that the following conditions
9cbc17435SMarcel Moolenaar  * are met:
10cbc17435SMarcel Moolenaar  *
11cbc17435SMarcel Moolenaar  * 1. Redistributions of source code must retain the above copyright
12cbc17435SMarcel Moolenaar  *    notice, this list of conditions and the following disclaimer.
13cbc17435SMarcel Moolenaar  * 2. Redistributions in binary form must reproduce the above copyright
14cbc17435SMarcel Moolenaar  *    notice, this list of conditions and the following disclaimer in the
15cbc17435SMarcel Moolenaar  *    documentation and/or other materials provided with the distribution.
16cbc17435SMarcel Moolenaar  *
17cbc17435SMarcel Moolenaar  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18cbc17435SMarcel Moolenaar  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19cbc17435SMarcel Moolenaar  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20cbc17435SMarcel Moolenaar  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21cbc17435SMarcel Moolenaar  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22cbc17435SMarcel Moolenaar  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23cbc17435SMarcel Moolenaar  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24cbc17435SMarcel Moolenaar  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25cbc17435SMarcel Moolenaar  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26cbc17435SMarcel Moolenaar  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27cbc17435SMarcel Moolenaar  */
28cbc17435SMarcel Moolenaar 
29cbc17435SMarcel Moolenaar #ifndef _MACHINE_KDB_H_
30cbc17435SMarcel Moolenaar #define _MACHINE_KDB_H_
31cbc17435SMarcel Moolenaar 
32cbc17435SMarcel Moolenaar #include <machine/frame.h>
33cbc17435SMarcel Moolenaar #include <machine/psl.h>
34cbc17435SMarcel Moolenaar 
3515dc1d44SMitchell Horne int kdb_cpu_set_watchpoint(vm_offset_t addr, vm_size_t size, int access);
3615dc1d44SMitchell Horne int kdb_cpu_clr_watchpoint(vm_offset_t addr, vm_size_t size);
3715dc1d44SMitchell Horne 
38cbc17435SMarcel Moolenaar static __inline void
kdb_cpu_clear_singlestep(void)39cbc17435SMarcel Moolenaar kdb_cpu_clear_singlestep(void)
40cbc17435SMarcel Moolenaar {
41cbc17435SMarcel Moolenaar 	kdb_frame->tf_rflags &= ~PSL_T;
42cbc17435SMarcel Moolenaar }
43cbc17435SMarcel Moolenaar 
44cbc17435SMarcel Moolenaar static __inline void
kdb_cpu_set_singlestep(void)45cbc17435SMarcel Moolenaar kdb_cpu_set_singlestep(void)
46cbc17435SMarcel Moolenaar {
47cbc17435SMarcel Moolenaar 	kdb_frame->tf_rflags |= PSL_T;
48cbc17435SMarcel Moolenaar }
49cbc17435SMarcel Moolenaar 
50cbc17435SMarcel Moolenaar static __inline void
kdb_cpu_sync_icache(unsigned char * addr,size_t size)5101bd17ccSMarcel Moolenaar kdb_cpu_sync_icache(unsigned char *addr, size_t size)
5201bd17ccSMarcel Moolenaar {
5301bd17ccSMarcel Moolenaar }
5401bd17ccSMarcel Moolenaar 
5501bd17ccSMarcel Moolenaar static __inline void
kdb_cpu_trap(int type,int code)56cbc17435SMarcel Moolenaar kdb_cpu_trap(int type, int code)
57cbc17435SMarcel Moolenaar {
58cbc17435SMarcel Moolenaar }
59cbc17435SMarcel Moolenaar 
60cbc17435SMarcel Moolenaar #endif /* _MACHINE_KDB_H_ */
61