github.com/usbarmory/tamago@v0.0.0-20240508072735-8612bbe1e454/arm/irq.s (about)

     1  // ARM processor support
     2  // https://github.com/usbarmory/tamago
     3  //
     4  // Copyright (c) WithSecure Corporation
     5  // https://foundry.withsecure.com
     6  //
     7  // Use of this source code is governed by the license
     8  // that can be found in the LICENSE file.
     9  
    10  // func irq_enable(spsr bool)
    11  TEXT ·irq_enable(SB),$0
    12  	CMP	$1, R0
    13  	B.EQ	spsr
    14  
    15  	WORD	$0xf1080080 // cpsie i
    16  	RET
    17  spsr:
    18  	WORD	$0xe14f0000 // mrs r0, SPSR
    19  	BIC	$1<<7, R0   // unmask IRQs
    20  	WORD	$0xe169f000 // msr SPSR, r0
    21  	RET
    22  
    23  // func irq_disable(spsr bool)
    24  TEXT ·irq_disable(SB),$0
    25  	CMP	$1, R0
    26  	B.EQ	spsr
    27  
    28  	WORD	$0xf10c0080 // cpsid i
    29  	RET
    30  spsr:
    31  	WORD	$0xe14f0000 // mrs r0, SPSR
    32  	ORR	$1<<7, R0   // mask IRQs
    33  	WORD	$0xe169f000 // msr SPSR, r0
    34  	RET
    35  
    36  // func fiq_enable(spsr bool)
    37  TEXT ·fiq_enable(SB),$0
    38  	CMP	$1, R0
    39  	B.EQ	spsr
    40  
    41  	WORD	$0xf1080040 // cpsie f
    42  	RET
    43  spsr:
    44  	WORD	$0xe14f0000 // mrs r0, SPSR
    45  	BIC	$1<<6, R0   // unmask FIQs
    46  	WORD	$0xe169f000 // msr SPSR, r0
    47  	RET
    48  
    49  // func fiq_disable(spsr bool)
    50  TEXT ·fiq_disable(SB),$0
    51  	CMP	$1, R0
    52  	B.EQ	spsr
    53  
    54  	WORD	$0xf10c0040 // cpsid f
    55  	RET
    56  spsr:
    57  	WORD	$0xe14f0000 // mrs r0, SPSR
    58  	ORR	$1<<6, R0   // mask FIQs
    59  	WORD	$0xe169f000 // msr SPSR, r0
    60  	RET