Ver código fonte

修复aarch64 smp启动失败问题 (#7760)

wangqinglin 1 ano atrás
pai
commit
e0b2b8fecd
2 arquivos alterados com 11 adições e 15 exclusões
  1. 9 9
      libcpu/aarch64/common/mmu.c
  2. 2 6
      libcpu/aarch64/cortex-a/entry_point.S

+ 9 - 9
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,

+ 2 - 6
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)