check cp->killed before returning to user from a timer interrupt
This commit is contained in:
		
							parent
							
								
									00ce31c09c
								
							
						
					
					
						commit
						15ce79de14
					
				
					 1 changed files with 4 additions and 0 deletions
				
			
		
							
								
								
									
										4
									
								
								trap.c
									
										
									
									
									
								
							
							
						
						
									
										4
									
								
								trap.c
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -91,4 +91,8 @@ trap(struct trapframe *tf)
 | 
			
		|||
  // If interrupts were on while locks held, would need to check nlock.
 | 
			
		||||
  if(cp && cp->state == RUNNING && tf->trapno == IRQ_OFFSET+IRQ_TIMER)
 | 
			
		||||
    yield();
 | 
			
		||||
 | 
			
		||||
  // Check if the process has been killed since we yielded
 | 
			
		||||
  if(cp && cp->killed && (tf->cs&3) == DPL_USER)
 | 
			
		||||
    exit();
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue