2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License"). You may not use this file except in compliance with the
9 * License. Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
20 * @APPLE_LICENSE_HEADER_END@
22 #include <i386/machine_routines.h>
23 #include <i386/io_map_entries.h>
24 #include <kern/cpu_data.h>
25 #include <kern/thread_act.h>
27 /* IO memory map services */
29 /* Map memory map IO space */
30 vm_offset_t
ml_io_map(
31 vm_offset_t phys_addr
,
34 return(io_map(phys_addr
,size
));
37 /* boot memory allocation */
38 vm_offset_t
ml_static_malloc(
41 return((vm_offset_t
)NULL
);
48 return phystokv(paddr
);
59 /* virtual to physical on wired pages */
60 vm_offset_t
ml_vtophys(
63 return kvtophys(vaddr
);
66 /* Interrupt handling */
68 /* Get Interrupts Enabled */
69 boolean_t
ml_get_interrupts_enabled(void)
73 __asm__
volatile("pushf; popl %0" : "=r" (flags
));
74 return (flags
& EFL_IF
) != 0;
77 /* Set Interrupts Enabled */
78 boolean_t
ml_set_interrupts_enabled(boolean_t enable
)
82 __asm__
volatile("pushf; popl %0" : "=r" (flags
));
85 __asm__
volatile("sti");
87 __asm__
volatile("cli");
89 return (flags
& EFL_IF
) != 0;
92 /* Check if running at interrupt context */
93 boolean_t
ml_at_interrupt_context(void)
95 return get_interrupt_level() != 0;
98 /* Generate a fake interrupt */
99 void ml_cause_interrupt(void)
101 panic("ml_cause_interrupt not defined yet on Intel");
104 void ml_thread_policy(
107 unsigned policy_info
)
112 /* Initialize Interrupts */
113 void ml_install_interrupt_handler(
117 IOInterruptHandler handler
,
120 boolean_t current_state
;
122 current_state
= ml_get_interrupts_enabled();
124 PE_install_interrupt_handler(nub
, source
, target
,
125 (IOInterruptHandler
) handler
, refCon
);
127 (void) ml_set_interrupts_enabled(current_state
);
132 processor_t processor
)
136 /* Stubs for pc tracing mechanism */
139 int pc_trace_cnt
= 0;
163 return(current_act_fast());