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>
13 #define X86_CR0_PE 0x00000001
16 .section ".jh.boot", "ax"
22 .section ".jh.startup", "ax"
31 ljmpl $INMATE_CS32,$_start
37 .quad 0x00cf9b000000ffff
38 .quad 0x00af9b000000ffff
39 .quad 0x00cf93000000ffff
42 .short gdt_ptr - loader_gdt - 1
43 .long loader_gdt + FSEGMENT_BASE
57 #ifdef REALMODE_LOADING
71 pushl %esi /* Pointer to real mode or Xen start_info pointer */
76 /* initialize vector for exception 6 */
77 movl $trap6_entry,%eax
78 movw %ax, _idt_offset_low
80 movw %ax, _idt_offset_high
82 movw %ax, _idt_selector
84 /* load tiny interrupt descriptor table to catch exception 6 */
91 /* Show an error message and wait for keypress to reboot. */
100 * eax: location on screen
104 98: mov $numbers,%ebx
108 movzbl (%ebx,%ecx,1),%ecx
117 /* print out warning */
118 movl $trap6_warning, %esi
119 movl $(0xb8000 + (24*80*2)), %edi
122 1: /* read next character from string */
125 /* check for end-of-string */
129 /* Check for hex number */
133 mov (32 + 32)(%esp),%edx
140 4: /* check for newline */
147 /* move screen upwards 1 line */
148 movl $((24*80*2)/4), %ecx
149 movl $(0xb8000 + 1*80*2), %esi
153 /* clear last line of screen */
154 movl $((1*80*2)/4), %ecx
155 movl $0x07200720, %eax
161 /* jump to new line */
162 movl $(0xb8000 + (24*80*2)), %edi
165 2: /* print character */
169 3: /* wait for keypress */
176 /* empty keyboard buffer */
179 /* ignore PS/2 mouse events */
186 /* the warning text */
189 .ascii "Bootstrap: Invalid opcode at detected!\n"
190 .ascii "Be sure that you don't use any CPU optimization flags like\n"
191 .ascii " -march=i686\n"
192 .ascii "when compiling Bootstrap and the depending libraries.\n"
194 .asciz " Press any key to reboot..."
197 .ascii "0123456789abcdef"
199 /* MultiBoot header - see multiboot.h. */
202 #define MULTIBOOT_MEMORY_INFO 0x00000002
204 .long 0x1BADB002 /* magic */
205 .long MULTIBOOT_MEMORY_INFO /* flags: AOUT_KLUDGE */
206 .long 0 - 0x1BADB002 - MULTIBOOT_MEMORY_INFO
215 .word 0,0,0,0 /* trap 0 */
216 .word 0,0,0,0 /* trap 1 */
217 .word 0,0,0,0 /* trap 2 */
218 .word 0,0,0,0 /* trap 3 */
219 .word 0,0,0,0 /* trap 4 */
220 .word 0,0,0,0 /* trap 5 */
232 #ifdef REALMODE_LOADING