wok rev 19400
memtest: DOS shutdown (again)
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Sat Sep 03 11:26:12 2016 +0200 (2016-09-03) |
parents | ebf8313df61f |
children | 50b423f7711b |
files | memtest/stuff/bootloader.S |
line diff
1.1 --- a/memtest/stuff/bootloader.S Sat Sep 03 09:48:39 2016 +0200 1.2 +++ b/memtest/stuff/bootloader.S Sat Sep 03 11:26:12 2016 +0200 1.3 @@ -44,7 +44,7 @@ 1.4 comstart: 1.5 cld # assume nothing 1.6 #ifdef CMDLINE 1.7 - movw $stacktop, %di 1.8 + movw %sp, %di 1.9 #else 1.10 #undef HELP 1.11 #endif 1.12 @@ -77,9 +77,15 @@ 1.13 nocmdline: 1.14 #endif 1.15 movw $SYSSEG, %ax 1.16 + movb $(512-(end_header-_start))/2, %cl 1.17 + movw $end_header, %di 1.18 #ifdef CHECK_REALMODE 1.19 #define PUTS 1.20 movw $EXEADRS(realmode_expected), %si 1.21 + //movw syssize-realmode_expected(%si), %bp 1.22 + .byte 0x8B, 0x6C, syssize-realmode_expected 1.23 + //movb setup_sects-realmode_expected(%si), %ch 1.24 + .byte 0x8A, 0x6C, setup_sects-realmode_expected 1.25 // bits 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 1.26 // flags 0 NT IOPL OF DF IF TF SF ZF 0 AF 0 PF 1 CF 1.27 //movb $0x10, %ah // DF = IF = TF = 0 1.28 @@ -93,36 +99,29 @@ 1.29 smsww %dx 1.30 shrw $1, %dx 1.31 jc puts 1.32 - //movw syssize-realmode_expected(%si), %bp 1.33 - .byte 0x8B, 0x6C, syssize-realmode_expected 1.34 - //movb setup_sects-realmode_expected(%si), %ch 1.35 - .byte 0x8A, 0x6C, setup_sects-realmode_expected 1.36 #else 1.37 movw EXEADRS(syssize), %bp 1.38 movb EXEADRS(setup_sects), %ch 1.39 #endif 1.40 - movb $(512-(end_header-_start))/2, %cl 1.41 movw $0x100, %si 1.42 - movw $end_header, %di 1.43 rep 1.44 movsw 1.45 + movw %ds, %bx 1.46 #ifndef SHUTDOWNDOS 1.47 ljmp $INITSEG, $movesys 1.48 #else 1.49 pushaw 1.50 - pushw %es 1.51 - xorw %si, %si 1.52 - movw %si, %ds # %ds = 0 1.53 - pushl 4(%si) 1.54 - movw %sp, %es:loadsp19+1(%si) 1.55 - movw $step19, 4(%si) 1.56 - movw %es, 6(%si) 1.57 + movw %cx, %ds # %ds = 0 1.58 + movw $4, %si 1.59 + pushl (%si) 1.60 + movw $step19, (%si) 1.61 + movw %es, 2(%si) 1.62 pushfw 1.63 popw %ax 1.64 incb %ah # set TF 1.65 pushw %ax 1.66 popfw 1.67 - ljmp *4*0x19(%si) 1.68 + ljmp *4*0x19-4(%si) 1.69 #endif 1.70 start: 1.71 pushw %dx 1.72 @@ -240,16 +239,13 @@ 1.73 xorw %si, %si 1.74 mov %si, %ds 1.75 popl 4*0x19(%si) 1.76 -loadsp19: 1.77 - movw $0, %sp 1.78 + movw $stacktop-4-16, %sp 1.79 popl 4(%si) 1.80 - popw %es 1.81 popaw 1.82 #endif 1.83 movesys: // %ax = SYSSEG 1.84 - pushw %es 1.85 + pushw %cs 1.86 popw %ss 1.87 - movw %ds, %bx 1.88 shrw $4, %si 1.89 addw %si, %bx 1.90 subw %ax, %bx