mirror of
https://github.com/DragonOS-Community/DragonOS.git
synced 2025-06-09 23:46:48 +00:00
🐛 创建页表时未清零内存空间
This commit is contained in:
parent
53c553c730
commit
c2d8e88617
@ -507,7 +507,7 @@ void do_IRQ(struct pt_regs *rsp, ul number)
|
||||
kBUG("current_pcb->preempt_count<0! pid=%d", current_pcb->pid); // should not be here
|
||||
|
||||
// 检测当前进程是否可被调度
|
||||
if (current_pcb->flags & PROC_NEED_SCHED && proc_current_cpu_id == 1)
|
||||
if (current_pcb->flags & PROC_NEED_SCHED)
|
||||
{
|
||||
sched_cfs();
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ void HPET_handler(uint64_t number, uint64_t param, struct pt_regs *regs)
|
||||
|
||||
// 将HEPT中断消息转发到ap:1处理器
|
||||
ipi_send_IPI(DEST_PHYSICAL, IDLE, ICR_LEVEL_DE_ASSERT, EDGE_TRIGGER, 0xc8,
|
||||
ICR_APIC_FIXED, ICR_No_Shorthand, true, 1);
|
||||
ICR_APIC_FIXED, ICR_ALL_EXCLUDE_Self, true, 0);
|
||||
|
||||
// 若当前时间比定时任务的时间间隔大,则进入中断下半部
|
||||
if (container_of(list_next(&timer_func_head.list), struct timer_func_list_t, list)->expire_jiffies <= timer_jiffies)
|
||||
|
@ -147,7 +147,8 @@ void system_initialize()
|
||||
|
||||
|
||||
//process_init();
|
||||
|
||||
current_pcb->cpu_id = 0;
|
||||
current_pcb->preempt_count = 0;
|
||||
HPET_init();
|
||||
|
||||
|
||||
|
@ -203,8 +203,8 @@ void mm_init()
|
||||
flush_tlb();
|
||||
// 初始化slab内存池
|
||||
slab_init();
|
||||
init_frame_buffer();
|
||||
page_table_init();
|
||||
init_frame_buffer();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -497,6 +497,7 @@ void init_frame_buffer()
|
||||
if (*tmp == 0)
|
||||
{
|
||||
ul *virt_addr = kmalloc(PAGE_4K_SIZE, 0);
|
||||
memset(virt_addr, 0, PAGE_4K_SIZE);
|
||||
set_pml4t(tmp, mk_pml4t(virt_2_phys(virt_addr), PAGE_KERNEL_PGT));
|
||||
}
|
||||
|
||||
@ -505,6 +506,7 @@ void init_frame_buffer()
|
||||
if (*tmp == 0)
|
||||
{
|
||||
ul *virt_addr = kmalloc(PAGE_4K_SIZE, 0);
|
||||
memset(virt_addr, 0, PAGE_4K_SIZE);
|
||||
set_pdpt(tmp, mk_pdpt(virt_2_phys(virt_addr), PAGE_KERNEL_DIR));
|
||||
}
|
||||
|
||||
@ -541,6 +543,7 @@ void mm_map_phys_addr(ul virt_addr_start, ul phys_addr_start, ul length, ul flag
|
||||
if (*tmp == 0)
|
||||
{
|
||||
ul *virt_addr = kmalloc(PAGE_4K_SIZE, 0);
|
||||
memset(virt_addr, 0, PAGE_4K_SIZE);
|
||||
set_pml4t(tmp, mk_pml4t(virt_2_phys(virt_addr), PAGE_KERNEL_PGT));
|
||||
}
|
||||
|
||||
@ -549,6 +552,7 @@ void mm_map_phys_addr(ul virt_addr_start, ul phys_addr_start, ul length, ul flag
|
||||
if (*tmp == 0)
|
||||
{
|
||||
ul *virt_addr = kmalloc(PAGE_4K_SIZE, 0);
|
||||
memset(virt_addr, 0, PAGE_4K_SIZE);
|
||||
set_pdpt(tmp, mk_pdpt(virt_2_phys(virt_addr), PAGE_KERNEL_DIR));
|
||||
}
|
||||
|
||||
@ -575,6 +579,7 @@ void mm_map_phys_addr_user(ul virt_addr_start, ul phys_addr_start, ul length, ul
|
||||
if (*tmp == 0)
|
||||
{
|
||||
ul *virt_addr = kmalloc(PAGE_4K_SIZE, 0);
|
||||
memset(virt_addr, 0, PAGE_4K_SIZE);
|
||||
set_pml4t(tmp, mk_pml4t(virt_2_phys(virt_addr), PAGE_USER_PGT));
|
||||
}
|
||||
else
|
||||
@ -585,6 +590,7 @@ void mm_map_phys_addr_user(ul virt_addr_start, ul phys_addr_start, ul length, ul
|
||||
if (*tmp == 0)
|
||||
{
|
||||
ul *virt_addr = kmalloc(PAGE_4K_SIZE, 0);
|
||||
memset(virt_addr, 0, PAGE_4K_SIZE);
|
||||
set_pdpt(tmp, mk_pdpt(virt_2_phys(virt_addr), PAGE_USER_DIR));
|
||||
}
|
||||
else
|
||||
|
@ -211,7 +211,8 @@ struct process_control_block *get_current_pcb()
|
||||
#define switch_proc(prev, next) \
|
||||
do \
|
||||
{ \
|
||||
__asm__ __volatile__("pushq %%rbp \n\t" \
|
||||
__asm__ __volatile__("cli \n\t" \
|
||||
"pushq %%rbp \n\t" \
|
||||
"pushq %%rax \n\t" \
|
||||
"movq %%rsp, %0 \n\t" \
|
||||
"movq %2, %%rsp \n\t" \
|
||||
@ -222,6 +223,7 @@ struct process_control_block *get_current_pcb()
|
||||
"1: \n\t" \
|
||||
"popq %%rax \n\t" \
|
||||
"popq %%rbp \n\t" \
|
||||
"sti \n\t" \
|
||||
: "=m"(prev->thread->rsp), "=m"(prev->thread->rip) \
|
||||
: "m"(next->thread->rsp), "m"(next->thread->rip), "D"(prev), "S"(next) \
|
||||
: "memory"); \
|
||||
|
@ -107,6 +107,8 @@ void sched_cfs()
|
||||
*/
|
||||
void sched_update_jiffies()
|
||||
{
|
||||
if(current_pcb->cpu_id == 0)
|
||||
return;
|
||||
switch (current_pcb->priority)
|
||||
{
|
||||
case 0:
|
||||
|
@ -153,7 +153,7 @@ void smp_ap_start()
|
||||
current_pcb->preempt_count = 0;
|
||||
sti();
|
||||
|
||||
if (proc_current_cpu_id == 1)
|
||||
if (proc_current_cpu_id == 2)
|
||||
process_init();
|
||||
while (1)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user