baremetal: add some missing lkmc_ prefixes

This commit is contained in:
Ciro Santilli 六四事件 法轮功
2019-02-20 00:00:03 +00:00
parent 9d69ec26a6
commit e44362b394
3 changed files with 9 additions and 9 deletions

View File

@@ -8,7 +8,7 @@ mystart:
isb isb
/* Load the vector table. */ /* Load the vector table. */
ldr x0, =vector_table ldr x0, =lkmc_vector_table
msr vbar_el1, x0 msr vbar_el1, x0
/* Prepare the stack for main, mandatory for C code. */ /* Prepare the stack for main, mandatory for C code. */

4
lkmc.c
View File

@@ -15,12 +15,12 @@ void lkmc_assert_fail() {
#if defined(__aarch64__) #if defined(__aarch64__)
#define LKMC_SYSREG_READ_WRITE(type, name) \ #define LKMC_SYSREG_READ_WRITE(type, name) \
type CONCAT(CONCAT(LKMC_SYSREG_SYMBOL_PREFIX, name), _read(void)) { \ type LKMC_CONCAT(LKMC_CONCAT(LKMC_SYSREG_SYMBOL_PREFIX, name), _read(void)) { \
type name; \ type name; \
__asm__ __volatile__("mrs %0, " #name : "=r" (name) : : ); \ __asm__ __volatile__("mrs %0, " #name : "=r" (name) : : ); \
return name; \ return name; \
} \ } \
void CONCAT(CONCAT(LKMC_SYSREG_SYMBOL_PREFIX, name), _write(type name)) { \ void LKMC_CONCAT(LKMC_CONCAT(LKMC_SYSREG_SYMBOL_PREFIX, name), _write(type name)) { \
__asm__ __volatile__("msr " #name ", %0" : : "r" (name) : ); \ __asm__ __volatile__("msr " #name ", %0" : : "r" (name) : ); \
} }
LKMC_SYSREG_OPS LKMC_SYSREG_OPS

12
lkmc.h
View File

@@ -11,8 +11,8 @@ void lkmc_assert_fail();
#endif #endif
/* https://stackoverflow.com/questions/1489932/how-to-concatenate-twice-with-the-c-preprocessor-and-expand-a-macro-as-in-arg */ /* https://stackoverflow.com/questions/1489932/how-to-concatenate-twice-with-the-c-preprocessor-and-expand-a-macro-as-in-arg */
#define CONCAT_EVAL(a,b) a ## b #define LKMC_CONCAT_EVAL(a,b) a ## b
#define CONCAT(a,b) CONCAT_EVAL(a, b) #define LKMC_CONCAT(a,b) LKMC_CONCAT_EVAL(a, b)
#define LKMC_GLOBAL(name) \ #define LKMC_GLOBAL(name) \
.global name; \ .global name; \
@@ -148,8 +148,8 @@ LKMC_VECTOR_SYMBOL_PREFIX ## func_name:; \
/* Define the actual vector table. */ /* Define the actual vector table. */
#define LKMC_VECTOR_TABLE \ #define LKMC_VECTOR_TABLE \
.align 11; \ .align 11; \
.global vector_table; \ LKMC_GLOBAL(lkmc_vector_table); \
vector_table:; \ ; \
LKMC_VECTOR_ENTRY(curr_el_sp0_sync); \ LKMC_VECTOR_ENTRY(curr_el_sp0_sync); \
LKMC_VECTOR_ENTRY(curr_el_sp0_irq); \ LKMC_VECTOR_ENTRY(curr_el_sp0_irq); \
LKMC_VECTOR_ENTRY(curr_el_sp0_fiq); \ LKMC_VECTOR_ENTRY(curr_el_sp0_fiq); \
@@ -239,8 +239,8 @@ void lkmc_vector_trap_handler(LkmcVectorExceptionFrame *exception);
#define LKMC_SYSREG_SYMBOL_PREFIX lkmc_sysreg_ #define LKMC_SYSREG_SYMBOL_PREFIX lkmc_sysreg_
#define LKMC_SYSREG_READ_WRITE(type, name) \ #define LKMC_SYSREG_READ_WRITE(type, name) \
type CONCAT(CONCAT(LKMC_SYSREG_SYMBOL_PREFIX, name), _read)(void); \ type LKMC_CONCAT(LKMC_CONCAT(LKMC_SYSREG_SYMBOL_PREFIX, name), _read)(void); \
void CONCAT(CONCAT(LKMC_SYSREG_SYMBOL_PREFIX, name), _write)(type name) void LKMC_CONCAT(LKMC_CONCAT(LKMC_SYSREG_SYMBOL_PREFIX, name), _write)(type name)
#define LKMC_SYSREG_OPS \ #define LKMC_SYSREG_OPS \
LKMC_SYSREG_READ_WRITE(uint32_t, cntv_ctl_el0); \ LKMC_SYSREG_READ_WRITE(uint32_t, cntv_ctl_el0); \
LKMC_SYSREG_READ_WRITE(uint32_t, daif); \ LKMC_SYSREG_READ_WRITE(uint32_t, daif); \