有bug,在debian,gcc=10.2.1上编译后运行会在进程切换时page fault

This commit is contained in:
fslongjin 2022-04-25 19:24:22 +08:00
parent e03cdea153
commit 4a41e734a5
2 changed files with 7 additions and 7 deletions

View File

@ -20,23 +20,26 @@ SECTIONS
} }
. += KERNEL_VMA; . += KERNEL_VMA;
. = ALIGN(32768);
text_start_pa = .; text_start_pa = .;
.text (text_start_pa): AT(text_start_pa - KERNEL_VMA) .text (text_start_pa): AT(text_start_pa - KERNEL_VMA)
{ {
_text = .; _text = .;
*(.text) *(.text)
_etext = .; _etext = .;
} }
. = ALIGN(8); . = ALIGN(32768);
data_start_pa = .; data_start_pa = .;
.data (data_start_pa): AT(data_start_pa - KERNEL_VMA) .data (data_start_pa): AT(data_start_pa - KERNEL_VMA)
{ {
_data = .; _data = .;
*(.data) *(.data)
_edata = .; _edata = .;
} }
. = ALIGN(32768);
rodata_start_pa = .; rodata_start_pa = .;
.rodata (rodata_start_pa): AT(rodata_start_pa - KERNEL_VMA) .rodata (rodata_start_pa): AT(rodata_start_pa - KERNEL_VMA)
{ {
@ -51,6 +54,7 @@ SECTIONS
.data.init_proc_union (init_proc_union_start_pa): AT(init_proc_union_start_pa - KERNEL_VMA) .data.init_proc_union (init_proc_union_start_pa): AT(init_proc_union_start_pa - KERNEL_VMA)
{ *(.data.init_proc_union) } { *(.data.init_proc_union) }
. = ALIGN(32768);
bss_start_pa = .; bss_start_pa = .;
.bss (bss_start_pa): AT(bss_start_pa - KERNEL_VMA) .bss (bss_start_pa): AT(bss_start_pa - KERNEL_VMA)
{ {

View File

@ -52,11 +52,7 @@ void __switch_to(struct process_control_block *prev, struct process_control_bloc
__asm__ __volatile__("movq %0, %%fs \n\t" ::"a"(next->thread->fs)); __asm__ __volatile__("movq %0, %%fs \n\t" ::"a"(next->thread->fs));
__asm__ __volatile__("movq %0, %%gs \n\t" ::"a"(next->thread->gs)); __asm__ __volatile__("movq %0, %%gs \n\t" ::"a"(next->thread->gs));
// wrmsr(0x175, next->thread->rbp); // wrmsr(0x175, next->thread->rbp);
uint color;
if (proc_current_cpu_id == 0)
color = WHITE;
else
color = YELLOW;
} }
/** /**