wok annotate syslinux/stuff/iso2exe/meminfo.S @ rev 24986

Up nettle 3.7.3 again, need glib-networking rebuild to no break midori
author Stanislas Leduc <shann@slitaz.org>
date Wed May 11 08:28:28 2022 -0400 (2022-05-11)
parents 45e76a6c05d7
children
rev   line source
pascal@15981 1 .text
pascal@15981 2 .code16
pascal@15981 3 .org 0
pascal@15981 4 stacktop = 0xFFFE
pascal@15981 5
pascal@15981 6 .globl _start
pascal@15981 7 _start:
pascal@15981 8 #if 1
pascal@15981 9 #define EXEADRS(x) x+0xE0
pascal@15981 10 #define CODESZ 0x200
pascal@15981 11 decw %bp // Magic number: MZ
pascal@15981 12 popw %dx
pascal@15981 13 jmp start // Bytes on last page of file
pascal@15981 14 .word (CODESZ+511)/512 // Pages in file
pascal@15981 15 .word 0 // Relocations
pascal@15981 16 .word (end_header-_start)/16 // Size of header in paragraphs
pascal@15981 17 .word 4096 // Minimum extra paragraphs needed
pascal@15981 18 .word -1 // Maximum extra paragraphs needed
pascal@15981 19 .word (CODESZ+15)/16 // Initial (relative) SS value
pascal@15981 20 .word stacktop // Initial SP value
pascal@15981 21 .word 0 // Checksum
pascal@15981 22 .word EXEADRS(comstart) // Initial IP value
pascal@15981 23 .word 0xFFF0 // Initial (relative) CS value
pascal@15981 24 // .word 0x001C // File address of relocation table
pascal@15981 25 // .word 0,0,0 // Overlay number
pascal@15981 26 start:
pascal@15981 27 pushw %dx
pascal@15981 28 cld
pascal@15981 29 pushw %cs
pascal@15981 30 call comstart2
pascal@15981 31 stop:
pascal@15981 32 hlt
pascal@15981 33 jmp stop
pascal@15981 34 end_header:
pascal@15981 35 #endif
pascal@15981 36 comstart:
pascal@15981 37 pushw %cs
pascal@15981 38 call comstart2
pascal@15981 39 int $0x20
pascal@15981 40 comstart2:
pascal@15981 41 call here
pascal@15981 42 here:
pascal@15981 43 popw %ax
pascal@15981 44 subw $here-_start, %ax
pascal@15981 45 shrw $4, %ax
pascal@15981 46 movw %cs, %dx
pascal@15981 47 addw %ax, %dx
pascal@15981 48 pushw %dx
pascal@15981 49 pushw $go
pascal@15981 50 retf
pascal@15981 51 go:
pascal@15981 52 pushw %cs
pascal@15981 53 popw %ds
pascal@15981 54 pushw %cs
pascal@15981 55 popw %es
pascal@17160 56 #if 1
pascal@17160 57 pushfw // save flags
pascal@17160 58 // bits 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
pascal@17160 59 // flags 0 NT IOPL OF DF IF TF SF ZF 0 AF 0 PF 1 CF
pascal@17160 60 movb $0x10, %ah
pascal@17160 61 pushw %ax
pascal@17160 62 popfw // < 286 : flags[12..15] are forced 1
pascal@17160 63 pushfw // = 286 : flags[12..15] are forced 0
pascal@17160 64 popw %bx // > 286 : only flags[15] is forced 0
pascal@17160 65 popfw // restore flags
pascal@17160 66 addb %ah, %bh // test F0 and 00 cases
pascal@17160 67 cmpb %ah, %bh
pascal@17160 68 jbe fail // C=8086/80186, Z=80286
pascal@17160 69 #endif
pascal@15981 70 xorl %ebx, %ebx
pascal@15981 71 e820lp:
pascal@15981 72 movl $0xe820, %eax
pascal@15981 73 movl $0x534d4150, %edx
pascal@15981 74 movl $20, %ecx
pascal@15981 75 movw $buffer, %di
pascal@15981 76 int $0x15
pascal@15981 77 jc fail
pascal@15981 78 cmpl $0x534d4150, %eax
pascal@15981 79 jne fail
pascal@15981 80 cmpl $20, %ecx
pascal@15981 81 jc fail
pascal@15981 82 pushl %ebx
pascal@15981 83 movw $header_e820, %si
pascal@15981 84 call puts64
pascal@15981 85 movw $usable, %si
pascal@15981 86 cmpl $1, (%di)
pascal@15981 87 je show_status
pascal@15981 88 movw $acpi_reclaim, %si
pascal@15981 89 cmpl $3, (%di)
pascal@15981 90 je show_status
pascal@15981 91 movw $acpi_nvs, %si
pascal@15981 92 cmpl $4, (%di)
pascal@15981 93 je show_status
pascal@15981 94 movw $reserved, %si
pascal@15981 95 show_status:
pascal@15981 96 call putcs
pascal@15981 97 popl %ebx
pascal@15981 98 orl %ebx, %ebx
pascal@15981 99 jnz e820lp
pascal@15981 100 fail:
pascal@15981 101 movb $10, %al
pascal@15981 102 call putc
pascal@15981 103 movw $8*4, %cx
pascal@15981 104 movw $buffer, %di
pascal@15981 105 pushw %di
pascal@15981 106 xorw %ax, %ax
pascal@15981 107 rep
pascal@15981 108 stosw
pascal@15981 109 movw $0xE801, %ax
pascal@15981 110 int $0x15
pascal@15981 111 popw %di
pascal@15981 112 jc fail2
pascal@15981 113 movb $0x10, 0+2(%di) // 1M
pascal@15981 114 movb $0x10, 32+2(%di) // 1M
pascal@15981 115 movb $0x1, 16+3(%di) // 16M
pascal@15981 116 movb $0x1, 48+3(%di) // 16M
pascal@15981 117 incb %bh
pascal@15981 118 movw %bx, 24+2(%di)
pascal@15981 119 incb %dh
pascal@15981 120 movw %dx, 56+2(%di)
pascal@17160 121 movw %cx, %dx
pascal@17160 122 movb $6, %cl
pascal@17160 123 shrw %cl, %ax // 1K -> 64K
pascal@15981 124 jz e801_configured
pascal@17160 125 shrw %cl, %dx // 1K -> 64K
pascal@15981 126 addw $0x10, %ax
pascal@17160 127 addw $0x10, %dx
pascal@15981 128 movw %ax, 8+2(%di)
pascal@17160 129 movw %dx, 40+2(%di)
pascal@15981 130 movw $extended, %si
pascal@15981 131 call pute801
pascal@15981 132 call pute801
pascal@15981 133 e801_configured:
pascal@15981 134 movw $buffer+32, %di
pascal@15981 135 movw $configured, %si
pascal@15981 136 call pute801
pascal@15981 137 call pute801
pascal@15981 138 movb $10, %al
pascal@15981 139 call putc
pascal@15982 140 fail2:
pascal@15982 141 movw $8, %cx
pascal@15982 142 movw $buffer, %di
pascal@15982 143 pushw %di
pascal@15982 144 xorw %ax, %ax
pascal@15982 145 rep
pascal@15982 146 stosw
pascal@15982 147 movb $0x88, %ah
pascal@15982 148 int $0x15
pascal@15982 149 popw %di
pascal@15982 150 jc fail3
pascal@15982 151 movb $0x10, 0+2(%di) // 1M
pascal@17160 152 movb $6, %cl
pascal@17160 153 shrw %cl, %ax // 1K -> 64K
pascal@15982 154 jz fail3
pascal@15982 155 addw $0x10, %ax
pascal@15982 156 movw %ax, 8+2(%di)
pascal@15982 157 movw $header_0088, %si
pascal@15982 158 call puts64
pascal@15982 159 movb $10, %al
pascal@15982 160 call putc
pascal@15982 161 fail3:
pascal@15981 162 retf
pascal@15981 163
pascal@15981 164 puts64:
pascal@15981 165 call puts
pascal@15981 166 call put64
pascal@15981 167 movw $middle, %si
pascal@15981 168 call putcs
pascal@15981 169 put64:
pascal@15981 170 movw $8, %cx
pascal@15981 171 addw %cx, %di
pascal@15981 172 pushw %di
pascal@15981 173 put64lp:
pascal@15981 174 decw %di
pascal@15981 175 movb (%di), %al
pascal@15981 176 shrb $4, %al
pascal@15981 177 call putx
pascal@15981 178 movb (%di), %al
pascal@15981 179 call putx
pascal@15981 180 loop put64lp
pascal@15981 181 popw %di
pascal@15981 182 ret
pascal@15981 183
pascal@15981 184 pute801:
pascal@15981 185 pushw %si
pascal@15981 186 movw $header_e801, %si
pascal@15981 187 call puts64
pascal@15981 188 popw %si
pascal@15981 189 pushw %si
pascal@15981 190 call putcs
pascal@15981 191 popw %si
pascal@15981 192 ret
pascal@15981 193 putcs:
pascal@15981 194 movb $0x20, %al
pascal@15981 195 putslp:
pascal@15981 196 call putc
pascal@15981 197 puts:
pascal@15981 198 lodsb
pascal@15981 199 orb %al, %al
pascal@15981 200 jnz putslp
pascal@15981 201 ret
pascal@15981 202
pascal@15981 203 putx:
pascal@15981 204 andb $0xF, %al
pascal@15981 205 addb $0x90, %al
pascal@15981 206 daa
pascal@15981 207 adcb $0x40, %al
pascal@15981 208 daa
pascal@15981 209 putc:
pascal@15981 210 movw $7, %bx
pascal@15981 211 movb $0xE, %ah
pascal@15981 212 int $0x10
pascal@15981 213 ret
pascal@15981 214
pascal@15982 215 header_0088:
pascal@15982 216 .byte 13,10
pascal@15982 217 .ascii "BIOS-0088: "
pascal@15982 218 .byte 0
pascal@15981 219 header_e801:
pascal@15981 220 .byte 13,10
pascal@15981 221 .ascii "BIOS-e801: "
pascal@15981 222 .byte 0
pascal@15981 223 extended:
pascal@15981 224 .ascii "(extended)"
pascal@15981 225 .byte 0
pascal@15981 226 configured:
pascal@15981 227 .ascii "(configured)"
pascal@15981 228 .byte 0
pascal@15981 229 header_e820:
pascal@15981 230 .byte 13,10
pascal@15981 231 .ascii "BIOS-e820: "
pascal@15981 232 .byte 0
pascal@15981 233 middle:
pascal@15981 234 .ascii "- "
pascal@15981 235 .byte 0
pascal@15981 236 usable: // 1
pascal@15981 237 .ascii "(usable)"
pascal@15981 238 .byte 0
pascal@15981 239 reserved: // 2
pascal@15981 240 .ascii "(reserved)"
pascal@15981 241 .byte 0
pascal@15981 242 acpi_reclaim: // 3
pascal@15981 243 .ascii "(ACPI Reclaim)"
pascal@15981 244 .byte 0
pascal@15981 245 acpi_nvs: // 4
pascal@15981 246 .ascii "(ACPI NVS)"
pascal@15981 247 .byte 0
pascal@15981 248 buffer:
pascal@15981 249 .org 510
pascal@15981 250 .word 0xAA55