arm_cpu.h
1 /*
2  * Copyright (C) 2014 Freie Universität Berlin
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser
5  * General Public License v2.1. See the file LICENSE in the top level
6  * directory for more details.
7  */
8 
9 #ifndef ARM_CPU_H
10 #define ARM_CPU_H
11 
12 #include <stdint.h>
13 #include "VIC.h"
14 #include "arm7_common.h"
15 
16 #ifdef __cplusplus
17  extern "C" {
18 #endif
19 
20 #define NEW_TASK_CPSR 0x1F
21 #define WORDSIZE 32
22 
23 uint32_t get_system_speed(void);
24 void cpu_clock_scale(uint32_t source, uint32_t target, uint32_t *prescale);
25 
26 void arm_reset(void);
27 
31 static inline uintptr_t cpu_get_caller_pc(void)
32 {
33  register uintptr_t lr_ptr;
34 
35  __asm__ __volatile__ ("mov %0, lr" : "=r" (lr_ptr));
36  return lr_ptr;
37 }
38 
46 #define STACK_CANARY_WORD (0xEAFFFFFEu)
47 
52 #ifdef __ARM_FEATURE_CLZ
53 #define BITARITHM_LSB_BUILTIN
54 #define BITARITHM_HAS_CLZ
55 #else
56 #define BITARITHM_LSB_LOOKUP
57 #endif
60 #ifdef __cplusplus
61 }
62 #endif
63 
64 #endif /* ARM_CPU_H */
ARM7 CPU common declarations.
static uinttxtptr_t cpu_get_caller_pc(void)
Get the last instruction's address.
Definition: cpu.h:141