#include <pexpert/device_tree.h>
#include <IOKit/IOPlatformExpert.h>
-#include <libkern/section_keywords.h>
#if KPC
#include <kern/kpc.h>
extern int mach_assert;
extern volatile uint32_t debug_enabled;
-SECURITY_READ_ONLY_LATE(unsigned int) debug_boot_arg;
void machine_conf(void);
{
int boot_arg;
-#if MACH_KDP
- if (PE_parse_boot_argn("debug", &debug_boot_arg, sizeof (debug_boot_arg)) &&
- debug_enabled) {
-#if DEVELOPMENT || DEBUG
- if (debug_boot_arg & DB_HALT)
- halt_in_debugger = 1;
-#endif
- if (debug_boot_arg & DB_NMI)
- panicDebugging = TRUE;
- } else {
- debug_boot_arg = 0;
- }
-#endif
-
PE_parse_boot_argn("assert", &mach_assert, sizeof (mach_assert));
if (PE_parse_boot_argn("preempt", &boot_arg, sizeof (boot_arg))) {
this_cpu_datap->cpu_id = in_processor_info->cpu_id;
- this_cpu_datap->cpu_chud = chudxnu_cpu_alloc(is_boot_cpu);
- if (this_cpu_datap->cpu_chud == (void *)NULL)
- goto processor_register_error;
this_cpu_datap->cpu_console_buf = console_cpu_alloc(is_boot_cpu);
if (this_cpu_datap->cpu_console_buf == (void *)(NULL))
goto processor_register_error;
#if KPC
kpc_unregister_cpu(this_cpu_datap);
#endif
- if (this_cpu_datap->cpu_chud != (void *)NULL)
- chudxnu_cpu_free(this_cpu_datap->cpu_chud);
if (!is_boot_cpu)
cpu_data_free(this_cpu_datap);
return KERN_FAILURE;
boolean_t
ml_at_interrupt_context(void)
{
- vm_offset_t stack_ptr;
- vm_offset_t intstack_top_ptr;
+ boolean_t at_interrupt_context = FALSE;
- __asm__ volatile("mov %0, sp\n":"=r"(stack_ptr));
- intstack_top_ptr = getCpuDatap()->intstack_top;
- return ((stack_ptr < intstack_top_ptr) && (stack_ptr > intstack_top_ptr - INTSTACK_SIZE));
+ disable_preemption();
+ at_interrupt_context = (getCpuDatap()->cpu_int_state != NULL);
+ enable_preemption();
+
+ return at_interrupt_context;
}
extern uint32_t cpu_idle_count;
ml_stack_remaining(void)
{
uintptr_t local = (uintptr_t) &local;
+ vm_offset_t intstack_top_ptr;
- if (ml_at_interrupt_context()) {
+ intstack_top_ptr = getCpuDatap()->intstack_top;
+ if ((local < intstack_top_ptr) && (local > intstack_top_ptr - INTSTACK_SIZE)) {
return (local - (getCpuDatap()->intstack_top - INTSTACK_SIZE));
} else {
return (local - current_thread()->kernel_stack);