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
17 .section ".jh.boot", "ax"
23 .section ".jh.startup", "ax"
32 ljmpl $INMATE_CS32,$_start + FSEGMENT_BASE
38 .quad 0x00cf9b000000ffff
39 .quad 0x00af9b000000ffff
40 .quad 0x00cf93000000ffff
43 .short gdt_ptr - loader_gdt - 1
44 .long loader_gdt + FSEGMENT_BASE
58 #ifdef REALMODE_LOADING
72 pushl %esi /* Pointer to real mode or Xen start_info pointer */
77 /* initialize vector for exception 6 */
78 movl $trap6_entry,%eax
79 movw %ax, _idt_offset_low
81 movw %ax, _idt_offset_high
83 movw %ax, _idt_selector
85 /* load tiny interrupt descriptor table to catch exception 6 */
92 /* Show an error message and wait for keypress to reboot. */
100 * edx: value to print
101 * eax: location on screen
105 98: mov $numbers,%ebx
109 movzbl (%ebx,%ecx,1),%ecx
118 /* print out warning */
119 movl $trap6_warning, %esi
120 movl $(0xb8000 + (24*80*2)), %edi
123 1: /* read next character from string */
126 /* check for end-of-string */
130 /* Check for hex number */
134 mov (32 + 32)(%esp),%edx
141 4: /* check for newline */
148 /* move screen upwards 1 line */
149 movl $((24*80*2)/4), %ecx
150 movl $(0xb8000 + 1*80*2), %esi
154 /* clear last line of screen */
155 movl $((1*80*2)/4), %ecx
156 movl $0x07200720, %eax
162 /* jump to new line */
163 movl $(0xb8000 + (24*80*2)), %edi
166 2: /* print character */
170 3: /* wait for keypress */
177 /* empty keyboard buffer */
180 /* ignore PS/2 mouse events */
187 /* the warning text */
190 .ascii "Bootstrap: Invalid opcode at detected!\n"
191 .ascii "Be sure that you don't use any CPU optimization flags like\n"
192 .ascii " -march=i686\n"
193 .ascii "when compiling Bootstrap and the depending libraries.\n"
195 .asciz " Press any key to reboot..."
198 .ascii "0123456789abcdef"
200 /* MultiBoot header - see multiboot.h. */
203 #define MULTIBOOT_MEMORY_INFO 0x00000002
205 .long 0x1BADB002 /* magic */
206 .long MULTIBOOT_MEMORY_INFO /* flags: AOUT_KLUDGE */
207 .long 0 - 0x1BADB002 - MULTIBOOT_MEMORY_INFO
216 .word 0,0,0,0 /* trap 0 */
217 .word 0,0,0,0 /* trap 1 */
218 .word 0,0,0,0 /* trap 2 */
219 .word 0,0,0,0 /* trap 3 */
220 .word 0,0,0,0 /* trap 4 */
221 .word 0,0,0,0 /* trap 5 */
233 #ifdef REALMODE_LOADING