2 * (c) 2009 Adam Lackorzynski <adam@os.inf.tu-dresden.de>,
3 * Frank Mehnert <fm3@os.inf.tu-dresden.de>
4 * economic rights: Technische Universität Dresden (Germany)
6 * This file is part of TUD:OS and distributed under the terms of the
7 * GNU General Public License 2.
8 * Please see the COPYING-GPL-2 file for details.
10 #include <l4/sys/compiler.h>
14 #define X86_CR0_PE 0x00000001
15 #define X86_CR0_WP 0x00010000
16 #define X86_CR0_PG 0x80000000
18 #define X86_CR4_PSE 0x00000010
20 #define MSR_MTRR_DEF_TYPE 0x000002ff
21 #define MTRR_ENABLE 0x00000800
24 .section ".jh.boot", "ax"
30 .section ".jh.startup", "ax"
39 ljmpl $INMATE_CS32,$_start
46 .quad 0x00cf9b000000ffff
47 .quad 0x00af9b000000ffff
48 .quad 0x00cf93000000ffff
51 .short gdt_ptr - loader_gdt - 1
52 .long loader_gdt + FSEGMENT_BASE
66 #ifdef REALMODE_LOADING
72 mov $loader_pdpt + FSEGMENT_BASE,%eax
75 mov $(X86_CR0_PG | X86_CR0_WP | X86_CR0_PE),%eax
78 movl $MSR_MTRR_DEF_TYPE,%ecx
96 pushl $0 /* No Xen start_info pointer */
101 /* initialize vector for exception 6 */
102 movl $trap6_entry,%eax
103 movw %ax, _idt_offset_low
105 movw %ax, _idt_offset_high
107 movw %ax, _idt_selector
109 /* load tiny interrupt descriptor table to catch exception 6 */
116 /* Show an error message and wait for keypress to reboot. */
124 * edx: value to print
125 * eax: location on screen
129 98: mov $numbers,%ebx
133 movzbl (%ebx,%ecx,1),%ecx
142 /* print out warning */
143 movl $trap6_warning, %esi
144 movl $(0xb8000 + (24*80*2)), %edi
147 1: /* read next character from string */
150 /* check for end-of-string */
154 /* Check for hex number */
158 mov (32 + 32)(%esp),%edx
165 4: /* check for newline */
172 /* move screen upwards 1 line */
173 movl $((24*80*2)/4), %ecx
174 movl $(0xb8000 + 1*80*2), %esi
178 /* clear last line of screen */
179 movl $((1*80*2)/4), %ecx
180 movl $0x07200720, %eax
186 /* jump to new line */
187 movl $(0xb8000 + (24*80*2)), %edi
190 2: /* print character */
194 3: /* wait for keypress */
201 /* empty keyboard buffer */
204 /* ignore PS/2 mouse events */
211 /* the warning text */
214 .ascii "Bootstrap: Invalid opcode at detected!\n"
215 .ascii "Be sure that you don't use any CPU optimization flags like\n"
216 .ascii " -march=i686\n"
217 .ascii "when compiling Bootstrap and the depending libraries.\n"
219 .asciz " Press any key to reboot..."
222 .ascii "0123456789abcdef"
224 /* MultiBoot header - see multiboot.h. */
227 #define MULTIBOOT_MEMORY_INFO 0x00000002
229 .long 0x1BADB002 /* magic */
230 .long MULTIBOOT_MEMORY_INFO /* flags: AOUT_KLUDGE */
231 .long 0 - 0x1BADB002 - MULTIBOOT_MEMORY_INFO
240 .word 0,0,0,0 /* trap 0 */
241 .word 0,0,0,0 /* trap 1 */
242 .word 0,0,0,0 /* trap 2 */
243 .word 0,0,0,0 /* trap 3 */
244 .word 0,0,0,0 /* trap 4 */
245 .word 0,0,0,0 /* trap 5 */
257 #ifdef REALMODE_LOADING