wok view syslinux/stuff/iso2exe/meminfo.S @ rev 15982

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