~ubuntu-branches/ubuntu/utopic/xen/utopic

« back to all changes in this revision

Viewing changes to stubdom/grub/boot-x86_32.S

  • Committer: Bazaar Package Importer
  • Author(s): Bastian Blank
  • Date: 2010-05-06 15:47:38 UTC
  • mto: (1.3.1) (15.1.1 sid) (4.1.1 experimental)
  • mto: This revision was merged to the branch mainline in revision 3.
  • Revision ID: james.westby@ubuntu.com-20100506154738-agoz0rlafrh1fnq7
Tags: upstream-4.0.0
ImportĀ upstreamĀ versionĀ 4.0.0

Show diffs side-by-side

added added

removed removed

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