- Remove unused code for CR3 and CR4.

- Fix few style(9) nits while I am here.
This commit is contained in:
Jung-uk Kim 2012-06-13 22:53:56 +00:00
parent 620216725a
commit 6ad799103d
5 changed files with 15 additions and 23 deletions

View File

@ -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:

View File

@ -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

View File

@ -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);

View File

@ -142,7 +142,7 @@ clear_pcb_flags(struct pcb *pcb, const u_int flags)
void makectx(struct trapframe *, struct pcb *);
int savectx(struct pcb *) __returns_twice;
void resumectx(struct pcb *, register_t);
void resumectx(struct pcb *);
#endif

View File

@ -89,9 +89,11 @@ static void acpi_wakeup_cpus(struct acpi_softc *);
#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, int state)
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 *sc, int state, int sleep_result,
/* 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_softc *sc)
/* 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);