source: trunk/BOOTCODE/REGULAR/DEBUG.ASM@ 43

Last change on this file since 43 was 43, checked in by Ben Rietbroek, 12 years ago

BSS Corruption Problem located (auxdebug on) [2012-02-21]

WARNING!!

All commits upto and including the commit of [2012-05-13] contain
a severe bug!! Building from these sources and then disabling
the 'force LBA' feature while also using the drive-letter feature or
editing the label can DESTROY THE MBR on ALL ATTACHED DISKS!!
DO NOT DISABLE 'FORCE LBA USAGE' WHEN BUILT FROM THE THESE COMMITS!!

Problem

o Function with Xrefs goes out-of-bounds because hideparttable is too small

Has only 30 entries and should be 45.
Lost partition checker initializes out-of-bounds.

Info

o About the hideparttable

For each partition it can be specified which other partitions need to
be hidden when that partition is booted. This is useful for legacy DOS
but also braindead Windows that presents HPFS/JFS partitions as
unformatted and tries to persuade the user to format them.
With v1.07 the numer of partitions that can be handled was expanded from
30 to 45, but the size of the hideparttable was overseen.

o The need to compress the hideparttable

The old size was 30x30=900 bytes while the required size is 45x45=2045 bytes.
This amount of space is not available in the image.
Since 6 bits are enough to identify the partition number to be hidden,
the solution is to devide the table into bitfields. This will result
in a table of (45*45*6)/8=1519 bytes, which can be fitted.

Changes

Revamped the sources quite a bit and moved the history to a separate
file. (AIR-BOOT.HIS)

New

o FIXCODE script for Linux

Just until the C version is ready...

