Skip to content

Commit 1487851

Browse files
committed
[libcpu-riscv]: [surpport SMP]: Fix issues with non-standard formatting
Fix issues with non-standard formatting. The page size defined by RT_HW_PAGE_END has been changed from 256MB to 128MB, as the default physical memory size when QEMU starts is only 128MB. Signed-off-by: Mengchen Teng <teng_mengchen@163.com>
1 parent 8a9066f commit 1487851

File tree

4 files changed

+26
-30
lines changed

4 files changed

+26
-30
lines changed

bsp/qemu-virt64-riscv/driver/board.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,17 @@
1515

1616
extern unsigned int __bss_start;
1717
extern unsigned int __bss_end;
18-
extern unsigned int _end;
18+
1919
#ifndef RT_USING_SMART
2020
#define KERNEL_VADDR_START 0x0
2121
#endif
2222

2323
#define VIRT64_SBI_MEMSZ (0x200000)
2424

25-
#define RT_HW_HEAP_BEGIN ((void *)&_end)
25+
#define RT_HW_HEAP_BEGIN ((void *)&__bss_end)
2626
#define RT_HW_HEAP_END ((void *)(RT_HW_HEAP_BEGIN + 64 * 1024 * 1024))
2727
#define RT_HW_PAGE_START RT_HW_HEAP_END
28-
#define RT_HW_PAGE_END ((void *)(KERNEL_VADDR_START + (256 * 1024 * 1024 - VIRT64_SBI_MEMSZ)))
28+
#define RT_HW_PAGE_END ((void *)(KERNEL_VADDR_START + (128 * 1024 * 1024 - VIRT64_SBI_MEMSZ)))
2929

3030
void rt_hw_board_init(void);
3131
void rt_init_user_mem(struct rt_thread *thread, const char *name,

bsp/qemu-virt64-riscv/link.lds

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -136,32 +136,32 @@ SECTIONS
136136
*(.scommon)
137137
} > SRAM
138138

139-
.bss :
140-
{
141-
*(.bss)
142-
*(.bss.*)
143-
*(.dynbss)
144-
*(COMMON)
145-
__bss_end = .;
146-
} > SRAM
147-
148139
.percpu (NOLOAD) :
149140
{
150141
/* Align for MMU early map */
151-
. = ALIGN(1<<(12+9));
142+
. = ALIGN(0x200000);
152143
PROVIDE(__percpu_start = .);
153144

154145
*(.percpu)
155146

156147
/* Align for MMU early map */
157-
. = ALIGN(1<<(12+9));
148+
. = ALIGN(0x200000);
158149

159150
PROVIDE(__percpu_end = .);
160151

161152
/* Clone the area */
162153
. = __percpu_end + (__percpu_end - __percpu_start) * (RT_CPUS_NR - 1);
163154
PROVIDE(__percpu_real_end = .);
164155
} > SRAM
156+
157+
.bss :
158+
{
159+
*(.bss)
160+
*(.bss.*)
161+
*(.dynbss)
162+
*(COMMON)
163+
__bss_end = .;
164+
} > SRAM
165165

166166
_end = .;
167167

bsp/qemu-virt64-riscv/link_smart.lds

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -137,25 +137,16 @@ SECTIONS
137137
*(.scommon)
138138
} > SRAM
139139

140-
.bss :
141-
{
142-
*(.bss)
143-
*(.bss.*)
144-
*(.dynbss)
145-
*(COMMON)
146-
__bss_end = .;
147-
} > SRAM
148-
149-
.percpu (NOLOAD) :
140+
.percpu (NOLOAD) :
150141
{
151142
/* Align for MMU early map */
152-
. = ALIGN(1<<(12+9));
143+
. = ALIGN(0x200000);
153144
PROVIDE(__percpu_start = .);
154145

155146
*(.percpu)
156147

157148
/* Align for MMU early map */
158-
. = ALIGN(1<<(12+9));
149+
. = ALIGN(0x200000);
159150

160151
PROVIDE(__percpu_end = .);
161152

@@ -164,6 +155,15 @@ SECTIONS
164155
PROVIDE(__percpu_real_end = .);
165156
} > SRAM
166157

158+
.bss :
159+
{
160+
*(.bss)
161+
*(.bss.*)
162+
*(.dynbss)
163+
*(COMMON)
164+
__bss_end = .;
165+
} > SRAM
166+
167167
_end = .;
168168

169169
/* Stabs debugging sections. */

libcpu/risc-v/common64/mmu.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -860,10 +860,6 @@ void rt_hw_mmu_setup(rt_aspace_t aspace, struct mem_desc *mdesc, int desc_nr)
860860

861861
#define SATP_BASE ((rt_ubase_t)SATP_MODE << SATP_MODE_OFFSET)
862862

863-
extern unsigned int __bss_end;
864-
#if defined(RT_USING_SMP) && defined(ARCH_MM_MMU)
865-
extern unsigned int __percpu_real_end;
866-
#endif
867863
/**
868864
* @brief Early memory setup function for hardware initialization.
869865
*

0 commit comments

Comments
 (0)