littlekernel / lk

LK embedded kernel
MIT License
3.11k stars 611 forks source link

arch_in_int_handler not working on multicore ARCH #368

Open uandkiran opened 1 year ago

uandkiran commented 1 year ago

on multicore processor, arch_in_int_handler call on CoreX returns 1, when interrupt hanlder is actually active on CoreY. Sol: __arm_in_handler needs to be percore variable rather than single variable shared across core(s)

static inline bool arch_in_int_handler(void) {

if ARM_ISA_ARMV7M

uint32_t ipsr;
__asm volatile ("MRS %0, ipsr" : "=r" (ipsr) );
return (ipsr & IPSR_ISR_Msk);

else

/* set by the interrupt glue to track that the cpu is inside a handler */
extern bool __arm_in_handler;

return __arm_in_handler;

endif

}

travisg commented 1 year ago

This is very true. Need to add a per cpu structure and put the bool there, if necessary.