Annotation of qemu/roms/ipxe/src/arch/i386/prefix/hdprefix.S, revision 1.1.1.1

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

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.