File size: 9.2 KB
Line 
1; AiR-BOOT (c) Copyright 1998-2008 M. Kiewitz
2;
3; This file is part of AiR-BOOT
4;
5; AiR-BOOT is free software: you can redistribute it and/or modify it under
6; the terms of the GNU General Public License as published by the Free
7; Software Foundation, either version 3 of the License, or (at your option)
8; any later version.
9;
10; AiR-BOOT is distributed in the hope that it will be useful, but WITHOUT ANY
11; WARRANTY: without even the implied warranty of MERCHANTABILITY or FITNESS
12; FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
13; details.
14;
15; You should have received a copy of the GNU General Public License along with
16; AiR-BOOT. If not, see <http://www.gnu.org/licenses/>.
17;
18;---------------------------------------------------------------------------
19; AiR-BOOT / DEBUG
20;---------------------------------------------------------------------------
21
22
23; -----------------------
24; Rousseau: # DEBUG.ASM #
25; -----------------------
26; This module contains functions for debugging AiR-BOOT.
27; It is only included in debug builds and the codesize of AiR-BOOT increases
28; in that case.
29;
30; Had problems with RU language version because it includes cyrillic charset.
31; Parts disabled for now.
32
33
34IFDEF ModuleNames
35DB 'DEBUG',0
36ENDIF
37
38DEBUG_CheckMath Proc Near
39 pushf
40 pusha
41
42 ; Msg check math-module
43 mov si,offset db_checkmath
44 call AuxIO_Print
45
46 ; Output hex-word
47 mov ax,0BABEh
48 call AuxIO_TeletypeHexWord
49
50 mov al,' '
51 call AuxIO_Teletype
52 mov al,'*'
53 call AuxIO_Teletype
54 mov al,' '
55 call AuxIO_Teletype
56
57 ; Output hex-word
58 mov ax,0BABEh
59 call AuxIO_TeletypeHexWord
60
61 mov al,' '
62 call AuxIO_Teletype
63 mov al,'='
64 call AuxIO_Teletype
65 mov al,' '
66 call AuxIO_Teletype
67
68 mov ax,0BABEh
69 mul ax
70 call AuxIO_TeletypeHexDWord
71
72 ; Start new line
73 call AuxIO_TeletypeNL
74
75 ; Output hex-dword
76 mov dx,0DEADh
77 mov ax,0FACEh
78 call AuxIO_TeletypeHexDWord
79
80 mov al,' '
81 call AuxIO_Teletype
82 mov al,'*'
83 call AuxIO_Teletype
84 mov al,' '
85 call AuxIO_Teletype
86
87 ; Output hex-dword
88 mov dx,0DEADh
89 mov ax,0FACEh
90 call AuxIO_TeletypeHexDWord
91
92 mov al,' '
93 call AuxIO_Teletype
94 mov al,'='
95 call AuxIO_Teletype
96 mov al,' '
97 call AuxIO_Teletype
98
99 mov bx,0DEADh
100 mov cx,0FACEh
101 mov dx,0DEADh
102 mov ax,0FACEh
103 call MATH_Mul32
104 call AuxIO_TeletypeHexQWord
105
106 ; Start new line
107 call AuxIO_TeletypeNL
108
109 ;~ ; Start new line
110 call AuxIO_TeletypeNL
111
112 popa
113 popf
114
115 ret
116DEBUG_CheckMath EndP
117
118
119DEBUG_DumpGeo Proc
120 pushf
121 pusha
122
123 ; BIOS cyls
124 mov dx,word ptr [BIOS_Cyls+02]
125 mov ax,word ptr [BIOS_Cyls+00]
126 call AuxIO_TeletypeHexDWord
127 call AuxIO_TeletypeNL
128
129 ; BIOS heads
130 mov dx,word ptr [BIOS_Heads+02]
131 mov ax,word ptr [BIOS_Heads+00]
132 call AuxIO_TeletypeHexDWord
133 call AuxIO_TeletypeNL
134
135 ; BIOS secs
136 mov dx,word ptr [BIOS_Secs+02]
137 mov ax,word ptr [BIOS_Secs+00]
138 call AuxIO_TeletypeHexDWord
139 call AuxIO_TeletypeNL
140
141 ; Bytes per sector
142 mov ax,[BIOS_Bytes]
143 call AuxIO_TeletypeHexWord
144 call AuxIO_TeletypeNL
145
146 ; Total secs
147 mov bx, word ptr [BIOS_TotalSecs+06]
148 mov cx, word ptr [BIOS_TotalSecs+04]
149 mov dx, word ptr [BIOS_TotalSecs+02]
150 mov ax, word ptr [BIOS_TotalSecs+00]
151 call AuxIO_TeletypeHexDWord
152 call AuxIO_TeletypeNL
153
154 ; CHS to LBA
155 mov dx,1
156 mov ax,29e5h
157 mov bx,23h
158 mov cx,9h
159 call CONV_CHS2LBA
160 call AuxIO_TeletypeHexDWord
161 call AuxIO_TeletypeNL
162
163 popa
164 popf
165
166 ret
167DEBUG_DumpGeo Endp
168
169;
170; Dump information before the menu is displayed.
171;
172DEBUG_Dump1 Proc Near
173 pushf
174 pusha
175
176 ; Hello message
177 mov si, offset AuxIOHello
178 call AuxIO_Print
179
180 ; Build Date
181 mov si, offset BUILD_DATE
182 call AuxIO_Print
183
184 ; Start new line
185 call AuxIO_TeletypeNL
186 call AuxIO_TeletypeNL
187
188 ;~ call DEBUG_CheckMath
189
190 ;~ call DEBUG_DumpGeo
191
192
193
194 popa
195 popf
196 ret
197DEBUG_Dump1 EndP
198
199
200DEBUG_DumpBSSSectors Proc Near
201 pushf
202 pusha
203
204 mov si, offset [PartitionSector]
205 call AuxIO_DumpSector
206 call AuxIO_TeletypeNL
207
208 mov si, offset [JfsPBR]
209 call AuxIO_DumpSector
210 call AuxIO_TeletypeNL
211
212 mov si, offset [LVMSector]
213 call AuxIO_DumpSector
214 call AuxIO_TeletypeNL
215
216 mov si, offset [TmpSector]
217 call AuxIO_DumpSector
218 call AuxIO_TeletypeNL
219
220 mov si, offset [NewPartTable]
221 call AuxIO_DumpSector
222 call AuxIO_TeletypeNL
223 call AuxIO_TeletypeNL
224
225 popa
226 popf
227 ret
228
229
230DEBUG_DumpBSSSectors EndP
231
232
233
234
235;
236; Dump information before the partition is booted.
237;
238DEBUG_Dump2 Proc Near
239 pushf
240 pusha
241
242
243 call AuxIO_TeletypeNL
244 call AuxIO_TeletypeNL
245
246
247 mov si,offset db_config
248 call AuxIO_Print
249
250 mov si,offset db_cfgparts
251 call AuxIO_Print
252 mov al,[CFG_Partitions]
253 call AuxIO_TeletypeHexByte
254 call AuxIO_TeletypeNL
255
256 mov si,offset db_cfgpartdef
257 call AuxIO_Print
258 mov al,[CFG_PartDefault]
259 call AuxIO_TeletypeHexByte
260 call AuxIO_TeletypeNL
261
262 mov si,offset db_cfgpartlast
263 call AuxIO_Print
264 mov al,[CFG_PartLast]
265 call AuxIO_TeletypeHexByte
266 call AuxIO_TeletypeNL
267 call AuxIO_TeletypeNL
268
269
270
271 mov si,offset db_vars
272 call AuxIO_Print
273
274 mov si,offset db_newpart
275 call AuxIO_Print
276 mov si,offset NewPartTable
277 call AuxIO_DumpSector
278 call AuxIO_TeletypeNL
279 add si,512
280 call AuxIO_DumpSector
281 call AuxIO_TeletypeNL
282 call AuxIO_TeletypeNL
283
284 mov si,offset db_newhide
285 call AuxIO_Print
286 mov si,offset NewHidePartTable
287 call AuxIO_DumpSector
288 call AuxIO_TeletypeNL
289 add si,512
290 call AuxIO_DumpSector
291 call AuxIO_TeletypeNL
292 call AuxIO_TeletypeNL
293
294 mov si,offset db_dletters
295 call AuxIO_Print
296 mov si,offset NewDriveLetters
297 call AuxIO_DumpParagraph
298 call AuxIO_TeletypeNL
299 add si,16
300 call AuxIO_DumpParagraph
301 call AuxIO_TeletypeNL
302 call AuxIO_TeletypeNL
303
304 mov si,offset db_tmpec
305 call AuxIO_Print
306 mov si,offset TmpSector
307 call AuxIO_DumpSector
308 call AuxIO_TeletypeNL
309 call AuxIO_TeletypeNL
310
311 mov si,offset db_partsec
312 call AuxIO_Print
313 mov si,offset PartitionSector
314 call AuxIO_DumpSector
315 call AuxIO_TeletypeNL
316 call AuxIO_TeletypeNL
317
318 popa
319 popf
320 ret
321DEBUG_Dump2 EndP
322
323
324
325db_mbr db "## MBR ##",10,0
326db_masterlvm db "## MLVMR ##",10,0
327
328db_checkmath db "## CHK MATH ##",10,0
329
330
331db_config db '## CFG (DMP2) ##',10,0
332db_cfgparts db 'CFG_Partitions:',0
333db_cfgpartdef db 'CFG_PartDefault:',0
334db_cfgpartlast db 'CFG_PartLast:',0
335
336
337db_vars db '## VARS ##',10,0
338db_partsec db 'PartitionSector:',10,0
339;db_lvmsec db 'LVMSector :',10,0
340db_tmpec db 'TmpSector :',10,0
341
342db_newpart db 'NewPartTable :',10,0
343db_newhide db 'NewHideTable:',10,0
344db_dletters db 'NewDriveLetters:',10,0
345
346;db_partsize db 'PartitionSizeTable:',10,0
347;db_partpoint db 'PartitionPointers:',10,0
348;db_partpointcnt db 'PartitionPointerCount:',0
349;db_partxref db 'PartitionXref:',10,0
350;db_partvoldl db 'PartitionVolumeLetters:',10,0
351
352;db_totaldisks db 'TotalHarddiscs:',0
353;db_lbaswitchtab db 'LBASwitchTable:',10,0
354;db_newparts db 'NewPartitions:',0
355
356;db_exabspos db 'ExtendedAbsPos:',0
357;db_exabsposset db 'ExtendedAbsPosSet:',0
358
359db_curpartloc db 'CurPartition_Location:',0
360;db_curiox db 'CurIO_UseExtension:',0
361
362db_curlvmsec db 'Current LVM Sector:',0
363
Note: See TracBrowser for help on using the repository browser.