📄 head.s
字号:
/* * head.S: VMXAssist runtime start off. * * Leendert van Doorn, leendert@watson.ibm.com * Copyright (c) 2005, International Business Machines Corporation. * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., 59 Temple * Place - Suite 330, Boston, MA 02111-1307 USA. */#include "vm86.h"#include "machine.h"/* * When a partition tries to mask off the CR0_PE bit a world * switch happens to the environment below. The magic indicates * that this is a valid context. */ jmp _start .align 8 .long VMXASSIST_MAGIC .long newctx /* new context */ .long oldctx /* old context *//* * This is the real start. Control was transfered to this point * with CR0_PE set and executing in some 32-bit segment. We call * main and setup our own environment. */ .globl _start .code32_start: cli /* save register parameters to C land */ /* clear bss */ cld xorb %al, %al movl $_bbss, %edi movl $_ebss, %ecx subl %edi, %ecx rep stosb movl %edx, booting_cpu movl %ebx, booting_vector /* make sure we are in a sane world */ clts /* setup my own stack */ movl $stack_top, %esp movl %esp, %ebp /* go ... */ call main jmp halt/* * Something bad happened, print invoking %eip and loop forever */ .align 4 .globl halthalt: push $halt_msg call printf cli jmp . .datahalt_msg: .asciz "Halt called from %%eip 0x%x\n"/* * Our stack */ .bss .align 8 .globl stack, stack_topstack: .skip STACK_SIZEstack_top:
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -