rev |
line source |
keir@17909
|
1 #include <os.h>
|
keir@17909
|
2 #include <arch_limits.h>
|
keir@17909
|
3 #include <xen/arch-x86_32.h>
|
keir@17909
|
4
|
keir@17909
|
5 /* For simplicity, we keep all of this into just one data page */
|
keir@17909
|
6 .data
|
keir@17909
|
7 .globl _boot_page
|
keir@17909
|
8 _boot_page:
|
keir@17909
|
9 .align __PAGE_SIZE
|
keir@17909
|
10
|
keir@17909
|
11 /*
|
keir@17909
|
12 * The following data is initialized from C code
|
keir@17909
|
13 */
|
keir@17909
|
14
|
keir@17909
|
15 /* Pte of this page */
|
keir@17909
|
16 .globl _boot_page_entry
|
keir@17909
|
17 _boot_page_entry:
|
keir@17909
|
18 _boot_page_entry_lo:
|
keir@17909
|
19 .long 0
|
keir@17909
|
20 _boot_page_entry_hi:
|
keir@17909
|
21 .long 0
|
keir@17909
|
22
|
keir@17909
|
23 /* mmuext_op structure */
|
keir@17909
|
24 /* Set new page directory */
|
keir@17909
|
25 _boot_mmuext:
|
keir@17909
|
26 /* Op # */
|
keir@17909
|
27 .long MMUEXT_NEW_BASEPTR
|
keir@17909
|
28
|
keir@17909
|
29 /* MFN of target page table directory */
|
keir@17909
|
30 .globl _boot_pdmfn
|
keir@17909
|
31 _boot_pdmfn:
|
keir@17909
|
32 .long 0
|
keir@17909
|
33
|
keir@17909
|
34 /* Unused */
|
keir@17909
|
35 .long 0
|
keir@17909
|
36
|
keir@17909
|
37 /* Unpin old page directory */
|
keir@17909
|
38 /* Op # */
|
keir@17909
|
39 .long MMUEXT_UNPIN_TABLE
|
keir@17909
|
40
|
keir@17909
|
41 /* MFN of old page table directory */
|
keir@17909
|
42 .globl _boot_oldpdmfn
|
keir@17909
|
43 _boot_oldpdmfn:
|
keir@17909
|
44 .long 0
|
keir@17909
|
45
|
keir@17909
|
46 /* Unused */
|
keir@17909
|
47 .long 0
|
keir@17909
|
48
|
keir@17909
|
49 /* Target stack address, also target virtual address of this page */
|
keir@17909
|
50 .globl _boot_stack
|
keir@17909
|
51 _boot_stack:
|
keir@17909
|
52 .long 0
|
keir@17909
|
53 .long __KERNEL_SS
|
keir@17909
|
54 .globl _boot_target
|
keir@17909
|
55 _boot_target:
|
keir@17909
|
56 .long 0
|
keir@17909
|
57
|
keir@17909
|
58 /* Target start info */
|
keir@17909
|
59 .globl _boot_start_info
|
keir@17909
|
60 _boot_start_info:
|
keir@17909
|
61 .long 0
|
keir@17909
|
62
|
keir@17909
|
63 /* Target start address */
|
keir@17909
|
64 .globl _boot_start
|
keir@17909
|
65 _boot_start:
|
keir@17909
|
66 .long 0
|
keir@17909
|
67
|
keir@17909
|
68 /*
|
keir@17909
|
69 * Boot target OS, does not return
|
keir@17909
|
70 */
|
keir@17909
|
71 .globl _boot
|
keir@17909
|
72 _boot:
|
keir@17909
|
73 /* Project ourselves at the target place. */
|
keir@17909
|
74 movl _boot_target, %ebx
|
keir@17909
|
75 movl %ebx, %ebp /* also keep it in ebp for relative addressing */
|
keir@17909
|
76 movl _boot_page_entry_lo, %ecx
|
keir@17909
|
77 movl _boot_page_entry_hi, %edx
|
keir@17909
|
78 movl $2, %esi /* UVMF_INVLPG */
|
keir@17909
|
79 movl $__HYPERVISOR_update_va_mapping, %eax
|
keir@17909
|
80 int $0x82
|
keir@17909
|
81 testl %eax, %eax
|
keir@17909
|
82 jz 0f
|
keir@17909
|
83 ud2
|
keir@17909
|
84
|
keir@17909
|
85 0:
|
keir@17909
|
86 /* Go there. */
|
keir@17909
|
87 movl $(0f - _boot_page), %eax
|
keir@17909
|
88 movl _boot_target, %ebx
|
keir@17909
|
89 addl %ebx, %eax
|
keir@17909
|
90 jmpl *%eax
|
keir@17909
|
91 0:
|
keir@17909
|
92
|
keir@17909
|
93 /* Load target page table and unpin old page table. */
|
keir@17909
|
94 /* We shouldn't have any problem since in the new page table our page is
|
keir@17909
|
95 mapped at the same place. */
|
keir@17909
|
96 leal (_boot_mmuext-_boot_page)(%ebp), %ebx
|
keir@17909
|
97 movl $2, %ecx
|
keir@17909
|
98 xorl %edx, %edx
|
keir@17909
|
99 movl $0x7FF0, %esi /* DOMID_SELF */
|
keir@17909
|
100 movl $__HYPERVISOR_mmuext_op, %eax
|
keir@17909
|
101 int $0x82
|
keir@17909
|
102 testl %eax, %eax
|
keir@17909
|
103 jns 0f
|
keir@17909
|
104 ud2
|
keir@17909
|
105
|
keir@17909
|
106 0:
|
keir@17909
|
107 /* Initialize registers. */
|
keir@17909
|
108 lss (_boot_stack-_boot_page)(%ebp), %esp
|
keir@17909
|
109 movl (_boot_start_info-_boot_page)(%ebp), %esi
|
keir@17909
|
110
|
keir@17909
|
111 /* Jump! */
|
keir@17909
|
112 jmpl *(_boot_start-_boot_page)(%ebp)
|