From c13c2b79cf89ae77278f4504a1760066513b18f8 Mon Sep 17 00:00:00 2001 From: jkim Date: Wed, 15 Feb 2012 23:33:22 +0000 Subject: Clean up RFLAG and CR3 register handling and nearby comments. For BSP, use spinlock_enter()/spinlock_exit() to save/restore RFLAGS. We know interrupt is disabled when returning from S3. For AP, we do not have to save/restore it because IRET will do it for us any way. Do not save CR3 locally because savectx() does it and BSP does not have to switch to kernel map for amd64. Change contigmalloc(9) flag while I am in the neighborhood. --- sys/amd64/amd64/mp_machdep.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'sys/amd64/amd64/mp_machdep.c') diff --git a/sys/amd64/amd64/mp_machdep.c b/sys/amd64/amd64/mp_machdep.c index da1812d..2c52fd1 100644 --- a/sys/amd64/amd64/mp_machdep.c +++ b/sys/amd64/amd64/mp_machdep.c @@ -1414,20 +1414,17 @@ cpustop_handler(void) void cpususpend_handler(void) { - register_t cr3, rf; u_int cpu; cpu = PCPU_GET(cpuid); - rf = intr_disable(); - cr3 = rcr3(); - if (savectx(susppcbs[cpu])) { ctx_fpusave(suspfpusave[cpu]); wbinvd(); CPU_SET_ATOMIC(cpu, &stopped_cpus); } else { pmap_init_pat(); + load_cr3(susppcbs[cpu]->pcb_cr3); PCPU_SET(switchtime, 0); PCPU_SET(switchticks, ticks); } @@ -1439,11 +1436,9 @@ cpususpend_handler(void) CPU_CLR_ATOMIC(cpu, &started_cpus); CPU_CLR_ATOMIC(cpu, &stopped_cpus); - /* Restore CR3 and enable interrupts */ - load_cr3(cr3); + /* Resume MCA and local APIC */ mca_resume(); lapic_setup(0); - intr_restore(rf); } /* -- cgit v1.1