mirror of
https://github.com/DragonOS-Community/DragonOS.git
synced 2025-06-09 19:36:47 +00:00
🎨 更改代码结构
This commit is contained in:
parent
777932704d
commit
53c553c730
@ -599,7 +599,6 @@ void mm_map_phys_addr_user(ul virt_addr_start, ul phys_addr_start, ul length, ul
|
||||
|
||||
// 页面写穿,禁止缓存
|
||||
set_pdt(tmp1, mk_pdt((ul)phys_addr_start + i, flags | PAGE_USER_PAGE));
|
||||
kdebug("mk_pdt((ul)phys_addr_start + i, flags | PAGE_USER_PAGE) = %#018lx",mk_pdt((ul)phys_addr_start + i, flags | PAGE_USER_PAGE));
|
||||
}
|
||||
|
||||
flush_tlb();
|
||||
|
@ -8,7 +8,6 @@
|
||||
#include <mm/slab.h>
|
||||
#include <sched/sched.h>
|
||||
|
||||
|
||||
extern void system_call(void);
|
||||
ul _stack_start; // initial proc的栈基地址(虚拟地址)
|
||||
struct mm_struct initial_mm = {0};
|
||||
@ -58,8 +57,6 @@ void __switch_to(struct process_control_block *prev, struct process_control_bloc
|
||||
color = WHITE;
|
||||
else
|
||||
color = YELLOW;
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -129,7 +126,7 @@ ul do_execve(struct pt_regs *regs)
|
||||
// mm_map_proc_page_table(get_CR3(), true, 0x800000, alloc_pages(ZONE_NORMAL, 1, PAGE_PGT_MAPPED)->addr_phys, PAGE_2M_SIZE, PAGE_USER_PAGE, true);
|
||||
|
||||
uint64_t addr = 0x800000UL;
|
||||
|
||||
/*
|
||||
unsigned long *tmp = phys_2_virt((unsigned long *)((unsigned long)get_CR3() & (~0xfffUL)) + ((addr >> PAGE_GDT_SHIFT) & 0x1ff));
|
||||
|
||||
unsigned long *virtual = kmalloc(PAGE_4K_SIZE, 0);
|
||||
@ -144,16 +141,15 @@ ul do_execve(struct pt_regs *regs)
|
||||
set_pdt(tmp, mk_pdt(p->addr_phys, PAGE_USER_PAGE));
|
||||
|
||||
flush_tlb();
|
||||
|
||||
/*
|
||||
mm_map_phys_addr_user(addr, alloc_pages(ZONE_NORMAL, 1, PAGE_PGT_MAPPED)->addr_phys, PAGE_2M_SIZE, PAGE_USER_PAGE);
|
||||
*/
|
||||
|
||||
mm_map_phys_addr_user(addr, alloc_pages(ZONE_NORMAL, 1, PAGE_PGT_MAPPED)->addr_phys, PAGE_2M_SIZE, PAGE_USER_PAGE);
|
||||
|
||||
if (!(current_pcb->flags & PF_KTHREAD))
|
||||
current_pcb->addr_limit = KERNEL_BASE_LINEAR_ADDR;
|
||||
// 将程序代码拷贝到对应的内存中
|
||||
memcpy((void *)0x800000, user_level_function, 1024);
|
||||
|
||||
|
||||
// kdebug("program copied!");
|
||||
return 0;
|
||||
}
|
||||
@ -385,8 +381,6 @@ unsigned long do_fork(struct pt_regs *regs, unsigned long clone_flags, unsigned
|
||||
else
|
||||
kdebug("is kernel proc.");
|
||||
|
||||
|
||||
|
||||
tsk->state = PROC_RUNNING;
|
||||
|
||||
sched_cfs_enqueue(tsk);
|
||||
|
Loading…
x
Reference in New Issue
Block a user