Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Message

Re: [lpc2000] Disabling interrupts from Thumb mode

2005-02-08 by 42Bastian Schick

>   .thumb   @ switch to thumb assembly mode
>
> disable_interrupt_thumb:
>     mov lr,pc
>     bx   disable_interrupt_arm @interworking jump
>
>   .arm  @ switch to ARM assembly mode
> disable_interrupt_arm:
>    mrs ...
>    orr ...
>     msr ...
>     bx lr   @ interworking return

This code does not work, you destroy lr !
This works:

@ int di();

	.thumb
di:
	bx	pc
	nop
	.arm
di_arm:
	mrs	r0,cpsr
	orr	r1,r0,#0xc0
	msr	cpsr_c,r1
	bx	lr
	.thumb	

@ void ei(int oldmask);
	.thumb
ei:
	bx	pc
	nop
	.arm
ei_arm:
	and	r0,r0,#0xc0		@ only modify F and I
	mrs	r1,cpsr
	bic	r1,r1,r0
	msr	cpsr_c,r1
	bx	lr

-- 
42Bastian Schick

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.