@ -274,6 +274,9 @@ event_dispatch:
callr r1
/ *
* Coming b a c k f r o m t h e C - w o r l d , o u r t h r e a d i n f o p o i n t e r
* should b e i n t h e d e s i g n a t e d r e g i s t e r ( u s u a l l y R 1 9 )
*
* If w e w e r e i n k e r n e l m o d e , w e d o n ' t n e e d t o c h e c k s c h e d u l e r
* or s i g n a l s i f C O N F I G _ P R E E M P T i s n o t s e t . I f s e t , t h e n i t h a s
* to j u m p t o a n e e d _ r e s c h e d k i n d o f b l o c k .
@ -286,67 +289,43 @@ event_dispatch:
# endif
/* "Nested control path" -- if the previous mode was kernel */
R0 = m e m w ( R 2 9 + #_ P T _ E R _ V M E S T ) ;
{
P0 = t s t b i t ( R 0 , #H V M _ V M E S T _ U M _ S F T ) ;
if ( ! P 0 . n e w ) j u m p : n t r e s t o r e _ a l l ;
R0 = m e m w ( R 2 9 + #_ P T _ E R _ V M E S T ) ;
R1 6 . L = #L O ( d o _ w o r k _ p e n d i n g ) ;
}
/ *
* Returning f r o m s y s t e m c a l l , n o r m a l l y c o m i n g b a c k f r o m u s e r m o d e
* /
return_from_syscall :
/* Disable interrupts while checking TIF */
R0 = #V M _ I N T _ D I S A B L E
trap1 ( #H V M _ T R A P 1 _ V M S E T I E )
/ *
* Coming b a c k f r o m t h e C - w o r l d , o u r t h r e a d i n f o p o i n t e r
* should b e i n t h e d e s i g n a t e d r e g i s t e r ( u s u a l l y R 1 9 )
* /
# if C O N F I G _ H E X A G O N _ A R C H _ V E R S I O N < 4
R1 . L = #L O ( _ T I F _ A L L W O R K _ M A S K )
{
R1 . H = #H I ( _ T I F _ A L L W O R K _ M A S K ) ;
R0 = m e m w ( T H R E A D I N F O _ R E G + #_ T H R E A D _ I N F O _ F L A G S ) ;
}
# else
{
R1 = ## _ T I F _ A L L W O R K _ M A S K ;
R0 = m e m w ( T H R E A D I N F O _ R E G + #_ T H R E A D _ I N F O _ F L A G S ) ;
P0 = t s t b i t ( R 0 , #H V M _ V M E S T _ U M _ S F T ) ;
if ( ! P 0 . n e w ) j u m p : n t r e s t o r e _ a l l ;
R1 6 . H = #H I ( d o _ w o r k _ p e n d i n g ) ;
R0 = #V M _ I N T _ D I S A B L E ;
}
# endif
/ *
* Compare a g a i n s t t h e " r e t u r n t o u s e r s p a c e " _ T I F _ W O R K _ M A S K
* Check a l s o t h e r e t u r n f r o m f o r k / s y s t e m c a l l , n o r m a l l y c o m i n g b a c k f r o m
* user m o d e
*
* R1 6 n e e d s t o h a v e d o _ w o r k _ p e n d i n g , a n d R 0 s h o u l d h a v e V M _ I N T _ D I S A B L E
* /
R1 = a n d ( R 1 ,R 0 ) ;
{ P0 = c m p . e q ( R 1 ,#0 ) ; if (!P0.new) jump:t work_pending;}
jump r e s t o r e _ a l l ; /* we're outta here! */
work_pending :
check_work_pending :
/* Disable interrupts while checking TIF */
trap1 ( #H V M _ T R A P 1 _ V M S E T I E )
{
P0 = t s t b i t ( R 1 , #T I F _ N E E D _ R E S C H E D ) ;
if ( ! P 0 . n e w ) j u m p : n t w o r k _ n o t i f y s i g ;
R0 = R 2 9 ; /* regs should still be at top of stack */
R1 = m e m w ( T H R E A D I N F O _ R E G + #_ T H R E A D _ I N F O _ F L A G S ) ;
callr R 1 6 ;
}
call s c h e d u l e
jump r e t u r n _ f r o m _ s y s c a l l ; /* check for more work */
work_notifysig :
/* this is the part that's kind of fuzzy. */
R1 = a n d ( R 0 , #( _ T I F _ S I G P E N D I N G | _ T I F _ N O T I F Y _ R E S U M E ) ) ;
{
P0 = c m p . e q ( R 1 , #0 ) ;
if P 0 . n e w j u m p : t r e s t o r e _ a l l ;
}
{
R1 = R 0 ; /* unsigned long thread_info_flags */
R0 = R 2 9 ; /* regs should still be at top of stack */
P0 = c m p . e q ( R 0 , #0 ) ; if (!P0.new) jump:nt check_work_pending;
R0 = #V M _ I N T _ D I S A B L E ;
}
call d o _ n o t i f y _ r e s u m e
restore_all :
/* Disable interrupts, if they weren't already, before reg restore. */
R0 = #V M _ I N T _ D I S A B L E
/ *
* Disable i n t e r r u p t s , i f t h e y w e r e n ' t a l r e a d y , b e f o r e r e g r e s t o r e .
* R0 g e t s p r e l o a d e d w i t h #V M _ I N T _ D I S A B L E b e f o r e w e g e t h e r e .
* /
trap1 ( #H V M _ T R A P 1 _ V M S E T I E )
/* do the setregs here for VM 0.5 */
@ -371,6 +350,7 @@ restore_all:
trap1 ( #H V M _ T R A P 1 _ V M R T E )
/* Notreached */
.globl _K_enter_genex
_K_enter_genex :
vm_ e v e n t _ e n t r y ( d o _ g e n e x )
@ -390,9 +370,12 @@ _K_enter_machcheck:
.globl ret_from_fork
ret_from_fork :
call s c h e d u l e _ t a i l
P0 = c m p . e q ( R 2 4 , #0 ) ;
if P 0 j u m p r e t u r n _ f r o m _ s y s c a l l
R0 = R 2 5 ;
callr R 2 4
jump r e t u r n _ f r o m _ s y s c a l l
{
call s c h e d u l e _ t a i l ;
R1 6 . H = #H I ( d o _ w o r k _ p e n d i n g ) ;
}
{
R1 6 . L = #L O ( d o _ w o r k _ p e n d i n g ) ;
R0 = #V M _ I N T _ D I S A B L E ;
jump c h e c k _ w o r k _ p e n d i n g ;
}