xref: /f-stack/freebsd/arm/include/stack.h (revision 22ce4aff)
1a9643ea8Slogwang /*-
2a9643ea8Slogwang  * Copyright (c) 2000, 2001 Ben Harris
3a9643ea8Slogwang  * Copyright (c) 1996 Scott K. Stevens
4a9643ea8Slogwang  *
5a9643ea8Slogwang  * Mach Operating System
6a9643ea8Slogwang  * Copyright (c) 1991,1990 Carnegie Mellon University
7a9643ea8Slogwang  * All Rights Reserved.
8a9643ea8Slogwang  *
9a9643ea8Slogwang  * Permission to use, copy, modify and distribute this software and its
10a9643ea8Slogwang  * documentation is hereby granted, provided that both the copyright
11a9643ea8Slogwang  * notice and this permission notice appear in all copies of the
12a9643ea8Slogwang  * software, derivative works or modified versions, and any portions
13a9643ea8Slogwang  * thereof, and that both notices appear in supporting documentation.
14a9643ea8Slogwang  *
15a9643ea8Slogwang  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
16a9643ea8Slogwang  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
17a9643ea8Slogwang  * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
18a9643ea8Slogwang  *
19a9643ea8Slogwang  * Carnegie Mellon requests users of this software to return to
20a9643ea8Slogwang  *
21a9643ea8Slogwang  *  Software Distribution Coordinator  or  [email protected]
22a9643ea8Slogwang  *  School of Computer Science
23a9643ea8Slogwang  *  Carnegie Mellon University
24a9643ea8Slogwang  *  Pittsburgh PA 15213-3890
25a9643ea8Slogwang  *
26a9643ea8Slogwang  * any improvements or extensions that they make and grant Carnegie the
27a9643ea8Slogwang  * rights to redistribute these changes.
28a9643ea8Slogwang  *
29a9643ea8Slogwang  * $FreeBSD$
30a9643ea8Slogwang  */
31a9643ea8Slogwang 
32a9643ea8Slogwang #ifndef _MACHINE_STACK_H_
33a9643ea8Slogwang #define	_MACHINE_STACK_H_
34a9643ea8Slogwang 
35a9643ea8Slogwang #define INKERNEL(va)	(((vm_offset_t)(va)) >= VM_MIN_KERNEL_ADDRESS)
36a9643ea8Slogwang 
37a9643ea8Slogwang #define FR_SCP	(0)
38a9643ea8Slogwang #define FR_RLV	(-1)
39a9643ea8Slogwang #define FR_RSP	(-2)
40a9643ea8Slogwang #define FR_RFP	(-3)
41a9643ea8Slogwang 
42a9643ea8Slogwang /* The state of the unwind process */
43a9643ea8Slogwang struct unwind_state {
44a9643ea8Slogwang 	uint32_t registers[16];
45a9643ea8Slogwang 	uint32_t start_pc;
46a9643ea8Slogwang 	uint32_t *insn;
47a9643ea8Slogwang 	u_int entries;
48a9643ea8Slogwang 	u_int byte;
49a9643ea8Slogwang 	uint16_t update_mask;
50a9643ea8Slogwang };
51a9643ea8Slogwang 
52a9643ea8Slogwang /* The register names */
53a9643ea8Slogwang #define	FP	11
54a9643ea8Slogwang #define	SP	13
55a9643ea8Slogwang #define	LR	14
56a9643ea8Slogwang #define	PC	15
57a9643ea8Slogwang 
58*22ce4affSfengbojiang #ifdef _KERNEL
59*22ce4affSfengbojiang 
60a9643ea8Slogwang int unwind_stack_one(struct unwind_state *, int);
61a9643ea8Slogwang 
62*22ce4affSfengbojiang struct linker_file;
63*22ce4affSfengbojiang void unwind_module_loaded(struct linker_file *);
64*22ce4affSfengbojiang void unwind_module_unloaded(struct linker_file *);
65*22ce4affSfengbojiang 
66*22ce4affSfengbojiang #endif
67*22ce4affSfengbojiang 
68a9643ea8Slogwang #endif /* !_MACHINE_STACK_H_ */
69