支持glibc静态编译链接的vfork.c , init.c , helloworld.c,每个app都有自己的地址空间 #2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
运行效果:
我认为的几个bug
1.默认使用gp寄存器指向Task's SchedInfo,app跑起来的时候会修改gp寄存器导致程序运行时没法拿到当前task的sched info,因此我修改为全局静态变量CURRENT存储当前TASK’s的SchedInfo
2.pt_regs_addr()函数原来是
但是由于align_down导致减去的值不是TRAPFRAME_SIZE
但在汇编中却是用self.kstack.as_ref().unwrap().top() 直接减去TRAPFRAME_SIZE
如下:
因此在rust中是用pt_regs_addr()获取trap_frame地址然后进行读写操作是和汇编里面的存储位置不匹配。
3.不知道是不是因为静态链接的原因,我这边测试后argc,argv,env按照下图摆放app可以成功接收到参数(和ppt不一样)
4.对syscall的fileops的writev进行了修改,使得可以正常输出。
原本的如下
修改后
修改前的writev返回值不对
未解决的bug(但最后想办法绕过了):
之前群里说的关于给task.mm赋值后会导致原页面回收(Arc指针计数并没有到0)