Home | History | Annotate | Line # | Download | only in isa
isa_irq.S revision 1.5
      1  1.5     matt /*	$NetBSD: isa_irq.S,v 1.5 2007/02/20 01:51:16 matt Exp $	*/
      2  1.1  thorpej 
      3  1.1  thorpej /*
      4  1.1  thorpej  * Copyright 1997
      5  1.1  thorpej  * Digital Equipment Corporation. All rights reserved.
      6  1.1  thorpej  *
      7  1.1  thorpej  * This software is furnished under license and may be used and
      8  1.1  thorpej  * copied only in accordance with the following terms and conditions.
      9  1.1  thorpej  * Subject to these conditions, you may download, copy, install,
     10  1.1  thorpej  * use, modify and distribute this software in source and/or binary
     11  1.1  thorpej  * form. No title or ownership is transferred hereby.
     12  1.1  thorpej  *
     13  1.1  thorpej  * 1) Any source code used, modified or distributed must reproduce
     14  1.1  thorpej  *    and retain this copyright notice and list of conditions as
     15  1.1  thorpej  *    they appear in the source file.
     16  1.1  thorpej  *
     17  1.1  thorpej  * 2) No right is granted to use any trade name, trademark, or logo of
     18  1.1  thorpej  *    Digital Equipment Corporation. Neither the "Digital Equipment
     19  1.1  thorpej  *    Corporation" name nor any trademark or logo of Digital Equipment
     20  1.1  thorpej  *    Corporation may be used to endorse or promote products derived
     21  1.1  thorpej  *    from this software without the prior written permission of
     22  1.1  thorpej  *    Digital Equipment Corporation.
     23  1.1  thorpej  *
     24  1.1  thorpej  * 3) This software is provided "AS-IS" and any express or implied
     25  1.1  thorpej  *    warranties, including but not limited to, any implied warranties
     26  1.1  thorpej  *    of merchantability, fitness for a particular purpose, or
     27  1.1  thorpej  *    non-infringement are disclaimed. In no event shall DIGITAL be
     28  1.1  thorpej  *    liable for any damages whatsoever, and in particular, DIGITAL
     29  1.1  thorpej  *    shall not be liable for special, indirect, consequential, or
     30  1.1  thorpej  *    incidental damages or damages for lost profits, loss of
     31  1.1  thorpej  *    revenue or loss of use, whether such damages arise in contract,
     32  1.1  thorpej  *    negligence, tort, under statute, in equity, at law or otherwise,
     33  1.1  thorpej  *    even if advised of the possibility of such damage.
     34  1.1  thorpej  */
     35  1.1  thorpej 
     36  1.1  thorpej /*
     37  1.1  thorpej  * Copyright (c) 1994-1998 Mark Brinicombe.
     38  1.1  thorpej  * Copyright (c) 1994 Brini.
     39  1.1  thorpej  * All rights reserved.
     40  1.1  thorpej  *
     41  1.1  thorpej  * This code is derived from software written for Brini by Mark Brinicombe
     42  1.1  thorpej  *
     43  1.1  thorpej  * Redistribution and use in source and binary forms, with or without
     44  1.1  thorpej  * modification, are permitted provided that the following conditions
     45  1.1  thorpej  * are met:
     46  1.1  thorpej  * 1. Redistributions of source code must retain the above copyright
     47  1.1  thorpej  *    notice, this list of conditions and the following disclaimer.
     48  1.1  thorpej  * 2. Redistributions in binary form must reproduce the above copyright
     49  1.1  thorpej  *    notice, this list of conditions and the following disclaimer in the
     50  1.1  thorpej  *    documentation and/or other materials provided with the distribution.
     51  1.1  thorpej  * 3. All advertising materials mentioning features or use of this software
     52  1.1  thorpej  *    must display the following acknowledgement:
     53  1.1  thorpej  *	This product includes software developed by Mark Brinicombe
     54  1.1  thorpej  *	for the NetBSD Project.
     55  1.1  thorpej  * 4. The name of the company nor the name of the author may be used to
     56  1.1  thorpej  *    endorse or promote products derived from this software without specific
     57  1.1  thorpej  *    prior written permission.
     58  1.1  thorpej  *
     59  1.1  thorpej  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     60  1.1  thorpej  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     61  1.1  thorpej  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     62  1.1  thorpej  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     63  1.1  thorpej  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     64  1.1  thorpej  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     65  1.1  thorpej  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     66  1.1  thorpej  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     67  1.1  thorpej  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     68  1.1  thorpej  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     69  1.1  thorpej  *
     70  1.1  thorpej  * 	from: irq.S
     71  1.1  thorpej  *
     72  1.1  thorpej  * Low level irq and fiq handlers
     73  1.1  thorpej  *
     74  1.1  thorpej  * Created      : 27/09/94
     75  1.1  thorpej  */
     76  1.1  thorpej 
     77  1.1  thorpej #include "opt_irqstats.h"
     78  1.1  thorpej 
     79  1.1  thorpej #include "assym.h"
     80  1.1  thorpej #include <machine/asm.h>
     81  1.1  thorpej #include <machine/cpu.h>
     82  1.1  thorpej #include <machine/frame.h>
     83  1.1  thorpej #include <dev/isa/isareg.h>
     84  1.1  thorpej #include <shark/isa/icu.h>
     85  1.1  thorpej #include <machine/irqhandler.h>
     86  1.1  thorpej 
     87  1.1  thorpej 	.text
     88  1.1  thorpej 	.align	0
     89  1.1  thorpej 
     90  1.1  thorpej /*
     91  1.1  thorpej  *
     92  1.1  thorpej  * irq_entry
     93  1.1  thorpej  *
     94  1.1  thorpej  * Main entry point for the IRQ vector
     95  1.1  thorpej  *
     96  1.1  thorpej  * This function reads the irq request bits in the IOMD registers
     97  1.1  thorpej  * IRQRQA, IRQRQB and DMARQ
     98  1.1  thorpej  * It then calls an installed handler for each bit that is set.
     99  1.1  thorpej  * The function stray_irqhandler is called if a handler is not defined
    100  1.1  thorpej  * for a particular interrupt.
    101  1.1  thorpej  * If a interrupt handler is found then it is called with r0 containing
    102  1.1  thorpej  * the argument defined in the handler structure. If the field ih_arg
    103  1.1  thorpej  * is zero then a pointer to the IRQ frame on the stack is passed instead.
    104  1.1  thorpej  */
    105  1.1  thorpej 
    106  1.1  thorpej Ldisabled_mask:
    107  1.1  thorpej 	.word	_C_LABEL(disabled_mask)
    108  1.1  thorpej 
    109  1.1  thorpej Lcurrent_spl_level:
    110  1.1  thorpej 	.word	_C_LABEL(current_spl_level)
    111  1.1  thorpej 
    112  1.1  thorpej Lcurrent_intr_depth:
    113  1.1  thorpej 	.word	_C_LABEL(current_intr_depth)
    114  1.1  thorpej 
    115  1.1  thorpej Lvam_io_data:
    116  1.1  thorpej 	.word	_C_LABEL(isa_io_bs_tag)
    117  1.1  thorpej 
    118  1.1  thorpej Lspl_masks:
    119  1.1  thorpej 	.word	_C_LABEL(spl_masks)
    120  1.1  thorpej 
    121  1.1  thorpej /*
    122  1.1  thorpej  * Register usage
    123  1.1  thorpej  *
    124  1.1  thorpej  *  r6  - Address of current handler
    125  1.1  thorpej  *  r7  - Pointer to handler pointer list
    126  1.1  thorpej  *  r8  - Current IRQ requests.
    127  1.1  thorpej  *  r9  - Used to count through possible IRQ bits.
    128  1.1  thorpej  *  r10 - Base address of IOMD
    129  1.1  thorpej  */
    130  1.1  thorpej 
    131  1.1  thorpej /* Some documentation is in isa_machdep.c */
    132  1.1  thorpej ASENTRY_NP(irq_entry)
    133  1.1  thorpej 	sub	lr, lr, #0x00000004	/* Adjust the lr */
    134  1.1  thorpej 
    135  1.1  thorpej 	PUSHFRAMEINSVC			/* Push an interrupt frame */
    136  1.3      scw 	ENABLE_ALIGNMENT_FAULTS
    137  1.1  thorpej 
    138  1.1  thorpej 	/* Load r8 with the ISA 8259 irqs */
    139  1.1  thorpej 	/* r8 <- irq's pending [15:0] */
    140  1.1  thorpej 
    141  1.1  thorpej 	/* address of 8259 #1 */
    142  1.1  thorpej 	ldr	r0, Lvam_io_data
    143  1.1  thorpej 	ldr	r0, [r0]
    144  1.1  thorpej 	ldrb	r8, [r0, #IO_ICU1]                /* ocw3 = irr */
    145  1.1  thorpej 
    146  1.1  thorpej 	/* clear the IRR bits that are currently masked. */
    147  1.1  thorpej 	ldr	r2, Li8259_mask
    148  1.1  thorpej 	ldr	r2, [r2]
    149  1.1  thorpej 	mvn	r2, r2                            /* disabled -> enabled */
    150  1.1  thorpej 
    151  1.1  thorpej 	/* address of 8259 #2 */
    152  1.1  thorpej 	tst	r2, #(1 << IRQ_SLAVE)             /* if slave is enabled */
    153  1.1  thorpej 	tstne	r8, #(1 << IRQ_SLAVE)             /* anything from slave? */
    154  1.1  thorpej 	ldrneb	r1, [r0, #IO_ICU2]                /* ocw3 = irr */
    155  1.1  thorpej 	orrne	r8, r8, r1, lsl #8
    156  1.1  thorpej 
    157  1.1  thorpej 	and	r8, r8, r2                        /* clear disabled */
    158  1.1  thorpej 
    159  1.1  thorpej 	/* clear IRQ 2, which is only used for slave 8259 */
    160  1.1  thorpej 	bic	r8, r8, #(1 << IRQ_SLAVE)
    161  1.1  thorpej 
    162  1.1  thorpej 	/*
    163  1.1  thorpej 	 * Note that we have entered the IRQ handler.
    164  1.1  thorpej 	 * We are in SVC mode so we cannot use the processor mode
    165  1.1  thorpej 	 * to determine if we are in an IRQ. Instead we will count the
    166  1.1  thorpej 	 * each time the interrupt handler is nested.
    167  1.1  thorpej 	 */
    168  1.1  thorpej 
    169  1.1  thorpej 	ldr	r0, Lcurrent_intr_depth
    170  1.1  thorpej 	ldr	r1, [r0]
    171  1.1  thorpej 	add	r1, r1, #1
    172  1.1  thorpej 	str	r1, [r0]
    173  1.1  thorpej 
    174  1.1  thorpej 	/* Block the current requested interrupts */
    175  1.1  thorpej 
    176  1.1  thorpej 	ldr	r1, Ldisabled_mask
    177  1.1  thorpej 	ldr	r0, [r1]
    178  1.1  thorpej 	stmfd	sp!, {r0}
    179  1.1  thorpej 	orr	r0, r0, r8
    180  1.1  thorpej 
    181  1.1  thorpej 	/*
    182  1.1  thorpej  	 * Need to block all interrupts at the IPL or lower for
    183  1.1  thorpej 	 * all asserted interrupts.
    184  1.1  thorpej 	 * This basically emulates hardware interrupt priority levels.
    185  1.1  thorpej 	 * Means we need to go through the interrupt mask and for
    186  1.1  thorpej 	 * every asserted interrupt we need to mask out all other
    187  1.1  thorpej 	 * interrupts at the same or lower IPL.
    188  1.1  thorpej 	 * If only we could wait until the main loop but we need to sort
    189  1.1  thorpej 	 * this out first so interrupts can be re-enabled.
    190  1.1  thorpej 	 *
    191  1.1  thorpej 	 * This would benefit from a special ffs type routine
    192  1.1  thorpej 	 */
    193  1.1  thorpej 
    194  1.1  thorpej 	mov	r9, #(_SPL_LEVELS - 1)
    195  1.1  thorpej 	ldr	r7, Lspl_masks
    196  1.1  thorpej 
    197  1.1  thorpej Lfind_highest_ipl:
    198  1.1  thorpej 	ldr	r2, [r7, r9, lsl #2]
    199  1.1  thorpej 	tst	r8, r2
    200  1.1  thorpej 	subeq	r9, r9, #1
    201  1.1  thorpej 	beq	Lfind_highest_ipl
    202  1.1  thorpej 
    203  1.1  thorpej 	/* r9 = SPL level of highest priority interrupt */
    204  1.1  thorpej 	add	r9, r9, #1
    205  1.1  thorpej 	ldr	r2, [r7, r9, lsl #2]
    206  1.1  thorpej 	mvn	r2, r2
    207  1.1  thorpej 	orr	r0, r0, r2
    208  1.1  thorpej 
    209  1.1  thorpej 	str	r0, [r1]
    210  1.1  thorpej 
    211  1.1  thorpej 	ldr	r0, Lcurrent_spl_level
    212  1.1  thorpej 	ldr	r1, [r0]
    213  1.1  thorpej 	str	r9, [r0]
    214  1.1  thorpej 	stmfd	sp!, {r1}
    215  1.1  thorpej 
    216  1.1  thorpej 	/* Update the IOMD irq masks */
    217  1.1  thorpej 	bl	_C_LABEL(irq_setmasks)
    218  1.1  thorpej 
    219  1.1  thorpej         mrs     r0, cpsr_all		/* Enable IRQ's */
    220  1.1  thorpej 	bic	r0, r0, #I32_bit
    221  1.1  thorpej 	msr	cpsr_all, r0
    222  1.1  thorpej 
    223  1.2    bjh21 	ldr	r7, Lirqhandlers
    224  1.1  thorpej         mov	r9, #0x00000001
    225  1.1  thorpej 
    226  1.1  thorpej irqloop:
    227  1.1  thorpej 	/* This would benefit from a special ffs type routine */
    228  1.1  thorpej 	tst	r8, r9			/* Is a bit set ? */
    229  1.1  thorpej 	beq	nextirq			/* No ? try next bit */
    230  1.1  thorpej 
    231  1.1  thorpej 	ldr	r6, [r7]		/* Get address of first handler structure */
    232  1.1  thorpej 
    233  1.1  thorpej 	teq	r6, #0x00000000		/* Do we have a handler */
    234  1.1  thorpej 	moveq	r0, r8			/* IRQ requests as arg 0 */
    235  1.1  thorpej 	beq	_C_LABEL(stray_irqhandler) /* call special handler */
    236  1.1  thorpej 
    237  1.1  thorpej 	ldr	r0, Lcnt
    238  1.1  thorpej 	ldr	r1, [r0, #(V_INTR)]
    239  1.1  thorpej 	add	r1, r1, #0x00000001
    240  1.1  thorpej 	str	r1, [r0, #(V_INTR)]
    241  1.1  thorpej 
    242  1.1  thorpej irqchainloop:
    243  1.1  thorpej 	ldr	r0, [r6, #(IH_ARG)]	/* Get argument pointer */
    244  1.1  thorpej 	teq	r0, #0x00000000		/* If arg is zero pass stack frame */
    245  1.1  thorpej 	addeq	r0, sp, #8		/* ... stack frame */
    246  1.5     matt 	add	r3, r6, #IH_EV_COUNT	/* get address of ih's ev_count */
    247  1.5     matt 	ldmia   r3, {r1-r2}		/* load ev_count */
    248  1.5     matt 	adds	r1, r1, #0x00000001	/* 64bit incr (lo) */
    249  1.5     matt         adc     r2, r2, #0x00000000	/* 64bit incr (hi) */
    250  1.5     matt 	stmia   r3, {r1-r2}		/* store ev_count */
    251  1.5     matt 
    252  1.2    bjh21 	mov	lr, pc			/* return address */
    253  1.1  thorpej 	ldr	pc, [r6, #(IH_FUNC)]	/* Call handler */
    254  1.1  thorpej 
    255  1.1  thorpej 	teq	r0, #0x00000001		/* Was the irq serviced ? */
    256  1.1  thorpej 	beq	irqdone
    257  1.1  thorpej 
    258  1.1  thorpej 	ldr	r6, [r6, #(IH_NEXT)]
    259  1.1  thorpej 	teq	r6, #0x00000000
    260  1.1  thorpej 	bne	irqchainloop
    261  1.1  thorpej 
    262  1.1  thorpej irqdone:
    263  1.1  thorpej nextirq:
    264  1.1  thorpej 	add	r7, r7, #0x00000004	/* update pointer to handlers */
    265  1.1  thorpej 	mov	r9, r9, lsl #1		/* move on to next bit */
    266  1.1  thorpej 	teq	r9, #(1 << 16)		/* done the last bit ? */
    267  1.1  thorpej 	bne	irqloop			/* no - loop back. */
    268  1.1  thorpej 
    269  1.1  thorpej 	ldmfd	sp!, {r2}
    270  1.1  thorpej 	ldr	r1, Lcurrent_spl_level
    271  1.1  thorpej 	str	r2, [r1]
    272  1.1  thorpej 
    273  1.1  thorpej 	/* Restore previous disabled mask */
    274  1.1  thorpej 	ldmfd	sp!, {r2}
    275  1.1  thorpej 	ldr	r1, Ldisabled_mask
    276  1.1  thorpej 	str	r2, [r1]
    277  1.1  thorpej 	bl	_C_LABEL(irq_setmasks)
    278  1.1  thorpej 
    279  1.1  thorpej 	bl	_C_LABEL(dosoftints)	/* Handle the soft interrupts */
    280  1.1  thorpej 
    281  1.1  thorpej 	/* Kill IRQ's in preparation for exit */
    282  1.1  thorpej         mrs     r0, cpsr_all
    283  1.1  thorpej         orr     r0, r0, #(I32_bit)
    284  1.1  thorpej         msr     cpsr_all, r0
    285  1.1  thorpej 
    286  1.1  thorpej 	/* Decrement the nest count */
    287  1.1  thorpej 	ldr	r0, Lcurrent_intr_depth
    288  1.1  thorpej 	ldr	r1, [r0]
    289  1.1  thorpej 	sub	r1, r1, #1
    290  1.1  thorpej 	str	r1, [r0]
    291  1.1  thorpej 
    292  1.3      scw 	DO_AST_AND_RESTORE_ALIGNMENT_FAULTS
    293  1.1  thorpej 	PULLFRAMEFROMSVCANDEXIT
    294  1.1  thorpej 
    295  1.1  thorpej 	/* NOT REACHED */
    296  1.1  thorpej 	b	. - 8
    297  1.1  thorpej 
    298  1.1  thorpej Lspl_mask:
    299  1.1  thorpej 	.word	_C_LABEL(spl_mask)	/* irq's allowed at current spl level */
    300  1.1  thorpej 
    301  1.1  thorpej Lcurrent_mask:
    302  1.1  thorpej 	.word	_C_LABEL(current_mask)	/* irq's that are usable */
    303  1.1  thorpej 
    304  1.3      scw AST_ALIGNMENT_FAULT_LOCALS
    305  1.3      scw 
    306  1.3      scw 
    307  1.1  thorpej ENTRY(irq_setmasks)
    308  1.1  thorpej 	/* Disable interrupts */
    309  1.1  thorpej 	mrs	r3, cpsr_all
    310  1.1  thorpej 	orr	r1, r3,  #(I32_bit)
    311  1.1  thorpej 	msr	cpsr_all, r1
    312  1.1  thorpej 
    313  1.1  thorpej 	/* Calculate interrupt mask */
    314  1.1  thorpej 	ldr	r1, Lcurrent_mask	/* All the enabled interrupts */
    315  1.1  thorpej 	ldrh	r1, [r1]		/* get hardware bits of mask */
    316  1.1  thorpej /*	.word	0xe0d110b0 */		/* hand-assembled ldrh r1, [r1] */
    317  1.1  thorpej 	ldr	r2, Lspl_mask		/* Block due to current spl level */
    318  1.1  thorpej 	ldr	r2, [r2]
    319  1.1  thorpej 	and	r1, r1, r2
    320  1.1  thorpej 	ldr	r2, Ldisabled_mask	/* Block due to active interrupts */
    321  1.1  thorpej 	ldr	r2, [r2]
    322  1.1  thorpej 	bic	r1, r1, r2
    323  1.1  thorpej 
    324  1.1  thorpej 	/* since 8259's are so slow to access, this code does everything
    325  1.1  thorpej 	   possible to avoid them */
    326  1.1  thorpej 
    327  1.1  thorpej 	/* get current mask: these are the bits */
    328  1.1  thorpej 	ldr	r0, Li8259_mask
    329  1.1  thorpej 	ldr	r2, [r0]
    330  1.1  thorpej 	/*       r2 = 0000.0000.0000.0000.ZZZZ.ZZZZ.ZZZZ.ZZZZ   */
    331  1.1  thorpej 
    332  1.1  thorpej 	/* see if there's anything enabled on 8259 #2 */
    333  1.1  thorpej 	tst	r1, #0xff00
    334  1.1  thorpej 
    335  1.1  thorpej 	biceq	r1, r1, #(1 << IRQ_SLAVE)  /* no, so disable it */
    336  1.1  thorpej 	orrne	r1, r1, #(1 << IRQ_SLAVE)  /* yes, so enable it */
    337  1.1  thorpej 	/* eq => r1 = 0000.0000.0000.0000.0000.0000.MMMM.M0MM
    338  1.1  thorpej            ne => r1 = 0000.0000.0000.0000.MMMM.MMMM.MMMM.M1MM   */
    339  1.1  thorpej 
    340  1.1  thorpej 	/* 8259 bit high => disable */
    341  1.1  thorpej 	mvn	r1, r1
    342  1.1  thorpej 	/* eq => r1 = 1111.1111.1111.1111.1111.1111.YYYY.Y1YY
    343  1.1  thorpej            ne => r1 = 1111.1111.1111.1111.YYYY.YYYY.YYYY.Y0YY
    344  1.1  thorpej            (for each bit position Y = !M)                       */
    345  1.1  thorpej 
    346  1.1  thorpej 	orreq	r1, r2, r1, lsl #16
    347  1.1  thorpej 	/* eq => r1 = 1111.1111.YYYY.Y1YY.ZZZZ.ZZZZ.ZZZZ.ZZZZ
    348  1.1  thorpej            ne => r1 = 1111.1111.1111.1111.YYYY.YYYY.YYYY.Y0YY   */
    349  1.1  thorpej 	orreq	r1, r1, #0x000000FF
    350  1.1  thorpej 	/* eq => r1 = 1111.1111.YYYY.Y1YY.ZZZZ.ZZZZ.1111.1111
    351  1.1  thorpej            ne => r1 = 1111.1111.1111.1111.YYYY.YYYY.YYYY.Y0YY   */
    352  1.1  thorpej 	and	r1, r1, r1, lsr #16
    353  1.1  thorpej 	/* eq => r1 = 0000.0000.0000.0000.ZZZZ.ZZZZ.YYYY.Y1YY
    354  1.1  thorpej            ne => r1 = 0000.0000.0000.0000.YYYY.YYYY.YYYY.Y0YY   */
    355  1.1  thorpej 
    356  1.1  thorpej 	/* if old = new, don't bother to set again.
    357  1.1  thorpej 	   fast path to exit, since 8259's are so slow anyway */
    358  1.1  thorpej 	eors	r2, r1, r2                /* which bits are different? */
    359  1.1  thorpej 	msreq	cpsr_all, r3              /* no bits are different, return */
    360  1.1  thorpej 	moveq	pc, lr
    361  1.1  thorpej 
    362  1.1  thorpej 	/* have to set at least one of the 8259's, store new mask */
    363  1.1  thorpej 	str	r1, [r0]
    364  1.1  thorpej 	ldr	r0, Lvam_io_data
    365  1.1  thorpej 	ldr	r0, [r0]
    366  1.1  thorpej 
    367  1.1  thorpej 	/* see if there's any change for 8259 #1 (master) */
    368  1.1  thorpej 	tst	r2, #0x00FF               /* bottom 8 bits different? */
    369  1.1  thorpej 	strneb	r1, [r0, #(IO_ICU1 + 1)]  /* icu1 / ocw1 */
    370  1.1  thorpej 
    371  1.1  thorpej 	/* anything for 8259 #2? */
    372  1.1  thorpej 	tst	r2, #0xFF00
    373  1.1  thorpej 	mov	r1, r1, lsr #8            /* next byte */
    374  1.1  thorpej 	strneb	r1, [r0, #(IO_ICU2 + 1)]  /* icu2 / ocw1 */
    375  1.1  thorpej 
    376  1.1  thorpej 	/* Restore old cpsr and exit */
    377  1.1  thorpej 	msr	cpsr_all, r3
    378  1.1  thorpej 	mov	pc, lr
    379  1.1  thorpej 
    380  1.1  thorpej Lcnt:
    381  1.1  thorpej 	.word	_C_LABEL(uvmexp)
    382  1.1  thorpej 
    383  1.1  thorpej Li8259_mask:
    384  1.1  thorpej 	.word	_C_LABEL(i8259_mask)
    385  1.1  thorpej 
    386  1.1  thorpej Lirqhandlers:
    387  1.1  thorpej 	.word	_C_LABEL(irqhandlers)	/* Pointer to array of irqhandlers */
    388