2005-04-17 02:20:36 +04:00
/ *
* Code f o r t h e v s y s c a l l p a g e . T h i s v e r s i o n u s e s t h e s y s e n t e r i n s t r u c t i o n .
*
* NOTE :
* 1 ) _ _ kernel_ v s y s c a l l _ m u s t _ b e f i r s t i n t h i s p a g e .
* 2 ) there a r e a l i g n m e n t c o n s t r a i n t s o n t h i s s t u b , s e e v s y s c a l l - s i g r e t u r n . S
* for d e t a i l s .
* /
2006-02-15 00:53:20 +03:00
/ *
* The c a l l e r p u t s a r g 2 i n % e c x , w h i c h g e t s p u s h e d . T h e k e r n e l w i l l u s e
* % ecx i t s e l f f o r a r g 2 . T h e p u s h i n g i s b e c a u s e t h e s y s e x i t i n s t r u c t i o n
* ( found i n e n t r y . S ) r e q u i r e s t h a t w e c l o b b e r % e c x w i t h t h e d e s i r e d % e s p .
* User c o d e m i g h t e x p e c t t h a t % e c x i s u n c l o b b e r e d t h o u g h , a s i t w o u l d b e
* for r e t u r n i n g v i a t h e i r e t i n s t r u c t i o n , s o w e m u s t p u s h a n d p o p .
*
* The c a l l e r p u t s a r g 3 i n % e d x , w h i c h t h e s y s e x i t i n s t r u c t i o n r e q u i r e s
* for % e i p . T h u s , e x a c t l y a s f o r a r g 2 , w e m u s t p u s h a n d p o p .
*
* Arg6 i s d i f f e r e n t . T h e c a l l e r p u t s a r g 6 i n % e b p . S i n c e t h e s y s e n t e r
* instruction c l o b b e r s % e s p , t h e u s e r ' s % e s p w o n ' t e v e n s u r v i v e e n t r y
* into t h e k e r n e l . W e s t o r e % e s p i n % e b p . C o d e i n e n t r y . S m u s t f e t c h
* arg6 f r o m t h e s t a c k .
2006-03-23 13:59:48 +03:00
*
* You c a n n o t u s e t h i s v s y s c a l l f o r t h e c l o n e ( ) s y s c a l l b e c a u s e t h e
* three d w o r d s o n t h e p a r e n t s t a c k d o n o t g e t c o p i e d t o t h e c h i l d .
2006-02-15 00:53:20 +03:00
* /
2005-04-17 02:20:36 +04:00
.text
.globl __kernel_vsyscall
.type _ _ kernel_ v s y s c a l l ,@function
__kernel_vsyscall :
.LSTART_vsyscall :
push % e c x
.Lpush_ecx :
push % e d x
.Lpush_edx :
push % e b p
.Lenter_kernel :
movl % e s p ,% e b p
sysenter
/* 7: align return point with nop's to make disassembly easier */
.space 7 , 0 x9 0
/* 14: System call restart point is here! (SYSENTER_RETURN - 2) */
jmp . L e n t e r _ k e r n e l
/* 16: System call normal return point is here! */
.globl SYSENTER_RETURN /* Symbol used by entry.S. */
SYSENTER_RETURN :
pop % e b p
.Lpop_ebp :
pop % e d x
.Lpop_edx :
pop % e c x
.Lpop_ecx :
ret
.LEND_vsyscall :
.size _ _ kernel_ v s y s c a l l ,. - . L S T A R T _ v s y s c a l l
.previous
.section .eh_frame , " a" ,@progbits
.LSTARTFRAMEDLSI :
.long .LENDCIEDLSI - .LSTARTCIEDLSI
.LSTARTCIEDLSI :
.long 0 /* CIE ID */
.byte 1 /* Version number */
.string " zR" / * N U L - t e r m i n a t e d a u g m e n t a t i o n s t r i n g * /
.uleb128 1 /* Code alignment factor */
.sleb128 - 4 /* Data alignment factor */
.byte 8 /* Return address register column */
.uleb128 1 /* Augmentation value length */
.byte 0x1b /* DW_EH_PE_pcrel|DW_EH_PE_sdata4. */
.byte 0x0c /* DW_CFA_def_cfa */
.uleb128 4
.uleb128 4
.byte 0x88 /* DW_CFA_offset, column 0x8 */
.uleb128 1
.align 4
.LENDCIEDLSI :
.long .LENDFDEDLSI - .LSTARTFDEDLSI /* Length FDE */
.LSTARTFDEDLSI :
.long .LSTARTFDEDLSI - .LSTARTFRAMEDLSI /* CIE pointer */
.long .LSTART_vsyscall - . /* PC-relative start address */
.long .LEND_vsyscall - .LSTART_vsyscall
.uleb128 0
/ * What f o l l o w s a r e t h e i n s t r u c t i o n s f o r t h e t a b l e g e n e r a t i o n .
We h a v e t o r e c o r d a l l c h a n g e s o f t h e s t a c k p o i n t e r . * /
.byte 0x04 /* DW_CFA_advance_loc4 */
.long .Lpush_ecx - .LSTART_vsyscall
.byte 0x0e /* DW_CFA_def_cfa_offset */
.byte 0x08 /* RA at offset 8 now */
.byte 0x04 /* DW_CFA_advance_loc4 */
.long .Lpush_edx - .Lpush_ecx
.byte 0x0e /* DW_CFA_def_cfa_offset */
.byte 0x0c /* RA at offset 12 now */
.byte 0x04 /* DW_CFA_advance_loc4 */
.long .Lenter_kernel - .Lpush_edx
.byte 0x0e /* DW_CFA_def_cfa_offset */
.byte 0x10 /* RA at offset 16 now */
.byte 0 x8 5 , 0 x04 / * D W _ C F A _ o f f s e t % e b p - 1 6 * /
/* Finally the epilogue. */
.byte 0x04 /* DW_CFA_advance_loc4 */
.long .Lpop_ebp - .Lenter_kernel
.byte 0x0e /* DW_CFA_def_cfa_offset */
.byte 0x0c /* RA at offset 12 now */
.byte 0xc5 /* DW_CFA_restore %ebp */
.byte 0x04 /* DW_CFA_advance_loc4 */
.long .Lpop_edx - .Lpop_ebp
.byte 0x0e /* DW_CFA_def_cfa_offset */
.byte 0x08 /* RA at offset 8 now */
.byte 0x04 /* DW_CFA_advance_loc4 */
.long .Lpop_ecx - .Lpop_edx
.byte 0x0e /* DW_CFA_def_cfa_offset */
.byte 0x04 /* RA at offset 4 now */
.align 4
.LENDFDEDLSI :
.previous
/ *
* Get t h e c o m m o n c o d e f o r t h e s i g r e t u r n e n t r y p o i n t s .
* /
# include " v s y s c a l l - s i g r e t u r n . S "