int_handler PUSH {r4,lr} ;// Preserve EXC_RETURN (and SP align) LDR r0,=thread_exit ;// Thread LR must generate an exit LDR r1,=int_code ;// Thread PC is our real handler LDR r2,=0x01000000 ;// PSR for thread in Thumb-state PUSH {r0-r2} ;// Create LR, PC and PSR SUB sp,sp,#(5*4) ;// Allocate space for r0-r3 and r12 LDR r0,=0xFFFFFFF9 ;// Thread using MSP return BX r0 ;// Return to newly created threadsvc_handler ADD sp,sp,#(9*4) ;// Remove Thread and r4 from stack POP {pc} ;// Perform standard exception return thread_exit SVC 0 ;// Return to handler modeint_code ....boot_code LDR r1,=0xE000ED14 ;// CCR register address LDR r0,[r1] ORR r0,r0,#1 ;// Enable NONBASETHRDENA STR r0,[r1] ....