2008-02-08 04:19:31 -08:00
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
#
# 1 6 5 5 0 serial R x i n t e r r u p t h a n d l e r f o r g d b s t u b I / O
#
# Copyright ( C ) 2 0 0 7 R e d H a t , I n c . A l l R i g h t s R e s e r v e d .
# Written b y D a v i d H o w e l l s ( d h o w e l l s @redhat.com)
#
# 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 i t 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 c e
# as p u b l i s h e d 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 ; either version
# 2 of t h e L i c e n c e , o r ( a t y o u r o p t i o n ) a n y l a t e r v e r s i o n .
#
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# include < l i n u x / s y s . h >
# include < l i n u x / l i n k a g e . h >
# include < a s m / s m p . h >
# include < a s m / c p u - r e g s . h >
# include < a s m / t h r e a d _ i n f o . h >
# include < a s m / f r a m e . i n c >
# include < a s m / i n t c t l - r e g s . h >
2010-10-27 17:28:55 +01:00
# include < a s m / i r q f l a g s . h >
2009-04-10 14:33:48 +01:00
# include < u n i t / s e r i a l . h >
2008-02-08 04:19:31 -08:00
.text
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
#
# GDB s t u b s e r i a l r e c e i v e i n t e r r u p t e n t r y p o i n t
# - intended t o r u n a t i n t e r r u p t p r i o r i t y 0
#
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
.globl gdbstub_io_rx_handler
.type gdbstub_ i o _ r x _ h a n d l e r ,@function
gdbstub_io_rx_handler :
movm [ d2 ,d3 ,a2 ,a3 ] ,( s p )
# if 1
movbu ( G D B P O R T _ S E R I A L _ I I R ) ,d2
# endif
mov ( g d b s t u b _ r x _ i n p ) ,a3
gdbstub_io_rx_more :
mov a3 ,a2
add 2 ,a3
and 0 x00 0 0 0 f f f ,a3
mov ( g d b s t u b _ r x _ o u t p ) ,d3
cmp a3 ,d3
beq g d b s t u b _ i o _ r x _ o v e r f l o w
movbu ( G D B P O R T _ S E R I A L _ L S R ) ,d3
btst U A R T _ L S R _ D R ,d3
beq g d b s t u b _ i o _ r x _ d o n e
movbu ( G D B P O R T _ S E R I A L _ R X ) ,d2
movbu d3 ,( g d b s t u b _ r x _ b u f f e r + 1 ,a2 )
movbu d2 ,( g d b s t u b _ r x _ b u f f e r ,a2 )
mov a3 ,( g d b s t u b _ r x _ i n p )
bra g d b s t u b _ i o _ r x _ m o r e
gdbstub_io_rx_done :
mov G x I C R _ D E T E C T ,d2
movbu d2 ,( X I R Q x I C R ( G D B P O R T _ S E R I A L _ I R Q ) ) # A C K t h e i n t e r r u p t
movhu ( X I R Q x I C R ( G D B P O R T _ S E R I A L _ I R Q ) ) ,d2 # f l u s h
movm ( s p ) ,[ d2 ,d3 ,a2 ,a3 ]
bset 0 x01 ,( g d b s t u b _ b u s y )
beq g d b s t u b _ i o _ r x _ e n t e r
rti
gdbstub_io_rx_overflow :
bset 0 x01 ,( g d b s t u b _ r x _ o v e r f l o w )
bra g d b s t u b _ i o _ r x _ d o n e
gdbstub_io_rx_enter :
2010-10-27 17:28:55 +01:00
LOCAL_ C H A N G E _ I N T R _ M A S K _ L E V E L ( N U M 2 E P S W _ I M ( C O N F I G _ G D B S T U B _ I R Q _ L E V E L + 1 ) )
2008-02-08 04:19:31 -08:00
add - 4 ,s p
SAVE_ A L L
mov 0 x f f f f f f f f ,d0
mov d0 ,( R E G _ O R I G _ D 0 ,f p )
mov 0 x28 0 ,d1
mov f p ,d0
call g d b s t u b _ r x _ i r q [ ] ,0 # g d b s t u b _ r x _ i r q ( r e g s , e x c e p )
2010-10-27 17:28:55 +01:00
LOCAL_ C L I
2008-02-08 04:19:31 -08:00
bclr 0 x01 ,( g d b s t u b _ b u s y )
.globl gdbstub_return
gdbstub_return :
RESTORE_ A L L
.size gdbstub_ i o _ r x _ h a n d l e r ,. - g d b s t u b _ i o _ r x _ h a n d l e r