|
1 | 1 | /*
|
2 | 2 | * Copyright (c) 2013-2014 Wind River Systems, Inc.
|
| 3 | + * Copyright 2024 Arm Limited and/or its affiliates <[email protected]> |
3 | 4 | *
|
4 | 5 | * SPDX-License-Identifier: Apache-2.0
|
5 | 6 | */
|
|
28 | 29 | #include <cortex_a_r/stack.h>
|
29 | 30 | #endif
|
30 | 31 |
|
31 |
| -#if defined(__GNUC__) |
32 |
| -/* |
33 |
| - * GCC can detect if memcpy is passed a NULL argument, however one of |
34 |
| - * the cases of relocate_vector_table() it is valid to pass NULL, so we |
35 |
| - * suppress the warning for this case. We need to do this before |
36 |
| - * string.h is included to get the declaration of memcpy. |
37 |
| - */ |
38 |
| -#pragma GCC diagnostic push |
39 |
| -#pragma GCC diagnostic ignored "-Wnonnull" |
40 |
| -#endif |
41 |
| - |
42 |
| -#include <string.h> |
43 |
| - |
44 |
| -#if defined(CONFIG_SW_VECTOR_RELAY) || defined(CONFIG_SW_VECTOR_RELAY_CLIENT) |
45 |
| -Z_GENERIC_SECTION(.vt_pointer_section) __attribute__((used)) |
46 |
| -void *_vector_table_pointer; |
47 |
| -#endif |
48 |
| - |
49 | 32 | #ifdef CONFIG_ARM_MPU
|
50 | 33 | extern void z_arm_mpu_init(void);
|
51 | 34 | extern void z_arm_configure_static_mpu_regions(void);
|
52 | 35 | #elif defined(CONFIG_ARM_AARCH32_MMU)
|
53 | 36 | extern int z_arm_mmu_init(void);
|
54 | 37 | #endif
|
55 | 38 |
|
56 |
| -#if defined(CONFIG_AARCH32_ARMV8_R) |
57 |
| - |
58 |
| -#define VECTOR_ADDRESS ((uintptr_t)_vector_start) |
59 |
| - |
60 |
| -static inline void relocate_vector_table(void) |
61 |
| -{ |
62 |
| - write_sctlr(read_sctlr() & ~HIVECS); |
63 |
| - write_vbar(VECTOR_ADDRESS & VBAR_MASK); |
64 |
| - barrier_isync_fence_full(); |
65 |
| -} |
66 |
| - |
67 |
| -#else |
68 |
| -#define VECTOR_ADDRESS 0 |
69 |
| - |
70 |
| -void __weak relocate_vector_table(void) |
71 |
| -{ |
72 |
| -#if defined(CONFIG_XIP) && (CONFIG_FLASH_BASE_ADDRESS != 0) || \ |
73 |
| - !defined(CONFIG_XIP) && (CONFIG_SRAM_BASE_ADDRESS != 0) |
74 |
| - write_sctlr(read_sctlr() & ~HIVECS); |
75 |
| - size_t vector_size = (size_t)_vector_end - (size_t)_vector_start; |
76 |
| - (void)memcpy(VECTOR_ADDRESS, _vector_start, vector_size); |
77 |
| -#elif defined(CONFIG_SW_VECTOR_RELAY) || defined(CONFIG_SW_VECTOR_RELAY_CLIENT) |
78 |
| - _vector_table_pointer = _vector_start; |
79 |
| -#endif |
80 |
| -} |
81 |
| - |
82 |
| -#if defined(__GNUC__) |
83 |
| -#pragma GCC diagnostic pop |
84 |
| -#endif |
85 |
| - |
86 |
| -#endif /* CONFIG_AARCH32_ARMV8_R */ |
87 |
| - |
88 | 39 | #if defined(CONFIG_CPU_HAS_FPU)
|
89 | 40 |
|
90 | 41 | static inline void z_arm_floating_point_init(void)
|
@@ -155,7 +106,6 @@ void z_prep_c(void)
|
155 | 106 | /* Initialize tpidruro with our struct _cpu instance address */
|
156 | 107 | write_tpidruro((uintptr_t)&_kernel.cpus[0]);
|
157 | 108 |
|
158 |
| - relocate_vector_table(); |
159 | 109 | #if defined(CONFIG_CPU_HAS_FPU)
|
160 | 110 | z_arm_floating_point_init();
|
161 | 111 | #endif
|
|
0 commit comments