summaryrefslogtreecommitdiff
path: root/libcpu
diff options
context:
space:
mode:
authorwangqinglin <[email protected]>2023-07-01 22:46:43 +0800
committerGitHub <[email protected]>2023-07-01 22:46:43 +0800
commite0b2b8fecdca528fb6e3ab0312851a21c272bff6 (patch)
treeeb91b2d175a0a1cf9cb5db17d76a3537c2af55c2 /libcpu
parent25072608f598c24bb4db3f74c1f9e116237112ac (diff)
修复aarch64 smp启动失败问题 (#7760)
Diffstat (limited to 'libcpu')
-rw-r--r--libcpu/aarch64/common/mmu.c18
-rw-r--r--libcpu/aarch64/cortex-a/entry_point.S8
2 files changed, 11 insertions, 15 deletions
diff --git a/libcpu/aarch64/common/mmu.c b/libcpu/aarch64/common/mmu.c
index e6a98e4741..cd55948729 100644
--- a/libcpu/aarch64/common/mmu.c
+++ b/libcpu/aarch64/common/mmu.c
@@ -528,18 +528,18 @@ struct page_table
unsigned long page[512];
};
-static struct page_table *__init_page_array;
-static unsigned long __page_off = 0UL;
+/* */
+static struct page_table __init_page_array[6] rt_align(0x1000);
+static unsigned long __page_off = 2UL; /* 0, 1 for ttbr0, ttrb1 */
+unsigned long get_ttbrn_base(void)
+{
+ return (unsigned long) __init_page_array;
+}
+
unsigned long get_free_page(void)
{
- if (!__init_page_array)
- {
- extern unsigned char __bss_end;
- __init_page_array = (struct page_table *) RT_ALIGN((unsigned long) &__bss_end, 0x1000);
- __page_off = 2; /* 0, 1 for ttbr0, ttrb1 */
- }
__page_off++;
- return (unsigned long)(__init_page_array[__page_off - 1].page);
+ return (unsigned long) (__init_page_array[__page_off - 1].page);
}
static int _map_single_page_2M(unsigned long *lv0_tbl, unsigned long va,
diff --git a/libcpu/aarch64/cortex-a/entry_point.S b/libcpu/aarch64/cortex-a/entry_point.S
index 9e4adddac7..e7e5650ea2 100644
--- a/libcpu/aarch64/cortex-a/entry_point.S
+++ b/libcpu/aarch64/cortex-a/entry_point.S
@@ -119,7 +119,7 @@ __start:
.L__jump_to_entry: /* jump to C code, should not return */
bl mmu_tcr_init
- adr x0, .early_mmu_table /* install early page table */
+ bl get_ttbrn_base
add x1, x0, #0x1000
msr ttbr0_el1, x0
@@ -246,7 +246,7 @@ _secondary_cpu_entry:
bl mmu_tcr_init
- adr x0, .early_mmu_table /* GET & setup early page table */
+ bl get_ttbrn_base
add x1, x0, #0x1000
msr ttbr0_el1, x0
@@ -294,10 +294,6 @@ after_mmu_enable_cpux:
#endif
.align 12
-.early_mmu_table:
-.space (4096 * 2)
-
-.align 12
.el_stack:
.space (8192)
.el_stack_top: \ No newline at end of file