Ⅰ xv6 内核 scheduler 的开中断 在proc.c中可以看到 for(;;){// Enable interrupts on this processor.sti();// Loop over process table looking for process to run.acquire(&ptable.lock); 执行scheduler的时候是开中断的,内核中只有scheduler函数会短暂的开中断的,其他时候都是关中断的。而如果做过 jos...
打开main.c可以看到如上的main函数,完成了各种初始化功能。这里面的很多函数涉及到后面章节的知识,这里主要看两个函数: mpinit():搜集其他CPU核的配置信息,以便后面利用。 startothers():启动其他CPU核,为其他处理器准备好启动代码,将entryothers代码从物理地址0x000100xxx的位置复制到物理地址0x7000,然后逐个CPU启动,...
Saved searches Use saved searches to filter your results more quickly Cancel Create saved search Sign in Sign up Reseting focus {{ message }} Titterball / xv6-public Public forked from mit-pdos/xv6-public Notifications You must be signed in to change notification settings Fork 0 ...
grep.c ide.c init.c initcode.S ioapic.c kalloc.c kbd.c kbd.h kernel.ld kill.c lapic.c ln.c log.c ls.c main.c memide.c memlayout.h mkdir.c mkfs.c mmu.h mp.c mp.h mytest.c param.h picirq.c pipe.c pr.pl printf.c ...
syscall执行实际的系统调用函数,通过之前在C中的包装函数里,我们将系统调用号SYS_write保存在了用户寄存器a7中,在trampoline代码中,我们将它保存在了进程的trapframe中,现在,我们在syscall里,通过进程的trapframe->a7读取到这个系统调用号,执行对应的内核中的系统调用程序。
bootmain.c xv6: boot loader adjustments 16年前 buf.h Another attempt at the bio.c comment. 18年前 cat.c more consistent spacing 18年前 console.c 16年前 cuth delete unnecessary #include lines 18年前 date.h defs.h move fork into proc.c ...
xv6/sh.c 1//Shell.23#include"types.h"4#include"user.h"5#include"fcntl.h"67//Parsed command representation8#defineEXEC 19#defineREDIR 210#definePIPE 311#defineLIST 412#defineBACK 51314#defineMAXARGS 101516structcmd {17inttype;18};1920structexeccmd {21inttype;22char*argv[MAXARGS];23char*...
内联汇编,顾名思义,一种语言的内部使用汇编,一般的语言是不能直接操作寄存器的,而汇编可以,所以在这种语言内部以某种方式嵌入汇编代码来提升能力,一般来说也就是 c/c++ 使用内联汇编比较多,本文用的 c 语言来叙述,废话不再多说,直接来看。 基本形式
1、定义vector<vector<int>> A;//错误的定义方式vector<vector<int> > A;//正缺的定义方式2、插入...
这个系统调用入口程序定义在syscall.c里面: voidsyscall(void){intnum;structproc*curproc=myproc();//获取当前进程的PCBnum = curproc->tf->eax;//获取系统调用号if(num >0&& num < NELEM(syscalls) && syscalls[num]) { curproc->tf->eax = syscalls[num]();//调用相应的系统调用处理函数,返回值赋...