2005-04-17 02:20:36 +04:00
/ *
* linux/ a r c h / a r m / l i b / l l _ c h a r _ w r . S
*
* Copyright ( C ) 1 9 9 5 , 1 9 9 6 R u s s e l l K i n g .
*
* This p r o g r a m i s f r e e s o f t w a r e ; you can redistribute it and/or modify
* it u n d e r t h e t e r m s o f t h e G N U G e n e r a l P u b l i c L i c e n s e v e r s i o n 2 a s
* published b y t h e F r e e S o f t w a r e F o u n d a t i o n .
*
* Speedups & 1 b p p c o d e ( C ) 1 9 9 6 P h i l i p B l u n d e l l & R u s s e l l K i n g .
*
* 1 0 - 0 4 - 9 6 RMK V a r i o u s c l e a n u p s & r e d u c e d r e g i s t e r u s a g e .
* 0 8 - 0 4 - 9 8 RMK S h i f t s r e - o r d e r e d
* /
@ Regs: [] = corruptible
@ {} = used
@ () = do not use
# include < l i n u x / l i n k a g e . h >
# include < a s m / a s s e m b l e r . h >
.text
LC0 : .word L C 0
.word bytes_per_char_h
.word video_size_row
.word acorndata_8x8
.word con_charconvtable
/ *
* r0 = p t r
* r1 = c h a r
* r2 = w h i t e
* /
ENTRY( l l _ w r i t e _ c h a r )
stmfd s p ! , { r4 - r7 , l r }
@
@ Smashable regs: {r0 - r3}, [r4 - r7], (r8 - fp), [ip], (sp), [lr], (pc)
@
/ *
* calculate o f f s e t i n t o c h a r a c t e r t a b l e
* /
mov r1 , r1 , l s l #3
/ *
* calculate o f f s e t r e q u i r e d f o r e a c h r o w .
* /
adr i p , L C 0
ldmia i p , { r3 , r4 , r5 , r6 , l r }
sub i p , i p , r3
add r6 , r6 , i p
add l r , l r , i p
ldr r4 , [ r4 , i p ]
ldr r5 , [ r5 , i p ]
/ *
* Go t o r e s o l u t i o n - d e p e n d e n t r o u t i n e . . .
* /
cmp r4 , #4
blt L r o w1 b p p
add r0 , r0 , r5 , l s l #3 @ Move to bottom of character
orr r1 , r1 , #7
ldrb r7 , [ r6 , r1 ]
teq r4 , #8
beq L r o w8 b p p l p
@
@ Smashable regs: {r0 - r3}, [r4], {r5 - r7}, (r8 - fp), [ip], (sp), {lr}, (pc)
@
Lrow4bpplp :
ldr r7 , [ l r , r7 , l s l #2 ]
mul r7 , r2 , r7
sub r1 , r1 , #1 @ avoid using r7 directly after
str r7 , [ r0 , - r5 ] !
ldrb r7 , [ r6 , r1 ]
ldr r7 , [ l r , r7 , l s l #2 ]
mul r7 , r2 , r7
tst r1 , #7 @ avoid using r7 directly after
str r7 , [ r0 , - r5 ] !
subne r1 , r1 , #1
ldrneb r7 , [ r6 , r1 ]
bne L r o w4 b p p l p
2006-06-25 14:23:45 +04:00
ldmfd s p ! , { r4 - r7 , p c }
2005-04-17 02:20:36 +04:00
@
@ Smashable regs: {r0 - r3}, [r4], {r5 - r7}, (r8 - fp), [ip], (sp), {lr}, (pc)
@
Lrow8bpplp :
mov i p , r7 , l s r #4
ldr i p , [ l r , i p , l s l #2 ]
mul r4 , r2 , i p
and i p , r7 , #15 @ avoid r4
ldr i p , [ l r , i p , l s l #2 ] @ avoid r4
mul i p , r2 , i p @ avoid r4
sub r1 , r1 , #1 @ avoid ip
sub r0 , r0 , r5 @ avoid ip
stmia r0 , { r4 , i p }
ldrb r7 , [ r6 , r1 ]
mov i p , r7 , l s r #4
ldr i p , [ l r , i p , l s l #2 ]
mul r4 , r2 , i p
and i p , r7 , #15 @ avoid r4
ldr i p , [ l r , i p , l s l #2 ] @ avoid r4
mul i p , r2 , i p @ avoid r4
tst r1 , #7 @ avoid ip
sub r0 , r0 , r5 @ avoid ip
stmia r0 , { r4 , i p }
subne r1 , r1 , #1
ldrneb r7 , [ r6 , r1 ]
bne L r o w8 b p p l p
2006-06-25 14:23:45 +04:00
ldmfd s p ! , { r4 - r7 , p c }
2005-04-17 02:20:36 +04:00
@
@ Smashable regs: {r0 - r3}, [r4], {r5, r6}, [r7], (r8 - fp), [ip], (sp), [lr], (pc)
@
Lrow1bpp :
add r6 , r6 , r1
ldmia r6 , { r4 , r7 }
strb r4 , [ r0 ] , r5
mov r4 , r4 , l s r #8
strb r4 , [ r0 ] , r5
mov r4 , r4 , l s r #8
strb r4 , [ r0 ] , r5
mov r4 , r4 , l s r #8
strb r4 , [ r0 ] , r5
strb r7 , [ r0 ] , r5
mov r7 , r7 , l s r #8
strb r7 , [ r0 ] , r5
mov r7 , r7 , l s r #8
strb r7 , [ r0 ] , r5
mov r7 , r7 , l s r #8
strb r7 , [ r0 ] , r5
2006-06-25 14:23:45 +04:00
ldmfd s p ! , { r4 - r7 , p c }
2005-04-17 02:20:36 +04:00
.bss
ENTRY( c o n _ c h a r c o n v t a b l e )
.space 1024