1d8315c79SWarner Losh /*-
2*4d846d26SWarner Losh * SPDX-License-Identifier: BSD-2-Clause
3af3dc4a7SPedro F. Giffuni *
455b81ba2SOlivier Houchard * Copyright (c) 2004 Marcel Moolenaar
555b81ba2SOlivier Houchard * All rights reserved.
655b81ba2SOlivier Houchard *
755b81ba2SOlivier Houchard * Redistribution and use in source and binary forms, with or without
855b81ba2SOlivier Houchard * modification, are permitted provided that the following conditions
955b81ba2SOlivier Houchard * are met:
1055b81ba2SOlivier Houchard *
1155b81ba2SOlivier Houchard * 1. Redistributions of source code must retain the above copyright
1255b81ba2SOlivier Houchard * notice, this list of conditions and the following disclaimer.
1355b81ba2SOlivier Houchard * 2. Redistributions in binary form must reproduce the above copyright
1455b81ba2SOlivier Houchard * notice, this list of conditions and the following disclaimer in the
1555b81ba2SOlivier Houchard * documentation and/or other materials provided with the distribution.
1655b81ba2SOlivier Houchard *
1755b81ba2SOlivier Houchard * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
1855b81ba2SOlivier Houchard * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
1955b81ba2SOlivier Houchard * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
2055b81ba2SOlivier Houchard * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
2155b81ba2SOlivier Houchard * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
2255b81ba2SOlivier Houchard * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2355b81ba2SOlivier Houchard * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2455b81ba2SOlivier Houchard * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2555b81ba2SOlivier Houchard * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
2655b81ba2SOlivier Houchard * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2755b81ba2SOlivier Houchard */
2855b81ba2SOlivier Houchard
2955b81ba2SOlivier Houchard #ifndef _MACHINE_KDB_H_
3055b81ba2SOlivier Houchard #define _MACHINE_KDB_H_
3155b81ba2SOlivier Houchard
32a89156f5SMichal Meloun #include <machine/cpu.h>
33a89156f5SMichal Meloun #include <machine/db_machdep.h>
3455b81ba2SOlivier Houchard #include <machine/frame.h>
3555b81ba2SOlivier Houchard #include <machine/psl.h>
3655b81ba2SOlivier Houchard
37595f8a59SZbigniew Bodek extern void kdb_cpu_clear_singlestep(void);
38595f8a59SZbigniew Bodek extern void kdb_cpu_set_singlestep(void);
39595f8a59SZbigniew Bodek boolean_t kdb_cpu_pc_is_singlestep(db_addr_t);
405a2933d0SMitchell Horne int kdb_cpu_set_watchpoint(vm_offset_t addr, size_t size, int access);
415a2933d0SMitchell Horne int kdb_cpu_clr_watchpoint(vm_offset_t addr, size_t size);
4255b81ba2SOlivier Houchard
4355b81ba2SOlivier Houchard static __inline void
kdb_cpu_sync_icache(unsigned char * addr,size_t size)4401bd17ccSMarcel Moolenaar kdb_cpu_sync_icache(unsigned char *addr, size_t size)
4501bd17ccSMarcel Moolenaar {
466a07a860SGrzegorz Bernacki
47a89156f5SMichal Meloun icache_sync((vm_offset_t)addr, size);
4801bd17ccSMarcel Moolenaar }
4901bd17ccSMarcel Moolenaar
5001bd17ccSMarcel Moolenaar static __inline void
kdb_cpu_trap(int type,int code)5155b81ba2SOlivier Houchard kdb_cpu_trap(int type, int code)
5255b81ba2SOlivier Houchard {
5355b81ba2SOlivier Houchard }
5455b81ba2SOlivier Houchard
5555b81ba2SOlivier Houchard #endif /* _MACHINE_KDB_H_ */
56