From owner-svn-src-all@FreeBSD.ORG Wed Jun 13 22:53:57 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (unknown [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 250DF106564A; Wed, 13 Jun 2012 22:53:57 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 0F6998FC08; Wed, 13 Jun 2012 22:53:57 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5DMru15054120; Wed, 13 Jun 2012 22:53:56 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5DMruKD054114; Wed, 13 Jun 2012 22:53:56 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201206132253.q5DMruKD054114@svn.freebsd.org> From: Jung-uk Kim Date: Wed, 13 Jun 2012 22:53:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237037 - in head/sys: amd64/acpica amd64/amd64 amd64/include x86/acpica X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jun 2012 22:53:57 -0000 Author: jkim Date: Wed Jun 13 22:53:56 2012 New Revision: 237037 URL: http://svn.freebsd.org/changeset/base/237037 Log: - Remove unused code for CR3 and CR4. - Fix few style(9) nits while I am here. Modified: head/sys/amd64/acpica/acpi_wakecode.S head/sys/amd64/amd64/cpu_switch.S head/sys/amd64/amd64/mp_machdep.c head/sys/amd64/include/pcb.h head/sys/x86/acpica/acpi_wakeup.c Modified: head/sys/amd64/acpica/acpi_wakecode.S ============================================================================== --- head/sys/amd64/acpica/acpi_wakecode.S Wed Jun 13 22:12:10 2012 (r237036) +++ head/sys/amd64/acpica/acpi_wakecode.S Wed Jun 13 22:53:56 2012 (r237037) @@ -220,7 +220,6 @@ wakeup_64: mov %ax, %ds /* Restore arguments. */ - movq wakeup_cr3 - wakeup_start(%rbx), %rsi movq wakeup_pcb - wakeup_start(%rbx), %rdi movq wakeup_ret - wakeup_start(%rbx), %rax @@ -273,10 +272,6 @@ bootgdtdesc: .long bootgdt - wakeup_start /* Offset plus %ds << 4 */ ALIGN_DATA -wakeup_cr4: /* not used */ - .quad 0 -wakeup_cr3: - .quad 0 wakeup_pcb: .quad 0 wakeup_ret: Modified: head/sys/amd64/amd64/cpu_switch.S ============================================================================== --- head/sys/amd64/amd64/cpu_switch.S Wed Jun 13 22:12:10 2012 (r237036) +++ head/sys/amd64/amd64/cpu_switch.S Wed Jun 13 22:53:56 2012 (r237037) @@ -394,12 +394,13 @@ ENTRY(savectx) END(savectx) /* - * resumectx(pcb, cr3) + * resumectx(pcb) * Resuming processor state from pcb. */ ENTRY(resumectx) /* Switch to KPML4phys. */ - movq %rsi,%cr3 + movq KPML4phys,%rax + movq %rax,%cr3 /* Force kernel segment registers. */ movl $KDSEL,%eax Modified: head/sys/amd64/amd64/mp_machdep.c ============================================================================== --- head/sys/amd64/amd64/mp_machdep.c Wed Jun 13 22:12:10 2012 (r237036) +++ head/sys/amd64/amd64/mp_machdep.c Wed Jun 13 22:53:56 2012 (r237037) @@ -1429,9 +1429,6 @@ cpususpend_handler(void) CPU_SET_ATOMIC(cpu, &suspended_cpus); } else { pmap_init_pat(); -#if 0 - load_cr3(susppcbs[cpu]->pcb_cr3); -#endif initializecpu(); PCPU_SET(switchtime, 0); PCPU_SET(switchticks, ticks); Modified: head/sys/amd64/include/pcb.h ============================================================================== --- head/sys/amd64/include/pcb.h Wed Jun 13 22:12:10 2012 (r237036) +++ head/sys/amd64/include/pcb.h Wed Jun 13 22:53:56 2012 (r237037) @@ -142,7 +142,7 @@ clear_pcb_flags(struct pcb *pcb, const u void makectx(struct trapframe *, struct pcb *); int savectx(struct pcb *) __returns_twice; -void resumectx(struct pcb *, register_t); +void resumectx(struct pcb *); #endif Modified: head/sys/x86/acpica/acpi_wakeup.c ============================================================================== --- head/sys/x86/acpica/acpi_wakeup.c Wed Jun 13 22:12:10 2012 (r237036) +++ head/sys/x86/acpica/acpi_wakeup.c Wed Jun 13 22:53:56 2012 (r237037) @@ -89,9 +89,11 @@ static void acpi_wakeup_cpus(struct acp #define ACPI_PAGETABLES 0 #endif -#define WAKECODE_VADDR(sc) ((sc)->acpi_wakeaddr + (ACPI_PAGETABLES * PAGE_SIZE)) -#define WAKECODE_PADDR(sc) ((sc)->acpi_wakephys + (ACPI_PAGETABLES * PAGE_SIZE)) -#define WAKECODE_FIXUP(offset, type, val) do { \ +#define WAKECODE_VADDR(sc) \ + ((sc)->acpi_wakeaddr + (ACPI_PAGETABLES * PAGE_SIZE)) +#define WAKECODE_PADDR(sc) \ + ((sc)->acpi_wakephys + (ACPI_PAGETABLES * PAGE_SIZE)) +#define WAKECODE_FIXUP(offset, type, val) do { \ type *addr; \ addr = (type *)(WAKECODE_VADDR(sc) + offset); \ *addr = val; \ @@ -210,7 +212,9 @@ acpi_sleep_machdep(struct acpi_softc *sc WAKECODE_FIXUP(resume_beep, uint8_t, (acpi_resume_beep != 0)); WAKECODE_FIXUP(reset_video, uint8_t, (acpi_reset_video != 0)); +#ifndef __amd64__ WAKECODE_FIXUP(wakeup_cr4, register_t, susppcbs[0]->pcb_cr4); +#endif WAKECODE_FIXUP(wakeup_pcb, struct pcb *, susppcbs[0]); WAKECODE_FIXUP(wakeup_gdt, uint16_t, susppcbs[0]->pcb_gdt.rd_limit); @@ -248,9 +252,6 @@ acpi_wakeup_machdep(struct acpi_softc *s /* Wakeup MD procedures in interrupt disabled context */ if (sleep_result == 1) { pmap_init_pat(); -#if 0 - load_cr3(susppcbs[0]->pcb_cr3); -#endif initializecpu(); PCPU_SET(switchtime, 0); PCPU_SET(switchticks, ticks); @@ -300,7 +301,8 @@ acpi_alloc_wakeup_handler(void) if (EVENTHANDLER_REGISTER(power_resume, acpi_stop_beep, NULL, EVENTHANDLER_PRI_LAST) == NULL) { printf("%s: can't register event handler\n", __func__); - contigfree(wakeaddr, (ACPI_PAGETABLES + 1) * PAGE_SIZE, M_DEVBUF); + contigfree(wakeaddr, (ACPI_PAGETABLES + 1) * PAGE_SIZE, + M_DEVBUF); return (NULL); } susppcbs = malloc(mp_ncpus * sizeof(*susppcbs), M_DEVBUF, M_WAITOK); @@ -348,17 +350,14 @@ acpi_install_wakeup_handler(struct acpi_ /* Save pointers to some global data. */ WAKECODE_FIXUP(wakeup_ret, void *, resumectx); -#ifdef __amd64__ - WAKECODE_FIXUP(wakeup_cr3, uint64_t, KPML4phys); -#else +#ifndef __amd64__ #ifdef PAE WAKECODE_FIXUP(wakeup_cr3, register_t, vtophys(kernel_pmap->pm_pdpt)); #else WAKECODE_FIXUP(wakeup_cr3, register_t, vtophys(kernel_pmap->pm_pdir)); #endif -#endif -#ifdef __amd64__ +#else /* Build temporary page tables below realmode code. */ pt4 = wakeaddr; pt3 = pt4 + (PAGE_SIZE) / sizeof(uint64_t);