From e0b2b8fecdca528fb6e3ab0312851a21c272bff6 Mon Sep 17 00:00:00 2001 From: wangqinglin <53550140+HelloByeAll@users.noreply.github.com> Date: Sat, 1 Jul 2023 22:46:43 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Daarch64=20smp=E5=90=AF?= =?UTF-8?q?=E5=8A=A8=E5=A4=B1=E8=B4=A5=E9=97=AE=E9=A2=98=20(#7760)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- libcpu/aarch64/common/mmu.c | 18 +++++++++--------- libcpu/aarch64/cortex-a/entry_point.S | 8 ++------ 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 @@ -293,10 +293,6 @@ after_mmu_enable_cpux: b rt_hw_secondary_cpu_bsp_start #endif -.align 12 -.early_mmu_table: -.space (4096 * 2) - .align 12 .el_stack: .space (8192)