Magellan Linux

Annotation of /tags/mkinitrd-6_3_1/isolinux/localboot.inc

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1143 - (hide annotations) (download)
Thu Aug 19 12:44:27 2010 UTC (13 years, 9 months ago) by niro
File size: 1798 byte(s)
tagged 'mkinitrd-6_3_1'
1 niro 1133 ; -----------------------------------------------------------------------
2     ;
3     ; Copyright 1999-2008 H. Peter Anvin - All Rights Reserved
4     ;
5     ; This program is free software; you can redistribute it and/or modify
6     ; it under the terms of the GNU General Public License as published by
7     ; the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
8     ; Boston MA 02110-1301, USA; either version 2 of the License, or
9     ; (at your option) any later version; incorporated herein by reference.
10     ;
11     ; -----------------------------------------------------------------------
12    
13     ;
14     ; localboot.inc
15     ;
16     ; Boot from a local disk, or invoke INT 18h.
17     ;
18    
19     %if HAS_LOCALBOOT
20    
21     ;
22     ; Boot a specified local disk. AX specifies the BIOS disk number; or
23     ; -1 in case we should execute INT 18h ("next device.")
24     ;
25     section .text
26    
27     local_boot:
28     call vgaclearmode
29     RESET_STACK_AND_SEGS dx ; dx <- 0
30     mov fs,dx
31     mov gs,dx
32     mov si,localboot_msg
33     call writestr
34     call cleanup_hardware
35     cmp ax,-1
36     je .int18
37    
38     ; Load boot sector from the specified BIOS device and jump to it.
39     mov dl,al
40     xor dh,dh
41     push dx
42     xor ax,ax ; Reset drive
43     int 13h
44     mov ax,0201h ; Read one sector
45     mov cx,0001h ; C/H/S = 0/0/1 (first sector)
46     mov bx,trackbuf
47     mov bp,retry_count
48     .again:
49     pusha
50     int 13h
51     popa
52     jnc .ok
53     dec bp
54     jnz .again
55     jmp kaboom ; Failure...
56     .ok:
57     pop dx
58     cli ; Abandon hope, ye who enter here
59     mov si,trackbuf
60     mov di,07C00h
61     mov cx,512 ; Probably overkill, but should be safe
62     rep movsd
63     mov ss,cx ; SS <- 0
64     mov sp,7C00h
65     jmp 0:07C00h ; Jump to new boot sector
66    
67     .int18:
68     int 18h ; Hope this does the right thing...
69     jmp kaboom ; If we returned, oh boy...
70    
71     section .data
72     localboot_msg db 'Booting from local disk...', CR, LF, 0
73    
74     section .text
75    
76     %endif ; HAS_LOCALBOOT