2006-11-27 06:06:26 +03:00
/ *
2005-04-17 02:20:36 +04:00
* _ _ clear_ u s e r _ p a g e , _ _ c l e a r _ u s e r , c l e a r _ p a g e i m p l e m e n t a t i o n o f S u p e r H
*
* Copyright ( C ) 2 0 0 1 K a z K o j i m a
* Copyright ( C ) 2 0 0 1 , 2 0 0 2 N i i b e Y u t a k a
2006-11-27 06:06:26 +03:00
* Copyright ( C ) 2 0 0 6 P a u l M u n d t
2005-04-17 02:20:36 +04:00
* /
# include < l i n u x / l i n k a g e . h >
2006-11-27 06:06:26 +03:00
# include < a s m / p a g e . h >
2005-04-17 02:20:36 +04:00
/ *
2007-11-23 07:55:02 +03:00
* clear_ p a g e
2005-04-17 02:20:36 +04:00
* @to: P1 address
*
2007-11-23 07:55:02 +03:00
* void c l e a r _ p a g e ( v o i d * t o )
2005-04-17 02:20:36 +04:00
* /
/ *
* r0 - - - s c r a t c h
* r4 - - - t o
2006-11-27 06:06:26 +03:00
* r5 - - - t o + P A G E _ S I Z E
2005-04-17 02:20:36 +04:00
* /
2007-11-23 07:55:02 +03:00
ENTRY( c l e a r _ p a g e )
2005-04-17 02:20:36 +04:00
mov r4 ,r5
2006-11-27 06:06:26 +03:00
mov. l . L l i m i t ,r0
2005-04-17 02:20:36 +04:00
add r0 ,r5
mov #0 ,r0
!
1 :
2008-03-21 12:07:04 +03:00
# if d e f i n e d ( C O N F I G _ C P U _ S H 4 )
2005-04-17 02:20:36 +04:00
movca. l r0 ,@r4
mov r4 ,r1
2008-03-21 12:07:04 +03:00
# else
mov. l r0 ,@r4
2005-04-17 02:20:36 +04:00
# endif
add #32 ,r4
mov. l r0 ,@-r4
mov. l r0 ,@-r4
mov. l r0 ,@-r4
mov. l r0 ,@-r4
mov. l r0 ,@-r4
mov. l r0 ,@-r4
mov. l r0 ,@-r4
# if d e f i n e d ( C O N F I G _ C P U _ S H 4 )
ocbwb @r1
# endif
cmp/ e q r5 ,r4
bf/ s 1 b
add #28 ,r4
!
rts
nop
2007-11-30 10:34:26 +03:00
.balign 4
2006-11-27 06:06:26 +03:00
.Llimit : .long ( PAGE_ S I Z E - 2 8 )
2005-04-17 02:20:36 +04:00
ENTRY( _ _ c l e a r _ u s e r )
!
mov #0 , r0
mov #0xe0 , r1 ! 0 x f f f f f f e 0
!
! r4 . . ( r4 + 3 1 ) & ~ 3 2 - - - - - - - - n o t a l i g n e d [ A r e a 0 ]
! ( r4 + 3 1 ) & ~ 3 2 . . ( r4 + r5 ) & ~ 3 2 - - - - - - - - a l i g n e d [ A r e a 1 ]
! ( r4 + r5 ) & ~ 3 2 . . r4 + r5 - - - - - - - - n o t a l i g n e d [ A r e a 2 ]
!
! Clear a r e a 0
mov r4 , r2
!
tst r1 , r5 ! l e n g t h < 3 2
bt . L a r e a2 ! s k i p t o r e m a i n d e r
!
add #31 , r2
and r1 , r2
cmp/ e q r4 , r2
bt . L a r e a1
mov r2 , r3
sub r4 , r3
mov r3 , r7
mov r4 , r2
!
.L0 : dt r3
0 : mov. b r0 , @r2
bf/ s . L 0
add #1 , r2
!
sub r7 , r5
mov r2 , r4
.Larea1 :
mov r4 , r3
add r5 , r3
and r1 , r3
cmp/ h i r2 , r3
bf . L a r e a2
!
! Clear a r e a 1
# if d e f i n e d ( C O N F I G _ C P U _ S H 4 )
1 : movca. l r0 , @r2
# else
1 : mov. l r0 , @r2
# endif
add #4 , r2
2 : mov. l r0 , @r2
add #4 , r2
3 : mov. l r0 , @r2
add #4 , r2
4 : mov. l r0 , @r2
add #4 , r2
5 : mov. l r0 , @r2
add #4 , r2
6 : mov. l r0 , @r2
add #4 , r2
7 : mov. l r0 , @r2
add #4 , r2
8 : mov. l r0 , @r2
add #4 , r2
cmp/ h i r2 , r3
bt/ s 1 b
nop
!
! Clear a r e a 2
.Larea2 :
mov r4 , r3
add r5 , r3
cmp/ h s r3 , r2
bt/ s . L d o n e
sub r2 , r3
.L2 : dt r3
9 : mov. b r0 , @r2
bf/ s . L 2
add #1 , r2
!
.Ldone : rts
mov #0 , r0 ! r e t u r n 0 a s n o r m a l r e t u r n
! return t h e n u m b e r o f b y t e s r e m a i n e d
.Lbad_clear_user :
mov r4 , r0
add r5 , r0
rts
sub r2 , r0
.section _ _ ex_ t a b l e ," a "
.align 2
.long 0 b, . L b a d _ c l e a r _ u s e r
.long 1 b, . L b a d _ c l e a r _ u s e r
.long 2 b, . L b a d _ c l e a r _ u s e r
.long 3 b, . L b a d _ c l e a r _ u s e r
.long 4 b, . L b a d _ c l e a r _ u s e r
.long 5 b, . L b a d _ c l e a r _ u s e r
.long 6 b, . L b a d _ c l e a r _ u s e r
.long 7 b, . L b a d _ c l e a r _ u s e r
.long 8 b, . L b a d _ c l e a r _ u s e r
.long 9 b, . L b a d _ c l e a r _ u s e r
.previous