p 32 kernel/exec.c struct proc *p = myproc(); p 49 kernel/exec.c if((pagetable = proc_pagetable(p)) == 0) p 75 kernel/exec.c p = myproc(); p 76 kernel/exec.c uint64 oldsz = p->sz; p 115 kernel/exec.c p->trapframe->a1 = sp; p 121 kernel/exec.c safestrcpy(p->name, last, sizeof(p->name)); p 124 kernel/exec.c oldpagetable = p->pagetable; p 125 kernel/exec.c p->pagetable = pagetable; p 126 kernel/exec.c p->sz = sz; p 127 kernel/exec.c p->trapframe->epc = elf.entry; // initial program counter = main p 128 kernel/exec.c p->trapframe->sp = sp; // initial stack pointer p 90 kernel/file.c struct proc *p = myproc(); p 97 kernel/file.c if(copyout(p->pagetable, addr, (char *)&st, sizeof(st)) < 0) p 36 kernel/kalloc.c char *p; p 37 kernel/kalloc.c p = (char*)PGROUNDUP((uint64)pa_start); p 38 kernel/kalloc.c for(; p + PGSIZE <= (char*)pa_end; p += PGSIZE) p 39 kernel/kalloc.c kfree(p); p 48 kernel/memlayout.h #define KSTACK(p) (TRAMPOLINE - ((p)+1)* 2*PGSIZE) p 19 kernel/proc.c static void freeproc(struct proc *p); p 35 kernel/proc.c struct proc *p; p 37 kernel/proc.c for(p = proc; p < &proc[NPROC]; p++) { p 41 kernel/proc.c uint64 va = KSTACK((int) (p - proc)); p 50 kernel/proc.c struct proc *p; p 54 kernel/proc.c for(p = proc; p < &proc[NPROC]; p++) { p 55 kernel/proc.c initlock(&p->lock, "proc"); p 56 kernel/proc.c p->state = UNUSED; p 57 kernel/proc.c p->kstack = KSTACK((int) (p - proc)); p 87 kernel/proc.c struct proc *p = c->proc; p 89 kernel/proc.c return p; p 112 kernel/proc.c struct proc *p; p 114 kernel/proc.c for(p = proc; p < &proc[NPROC]; p++) { p 115 kernel/proc.c acquire(&p->lock); p 116 kernel/proc.c if(p->state == UNUSED) { p 119 kernel/proc.c release(&p->lock); p 125 kernel/proc.c p->pid = allocpid(); p 126 kernel/proc.c p->state = USED; p 129 kernel/proc.c if((p->trapframe = (struct trapframe *)kalloc()) == 0){ p 130 kernel/proc.c freeproc(p); p 131 kernel/proc.c release(&p->lock); p 136 kernel/proc.c p->pagetable = proc_pagetable(p); p 137 kernel/proc.c if(p->pagetable == 0){ p 138 kernel/proc.c freeproc(p); p 139 kernel/proc.c release(&p->lock); p 145 kernel/proc.c memset(&p->context, 0, sizeof(p->context)); p 146 kernel/proc.c p->context.ra = (uint64)forkret; p 147 kernel/proc.c p->context.sp = p->kstack + PGSIZE; p 149 kernel/proc.c return p; p 156 kernel/proc.c freeproc(struct proc *p) p 158 kernel/proc.c if(p->trapframe) p 159 kernel/proc.c kfree((void*)p->trapframe); p 160 kernel/proc.c p->trapframe = 0; p 161 kernel/proc.c if(p->pagetable) p 162 kernel/proc.c proc_freepagetable(p->pagetable, p->sz); p 163 kernel/proc.c p->pagetable = 0; p 164 kernel/proc.c p->sz = 0; p 165 kernel/proc.c p->pid = 0; p 166 kernel/proc.c p->parent = 0; p 167 kernel/proc.c p->name[0] = 0; p 168 kernel/proc.c p->chan = 0; p 169 kernel/proc.c p->killed = 0; p 170 kernel/proc.c p->xstate = 0; p 171 kernel/proc.c p->state = UNUSED; p 177 kernel/proc.c proc_pagetable(struct proc *p) p 199 kernel/proc.c (uint64)(p->trapframe), PTE_R | PTE_W) < 0){ p 235 kernel/proc.c struct proc *p; p 237 kernel/proc.c p = allocproc(); p 238 kernel/proc.c initproc = p; p 242 kernel/proc.c uvmfirst(p->pagetable, initcode, sizeof(initcode)); p 243 kernel/proc.c p->sz = PGSIZE; p 246 kernel/proc.c p->trapframe->epc = 0; // user program counter p 247 kernel/proc.c p->trapframe->sp = PGSIZE; // user stack pointer p 249 kernel/proc.c safestrcpy(p->name, "initcode", sizeof(p->name)); p 250 kernel/proc.c p->cwd = namei("/"); p 252 kernel/proc.c p->state = RUNNABLE; p 254 kernel/proc.c release(&p->lock); p 263 kernel/proc.c struct proc *p = myproc(); p 265 kernel/proc.c sz = p->sz; p 267 kernel/proc.c if((sz = uvmalloc(p->pagetable, sz, sz + n, PTE_W)) == 0) { p 271 kernel/proc.c sz = uvmdealloc(p->pagetable, sz, sz + n); p 273 kernel/proc.c p->sz = sz; p 284 kernel/proc.c struct proc *p = myproc(); p 292 kernel/proc.c if(uvmcopy(p->pagetable, np->pagetable, p->sz) < 0){ p 297 kernel/proc.c np->sz = p->sz; p 300 kernel/proc.c *(np->trapframe) = *(p->trapframe); p 307 kernel/proc.c if(p->ofile[i]) p 308 kernel/proc.c np->ofile[i] = filedup(p->ofile[i]); p 309 kernel/proc.c np->cwd = idup(p->cwd); p 311 kernel/proc.c safestrcpy(np->name, p->name, sizeof(p->name)); p 318 kernel/proc.c np->parent = p; p 331 kernel/proc.c reparent(struct proc *p) p 336 kernel/proc.c if(pp->parent == p){ p 349 kernel/proc.c struct proc *p = myproc(); p 351 kernel/proc.c if(p == initproc) p 356 kernel/proc.c if(p->ofile[fd]){ p 357 kernel/proc.c struct file *f = p->ofile[fd]; p 359 kernel/proc.c p->ofile[fd] = 0; p 364 kernel/proc.c iput(p->cwd); p 366 kernel/proc.c p->cwd = 0; p 371 kernel/proc.c reparent(p); p 374 kernel/proc.c wakeup(p->parent); p 376 kernel/proc.c acquire(&p->lock); p 378 kernel/proc.c p->xstate = status; p 379 kernel/proc.c p->state = ZOMBIE; p 395 kernel/proc.c struct proc *p = myproc(); p 403 kernel/proc.c if(pp->parent == p){ p 411 kernel/proc.c if(addr != 0 && copyout(p->pagetable, addr, (char *)&pp->xstate, p 427 kernel/proc.c if(!havekids || killed(p)){ p 433 kernel/proc.c sleep(p, &wait_lock); //DOC: wait-sleep p 447 kernel/proc.c struct proc *p; p 458 kernel/proc.c for(p = proc; p < &proc[NPROC]; p++) { p 459 kernel/proc.c acquire(&p->lock); p 460 kernel/proc.c if(p->state == RUNNABLE) { p 464 kernel/proc.c p->state = RUNNING; p 465 kernel/proc.c c->proc = p; p 466 kernel/proc.c swtch(&c->context, &p->context); p 473 kernel/proc.c release(&p->lock); p 494 kernel/proc.c struct proc *p = myproc(); p 496 kernel/proc.c if(!holding(&p->lock)) p 500 kernel/proc.c if(p->state == RUNNING) p 506 kernel/proc.c swtch(&p->context, &mycpu()->context); p 514 kernel/proc.c struct proc *p = myproc(); p 515 kernel/proc.c acquire(&p->lock); p 516 kernel/proc.c p->state = RUNNABLE; p 518 kernel/proc.c release(&p->lock); p 550 kernel/proc.c struct proc *p = myproc(); p 559 kernel/proc.c acquire(&p->lock); //DOC: sleeplock1 p 563 kernel/proc.c p->chan = chan; p 564 kernel/proc.c p->state = SLEEPING; p 569 kernel/proc.c p->chan = 0; p 572 kernel/proc.c release(&p->lock); p 581 kernel/proc.c struct proc *p; p 583 kernel/proc.c for(p = proc; p < &proc[NPROC]; p++) { p 584 kernel/proc.c if(p != myproc()){ p 585 kernel/proc.c acquire(&p->lock); p 586 kernel/proc.c if(p->state == SLEEPING && p->chan == chan) { p 587 kernel/proc.c p->state = RUNNABLE; p 589 kernel/proc.c release(&p->lock); p 600 kernel/proc.c struct proc *p; p 602 kernel/proc.c for(p = proc; p < &proc[NPROC]; p++){ p 603 kernel/proc.c acquire(&p->lock); p 604 kernel/proc.c if(p->pid == pid){ p 605 kernel/proc.c p->killed = 1; p 606 kernel/proc.c if(p->state == SLEEPING){ p 608 kernel/proc.c p->state = RUNNABLE; p 610 kernel/proc.c release(&p->lock); p 613 kernel/proc.c release(&p->lock); p 619 kernel/proc.c setkilled(struct proc *p) p 621 kernel/proc.c acquire(&p->lock); p 622 kernel/proc.c p->killed = 1; p 623 kernel/proc.c release(&p->lock); p 627 kernel/proc.c killed(struct proc *p) p 631 kernel/proc.c acquire(&p->lock); p 632 kernel/proc.c k = p->killed; p 633 kernel/proc.c release(&p->lock); p 643 kernel/proc.c struct proc *p = myproc(); p 645 kernel/proc.c return copyout(p->pagetable, dst, src, len); p 658 kernel/proc.c struct proc *p = myproc(); p 660 kernel/proc.c return copyin(p->pagetable, dst, src, len); p 681 kernel/proc.c struct proc *p; p 685 kernel/proc.c for(p = proc; p < &proc[NPROC]; p++){ p 686 kernel/proc.c if(p->state == UNUSED) p 688 kernel/proc.c if(p->state >= 0 && p->state < NELEM(states) && states[p->state]) p 689 kernel/proc.c state = states[p->state]; p 692 kernel/proc.c printf("%d %s %s", p->pid, state, p->name); p 61 kernel/string.c strncmp(const char *p, const char *q, uint n) p 63 kernel/string.c while(n > 0 && *p && *p == *q) p 64 kernel/string.c n--, p++, q++; p 67 kernel/string.c return (uchar)*p - (uchar)*q; p 14 kernel/syscall.c struct proc *p = myproc(); p 15 kernel/syscall.c if(addr >= p->sz || addr+sizeof(uint64) > p->sz) // both tests needed, in case of overflow p 17 kernel/syscall.c if(copyin(p->pagetable, (char *)ip, addr, sizeof(*ip)) != 0) p 27 kernel/syscall.c struct proc *p = myproc(); p 28 kernel/syscall.c if(copyinstr(p->pagetable, buf, addr, max) < 0) p 36 kernel/syscall.c struct proc *p = myproc(); p 39 kernel/syscall.c return p->trapframe->a0; p 41 kernel/syscall.c return p->trapframe->a1; p 43 kernel/syscall.c return p->trapframe->a2; p 45 kernel/syscall.c return p->trapframe->a3; p 47 kernel/syscall.c return p->trapframe->a4; p 49 kernel/syscall.c return p->trapframe->a5; p 135 kernel/syscall.c struct proc *p = myproc(); p 137 kernel/syscall.c num = p->trapframe->a7; p 141 kernel/syscall.c p->trapframe->a0 = syscalls[num](); p 144 kernel/syscall.c p->pid, p->name, num); p 145 kernel/syscall.c p->trapframe->a0 = -1; p 43 kernel/sysfile.c struct proc *p = myproc(); p 46 kernel/sysfile.c if(p->ofile[fd] == 0){ p 47 kernel/sysfile.c p->ofile[fd] = f; p 73 kernel/sysfile.c uint64 p; p 75 kernel/sysfile.c argaddr(1, &p); p 79 kernel/sysfile.c return fileread(f, p, n); p 87 kernel/sysfile.c uint64 p; p 89 kernel/sysfile.c argaddr(1, &p); p 94 kernel/sysfile.c return filewrite(f, p, n); p 414 kernel/sysfile.c struct proc *p = myproc(); p 428 kernel/sysfile.c iput(p->cwd); p 430 kernel/sysfile.c p->cwd = ip; p 483 kernel/sysfile.c struct proc *p = myproc(); p 491 kernel/sysfile.c p->ofile[fd0] = 0; p 496 kernel/sysfile.c if(copyout(p->pagetable, fdarray, (char*)&fd0, sizeof(fd0)) < 0 || p 497 kernel/sysfile.c copyout(p->pagetable, fdarray+sizeof(fd0), (char *)&fd1, sizeof(fd1)) < 0){ p 498 kernel/sysfile.c p->ofile[fd0] = 0; p 499 kernel/sysfile.c p->ofile[fd1] = 0; p 33 kernel/sysproc.c uint64 p; p 34 kernel/sysproc.c argaddr(0, &p); p 35 kernel/sysproc.c return wait(p); p 48 kernel/trap.c struct proc *p = myproc(); p 51 kernel/trap.c p->trapframe->epc = r_sepc(); p 56 kernel/trap.c if(killed(p)) p 61 kernel/trap.c p->trapframe->epc += 4; p 71 kernel/trap.c printf("usertrap(): unexpected scause 0x%lx pid=%d\n", r_scause(), p->pid); p 73 kernel/trap.c setkilled(p); p 76 kernel/trap.c if(killed(p)) p 92 kernel/trap.c struct proc *p = myproc(); p 105 kernel/trap.c p->trapframe->kernel_satp = r_satp(); // kernel page table p 106 kernel/trap.c p->trapframe->kernel_sp = p->kstack + PGSIZE; // process's kernel stack p 107 kernel/trap.c p->trapframe->kernel_trap = (uint64)usertrap; p 108 kernel/trap.c p->trapframe->kernel_hartid = r_tp(); // hartid for cpuid() p 120 kernel/trap.c w_sepc(p->trapframe->epc); p 123 kernel/trap.c uint64 satp = MAKE_SATP(p->pagetable); p 429 kernel/vm.c char *p = (char *) (pa0 + (srcva - va0)); p 431 kernel/vm.c if(*p == '\0'){ p 436 kernel/vm.c *dst = *p; p 440 kernel/vm.c p++; p 42 mkfs/mkfs.c void iappend(uint inum, void *p, int n); p 257 mkfs/mkfs.c char *p = (char*)xp; p 288 mkfs/mkfs.c bcopy(p, buf + off - (fbn * BSIZE), n1); p 292 mkfs/mkfs.c p += n1; p 15 user/grep.c char *p, *q; p 21 user/grep.c p = buf; p 22 user/grep.c while((q = strchr(p, '\n')) != 0){ p 24 user/grep.c if(match(pattern, p)){ p 26 user/grep.c write(1, p, q+1 - p); p 28 user/grep.c p = q+1; p 31 user/grep.c m -= p - buf; p 32 user/grep.c memmove(buf, p, m); p 11 user/ls.c char *p; p 14 user/ls.c for(p=path+strlen(path); p >= path && *p != '/'; p--) p 16 user/ls.c p++; p 19 user/ls.c if(strlen(p) >= DIRSIZ) p 20 user/ls.c return p; p 21 user/ls.c memmove(buf, p, strlen(p)); p 22 user/ls.c memset(buf+strlen(p), ' ', DIRSIZ-strlen(p)); p 29 user/ls.c char buf[512], *p; p 57 user/ls.c p = buf+strlen(buf); p 58 user/ls.c *p++ = '/'; p 62 user/ls.c memmove(p, de.name, DIRSIZ); p 63 user/ls.c p[DIRSIZ] = 0; p 61 user/sh.c int p[2]; p 103 user/sh.c if(pipe(p) < 0) p 107 user/sh.c dup(p[1]); p 108 user/sh.c close(p[0]); p 109 user/sh.c close(p[1]); p 114 user/sh.c dup(p[0]); p 115 user/sh.c close(p[0]); p 116 user/sh.c close(p[1]); p 119 user/sh.c close(p[0]); p 120 user/sh.c close(p[1]); p 29 user/ulib.c strcmp(const char *p, const char *q) p 31 user/ulib.c while(*p && *p == *q) p 32 user/ulib.c p++, q++; p 33 user/ulib.c return (uchar)*p - (uchar)*q; p 27 user/umalloc.c Header *bp, *p; p 30 user/umalloc.c for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) p 31 user/umalloc.c if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) p 33 user/umalloc.c if(bp + bp->s.size == p->s.ptr){ p 34 user/umalloc.c bp->s.size += p->s.ptr->s.size; p 35 user/umalloc.c bp->s.ptr = p->s.ptr->s.ptr; p 37 user/umalloc.c bp->s.ptr = p->s.ptr; p 38 user/umalloc.c if(p + p->s.size == bp){ p 39 user/umalloc.c p->s.size += bp->s.size; p 40 user/umalloc.c p->s.ptr = bp->s.ptr; p 42 user/umalloc.c p->s.ptr = bp; p 43 user/umalloc.c freep = p; p 49 user/umalloc.c char *p; p 54 user/umalloc.c p = sbrk(nu * sizeof(Header)); p 55 user/umalloc.c if(p == (char*)-1) p 57 user/umalloc.c hp = (Header*)p; p 66 user/umalloc.c Header *p, *prevp; p 74 user/umalloc.c for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ p 75 user/umalloc.c if(p->s.size >= nunits){ p 76 user/umalloc.c if(p->s.size == nunits) p 77 user/umalloc.c prevp->s.ptr = p->s.ptr; p 79 user/umalloc.c p->s.size -= nunits; p 80 user/umalloc.c p += p->s.size; p 81 user/umalloc.c p->s.size = nunits; p 84 user/umalloc.c return (void*)(p + 1); p 86 user/umalloc.c if(p == freep) p 87 user/umalloc.c if((p = morecore(nunits)) == 0) p 2067 user/usertests.c char *c, *oldbrk, *a, *lastaddr, *p; p 2075 user/usertests.c p = sbrk(amt); p 2076 user/usertests.c if (p != a) { p 2273 user/usertests.c uint64 p; p 2276 user/usertests.c for(p = 0; p <= (uint)hi; p += PGSIZE){ p 2278 user/usertests.c if(link("nosuchfile", (char*)p) != -1){ p 2548 user/usertests.c char *p = (char *) (top - 64); p 2549 user/usertests.c p[0] = 'x'; p 2550 user/usertests.c p[1] = '\0'; p 2551 user/usertests.c int fd = open(p, O_RDWR|O_CREATE); p 2552 user/usertests.c write(fd, p, 1); p 2554 user/usertests.c fd = open(p, O_RDWR); p 2555 user/usertests.c p[0] = '\0'; p 2556 user/usertests.c read(fd, p, 1); p 2557 user/usertests.c if(p[0] != 'x')