diff options
Diffstat (limited to 'sys/arch')
-rw-r--r-- | sys/arch/amd64/amd64/locore.S | 20 | ||||
-rw-r--r-- | sys/arch/amd64/amd64/machdep.c | 9 | ||||
-rw-r--r-- | sys/arch/amd64/include/cpu.h | 5 |
3 files changed, 31 insertions, 3 deletions
diff --git a/sys/arch/amd64/amd64/locore.S b/sys/arch/amd64/amd64/locore.S index 694d16314ed..e185eb4e371 100644 --- a/sys/arch/amd64/amd64/locore.S +++ b/sys/arch/amd64/amd64/locore.S @@ -1,4 +1,4 @@ -/* $OpenBSD: locore.S,v 1.35 2009/05/28 09:05:33 art Exp $ */ +/* $OpenBSD: locore.S,v 1.36 2009/06/02 03:04:54 jordan Exp $ */ /* $NetBSD: locore.S,v 1.13 2004/03/25 18:33:17 drochner Exp $ */ /* @@ -789,13 +789,30 @@ switch_exited: ret ENTRY(cpu_idle_enter) + movq _C_LABEL(cpu_idle_enter_fcn),%rax + cmpq $0,%rax + je 1f + jmpq *%rax +1: ret ENTRY(cpu_idle_cycle) + movq _C_LABEL(cpu_idle_cycle_fcn),%rax + cmpq $0,%rax + je 1f + call *%rax + ret +1: + sti hlt ret ENTRY(cpu_idle_leave) + movq _C_LABEL(cpu_idle_leave_fcn),%rax + cmpq $0,%rax + je 1f + jmpq *%rax +1: ret .globl _C_LABEL(panic) @@ -1049,3 +1066,4 @@ ENTRY(acpi_release_global_lock) andl $1, %eax ret #endif + diff --git a/sys/arch/amd64/amd64/machdep.c b/sys/arch/amd64/amd64/machdep.c index 7b16c679bce..d8492b681a0 100644 --- a/sys/arch/amd64/amd64/machdep.c +++ b/sys/arch/amd64/amd64/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.91 2009/05/30 20:47:00 kettenis Exp $ */ +/* $OpenBSD: machdep.c,v 1.92 2009/06/02 03:04:54 jordan Exp $ */ /* $NetBSD: machdep.c,v 1.3 2003/05/07 22:58:18 fvdl Exp $ */ /*- @@ -148,6 +148,13 @@ extern int db_console; /* the following is used externally (sysctl_hw) */ char machine[] = MACHINE; +/* + * switchto vectors + */ +void (*cpu_idle_leave_fcn)(void) = NULL; +void (*cpu_idle_cycle_fcn)(void) = NULL; +void (*cpu_idle_enter_fcn)(void) = NULL; + /* the following is used externally for concurrent handlers */ int setperf_prio = 0; diff --git a/sys/arch/amd64/include/cpu.h b/sys/arch/amd64/include/cpu.h index 599cbf4449b..efd8ea21f50 100644 --- a/sys/arch/amd64/include/cpu.h +++ b/sys/arch/amd64/include/cpu.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu.h,v 1.44 2009/05/28 09:05:33 art Exp $ */ +/* $OpenBSD: cpu.h,v 1.45 2009/06/02 03:04:54 jordan Exp $ */ /* $NetBSD: cpu.h,v 1.1 2003/04/26 18:39:39 fvdl Exp $ */ /*- @@ -276,6 +276,9 @@ void x86_64_bufinit(void); void x86_64_init_pcb_tss_ldt(struct cpu_info *); void cpu_proc_fork(struct proc *, struct proc *); int amd64_pa_used(paddr_t); +extern void (*cpu_idle_enter_fcn)(void); +extern void (*cpu_idle_cycle_fcn)(void); +extern void (*cpu_idle_leave_fcn)(void); struct region_descriptor; void lgdt(struct region_descriptor *); |