|
|
1.1 root 1: /*
2: * Copyright (C) 2006-2011 Free Software Foundation
3: *
4: * This program is free software ; you can redistribute it and/or modify
5: * it under the terms of the GNU General Public License as published by
6: * the Free Software Foundation ; either version 2 of the License, or
7: * (at your option) any later version.
8: *
9: * This program is distributed in the hope that it will be useful,
10: * but WITHOUT ANY WARRANTY ; without even the implied warranty of
11: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12: * GNU General Public License for more details.
13: *
14: * You should have received a copy of the GNU General Public License
15: * along with the program ; if not, write to the Free Software
16: * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17: */
18:
19: #include <xen/public/elfnote.h>
20:
21: .section __xen_guest
22: .ascii "GUEST_OS=GNU Mach"
23: .ascii ",GUEST_VERSION=1.3"
24: .ascii ",XEN_VER=xen-3.0"
25: .ascii ",VIRT_BASE=0xC0000000"
26: .ascii ",ELF_PADDR_OFFSET=0xC0000000"
27: .ascii ",HYPERCALL_PAGE=0x2"
28: #if PAE
29: .ascii ",PAE=yes[extended-cr3]"
30: #else
31: .ascii ",PAE=no"
32: #endif
33: .ascii ",LOADER=generic"
34: #ifdef MACH_PSEUDO_PHYS
35: .ascii ",FEATURES=pae_pgdir_above_4gb"
36: #else /* MACH_PSEUDO_PHYS */
37: .ascii ",FEATURES=!auto_translated_physmap"
38: #endif
39: #ifndef MACH_PV_PAGETABLES
40: .ascii "|!writable_page_tables"
41: #endif /* MACH_PV_PAGETABLES */
42: #ifndef MACH_PV_DESCRIPTORS
43: .ascii "|!writable_descriptor_tables"
44: #endif /* MACH_PV_DESCRIPTORS */
45: #ifndef MACH_RING1
46: .ascii "|!supervisor_mode_kernel"
47: #endif /* MACH_PV_DESCRIPTORS */
48: .byte 0
49:
50: /* Macro taken from linux/include/linux/elfnote.h */
51: #define ELFNOTE(name, type, desctype, descdata) \
52: .pushsection .note.name ; \
53: .align 4 ; \
54: .long 2f - 1f /* namesz */ ; \
55: .long 4f - 3f /* descsz */ ; \
56: .long type ; \
57: 1:.asciz "name" ; \
58: 2:.align 4 ; \
59: 3:desctype descdata ; \
60: 4:.align 4 ; \
61: .popsection ;
62:
63: ELFNOTE(Xen, XEN_ELFNOTE_GUEST_OS, .asciz, "GNU Mach")
64: ELFNOTE(Xen, XEN_ELFNOTE_GUEST_VERSION, .asciz, "1.3")
65: ELFNOTE(Xen, XEN_ELFNOTE_XEN_VERSION, .asciz, "xen-3.0")
66: ELFNOTE(Xen, XEN_ELFNOTE_VIRT_BASE, .long, _START)
67: ELFNOTE(Xen, XEN_ELFNOTE_PADDR_OFFSET, .long, _START)
68: ELFNOTE(Xen, XEN_ELFNOTE_ENTRY, .long, start)
69: ELFNOTE(Xen, XEN_ELFNOTE_HYPERCALL_PAGE, .long, hypcalls)
70: #if PAE
71: ELFNOTE(Xen, XEN_ELFNOTE_PAE_MODE, .asciz, "yes[extended-cr3]")
72: #else
73: ELFNOTE(Xen, XEN_ELFNOTE_PAE_MODE, .asciz, "no")
74: #endif
75: ELFNOTE(Xen, XEN_ELFNOTE_LOADER, .asciz, "generic")
76: ELFNOTE(Xen, XEN_ELFNOTE_FEATURES, .asciz, ""
77: #ifdef MACH_PSEUDO_PHYS
78: "pae_pgdir_above_4gb"
79: #else /* MACH_PSEUDO_PHYS */
80: "!auto_translated_physmap"
81: #endif
82: #ifndef MACH_PV_PAGETABLES
83: "|!writable_page_tables"
84: #endif /* MACH_PV_PAGETABLES */
85: #ifndef MACH_PV_DESCRIPTORS
86: "|!writable_descriptor_tables"
87: #endif /* MACH_PV_DESCRIPTORS */
88: #ifndef MACH_RING1
89: "|!supervisor_mode_kernel"
90: #endif /* MACH_RING1 */
91: )
92:
93: #include <mach/machine/asm.h>
94:
95: #include <i386/i386/i386asm.h>
96:
97: .text
98: .globl gdt, ldt
99: .globl start, _start, gdt
100: start:
101: _start:
102:
103: /* Switch to our own interrupt stack. */
104: movl $(_intstack+INTSTACK_SIZE),%eax
105: movl %eax,%esp
106:
107: /* Reset EFLAGS to a known state. */
108: pushl $0
109: popf
110:
111: /* Push the start_info pointer to be the second argument. */
112: subl $KERNELBASE,%esi
113: pushl %esi
114:
115: /* Fix ifunc entries */
116: movl $__rel_iplt_start,%esi
117: movl $__rel_iplt_end,%edi
118: iplt_cont:
119: cmpl %edi,%esi
120: jae iplt_done
121: movl (%esi),%ebx /* r_offset */
122: movb 4(%esi),%al /* info */
123: cmpb $42,%al /* IRELATIVE */
124: jnz iplt_next
125: call *(%ebx) /* call ifunc */
126: movl %eax,(%ebx) /* fixed address */
127: iplt_next:
128: addl $8,%esi
129: jmp iplt_cont
130: iplt_done:
131:
132: /* Jump into C code. */
133: call EXT(c_boot_entry)
134:
135: /* Those need to be aligned on page boundaries. */
136: .global hyp_shared_info, hypcalls
137:
138: .org (start + 0x1000)
139: hyp_shared_info:
140: .org hyp_shared_info + 0x1000
141:
142: /* Labels just for debuggers */
143: #define hypcall(name, n) \
144: .org hypcalls + n*32 ; \
145: .globl __hyp_##name ; \
146: __hyp_##name:
147:
148: hypcalls:
149: hypcall(set_trap_table, 0)
150: hypcall(mmu_update, 1)
151: hypcall(set_gdt, 2)
152: hypcall(stack_switch, 3)
153: hypcall(set_callbacks, 4)
154: hypcall(fpu_taskswitch, 5)
155: hypcall(sched_op_compat, 6)
156: hypcall(platform_op, 7)
157: hypcall(set_debugreg, 8)
158: hypcall(get_debugreg, 9)
159: hypcall(update_descriptor, 10)
160: hypcall(memory_op, 12)
161: hypcall(multicall, 13)
162: hypcall(update_va_mapping, 14)
163: hypcall(set_timer_op, 15)
164: hypcall(event_channel_op_compat, 16)
165: hypcall(xen_version, 17)
166: hypcall(console_io, 18)
167: hypcall(physdev_op_compat, 19)
168: hypcall(grant_table_op, 20)
169: hypcall(vm_assist, 21)
170: hypcall(update_va_mapping_otherdomain, 22)
171: hypcall(iret, 23)
172: hypcall(vcpu_op, 24)
173: hypcall(set_segment_base, 25)
174: hypcall(mmuext_op, 26)
175: hypcall(acm_op, 27)
176: hypcall(nmi_op, 28)
177: hypcall(sched_op, 29)
178: hypcall(callback_op, 30)
179: hypcall(xenoprof_op, 31)
180: hypcall(event_channel_op, 32)
181: hypcall(physdev_op, 33)
182: hypcall(hvm_op, 34)
183: hypcall(sysctl, 35)
184: hypcall(domctl, 36)
185: hypcall(kexec_op, 37)
186:
187: hypcall(arch_0, 48)
188: hypcall(arch_1, 49)
189: hypcall(arch_2, 50)
190: hypcall(arch_3, 51)
191: hypcall(arch_4, 52)
192: hypcall(arch_5, 53)
193: hypcall(arch_6, 54)
194: hypcall(arch_7, 55)
195:
196: .org hypcalls + 0x1000
197:
198: gdt:
199: .org gdt + 0x1000
200:
201: ldt:
202: .org ldt + 0x1000
203:
204: stack:
205: .long _intstack+INTSTACK_SIZE,0xe021
206: .comm _intstack,INTSTACK_SIZE
207:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.