Palacios Public Git Repository

To checkout Palacios execute

  git clone http://v3vee.org/palacios/palacios.web/palacios.git
This will give you the master branch. You probably want the devel branch or one of the release branches. To switch to the devel branch, simply execute
  cd palacios
  git checkout --track -b devel origin/devel
The other branches are similar.


Merge branch 'devel'
[palacios.git] / kitten / arch / x86_64 / boot / 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 #include <arch/boot.h>
17
18 SETUPSECTS      = 4                     /* default nr of setup-sectors */
19 BOOTSEG         = 0x07C0                /* original address of boot-sector */
20 INITSEG         = DEF_INITSEG           /* we move boot here - out of the way */
21 SETUPSEG        = DEF_SETUPSEG          /* setup starts here */
22 SYSSEG          = DEF_SYSSEG            /* system loaded at 0x10000 (65536) */
23 SYSSIZE         = DEF_SYSSIZE           /* system size: # of 16-byte clicks */
24                                         /* to be loaded */
25 ROOT_DEV        = 0                     /* ROOT_DEV is now written by "build" */
26 SWAP_DEV        = 0                     /* SWAP_DEV is now written by "build" */
27
28 #define SVGA_MODE 0
29
30 #ifndef RAMDISK
31 #define RAMDISK 0
32 #endif
33
34 #ifndef ROOT_RDONLY
35 #define ROOT_RDONLY 1
36 #endif
37
38 .code16
39 .text
40
41 .global _start
42 _start:
43
44         # Normalize the start address
45         jmpl    $BOOTSEG, $start2
46
47 start2:
48         movw    %cs, %ax
49         movw    %ax, %ds
50         movw    %ax, %es
51         movw    %ax, %ss
52         movw    $0x7c00, %sp
53         sti
54         cld
55
56         movw    $bugger_off_msg, %si
57
58 msg_loop:
59         lodsb
60         andb    %al, %al
61         jz      die
62         movb    $0xe, %ah
63         movw    $7, %bx
64         int     $0x10
65         jmp     msg_loop
66
67 die:
68         # Allow the user to press a key, then reboot
69         xorw    %ax, %ax
70         int     $0x16
71         int     $0x19
72
73         # int 0x19 should never return.  In case it does anyway,
74         # invoke the BIOS reset code...
75         ljmp    $0xf000,$0xfff0
76
77
78 bugger_off_msg:
79         .ascii  "Direct booting from floppy is no longer supported.\r\n"
80         .ascii  "Please use a boot loader program instead.\r\n"
81         .ascii  "\n"
82         .ascii  "Remove disk and press any key to reboot . . .\r\n"
83         .byte   0
84
85
86         # Kernel attributes; used by setup
87
88         .org 497
89 setup_sects:    .byte SETUPSECTS
90 root_flags:     .word ROOT_RDONLY
91 syssize:        .word SYSSIZE
92 swap_dev:       .word SWAP_DEV
93 ram_size:       .word RAMDISK
94 vid_mode:       .word SVGA_MODE
95 root_dev:       .word ROOT_DEV
96 boot_flag:      .word 0xAA55