codegen: fixed crash on risc architectures because of missing i_size
[ajla.git] / asm.h
blob2daeb9ea2308eb64e46c4622c6dfa2749548c5f3
1 /*
2 * Copyright (C) 2024 Mikulas Patocka
4 * This file is part of Ajla.
6 * Ajla is free software: you can redistribute it and/or modify it under the
7 * terms of the GNU General Public License as published by the Free Software
8 * Foundation, either version 3 of the License, or (at your option) any later
9 * version.
11 * Ajla is distributed in the hope that it will be useful, but WITHOUT ANY
12 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
13 * A PARTICULAR PURPOSE. See the GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along with
16 * Ajla. If not, see <https://www.gnu.org/licenses/>.
19 #ifndef AJLA_ASM_H
20 #define AJLA_ASM_H
22 #include "code-op.h"
24 typedef unsigned cpu_feature_mask_t;
26 extern cpu_feature_mask_t cpu_feature_flags;
28 enum {
29 #define ASM_INC_ENUM
30 #include "asm.inc"
31 #undef ASM_INC_ENUM
32 CPU_FEATURE_max
35 enum {
36 cpu_feature_static_flags = 0
37 #define ASM_INC_STATIC
38 #include "asm.inc"
39 #undef ASM_INC_STATIC
42 #define cpu_feature_mask(feature) ((cpu_feature_mask_t)1 << (feature))
43 #ifdef DEBUG_ENV
44 #define cpu_test_feature(feature) (!!(cpu_feature_flags & cpu_feature_mask(feature)))
45 #else
46 #define cpu_test_feature(feature) (cpu_feature_static_flags & cpu_feature_mask(feature) || cpu_feature_flags & cpu_feature_mask(feature))
47 #endif
50 void asm_setup_thread(void);
51 code_t code_alt(code_t code);
54 void asm_init(void);
55 void asm_done(void);
57 #endif