Adding debian version 3.70~pre8+dfsg-1.
[syslinux-debian/hramrach.git] / gpxe / src / arch / i386 / prefix / hdprefix.S
blob56fcb36d598201129f5d0fc6d363614c0ab7c30e
1         .text
2         .arch i386
3         .section ".prefix", "awx", @progbits
4         .code16
5         .org 0
7         movw    $load_image, %bp
8         jmp     find_active_partition
10 #include "bootpart.S"
12 load_image:
13         /* Get disk geometry */
14         pushal
15         pushw   %es
16         movb    $0x08, %ah
17         int     $0x13
18         jc      load_failed
19         movb    %cl, max_sector
20         movb    %dh, max_head
21         popw    %es
22         popal
23         
24 1:      /* Read to end of current track */
25         movb    %cl, %al
26         negb    %al
27         addb    max_sector, %al
28         incb    %al
29         andb    $0x3f, %al
30         movzbl  %al, %eax
31         call    *read_sectors
32         jc      load_failed
33         
34         /* Update %es */
35         movw    %es, %bx
36         shll    $5, %eax
37         addw    %ax, %bx
38         movw    %bx, %es
39         shrl    $5, %eax
40         
41         /* Update LBA address */
42         addl    %eax, %edi
43         adcl    $0, %esi
44         
45         /* Update CHS address */
46         andb    $0xc0, %cl
47         orb     $0x01, %cl
48         incb    %dh
49         cmpb    max_head, %dh
50         jbe     2f
51         xorb    %dh, %dh
52         incb    %ch
53         jnc     2f
54         addb    $0xc0, %cl
56         /* Loop until whole image is read */
57         subl    %eax, load_length
58         ja      1b
59         ljmp    $BOOT_SEG, $start_image
61 max_sector:
62         .byte   0
63 max_head:
64         .byte   0
65 load_length:
66         .long   _load_size_sect
67         
68         .section ".zinfo.fixup", "a"    /* Compressor fixup information */
69         .ascii  "SUBL"
70         .long   load_length
71         .long   512
72         .long   0
73         .previous
76 load_failed:
77         movw    $10f, %si
78         jmp     boot_error
79 10:     .asciz  "Could not load gPXE\r\n"
81         .org 510
82         .byte 0x55, 0xaa
84 start_image:
85         call    install
87         /* Set up real-mode stack */
88         movw    %bx, %ss
89         movw    $_estack16, %sp
91         /* Jump to .text16 segment */
92         pushw   %ax
93         pushw   $1f
94         lret
95         .section ".text16", "awx", @progbits
97         pushl   $main
98         pushw   %cs
99         call    prot_call
100         popl    %eax /* discard */
102         /* Boot next device */
103         int $0x18