Changeset View
Changeset View
Standalone View
Standalone View
sys/amd64/acpica/acpi_wakecode.S
Show First 20 Lines • Show All 142 Lines • ▼ Show 20 Lines | wakeup_sw32: | ||||
*/ | */ | ||||
ALIGN_TEXT | ALIGN_TEXT | ||||
.code32 | .code32 | ||||
wakeup_32: | wakeup_32: | ||||
mov $bootdata32 - bootgdt, %eax | mov $bootdata32 - bootgdt, %eax | ||||
mov %ax, %ds | mov %ax, %ds | ||||
/* Turn on the PAE bit for when paging is enabled */ | /* | ||||
* Turn on the PAE and optionally LA57 bits for when paging | |||||
* is enabled. | |||||
alc: "Turn on the PAE bit and optionally the LA57 bit for ... is later enabled." | |||||
*/ | |||||
mov %cr4, %eax | mov %cr4, %eax | ||||
orl $CR4_PAE, %eax | orl $CR4_PAE, %eax | ||||
mov %eax, %cr4 | leal wakeup_pagetables - wakeup_start(%ebx), %ecx | ||||
movl (%ecx), %ecx | |||||
testl $0x1, %ecx | |||||
je 1f | |||||
orl $CR4_LA57, %eax | |||||
1: mov %eax, %cr4 | |||||
/* | /* | ||||
* Enable EFER.LME so that we get long mode when all the prereqs are | * Enable EFER.LME so that we get long mode when all the prereqs are | ||||
* in place. In this case, it turns on when CR0_PG is finally enabled. | * in place. In this case, it turns on when CR0_PG is finally enabled. | ||||
* Also it picks up a few other EFER bits that we'll use need we're | * Also it picks up a few other EFER bits that we'll use need we're | ||||
* here, like SYSCALL and NX enable. | * here, like SYSCALL and NX enable. | ||||
*/ | */ | ||||
movl $MSR_EFER, %ecx | movl $MSR_EFER, %ecx | ||||
movl wakeup_efer - wakeup_start(%ebx), %eax | movl wakeup_efer - wakeup_start(%ebx), %eax | ||||
movl wakeup_efer + 4 - wakeup_start(%ebx), %edx | movl wakeup_efer + 4 - wakeup_start(%ebx), %edx | ||||
wrmsr | wrmsr | ||||
/* | /* | ||||
* Point to the embedded page tables for startup. Note that this | * Point to the embedded page tables for startup. Note that this | ||||
* only gets accessed after we're actually in 64 bit mode, however | * only gets accessed after we're actually in 64 bit mode, however | ||||
* we can only set the bottom 32 bits of %cr3 in this state. This | * we can only set the bottom 32 bits of %cr3 in this state. This | ||||
* means we are required to use a temporary page table that is below | * means we are required to use a temporary page table that is below | ||||
* the 4GB limit. %ebx is still our relocation base. We could just | * the 4GB limit. %ebx is still our relocation base. We could just | ||||
* subtract 3 * PAGE_SIZE, but that would be too easy. | * subtract 3 * PAGE_SIZE, but that would be too easy. | ||||
*/ | */ | ||||
leal wakeup_pagetables - wakeup_start(%ebx), %eax | leal wakeup_pagetables - wakeup_start(%ebx), %eax | ||||
movl (%eax), %eax | movl (%eax), %eax | ||||
andl $~0x1, %eax | |||||
mov %eax, %cr3 | mov %eax, %cr3 | ||||
/* | /* | ||||
* Finally, switch to long bit mode by enabling paging. We have | * Finally, switch to long bit mode by enabling paging. We have | ||||
* to be very careful here because all the segmentation disappears | * to be very careful here because all the segmentation disappears | ||||
* out from underneath us. The spec says we can depend on the | * out from underneath us. The spec says we can depend on the | ||||
* subsequent pipelined branch to execute, but *only if* everything | * subsequent pipelined branch to execute, but *only if* everything | ||||
* is still identity mapped. If any mappings change, the pipeline | * is still identity mapped. If any mappings change, the pipeline | ||||
▲ Show 20 Lines • Show All 101 Lines • Show Last 20 Lines |
"Turn on the PAE bit and optionally the LA57 bit for ... is later enabled."