⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 smp_trampoline.s

📁 newos is new operation system
💻 S
字号:
/* ** Copyright 2001, Travis Geiselbrecht. All rights reserved.** Distributed under the terms of the NewOS License.*/// expects a stack page like this:// (stack has to be at (0x9e000)//	0x9effc            : final esp//  0x9eff8            : page dir////  0x9e000 - 0x9e006  : gdt descriptor//	0x9e008 - 0x9e020  : gdt//// smp_trampoline must be located at 0x9f000.globl smp_trampoline.globl smp_trampoline_end.globl foo.code16smp_trampoline:	cli		mov    $0x9e00,%ax	mov    %ax,%ds//	lgdt   0x9e000          # load the gdt.byte 0x66, 0x0f, 0x01, 0x15, 0x00, 0xe0, 0x09, 0x00	movl   %cr0,%eax	orl    $0x01,%eax	movl   %eax,%cr0              # switch into protected mode.code32_trampoline_32:	.byte 0x66	ljmp   $0x08,$(trampoline_32 - smp_trampoline + 0x9f000)trampoline_32:	mov    $0x10, %ax	mov    %ax, %ds	mov    %ax, %es	mov    %ax, %fs	mov    %ax, %gs	mov    %ax, %ss	movl   $0x9eff8,%esp    # set up the stack pointer	popl   %eax             # get the page dir	movl   %eax,%cr3        # set the page dir		popl   %eax             # get the final stack location	movl   %eax,%esp	// load an address for an indirect jump	movl   $trampoline_after_paging,%ecx	movl   %cr0,%eax	orl    $0x80000000,%eax	movl   %eax,%cr0          # enable paging	// jump to the address previously loaded. NOTE:	// this address is the address at which the code is originally linked,	// which is > 1MB. We will be out of the low memory at this point.	jmp    *%ecxtrampoline_after_paging:	// just return, the bsp would have set the return address to the	// target function at the top of the passed stack	retsmp_trampoline_end:

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -