Zephyr API Documentation
4.0.0-rc2
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
exc_handle.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2018 Intel Corporation.
3
*
4
* SPDX-License-Identifier: Apache-2.0
5
*/
6
7
#ifndef ZEPHYR_INCLUDE_EXC_HANDLE_H_
8
#define ZEPHYR_INCLUDE_EXC_HANDLE_H_
9
10
/*
11
* This is used by some architectures to define code ranges which may
12
* perform operations that could generate a CPU exception that should not
13
* be fatal. Instead, the exception should return but set the program
14
* counter to a 'fixup' memory address which will gracefully error out.
15
*
16
* For example, in the case where user mode passes in a C string via
17
* system call, the length of that string needs to be measured. A specially
18
* written assembly language version of strlen (arch_user_string_len)
19
* defines start and end symbols where the memory in the string is examined;
20
* if this generates a fault, jumping to the fixup symbol within the same
21
* function will return an error result to the caller.
22
*
23
* To ensure precise control of the state of registers and the stack pointer,
24
* these functions need to be written in assembly.
25
*
26
* The arch-specific fault handling code will define an array of these
27
* z_exc_handle structures and return from the exception with the PC updated
28
* to the fixup address if a match is found.
29
*/
30
31
struct
z_exc_handle {
32
void
*start;
33
void
*end;
34
void
*fixup;
35
};
36
37
#define Z_EXC_HANDLE(name) \
38
{ name ## _fault_start, name ## _fault_end, name ## _fixup }
39
40
#define Z_EXC_DECLARE(name) \
41
void name ## _fault_start(void); \
42
void name ## _fault_end(void); \
43
void name ## _fixup(void)
44
45
#endif
/* ZEPHYR_INCLUDE_EXC_HANDLE_H_ */
zephyr
arch
common
exc_handle.h
Generated on Fri Nov 8 2024 18:02:18 for Zephyr API Documentation by
1.12.0