static struct regs_td *current_regs_td(void)
{
- if (in_interrupt())
+ if (swap_in_interrupt())
return &__get_cpu_var(per_cpu_regs_td_i);
else if (switch_to_bits_get(current_kctx, SWITCH_TO_ALL))
return &__get_cpu_var(per_cpu_regs_td_st);
#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(4, 0, 0) */
}
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 0, 0)
+#define swap_in_interrupt() (in_interrupt() & ~HARDIRQ_OFFSET)
+#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(4, 0, 0) */
+
static inline unsigned long arch_get_task_pc(struct task_struct *p)
{
/* FIXME: Not implemented yet */
{
struct kctx *ctx = current_kctx;
- if (in_interrupt())
+ if (swap_in_interrupt())
return &__get_cpu_var(per_cpu_kpc_data_i);
else if (switch_to_bits_get(ctx, SWITCH_TO_ALL))
return &__get_cpu_var(per_cpu_kpc_data_st);
void switch_to_bits_reset(struct kctx *ctx, unsigned long mask);
unsigned long switch_to_bits_get(struct kctx *ctx, unsigned long mask);
+
+#ifndef swap_in_interrupt
+#define swap_in_interrupt() in_interrupt()
+#endif /* swap_in_interrupt */
+
static inline int able2resched(struct kctx *ctx)
{
- if (in_interrupt() || switch_to_bits_get(ctx, SWITCH_TO_ALL))
+ if (swap_in_interrupt() || switch_to_bits_get(ctx, SWITCH_TO_ALL))
return 0;
return 1;