simple fix for fork
This commit is contained in:
parent
b3f160accf
commit
1a5b096b94
@ -11,6 +11,7 @@
|
||||
#include "elf.h"
|
||||
#include "fs.h" //added by mingxuan 2019-5-19
|
||||
#include "vfs.h"
|
||||
#include "stdio.h"
|
||||
|
||||
|
||||
|
||||
@ -168,15 +169,17 @@ static u32 exec_load(u32 fd,const Elf32_Ehdr* Echo_Ehdr,const Elf32_Phdr Echo_Ph
|
||||
{//最后一个program
|
||||
break;
|
||||
}
|
||||
if( Echo_Phdr[ph_num].p_flags == 0x5 || Echo_Phdr[ph_num].p_flags == 0x4) //101,只读
|
||||
if( Echo_Phdr[ph_num].p_flags == 0x5) //101,R E
|
||||
{//.text
|
||||
exec_elfcpy(fd,Echo_Phdr[ph_num],PG_P | PG_USU | PG_RWR);//进程代码段
|
||||
// kprintf("text lin base: 0x%08x\n", Echo_Phdr[ph_num].p_vaddr);
|
||||
p_proc_current->task.memmap.text_lin_base = Echo_Phdr[ph_num].p_vaddr;
|
||||
p_proc_current->task.memmap.text_lin_limit = Echo_Phdr[ph_num].p_vaddr + Echo_Phdr[ph_num].p_memsz;
|
||||
}
|
||||
else if(Echo_Phdr[ph_num].p_flags == 0x6)//110,读写
|
||||
else if(Echo_Phdr[ph_num].p_flags == 0x4)//110,R
|
||||
{//.data
|
||||
exec_elfcpy(fd,Echo_Phdr[ph_num],PG_P | PG_USU | PG_RWW);//进程数据段
|
||||
// kprintf("data lin base: 0x%08x\n", Echo_Phdr[ph_num].p_vaddr);
|
||||
p_proc_current->task.memmap.data_lin_base = Echo_Phdr[ph_num].p_vaddr;
|
||||
p_proc_current->task.memmap.data_lin_limit = Echo_Phdr[ph_num].p_vaddr + Echo_Phdr[ph_num].p_memsz;
|
||||
}
|
||||
@ -199,7 +202,7 @@ static int exec_pcb_init(char* path)
|
||||
char* p_regs; //point to registers in the new kernel stack, added by xw, 17/12/11
|
||||
|
||||
//名称 状态 特权级 寄存器
|
||||
strcpy(p_proc_current->task.p_name, path); //名称
|
||||
strncpy(p_proc_current->task.p_name, path, sizeof(p_proc_current->task.p_name)-1); //名称
|
||||
p_proc_current->task.stat = READY; //状态
|
||||
p_proc_current->task.ldts[0].attr1 = DA_C | PRIVILEGE_USER << 5;//特权级修改为用户级
|
||||
p_proc_current->task.ldts[1].attr1 = DA_DRW | PRIVILEGE_USER << 5;//特权级修改为用户级
|
||||
|
||||
Loading…
Reference in New Issue
Block a user