wok annotate linld/stuff/tobzimage.S @ rev 22961
updated iso-codes (3.45 -> 4.4)
author | Hans-G?nter Theisgen |
---|---|
date | Fri Feb 28 16:47:15 2020 +0100 (2020-02-28) |
parents | 58452392e881 |
children |
rev | line source |
---|---|
pascal@19206 | 1 |
pascal@19203 | 2 #define REALMODE_SWITCH |
pascal@19203 | 3 #define SHUTDOWNDOS |
pascal@19206 | 4 #define ELKS_SUPPORT |
pascal@19206 | 5 #define LINUX001_SUPPORT |
pascal@19203 | 6 |
pascal@18228 | 7 .code16 |
pascal@18228 | 8 .org 0 |
pascal@18228 | 9 |
pascal@19203 | 10 #define CODE32_START 0x100000 |
pascal@18228 | 11 jmp start |
pascal@18228 | 12 .ascii "HdrS" |
pascal@18228 | 13 .word 0x200 # version |
pascal@18228 | 14 .long 0 # realmode_swtch |
pascal@18228 | 15 .word 0x1000 # start_sys_seg |
pascal@18228 | 16 .word kernel_version |
pascal@18228 | 17 .byte 0 # type of loader |
pascal@18228 | 18 .byte 1 # loadflags |
pascal@18228 | 19 .word 0x8000 # setup_move_size |
pascal@19203 | 20 .long CODE32_START # code32_start |
pascal@18228 | 21 .long 0 # ramdisk_image |
pascal@18228 | 22 .long 0 # ramdisk_size |
pascal@18228 | 23 .long 0 # bootsect_kludge |
pascal@18228 | 24 .word 0 # heap_end_ptr 2.01+, patched by bootloader |
pascal@19203 | 25 |
pascal@18228 | 26 start: |
pascal@18228 | 27 pushf |
pascal@18228 | 28 pushw %cs |
pascal@18228 | 29 pushw $0 |
pascal@18228 | 30 pushaw |
pascal@19203 | 31 xorw %di, %di |
pascal@19203 | 32 .byte 0x66, 0xC7, 0x05 # movl $?, (%di) |
pascal@18229 | 33 rep |
pascal@18229 | 34 movsw |
pascal@18229 | 35 popaw |
pascal@19206 | 36 doiret: |
pascal@18229 | 37 iret |
pascal@19203 | 38 pushw %ds |
pascal@18228 | 39 pushw %di |
pascal@19203 | 40 #ifdef REALMODE_SWITCH |
pascal@19203 | 41 movw $0x0208, %si |
pascal@19203 | 42 lodsw |
pascal@19203 | 43 orw (%si), %ax |
pascal@19203 | 44 jz norealmode_switch |
pascal@19203 | 45 lcallw *-2(%si) |
pascal@19203 | 46 norealmode_switch: |
pascal@19203 | 47 #endif |
pascal@19203 | 48 |
pascal@19203 | 49 #ifdef SHUTDOWNDOS |
pascal@19203 | 50 xorw %si, %si |
pascal@19203 | 51 movw %si, %ds # %ds = 0 |
pascal@19203 | 52 pushl 4(%si) |
pascal@19206 | 53 movw %sp, %cs:loadsp19+1(%si) |
pascal@19206 | 54 cmpb $0xF0, 7(%si) |
pascal@19203 | 55 jnb notdos |
pascal@19203 | 56 movw $step19, 4(%si) |
pascal@19203 | 57 movw %cs, 6(%si) |
pascal@19203 | 58 pushfw |
pascal@19203 | 59 popw %ax |
pascal@19203 | 60 incb %ah # set TF |
pascal@19203 | 61 pushw %ax |
pascal@19203 | 62 popfw |
pascal@19203 | 63 ljmp *4*0x19(%si) |
pascal@19203 | 64 step19: |
pascal@19203 | 65 pushw %si |
pascal@19203 | 66 pushw %ds |
pascal@19203 | 67 movw %sp, %si |
pascal@19203 | 68 ldsw %ss:4(%si), %si |
pascal@19203 | 69 cmpw $0x19CD, (%si) |
pascal@19203 | 70 popw %ds |
pascal@19203 | 71 popw %si |
pascal@19206 | 72 jne doiret |
pascal@19203 | 73 xorw %si, %si |
pascal@19203 | 74 mov %si, %ds |
pascal@19203 | 75 notdos: |
pascal@19203 | 76 loadsp19: |
pascal@19206 | 77 movw $0, %sp |
pascal@19203 | 78 popl 4(%si) |
pascal@19203 | 79 pushw %ss |
pascal@19203 | 80 popw %ds |
pascal@19206 | 81 #else |
pascal@19206 | 82 xorw %si, %si |
pascal@19203 | 83 #endif |
pascal@19206 | 84 #if defined(ELKS_SUPPORT) || defined(LINUX001_SUPPORT) |
pascal@19206 | 85 movw %sp, %bx |
pascal@19206 | 86 #endif |
pascal@18228 | 87 movw $9, %cx |
pascal@18228 | 88 z1: |
pascal@19203 | 89 pushw %si # 0000 0000 0000 0000 0000 0000 0000 0000 0000 |
pascal@18228 | 90 loop z1 |
pascal@18228 | 91 movw $0x9301, %ax |
pascal@19203 | 92 cwd |
pascal@19203 | 93 pushw %ax # 9301 |
pascal@19206 | 94 pushw %si # 0000 |
pascal@19203 | 95 pushw %dx # FFFF |
pascal@19206 | 96 pushw %si # 0000 |
pascal@18228 | 97 movb 0x216, %al |
pascal@19203 | 98 pushw %ax # 93xx |
pascal@19206 | 99 pushw %si # 0000 |
pascal@19203 | 100 pushw %dx # FFFF |
pascal@18228 | 101 movb $8, %cl |
pascal@18228 | 102 z2: |
pascal@19203 | 103 pushw %si # 0000 0000 0000 0000 0000 0000 0000 0000 |
pascal@18228 | 104 loop z2 |
pascal@19203 | 105 movw $0x200, %di |
pascal@18228 | 106 movw -12(%di), %dx |
pascal@19203 | 107 pushw %ss |
pascal@19203 | 108 popw %es |
pascal@19203 | 109 movw %sp, %si |
pascal@18228 | 110 mvlp: |
pascal@18228 | 111 movw $0x8000, %cx |
pascal@18228 | 112 movb $0x87, %ah |
pascal@18228 | 113 int $0x15 |
pascal@18228 | 114 incw 20(%si) |
pascal@18228 | 115 incw 28(%si) |
pascal@19208 | 116 subw $0x1000, %dx |
pascal@18228 | 117 ja mvlp |
pascal@19203 | 118 addw $48, %sp |
pascal@19206 | 119 #ifdef ELKS_SUPPORT |
pascal@19206 | 120 //cmpl $0x534B4C45, -26(%di) |
pascal@19208 | 121 movw $0x100, %cx |
pascal@19206 | 122 elks_patch: |
pascal@19206 | 123 jmp notelks |
pascal@19206 | 124 movb %ch, 23(%bx) |
pascal@19206 | 125 movw %cx, %es |
pascal@19206 | 126 pushw %di |
pascal@19206 | 127 xorw %di, %di |
pascal@19206 | 128 xorw %si, %si |
pascal@19206 | 129 movb $0x6, %ch |
pascal@19206 | 130 rep |
pascal@19206 | 131 movsw |
pascal@19206 | 132 popw %di |
pascal@19206 | 133 pushw %es |
pascal@19206 | 134 popw %ds |
pascal@19206 | 135 notelks: |
pascal@19206 | 136 #endif |
pascal@19206 | 137 movw $0x400, %si |
pascal@19203 | 138 decb -15(%di) |
pascal@19206 | 139 #ifdef LINUX001_SUPPORT |
pascal@19206 | 140 //cmpw $0x3AE8, 0x3F(%si) |
pascal@19206 | 141 linux001_patch: |
pascal@19206 | 142 jmp notlnx001 |
pascal@19206 | 143 movb $0x42, (%bx) |
pascal@19206 | 144 xorw %di, %di |
pascal@19208 | 145 # ifndef ELKS_SUPPORT |
pascal@19206 | 146 movw $0x100, %cx |
pascal@19208 | 147 # endif |
pascal@19206 | 148 rep |
pascal@19206 | 149 movsw |
pascal@19206 | 150 notlnx001: |
pascal@19206 | 151 #endif |
pascal@19208 | 152 movb -15(%di), %ch |
pascal@18228 | 153 lret |
pascal@19203 | 154 endcode: |
pascal@19203 | 155 |
pascal@19203 | 156 .org 256 |
pascal@18228 | 157 kernel_version: |
pascal@18228 | 158 .asciz "zImage" |
pascal@18228 | 159 .org 512 |
pascal@18228 | 160 oldsetup: |
pascal@18228 | 161 |
pascal@19203 | 162 |
pascal@19203 | 163 |