Palacios Public Git Repository

To checkout Palacios execute

  git clone http://v3vee.org/palacios/palacios.web/palacios.git
This will give you the master branch. You probably want the devel branch or one of the release branches. To switch to the devel branch, simply execute
  cd palacios
  git checkout --track -b devel origin/devel
The other branches are similar.


Modified boot and vmxassist to handle real/protected transition.
[palacios.git] / bios / vmxassist / head.S
1 /*
2  * head.S: VMXAssist runtime start off.
3  *
4  * Leendert van Doorn, leendert@watson.ibm.com
5  * Copyright (c) 2005, International Business Machines Corporation.
6  *
7  * This program is free software; you can redistribute it and/or modify it
8  * under the terms and conditions of the GNU General Public License,
9  * version 2, as published by the Free Software Foundation.
10  *
11  * This program is distributed in the hope it will be useful, but WITHOUT
12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
14  * more details.
15  *
16  * You should have received a copy of the GNU General Public License along with
17  * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
18  * Place - Suite 330, Boston, MA 02111-1307 USA.
19  */
20 #include "vm86.h"
21 #include "machine.h"
22
23 /*
24  * When a partition tries to mask off the CR0_PE bit a world
25  * switch happens to the environment below. The magic indicates
26  * that this is a valid context.
27  */
28         jmp     _start
29
30         .align  8
31         .long   VMXASSIST_MAGIC
32         .long   newctx                  /* new context */
33         .long   oldctx                  /* old context */
34
35 /*
36  * This is the real start. Control was transfered to this point
37  * with CR0_PE set and executing in some 32-bit segment. We call
38  * main and setup our own environment.
39  */
40         .globl  _start
41         .code32
42 _start:
43         cli
44
45         /* save register parameters to C land */
46
47         /* clear bss */
48         cld
49         xorb    %al, %al
50         movl    $_bbss, %edi
51         movl    $_ebss, %ecx
52         subl    %edi, %ecx
53         rep     stosb
54
55         movl    %edx, booting_cpu
56         movl    %ebx, booting_vector
57
58         /* make sure we are in a sane world */
59         clts
60
61         /* setup my own stack */
62         movl    $stack_top, %esp
63         movl    %esp, %ebp
64
65         /* go ... */
66         call    main
67         jmp     halt
68
69 /*
70  * Something bad happened, print invoking %eip and loop forever
71  */
72         .align  4
73         .globl  halt
74 halt:
75         push    $halt_msg
76         call    printf
77         cli
78         jmp     .
79
80         .data
81 halt_msg:
82         .asciz  "Halt called from %%eip 0x%x\n"
83
84
85 /*
86  * Our stack
87  */
88         .bss
89         .align  8
90         .globl  stack, stack_top
91 stack:
92         .skip   STACK_SIZE
93 stack_top:
94