FFmpeg
riscv.h
Go to the documentation of this file.
1 /*
2  * Copyright © 2025, Niklas Haas
3  * Copyright © 2018, VideoLAN and dav1d authors
4  * Copyright © 2018, Two Orioles, LLC
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions are met:
9  *
10  * 1. Redistributions of source code must retain the above copyright notice, this
11  * list of conditions and the following disclaimer.
12  *
13  * 2. Redistributions in binary form must reproduce the above copyright notice,
14  * this list of conditions and the following disclaimer in the documentation
15  * and/or other materials provided with the distribution.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
21  * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27  */
28 
29 #ifndef CHECKASM_PLATFORM_RISCV_H
30 #define CHECKASM_PLATFORM_RISCV_H
31 
34 
35 #define checkasm_declare_impl(ret, ...) \
36  ret (*checked_call)(__VA_ARGS__) = checkasm_checked_call_ptr()
37 
38 #define checkasm_call_checked(func, ...) \
39  (checkasm_set_signal_handler_state(1), \
40  checkasm_push_stack_guard((uintptr_t[16]){ 0, 0 }), \
41  checkasm_clobber_args(), \
42  checkasm_set_function(func), \
43  checked_call(__VA_ARGS__)); \
44  checkasm_pop_stack_guard(); \
45  checkasm_set_signal_handler_state(0)
46 #define CHECKASM_ALIGNMENT 16
47 
49 
50 #endif /* CHECKASM_PLATFORM_RISCV_H */
checkasm_clobber_args
CHECKASM_API void checkasm_clobber_args(void)
checkasm_checked_call_ptr
CHECKASM_API void * checkasm_checked_call_ptr(void)
checkasm_set_function
CHECKASM_API void checkasm_set_function(void *)
CHECKASM_API
#define CHECKASM_API
Symbol visibility attribute for public API functions.
Definition: attributes.h:90