mirror of
https://github.com/DragonOS-Community/DragonOS.git
synced 2025-06-08 22:36:48 +00:00
bug fix
This commit is contained in:
parent
c2d8e88617
commit
be8ac71aa9
@ -7,7 +7,7 @@ DIR_LIB=lib
|
|||||||
lib_patterns := *.a
|
lib_patterns := *.a
|
||||||
LIB_FILES := $(foreach DIR,$(DIR_LIB),$(addprefix $(DIR)/,$(lib_patterns)))
|
LIB_FILES := $(foreach DIR,$(DIR_LIB),$(addprefix $(DIR)/,$(lib_patterns)))
|
||||||
|
|
||||||
CFLAGS := -mcmodel=large -fno-builtin -m64 -g -O0 -I .
|
CFLAGS := -mcmodel=large -fno-builtin -m64 -g -O0 -I . -fno-stack-protector
|
||||||
ARCH=x86_64
|
ARCH=x86_64
|
||||||
# 控制操作系统使用的中断控制器 _INTR_8259A_ _INTR_APIC_
|
# 控制操作系统使用的中断控制器 _INTR_8259A_ _INTR_APIC_
|
||||||
PIC := _INTR_APIC_
|
PIC := _INTR_APIC_
|
||||||
|
@ -27,6 +27,7 @@ int printk_init(const int char_size_x, const int char_size_y)
|
|||||||
{
|
{
|
||||||
struct multiboot_tag_framebuffer_info_t info;
|
struct multiboot_tag_framebuffer_info_t info;
|
||||||
int reserved;
|
int reserved;
|
||||||
|
|
||||||
multiboot2_iter(multiboot2_get_Framebuffer_info, &info, &reserved);
|
multiboot2_iter(multiboot2_get_Framebuffer_info, &info, &reserved);
|
||||||
|
|
||||||
pos.width = info.framebuffer_width;
|
pos.width = info.framebuffer_width;
|
||||||
|
@ -350,5 +350,3 @@ ENTRY(syscall_int)
|
|||||||
jmp Err_Code
|
jmp Err_Code
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ENTRY(_stack_start)
|
|
||||||
.quad initial_proc_union + 32768
|
|
@ -202,6 +202,7 @@ multiboot_header_end:
|
|||||||
ENTRY(_start)
|
ENTRY(_start)
|
||||||
// 关中断
|
// 关中断
|
||||||
cli
|
cli
|
||||||
|
|
||||||
// multiboot2_info 结构体指针
|
// multiboot2_info 结构体指针
|
||||||
mov %ebx, mb2_info
|
mov %ebx, mb2_info
|
||||||
//mov %ebx, %e8
|
//mov %ebx, %e8
|
||||||
@ -308,7 +309,7 @@ ENTRY(_start64)
|
|||||||
mov %ax, %fs
|
mov %ax, %fs
|
||||||
mov %ax, %ss
|
mov %ax, %ss
|
||||||
mov $0x7e00, %esp
|
mov $0x7e00, %esp
|
||||||
|
|
||||||
// === 加载GDTR ====
|
// === 加载GDTR ====
|
||||||
lgdt GDT_POINTER(%rip) //这里我没搞明白rip相对寻址, 看了文档,大概是用来实现PIC的(position independent code)
|
lgdt GDT_POINTER(%rip) //这里我没搞明白rip相对寻址, 看了文档,大概是用来实现PIC的(position independent code)
|
||||||
//lgdt $GDT_POINTER
|
//lgdt $GDT_POINTER
|
||||||
|
@ -34,7 +34,7 @@ SECTIONS
|
|||||||
{
|
{
|
||||||
_data = .;
|
_data = .;
|
||||||
*(.data)
|
*(.data)
|
||||||
|
|
||||||
_edata = .;
|
_edata = .;
|
||||||
}
|
}
|
||||||
rodata_start_pa = .;
|
rodata_start_pa = .;
|
||||||
@ -60,4 +60,9 @@ SECTIONS
|
|||||||
}
|
}
|
||||||
|
|
||||||
_end = .;
|
_end = .;
|
||||||
|
|
||||||
|
/DISCARD/ : {
|
||||||
|
*(.eh_frame)
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
@ -82,12 +82,12 @@ void system_initialize()
|
|||||||
{
|
{
|
||||||
|
|
||||||
// 初始化printk
|
// 初始化printk
|
||||||
|
|
||||||
printk_init(8, 16);
|
printk_init(8, 16);
|
||||||
kinfo("Kernel Starting...");
|
kinfo("Kernel Starting...");
|
||||||
// 重新加载gdt和idt
|
// 重新加载gdt和idt
|
||||||
|
|
||||||
ul tss_item_addr = (ul)phys_2_virt(0x7c00);
|
ul tss_item_addr = (ul)phys_2_virt(0x7c00);
|
||||||
|
|
||||||
_stack_start = head_stack_start; // 保存init proc的栈基地址(由于之后取消了地址重映射,因此必须在这里重新保存)
|
_stack_start = head_stack_start; // 保存init proc的栈基地址(由于之后取消了地址重映射,因此必须在这里重新保存)
|
||||||
kdebug("_stack_start=%#018lx", _stack_start);
|
kdebug("_stack_start=%#018lx", _stack_start);
|
||||||
|
|
||||||
@ -158,7 +158,7 @@ void system_initialize()
|
|||||||
//操作系统内核从这里开始执行
|
//操作系统内核从这里开始执行
|
||||||
void Start_Kernel(void)
|
void Start_Kernel(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
// 获取multiboot2的信息
|
// 获取multiboot2的信息
|
||||||
uint64_t mb2_info, mb2_magic;
|
uint64_t mb2_info, mb2_magic;
|
||||||
__asm__ __volatile__("movq %%r15, %0 \n\t"
|
__asm__ __volatile__("movq %%r15, %0 \n\t"
|
||||||
@ -174,8 +174,7 @@ void Start_Kernel(void)
|
|||||||
|
|
||||||
mb2_info &= 0xffffffff;
|
mb2_info &= 0xffffffff;
|
||||||
mb2_magic &= 0xffffffff;
|
mb2_magic &= 0xffffffff;
|
||||||
|
multiboot2_magic = (uint)mb2_magic;
|
||||||
multiboot2_magic = mb2_magic;
|
|
||||||
multiboot2_boot_info_addr = mb2_info + PAGE_OFFSET;
|
multiboot2_boot_info_addr = mb2_info + PAGE_OFFSET;
|
||||||
|
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ struct process_control_block *sched_cfs_dequeue()
|
|||||||
{
|
{
|
||||||
if (list_empty(&sched_cfs_ready_queue[proc_current_cpu_id].proc_queue.list))
|
if (list_empty(&sched_cfs_ready_queue[proc_current_cpu_id].proc_queue.list))
|
||||||
{
|
{
|
||||||
kdebug("list empty");
|
kdebug("list empty, count=%d", sched_cfs_ready_queue[proc_current_cpu_id].count);
|
||||||
return &initial_proc_union.pcb;
|
return &initial_proc_union.pcb;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -153,7 +153,7 @@ void smp_ap_start()
|
|||||||
current_pcb->preempt_count = 0;
|
current_pcb->preempt_count = 0;
|
||||||
sti();
|
sti();
|
||||||
|
|
||||||
if (proc_current_cpu_id == 2)
|
if (proc_current_cpu_id == 1)
|
||||||
process_init();
|
process_init();
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user