]> rtime.felk.cvut.cz Git - jailhouse.git/blob - inmates/header-32.S
x86: Handle more SIB cases in MMIO instruction parser
[jailhouse.git] / inmates / header-32.S
1 /*
2  * Jailhouse, a Linux-based partitioning hypervisor
3  *
4  * Copyright (c) Siemens AG, 2014
5  *
6  * Authors:
7  *  Jan Kiszka <jan.kiszka@siemens.com>
8  *
9  * This work is licensed under the terms of the GNU GPL, version 2.  See
10  * the COPYING file in the top-level directory.
11  */
12
13 #include <inmate.h>
14
15 #define X86_CR0_PE      0x00000001
16 #define X86_CR0_WP      0x00010000
17 #define X86_CR0_PG      0x80000000
18
19 #define X86_CR4_PSE     0x00000010
20
21         .code16gcc
22         .section ".boot", "ax"
23
24         ljmp $0xf000,$start16
25
26
27         .section ".startup", "ax"
28
29 start16:
30         cs,lgdtl gdt_ptr
31
32         mov %cr0,%eax
33         or $X86_CR0_PE,%al
34         mov %eax,%cr0
35
36         ljmpl $INMATE_CS32,$start32 + FSEGMENT_BASE
37
38
39         .code32
40 start32:
41         mov %cr4,%eax
42         or $X86_CR4_PSE,%eax
43         mov %eax,%cr4
44
45         mov $loader_pdpt + FSEGMENT_BASE,%eax
46         mov %eax,%cr3
47
48         mov $(X86_CR0_PG | X86_CR0_WP | X86_CR0_PE),%eax
49         mov %eax,%cr0
50
51         mov $stack_top,%esp
52
53         mov $INMATE_DS32,%eax
54         mov %eax,%ds
55         mov %eax,%es
56         mov %eax,%ss
57
58         xor %eax,%eax
59         mov $bss_start,%edi
60         mov $bss_dwords,%ecx
61         rep stosl
62
63         mov $inmate_main,%eax
64         jmp *%eax
65
66
67         .align(16)
68         .global loader_gdt
69 loader_gdt:
70         .quad   0
71         .quad   0x00cf9b000000ffff
72         .quad   0x00af9b000000ffff
73         .quad   0x00cf93000000ffff
74
75 gdt_ptr:
76         .short  gdt_ptr - loader_gdt - 1
77         .long   loader_gdt + FSEGMENT_BASE
78
79         .align(4096)
80         .global loader_pdpt
81 loader_pdpt:
82         .long   0x00000083