arch/x86/platform/olpc/xo1-wakeup.S

Source file repositories/reference/linux-study-clean/arch/x86/platform/olpc/xo1-wakeup.S

File Facts

System
Linux kernel
Corpus path
arch/x86/platform/olpc/xo1-wakeup.S
Extension
.S
Size
2250 bytes
Lines
127
Domain
Architecture Layer
Bucket
arch/x86
Inferred role
Architecture Layer: arch/x86
Status
atlas-only

Why This File Exists

CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.

Dependency Surface

Detected Declarations

Annotated Snippet

.text
#include <linux/linkage.h>
#include <asm/segment.h>
#include <asm/page.h>
#include <asm/pgtable_32.h>

	.macro writepost,value
		movb $0x34, %al
		outb %al, $0x70
		movb $\value, %al
		outb %al, $0x71
	.endm

wakeup_start:
	# OFW lands us here, running in protected mode, with a
	# kernel-compatible GDT already setup.

	# Clear any dangerous flags
	pushl $0
	popfl

	writepost 0x31

	# Set up %cr3
	movl $initial_page_table - __PAGE_OFFSET, %eax
	movl %eax, %cr3

	movl saved_cr4, %eax
	movl %eax, %cr4

	movl saved_cr0, %eax
	movl %eax, %cr0

	# Control registers were modified, pipeline resync is needed
	jmp 1f
1:

	movw    $__KERNEL_DS, %ax
	movw    %ax, %ss
	movw    %ax, %ds
	movw    %ax, %es
	movw    %ax, %fs
	movw    %ax, %gs

	lgdt    saved_gdt
	lidt    saved_idt
	lldt    saved_ldt
	ljmp    $(__KERNEL_CS),$1f
1:
	movl    %cr3, %eax
	movl    %eax, %cr3
	wbinvd

	# Go back to the return point
	jmp ret_point

save_registers:
	sgdt  saved_gdt
	sidt  saved_idt
	sldt  saved_ldt

	pushl %edx
	movl %cr4, %edx
	movl %edx, saved_cr4

	movl %cr0, %edx
	movl %edx, saved_cr0

	popl %edx

Annotation

Implementation Notes