#include <kern/processor.h>
boolean_t get_interrupts_enabled(void);
-extern boolean_t set_interrupts_enabled(boolean_t);
/* Map memory map IO space */
vm_offset_t
per_proc_info[current_cpu].interrupt_handler = handler;
per_proc_info[current_cpu].interrupt_refCon = refCon;
- per_proc_info[current_cpu].get_interrupts_enabled
- = get_interrupts_enabled;
- per_proc_info[current_cpu].set_interrupts_enabled
- = set_interrupts_enabled;
+ per_proc_info[current_cpu].interrupts_enabled = TRUE;
(void) ml_set_interrupts_enabled(current_state);
}
current_state = ml_get_interrupts_enabled();
current_cpu = cpu_number();
- per_proc_info[current_cpu].get_interrupts_enabled
- = get_interrupts_enabled;
- per_proc_info[current_cpu].set_interrupts_enabled
- = set_interrupts_enabled;
+ per_proc_info[current_cpu].interrupts_enabled = TRUE;
(void) ml_set_interrupts_enabled(current_state);
}
/* Get Interrupts Enabled */
boolean_t ml_get_interrupts_enabled(void)
{
- return(per_proc_info[cpu_number()].get_interrupts_enabled());
+ if (per_proc_info[cpu_number()].interrupts_enabled == TRUE)
+ return(get_interrupts_enabled());
+ else
+ return(fake_get_interrupts_enabled());
}
boolean_t get_interrupts_enabled(void)
return((mfmsr() & MASK(MSR_EE)) != 0);
}
-/* Set Interrupts Enabled */
-boolean_t ml_set_interrupts_enabled(boolean_t enable)
-{
- return(per_proc_info[cpu_number()].set_interrupts_enabled(enable));
-}
-
/* Check if running at interrupt context */
boolean_t ml_at_interrupt_context(void)
{
- /*
- * If running at interrupt context, the current thread won't be
- * dispatched on another cpu. There is no need to turn off preemption.
- */
- return (per_proc_info[cpu_number()].istackptr == 0);
+ boolean_t ret;
+ boolean_t current_state;
+
+ current_state = ml_set_interrupts_enabled(FALSE);
+ ret = (per_proc_info[cpu_number()].istackptr == 0);
+ ml_set_interrupts_enabled(current_state);
+ return(ret);
}
/* Generate a fake interrupt */
CreateFakeIO();
}
-void machine_clock_assist(void)
-{
- if (per_proc_info[cpu_number()].get_interrupts_enabled == fake_get_interrupts_enabled)
- CreateFakeDEC();
-}
-
void machine_idle(void)
{
- if (per_proc_info[cpu_number()].get_interrupts_enabled != fake_get_interrupts_enabled) {
+ if (per_proc_info[cpu_number()].interrupts_enabled == TRUE) {
int cur_decr;
machine_idle_ppc();
cause_ast_check(processor_t processor)
{
if ((processor != current_processor())
- && (per_proc_info[processor->slot_num].get_interrupts_enabled
- != fake_get_interrupts_enabled))
+ && (per_proc_info[processor->slot_num].interrupts_enabled == TRUE))
cpu_signal(processor->slot_num, SIGPast, NULL, NULL);
}
int mycpu = cpu_number();
return(per_proc_info[mycpu].cpu_flags & traceBE);
}
+