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>
26 /* IO memory map services */
28 /* Map memory map IO space */
29 vm_offset_t
ml_io_map(
30 vm_offset_t phys_addr
,
33 return(io_map(phys_addr
,size
));
36 /* boot memory allocation */
37 vm_offset_t
ml_static_malloc(
40 return((vm_offset_t
)NULL
);
47 return phystokv(paddr
);
58 /* virtual to physical on wired pages */
59 vm_offset_t
ml_vtophys(
62 return kvtophys(vaddr
);
65 /* Interrupt handling */
67 /* Get Interrupts Enabled */
68 boolean_t
ml_get_interrupts_enabled(void)
72 __asm__
volatile("pushf; popl %0" : "=r" (flags
));
73 return (flags
& EFL_IF
) != 0;
76 /* Set Interrupts Enabled */
77 boolean_t
ml_set_interrupts_enabled(boolean_t enable
)
81 __asm__
volatile("pushf; popl %0" : "=r" (flags
));
84 __asm__
volatile("sti");
86 __asm__
volatile("cli");
88 return (flags
& EFL_IF
) != 0;
91 /* Check if running at interrupt context */
92 boolean_t
ml_at_interrupt_context(void)
94 return get_interrupt_level() != 0;
97 /* Generate a fake interrupt */
98 void ml_cause_interrupt(void)
100 panic("ml_cause_interrupt not defined yet on Intel");
103 /* Initialize Interrupts */
104 void ml_install_interrupt_handler(
108 IOInterruptHandler handler
,
111 boolean_t current_state
;
113 current_state
= ml_get_interrupts_enabled();
115 PE_install_interrupt_handler(nub
, source
, target
,
116 (IOInterruptHandler
) handler
, refCon
);
118 (void) ml_set_interrupts_enabled(current_state
);
123 processor_t processor
)
127 /* Stubs for pc tracing mechanism */
130 int pc_trace_cnt
= 0;