wok diff syslinux/stuff/iso2exe/bootiso.S @ rev 19827
syslinux/iso2exe: follow boot flag
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Wed Mar 08 15:32:40 2017 +0100 (2017-03-08) |
parents | 7a16da2c93b9 |
children | fd4b65b5c1de |
line diff
1.1 --- a/syslinux/stuff/iso2exe/bootiso.S Tue Oct 04 15:33:49 2016 +0200 1.2 +++ b/syslinux/stuff/iso2exe/bootiso.S Wed Mar 08 15:32:40 2017 +0100 1.3 @@ -32,14 +32,16 @@ 1.4 1.5 moved = 0x8000 1.6 start0: 1.7 - pushw %dx // restore %sp 1.8 - incw %bp // restore %bp 1.9 + //pushw %dx // restore %sp 1.10 + //incw %bp // restore %bp 1.11 xorw %bx, %bx 1.12 movw %bx, %ds 1.13 movb $0x7C, %bh 1.14 + pushw %ds 1.15 + popw %ss 1.16 + movw %bx, %sp 1.17 pushw %bx // return address 1.18 - pushaw 1.19 - movw %sp, %bp 1.20 + pushw %di 1.21 pushw %es // save %es:%di 1.22 cld 1.23 sti 1.24 @@ -47,7 +49,7 @@ 1.25 popw %es 1.26 call setreg 1.27 rep 1.28 - movsw 1.29 + movsw 1.30 movw $0x80, %dx 1.31 ljmp $0, $moved+start2 1.32 .byte 0 1.33 @@ -71,11 +73,11 @@ 1.34 1.35 dxfound: 1.36 call readsectorX // read isolinux boot sector 1.37 - movw %dx, 10(%bp) 1.38 cmpw (%bx), %cx 1.39 jnc puts // read fail or no isohydrid boot sector 1.40 + movw $patch,%si 1.41 popw %es 1.42 - popa // isolinux boot needs %es:%di and %dx 1.43 + popw %di // isolinux boot needs %es:%di and %dx 1.44 putsret: 1.45 ret 1.46 1.47 @@ -118,6 +120,58 @@ 1.48 ret 1.49 .org 0x01B8 1.50 1.51 +////////////////////////// partition boot code //////////////////////////////// 1.52 +// assume CS=DS=SS=0 BX=7C00 DL=<drive> SI=7DBE 1.53 + 1.54 + .org 0x7C00 1.55 + jmp bootpartition 1.56 + .org 0x7C03 1.57 + .org 0x7DBE 1.58 +table = moved+0x1BE 1.59 +patch: 1.60 + .byte 0,0,0 // head of original bs 1.61 +partcode: 1.62 + popw %di 1.63 + movw $table,%si 1.64 + call movepartition 1.65 + movb $4,%cl 1.66 + movw $table-16,%di 1.67 +next: 1.68 + addw $16,%di 1.69 + cmpb %ch,(%di) // boot flag ? 1.70 + loope next 1.71 + pushw %ds 1.72 + pushw %ds 1.73 + pushl 8(%di) 1.74 + pushw %ds 1.75 + pushw %bx 1.76 + pushw $1 1.77 + pushw $0x10 1.78 + movw %sp,%si // assume %ds = %ss 1.79 + movb $0x42,%ah 1.80 + pushw %bx 1.81 + cmpw $63,2(%di) // empty or isolinux partition ? 1.82 + jbe default 1.83 + int $0x13 1.84 +default: 1.85 + ret 1.86 + .org 0x7DEF 1.87 +bootpartition: 1.88 + pushw %ds 1.89 + popw %es 1.90 + pushw %si 1.91 + movw %bx,%di 1.92 + movsw 1.93 + movsb 1.94 + movw $partcode+0x100,%di 1.95 + pushw %di 1.96 +movepartition: 1.97 + movw $66/2,%cx 1.98 + rep 1.99 + movsw 1.100 + ret 1.101 + .org 0x7E00 1.102 + 1.103 .org 0x7F48 1.104 ////////////////////////////// DOS EXE code /////////////////////////////////// 1.105