xref: /freebsd/sys/arm/include/gdb_machdep.h (revision 95ee2897e98f5d444f26ed2334cc7c439f9c16c6)
1be050429SOlivier Houchard /*-
2*4d846d26SWarner Losh  * SPDX-License-Identifier: BSD-2-Clause
3af3dc4a7SPedro F. Giffuni  *
4be050429SOlivier Houchard  * Copyright (c) 2006 Olivier Houchard
5be050429SOlivier Houchard  * All rights reserved.
6be050429SOlivier Houchard  *
7be050429SOlivier Houchard  * Redistribution and use in source and binary forms, with or without
8be050429SOlivier Houchard  * modification, are permitted provided that the following conditions
9be050429SOlivier Houchard  * are met:
10be050429SOlivier Houchard  *
11be050429SOlivier Houchard  * 1. Redistributions of source code must retain the above copyright
12be050429SOlivier Houchard  *    notice, this list of conditions and the following disclaimer.
13be050429SOlivier Houchard  * 2. Redistributions in binary form must reproduce the above copyright
14be050429SOlivier Houchard  *    notice, this list of conditions and the following disclaimer in the
15be050429SOlivier Houchard  *    documentation and/or other materials provided with the distribution.
16be050429SOlivier Houchard  *
17be050429SOlivier Houchard  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18be050429SOlivier Houchard  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19be050429SOlivier Houchard  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20be050429SOlivier Houchard  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21be050429SOlivier Houchard  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22be050429SOlivier Houchard  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23be050429SOlivier Houchard  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24be050429SOlivier Houchard  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25be050429SOlivier Houchard  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26be050429SOlivier Houchard  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27be050429SOlivier Houchard  */
28be050429SOlivier Houchard 
29be050429SOlivier Houchard #ifndef _MACHINE_GDB_MACHDEP_H_
30be050429SOlivier Houchard #define	_MACHINE_GDB_MACHDEP_H_
31be050429SOlivier Houchard 
32be050429SOlivier Houchard #define	GDB_BUFSZ	400
33be050429SOlivier Houchard #define	GDB_NREGS	26
348bf82b34SMark Johnston #define	GDB_REG_SP	13
358bf82b34SMark Johnston #define	GDB_REG_LR	14
36be050429SOlivier Houchard #define	GDB_REG_PC	15
37be050429SOlivier Houchard 
38be050429SOlivier Houchard static __inline size_t
gdb_cpu_regsz(int regnum)39a92526f3SMark Johnston gdb_cpu_regsz(int regnum)
40be050429SOlivier Houchard {
41a92526f3SMark Johnston 	/*
42a92526f3SMark Johnston 	 * GDB expects the FPA registers f0-f7, each 96 bits wide, to be placed
43a92526f3SMark Johnston 	 * in between the PC and CSPR in response to a "g" packet.
44a92526f3SMark Johnston 	 */
45a92526f3SMark Johnston 	return (regnum >= 16 && regnum <= 23 ? 12 : sizeof(int));
46be050429SOlivier Houchard }
47be050429SOlivier Houchard 
48be050429SOlivier Houchard static __inline int
gdb_cpu_query(void)49be050429SOlivier Houchard gdb_cpu_query(void)
50be050429SOlivier Houchard {
51be050429SOlivier Houchard 	return (0);
52be050429SOlivier Houchard }
53be050429SOlivier Houchard 
54beb24065SJonathan T. Looney static __inline void *
gdb_begin_write(void)55beb24065SJonathan T. Looney gdb_begin_write(void)
56beb24065SJonathan T. Looney {
57beb24065SJonathan T. Looney 
58beb24065SJonathan T. Looney 	return (NULL);
59beb24065SJonathan T. Looney }
60beb24065SJonathan T. Looney 
61beb24065SJonathan T. Looney static __inline void
gdb_end_write(void * arg __unused)62beb24065SJonathan T. Looney gdb_end_write(void *arg __unused)
63beb24065SJonathan T. Looney {
64beb24065SJonathan T. Looney 
65beb24065SJonathan T. Looney }
66beb24065SJonathan T. Looney 
677446b088SMitchell Horne static __inline void
gdb_cpu_stop_reason(int type __unused,int code __unused)687446b088SMitchell Horne gdb_cpu_stop_reason(int type __unused, int code __unused)
697446b088SMitchell Horne {
707446b088SMitchell Horne 
717446b088SMitchell Horne }
727446b088SMitchell Horne 
73be050429SOlivier Houchard void *gdb_cpu_getreg(int, size_t *);
74be050429SOlivier Houchard void gdb_cpu_setreg(int, void *);
75be050429SOlivier Houchard int gdb_cpu_signal(int, int);
76be050429SOlivier Houchard 
77be050429SOlivier Houchard #endif /* !_MACHINE_GDB_MACHDEP_H_ */
78