fix mapkstack
This commit is contained in:
		
							parent
							
								
									62091abae9
								
							
						
					
					
						commit
						6c78af4a57
					
				
					 3 changed files with 5 additions and 5 deletions
				
			
		| 
						 | 
				
			
			@ -193,7 +193,7 @@ uint64          walkaddr(pagetable_t, uint64);
 | 
			
		|||
int             copyout(pagetable_t, uint64, char *, uint64);
 | 
			
		||||
int             copyin(pagetable_t, char *, uint64, uint64);
 | 
			
		||||
int             copyinstr(pagetable_t, char *, uint64, uint64);
 | 
			
		||||
char*           map_kstack();
 | 
			
		||||
char*           mapkstack(uint64);
 | 
			
		||||
uint64          kernelpa(uint64);
 | 
			
		||||
void            clearpteu(pagetable_t, uint64);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -29,8 +29,8 @@ procinit(void)
 | 
			
		|||
  for(p = proc; p < &proc[NPROC]; p++) {
 | 
			
		||||
      initlock(&p->lock, "proc");
 | 
			
		||||
      // Allocate a page for the kernel stack.
 | 
			
		||||
      char *kstack = (char *) KSTACK((int) (p - proc));
 | 
			
		||||
      if((p->kstack = map_kstack(kstack)) == 0) {
 | 
			
		||||
      uint64 kstack = KSTACK((int) (p - proc));
 | 
			
		||||
      if((p->kstack = mapkstack(kstack)) == 0) {
 | 
			
		||||
        panic("procinit");
 | 
			
		||||
      }
 | 
			
		||||
  }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -406,13 +406,13 @@ copyinstr(pagetable_t pagetable, char *dst, uint64 srcva, uint64 max)
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
char *
 | 
			
		||||
map_kstack(uint64 kstack)
 | 
			
		||||
mapkstack(uint64 kstack)
 | 
			
		||||
{
 | 
			
		||||
  char *k = kalloc();
 | 
			
		||||
  if(k == 0) {
 | 
			
		||||
    return 0;
 | 
			
		||||
  }
 | 
			
		||||
  if (mappages(kernel_pagetable, (uint64) kstack, PGSIZE,
 | 
			
		||||
  if (mappages(kernel_pagetable, kstack, PGSIZE,
 | 
			
		||||
               (uint64) k, PTE_R | PTE_W) == 0) {
 | 
			
		||||
    kvminithart();
 | 
			
		||||
    return (char *) kstack;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue