ucore_LAB5实验报告实验目的:了解第一个用户进程创建过程了解系统调用框架的实现机制了解ucore如何实现系统调用sys_fork/sys_exec/sys_exit/sys_wait来进行进程管理实验内容:实验4完成了内核线程,但到目前为止,所有的运行都在内核态执行。实验5将创建用户进程,让用户进程在用户态执行,且在需要ucore支持时,可通过系统调用来让ucore提供服务。为此需要构造出第一个用户进程,并通过系统调用sys_fork/sys_exec/sys_exit/sys_wait来支持运行不同的应用程序,完成对用户进程的执行过程的基本管理。练习练习0:填写已有实验根据提示,对标注LAB5YOURCODE:(updateLAB4steps)的部分进行一定的改动。Kern/trap/:/*LAB1YOURCODE:STEP3*//*handlethetimerinterrupt*//*(1)Afteratimerinterrupt,youshouldrecordthiseventusingaglobalvariable(increaseit),suchasticksinkern/driver/*(2)EveryTICK_NUMcycle,youcanprintsomeinfousingafunciton,suchasprint_ticks().*(3)TooSimple?Yes,Ithinkso!*//*LAB5YOURCODE*//*youshouldupateyoulab1code(justaddONEorTWOlinesofcode):*EveryTICK_NUMcycle,youshouldsetcurrentprocess'scurrent->need_resched=1*/ticks++;if(ticks%TICK_NUM==0){assert(current!=NULL);current->need_resched=1;}/*LAB1YOURCODE:STEP2*//*(1)WherearetheentryaddrsofeachInterruptServiceRoutine(ISR)?*AllISR'[]?*__vectors[]isinkern/trap/*(try"mandinlab1,)*Youcanuse"externuintptr_t__vectors[];"hisexternvariablewhichwillbeusedlater.*(2)NowyoushouldsetuptheentriesofISRinInterruptDescriptionTable(IDT).*Canyouseeidt[256]inthisfile?Yes,it'sIDT!youcanuseSETGATEmacrotosetupeachitemofIDT*(3)AftersetupthecontentsofIDT,youwillletCPUknowwhereistheIDTbyusing'lidt'instruction.*Youdon'tknowthemeaningofthisinstruction?justgoogleit!andcheckthelibs/.*Notice:!*//*LAB5YOURCODE*///youshouldupdateyourlab1code(justaddONEorTWOlinesofcode),letuserapptousesyscalltogettheserviceofucore//soyoushouldsetupthesyscallinterruptgateinhereexternuintptr_t__vectors[];inti;for(i=0;i<sizeof(idt)/sizeof(structgatedesc);i++){SETGATE(idt[i],0,GD_KTEXT,__vectors[i],DPL_KERNEL);}SETGATE(idt[T_SYSCALL],1,GD_KTEXT,__vectors[T_SYSCALL],DPL_USER);lidt(&idt_pd);Kern/process/:staticstructproc_struct*alloc_proc(void){struc
ucore LAB5实验报告 来自淘豆网m.daumloan.com转载请标明出处.