]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/bootstrap_custom/server/src/ARCH-x86/bootsect.S
l4: bootstrap_custom: Fix unsupported paging mode error, which was caused by the...
[l4.git] / l4 / pkg / bootstrap_custom / server / src / ARCH-x86 / bootsect.S
1 /*
2  *      bootsect.S              Copyright (C) 1991, 1992 Linus Torvalds
3  *
4  *      modified by Drew Eckhardt
5  *      modified by Bruce Evans (bde)
6  *      modified by Chris Noe (May 1999) (as86 -> gas)
7  *      gutted by H. Peter Anvin (Jan 2003)
8  *
9  * BIG FAT NOTE: We're in real mode using 64k segments.  Therefore segment
10  * addresses must be multiplied by 16 to obtain their respective linear
11  * addresses. To avoid confusion, linear addresses are written using leading
12  * hex while segment addresses are written as segment:offset.
13  *
14  */
15
16 /* Don't touch these, unless you really know what you're doing. */
17 #define DEF_INITSEG     0x9000
18 #define DEF_SYSSEG      0x1000
19 #define DEF_SETUPSEG    0x9020
20 #define DEF_SYSSIZE     0x7F00
21
22 /* Internal svga startup constants */
23 #define NORMAL_VGA      0xffff          /* 80x25 mode */
24 #define EXTENDED_VGA    0xfffe          /* 80x50 mode */
25 #define ASK_VGA         0xfffd          /* ask for it at bootup */
26
27
28 SETUPSECTS      = 6                     /* default nr of setup-sectors */
29 BOOTSEG         = 0x07C0                /* original address of boot-sector */
30 INITSEG         = DEF_INITSEG           /* we move boot here - out of the way */
31 SETUPSEG        = DEF_SETUPSEG          /* setup starts here */
32 SYSSEG          = DEF_SYSSEG            /* system loaded at 0x10000 (65536) */
33 SYSSIZE         = DEF_SYSSIZE           /* system size: # of 16-byte clicks */
34                                         /* to be loaded */
35 ROOT_DEV        = 0                     /* ROOT_DEV is now written by "build" */
36 SWAP_DEV        = 0                     /* SWAP_DEV is now written by "build" */
37
38 #ifndef SVGA_MODE
39 #define SVGA_MODE ASK_VGA
40 #endif
41
42 #ifndef RAMDISK
43 #define RAMDISK 0
44 #endif
45
46 #ifndef ROOT_RDONLY
47 #define ROOT_RDONLY 1
48 #endif
49
50 .code16
51 .text
52
53 .global _start
54 _start:
55
56         # Normalize the start address
57         jmpl    $BOOTSEG, $start2
58
59 start2:
60         movw    %cs, %ax
61         movw    %ax, %ds
62         movw    %ax, %es
63         movw    %ax, %ss
64         movw    $0x7c00, %sp
65         sti
66         cld
67
68         movw    $bugger_off_msg, %si
69
70 msg_loop:
71         lodsb
72         andb    %al, %al
73         jz      die
74         movb    $0xe, %ah
75         movw    $7, %bx
76         int     $0x10
77         jmp     msg_loop
78
79 die:
80         # Allow the user to press a key, then reboot
81         xorw    %ax, %ax
82         int     $0x16
83         int     $0x19
84
85         # int 0x19 should never return.  In case it does anyway,
86         # invoke the BIOS reset code...
87         ljmp    $0xf000,$0xfff0
88
89
90 bugger_off_msg:
91         .ascii  "Direct booting from floppy is no longer supported.\r\n"
92         .ascii  "Please use a boot loader program instead.\r\n"
93         .ascii  "\n"
94         .ascii  "Remove disk and press any key to reboot . . .\r\n"
95         .byte   0
96         
97
98         # Kernel attributes; used by setup
99
100         .org 497
101 setup_sects:    .byte SETUPSECTS
102 root_flags:     .word ROOT_RDONLY
103 syssize:        .word SYSSIZE
104 swap_dev:       .word SWAP_DEV
105 ram_size:       .word RAMDISK
106 vid_mode:       .word SVGA_MODE
107 root_dev:       .word ROOT_DEV
108 boot_flag:      .word 0xAA55