2f031e5d10236e99e3dc8a41438820ebe473cff9
[coreboot.git] / src / arch / i386 / lib / console.inc
1 #include <console/loglevel.h>
2
3 jmp     console0
4
5 #define __STR(X) #X
6 #define STR(X) __STR(X)
7
8 #ifndef  LINUXBIOS_EXTRA_VERSION
9 #define LINUXBIOS_EXTRA_VERSION
10 #endif
11
12 #ifndef ASM_CONSOLE_LOGLEVEL
13 #define ASM_CONSOLE_LOGLEVEL 5
14 #endif
15 console_test:
16         .ascii  "\r\n\r\nLinuxBIOS-"
17         .ascii  STR(LINUXBIOS_VERSION)
18         .ascii  STR(LINUXBIOS_EXTRA_VERSION)
19         .ascii  " "
20         .ascii  STR(LINUXBIOS_BUILD)
21         .asciz  " starting...\r\n"
22
23 #undef STR
24         /* uses:        ax, dx */
25 #if CONFIG_CONSOLE_SERIAL8250
26 #define __CONSOLE_INLINE_TX_AL TTYS0_TX_AL
27 #else
28 #define __CONSOLE_INLINE_TX_AL
29 #endif
30
31         /* uses:        esp, ax, dx */
32 #define __CONSOLE_TX_CHAR(byte) \
33         mov     byte, %al       ; \
34         CALLSP(console_tx_al)
35
36         /* uses:         ax, dx */
37 #define __CONSOLE_INLINE_TX_CHAR(byte)  \
38         mov     byte, %al       ; \
39         __CONSOLE_INLINE_TX_AL
40
41         /* uses:        esp, ax, edx */
42 #define __CONSOLE_TX_HEX8(byte) \
43         mov     byte, %al       ; \
44         CALLSP(console_tx_hex8)
45
46         /* uses:         byte, ax, dx */
47 #define __CONSOLE_INLINE_TX_HEX8(byte)  \
48         movb    byte, %dl       ; \
49         shll    $16, %edx       ; \
50         shr     $4, %al         ; \
51         add     $'0', %al       ; \
52         cmp     $'9', %al       ; \
53         jle     9f              ; \
54         add     $39, %al        ; \
55 9:                              ; \
56         __CONSOLE_INLINE_TX_AL  ; \
57         shrl    $16, %edx       ; \
58         movb    %dl, %al        ; \
59         and     $0x0f, %al      ; \
60         add     $'0', %al       ; \
61         cmp     $'9', %al       ; \
62         jle     9f              ; \
63         add     $39, %al        ; \
64 9:                              ; \
65         __CONSOLE_INLINE_TX_AL
66
67         /* uses:        esp, eax, ebx, dx */
68 #define __CONSOLE_TX_HEX32(lword)       \
69         mov     lword, %eax     ; \
70         CALLSP(console_tx_hex32)
71
72         /* uses:        eax, lword, dx */
73 #define __CONSOLE_INLINE_TX_HEX32(lword)        \
74         mov     lword, %eax     ; \
75         shr     $28, %eax       ; \
76         add     $'0', %al       ; \
77         cmp     $'9', %al       ; \
78         jle     9f              ; \
79         add     $39, %al        ; \
80 9:                              ; \
81         __CONSOLE_INLINE_TX_AL          ; \
82                                 ; \
83         mov     lword, %eax     ; \
84         shr     $24, %eax       ; \
85         and     $0x0f, %al      ; \
86         add     $'0', %al       ; \
87         cmp     $'9', %al       ; \
88         jle     9f              ; \
89         add     $39, %al        ; \
90 9:                              ; \
91         __CONSOLE_INLINE_TX_AL          ; \
92                                 ; \
93         mov     lword, %eax     ; \
94         shr     $20, %eax       ; \
95         and     $0x0f, %al      ; \
96         add     $'0', %al       ; \
97         cmp     $'9', %al       ; \
98         jle     9f              ; \
99         add     $39, %al        ; \
100 9:                              ; \
101         __CONSOLE_INLINE_TX_AL          ; \
102                                 ; \
103         mov     lword, %eax     ; \
104         shr     $16, %eax       ; \
105         and     $0x0f, %al      ; \
106         add     $'0', %al       ; \
107         cmp     $'9', %al       ; \
108         jle     9f              ; \
109         add     $39, %al        ; \
110 9:                              ; \
111         __CONSOLE_INLINE_TX_AL          ; \
112                                 ; \
113         mov     lword, %eax     ; \
114         shr     $12, %eax       ; \
115         and     $0x0f, %al      ; \
116         add     $'0', %al       ; \
117         cmp     $'9', %al       ; \
118         jle     9f              ; \
119         add     $39, %al        ; \
120 9:                              ; \
121         __CONSOLE_INLINE_TX_AL          ; \
122                                 ; \
123         mov     lword, %eax     ; \
124         shr     $8, %eax        ; \
125         and     $0x0f, %al      ; \
126         add     $'0', %al       ; \
127         cmp     $'9', %al       ; \
128         jle     9f              ; \
129         add     $39, %al        ; \
130 9:                              ; \
131         __CONSOLE_INLINE_TX_AL          ; \
132                                 ; \
133         mov     lword, %eax     ; \
134         shr     $4, %eax        ; \
135         and     $0x0f, %al      ; \
136         add     $'0', %al       ; \
137         cmp     $'9', %al       ; \
138         jle     9f              ; \
139         add     $39, %al        ; \
140 9:                              ; \
141         __CONSOLE_INLINE_TX_AL          ; \
142                                 ; \
143         mov     lword, %eax     ; \
144         and     $0x0f, %al      ; \
145         add     $'0', %al       ; \
146         cmp     $'9', %al       ; \
147         jle     9f              ; \
148         add     $39, %al        ; \
149 9:                              ; \
150         __CONSOLE_INLINE_TX_AL
151
152
153         /* uses:         esp, ebx, ax, dx */
154 #define __CONSOLE_TX_STRING(string)     \
155         mov     string, %ebx    ; \
156         CALLSP(console_tx_string)
157
158         /* uses:         ebx, ax, dx */
159 #define __CONSOLE_INLINE_TX_STRING(string)      \
160         movl    string, %ebx    ; \
161 10:     movb    (%ebx), %al     ; \
162         incl    %ebx            ; \
163         testb   %al, %al        ; \
164         jz      11f             ; \
165         __CONSOLE_INLINE_TX_AL  ; \
166         jmp     10b             ; \
167 11:     
168
169
170 #define CONSOLE_EMERG_TX_CHAR(byte)            __CONSOLE_TX_CHAR(byte)
171 #define CONSOLE_EMERG_INLINE_TX_CHAR(byte)     __CONSOLE_INLINE_TX_CHAR(byte)
172 #define CONSOLE_EMERG_TX_HEX8(byte)            __CONSOLE_TX_HEX8(byte)
173 #define CONSOLE_EMERG_INLINE_TX_HEX8(byte)     __CONSOLE_INLINE_TX_HEX8(byte)
174 #define CONSOLE_EMERG_TX_HEX32(lword)          __CONSOLE_TX_HEX32(lword)
175 #define CONSOLE_EMERG_INLINE_TX_HEX32(lword)   __CONSOLE_INLINE_TX_HEX32(lword)
176 #define CONSOLE_EMERG_TX_STRING(string)        __CONSOLE_TX_STRING(string)
177 #define CONSOLE_EMERG_INLINE_TX_STRING(string) __CONSOLE_INLINE_TX_STRING(string)
178
179 #define CONSOLE_ALERT_TX_CHAR(byte)            __CONSOLE_TX_CHAR(byte)
180 #define CONSOLE_ALERT_INLINE_TX_CHAR(byte)     __CONSOLE_INLINE_TX_CHAR(byte)
181 #define CONSOLE_ALERT_TX_HEX8(byte)            __CONSOLE_TX_HEX8(byte)
182 #define CONSOLE_ALERT_INLINE_TX_HEX8(byte)     __CONSOLE_INLINE_TX_HEX8(byte)
183 #define CONSOLE_ALERT_TX_HEX32(lword)          __CONSOLE_TX_HEX32(lword)
184 #define CONSOLE_ALERT_INLINE_TX_HEX32(lword)   __CONSOLE_INLINE_TX_HEX32(lword)
185 #define CONSOLE_ALERT_TX_STRING(string)        __CONSOLE_TX_STRING(string)
186 #define CONSOLE_ALERT_INLINE_TX_STRING(string) __CONSOLE_INLINE_TX_STRING(string)
187
188 #define CONSOLE_CRIT_TX_CHAR(byte)            __CONSOLE_TX_CHAR(byte)
189 #define CONSOLE_CRIT_INLINE_TX_CHAR(byte)     __CONSOLE_INLINE_TX_CHAR(byte)
190 #define CONSOLE_CRIT_TX_HEX8(byte)            __CONSOLE_TX_HEX8(byte)
191 #define CONSOLE_CRIT_INLINE_TX_HEX8(byte)     __CONSOLE_INLINE_TX_HEX8(byte)
192 #define CONSOLE_CRIT_TX_HEX32(lword)          __CONSOLE_TX_HEX32(lword)
193 #define CONSOLE_CRIT_INLINE_TX_HEX32(lword)   __CONSOLE_INLINE_TX_HEX32(lword)
194 #define CONSOLE_CRIT_TX_STRING(string)        __CONSOLE_TX_STRING(string)
195 #define CONSOLE_CRIT_INLINE_TX_STRING(string) __CONSOLE_INLINE_TX_STRING(string)
196
197 #define CONSOLE_ERR_TX_CHAR(byte)            __CONSOLE_TX_CHAR(byte)
198 #define CONSOLE_ERR_INLINE_TX_CHAR(byte)     __CONSOLE_INLINE_TX_CHAR(byte)
199 #define CONSOLE_ERR_TX_HEX8(byte)            __CONSOLE_TX_HEX8(byte)
200 #define CONSOLE_ERR_INLINE_TX_HEX8(byte)     __CONSOLE_INLINE_TX_HEX8(byte)
201 #define CONSOLE_ERR_TX_HEX32(lword)          __CONSOLE_TX_HEX32(lword)
202 #define CONSOLE_ERR_INLINE_TX_HEX32(lword)   __CONSOLE_INLINE_TX_HEX32(lword)
203 #define CONSOLE_ERR_TX_STRING(string)        __CONSOLE_TX_STRING(string)
204 #define CONSOLE_ERR_INLINE_TX_STRING(string) __CONSOLE_INLINE_TX_STRING(string)
205
206 #define CONSOLE_WARNING_TX_CHAR(byte)            __CONSOLE_TX_CHAR(byte)
207 #define CONSOLE_WARNING_INLINE_TX_CHAR(byte)     __CONSOLE_INLINE_TX_CHAR(byte)
208 #define CONSOLE_WARNING_TX_HEX8(byte)            __CONSOLE_TX_HEX8(byte)
209 #define CONSOLE_WARNING_INLINE_TX_HEX8(byte)     __CONSOLE_INLINE_TX_HEX8(byte)
210 #define CONSOLE_WARNING_TX_HEX32(lword)          __CONSOLE_TX_HEX32(lword)
211 #define CONSOLE_WARNING_INLINE_TX_HEX32(lword)   __CONSOLE_INLINE_TX_HEX32(lword)
212 #define CONSOLE_WARNING_TX_STRING(string)        __CONSOLE_TX_STRING(string)
213 #define CONSOLE_WARNING_INLINE_TX_STRING(string) __CONSOLE_INLINE_TX_STRING(string)
214
215 #define CONSOLE_NOTICE_TX_CHAR(byte)            __CONSOLE_TX_CHAR(byte)
216 #define CONSOLE_NOTICE_INLINE_TX_CHAR(byte)     __CONSOLE_INLINE_TX_CHAR(byte)
217 #define CONSOLE_NOTICE_TX_HEX8(byte)            __CONSOLE_TX_HEX8(byte)
218 #define CONSOLE_NOTICE_INLINE_TX_HEX8(byte)     __CONSOLE_INLINE_TX_HEX8(byte)
219 #define CONSOLE_NOTICE_TX_HEX32(lword)          __CONSOLE_TX_HEX32(lword)
220 #define CONSOLE_NOTICE_INLINE_TX_HEX32(lword)   __CONSOLE_INLINE_TX_HEX32(lword)
221 #define CONSOLE_NOTICE_TX_STRING(string)        __CONSOLE_TX_STRING(string)
222 #define CONSOLE_NOTICE_INLINE_TX_STRING(string) __CONSOLE_INLINE_TX_STRING(string)
223
224 #define CONSOLE_INFO_TX_CHAR(byte)            __CONSOLE_TX_CHAR(byte)
225 #define CONSOLE_INFO_INLINE_TX_CHAR(byte)     __CONSOLE_INLINE_TX_CHAR(byte)
226 #define CONSOLE_INFO_TX_HEX8(byte)            __CONSOLE_TX_HEX8(byte)
227 #define CONSOLE_INFO_INLINE_TX_HEX8(byte)     __CONSOLE_INLINE_TX_HEX8(byte)
228 #define CONSOLE_INFO_TX_HEX32(lword)          __CONSOLE_TX_HEX32(lword)
229 #define CONSOLE_INFO_INLINE_TX_HEX32(lword)   __CONSOLE_INLINE_TX_HEX32(lword)
230 #define CONSOLE_INFO_TX_STRING(string)        __CONSOLE_TX_STRING(string)
231 #define CONSOLE_INFO_INLINE_TX_STRING(string) __CONSOLE_INLINE_TX_STRING(string)
232
233 #define CONSOLE_DEBUG_TX_CHAR(byte)            __CONSOLE_TX_CHAR(byte)
234 #define CONSOLE_DEBUG_INLINE_TX_CHAR(byte)     __CONSOLE_INLINE_TX_CHAR(byte)
235 #define CONSOLE_DEBUG_TX_HEX8(byte)            __CONSOLE_TX_HEX8(byte)
236 #define CONSOLE_DEBUG_INLINE_TX_HEX8(byte)     __CONSOLE_INLINE_TX_HEX8(byte)
237 #define CONSOLE_DEBUG_TX_HEX32(lword)          __CONSOLE_TX_HEX32(lword)
238 #define CONSOLE_DEBUG_INLINE_TX_HEX32(lword)   __CONSOLE_INLINE_TX_HEX32(lword)
239 #define CONSOLE_DEBUG_TX_STRING(string)        __CONSOLE_TX_STRING(string)
240 #define CONSOLE_DEBUG_INLINE_TX_STRING(string) __CONSOLE_INLINE_TX_STRING(string)
241
242 #define CONSOLE_SPEW_TX_CHAR(byte)            __CONSOLE_TX_CHAR(byte)
243 #define CONSOLE_SPEW_INLINE_TX_CHAR(byte)     __CONSOLE_INLINE_TX_CHAR(byte)
244 #define CONSOLE_SPEW_TX_HEX8(byte)            __CONSOLE_TX_HEX8(byte)
245 #define CONSOLE_SPEW_INLINE_TX_HEX8(byte)     __CONSOLE_INLINE_TX_HEX8(byte)
246 #define CONSOLE_SPEW_TX_HEX32(lword)          __CONSOLE_TX_HEX32(lword)
247 #define CONSOLE_SPEW_INLINE_TX_HEX32(lword)   __CONSOLE_INLINE_TX_HEX32(lword)
248 #define CONSOLE_SPEW_TX_STRING(string)        __CONSOLE_TX_STRING(string)
249 #define CONSOLE_SPEW_INLINE_TX_STRING(string) __CONSOLE_INLINE_TX_STRING(string)
250
251 #if ASM_CONSOLE_LOGLEVEL <= BIOS_EMERG
252 #undef  CONSOLE_EMERG_TX_CHAR
253 #undef  CONSOLE_EMERG_INLINE_TX_CHAR
254 #undef  CONSOLE_EMERG_TX_HEX8
255 #undef  CONSOLE_EMERG_INLINE_TX_HEX8
256 #undef  CONSOLE_EMERG_TX_HEX32
257 #undef  CONSOLE_EMERG_INLINE_TX_HEX32
258 #undef  CONSOLE_EMERG_TX_STRING
259 #undef  CONSOLE_EMERG_INLINE_TX_STRING
260 #define CONSOLE_EMERG_TX_CHAR(byte)            
261 #define CONSOLE_EMERG_INLINE_TX_CHAR(byte)     
262 #define CONSOLE_EMERG_TX_HEX8(byte)            
263 #define CONSOLE_EMERG_INLINE_TX_HEX8(byte)     
264 #define CONSOLE_EMERG_TX_HEX32(lword)          
265 #define CONSOLE_EMERG_INLINE_TX_HEX32(lword)   
266 #define CONSOLE_EMERG_TX_STRING(string)        
267 #define CONSOLE_EMERG_INLINE_TX_STRING(string) 
268 #endif
269
270
271 #if ASM_CONSOLE_LOGLEVEL <= BIOS_ALERT
272 #undef  CONSOLE_ALERT_TX_CHAR
273 #undef  CONSOLE_ALERT_INLINE_TX_CHAR
274 #undef  CONSOLE_ALERT_TX_HEX8
275 #undef  CONSOLE_ALERT_INLINE_TX_HEX8
276 #undef  CONSOLE_ALERT_TX_HEX32
277 #undef  CONSOLE_ALERT_INLINE_TX_HEX32
278 #undef  CONSOLE_ALERT_TX_STRING
279 #undef  CONSOLE_ALERT_INLINE_TX_STRING
280 #define CONSOLE_ALERT_TX_CHAR(byte)            
281 #define CONSOLE_ALERT_INLINE_TX_CHAR(byte)     
282 #define CONSOLE_ALERT_TX_HEX8(byte)            
283 #define CONSOLE_ALERT_INLINE_TX_HEX8(byte)     
284 #define CONSOLE_ALERT_TX_HEX32(lword)          
285 #define CONSOLE_ALERT_INLINE_TX_HEX32(lword)   
286 #define CONSOLE_ALERT_TX_STRING(string)        
287 #define CONSOLE_ALERT_INLINE_TX_STRING(string) 
288 #endif
289
290 #if ASM_CONSOLE_LOGLEVEL <= BIOS_CRIT
291 #undef  CONSOLE_CRIT_TX_CHAR
292 #undef  CONSOLE_CRIT_INLINE_TX_CHAR
293 #undef  CONSOLE_CRIT_TX_HEX8
294 #undef  CONSOLE_CRIT_INLINE_TX_HEX8
295 #undef  CONSOLE_CRIT_TX_HEX32
296 #undef  CONSOLE_CRIT_INLINE_TX_HEX32
297 #undef  CONSOLE_CRIT_TX_STRING
298 #undef  CONSOLE_CRIT_INLINE_TX_STRING
299 #define CONSOLE_CRIT_TX_CHAR(byte)            
300 #define CONSOLE_CRIT_INLINE_TX_CHAR(byte)     
301 #define CONSOLE_CRIT_TX_HEX8(byte)            
302 #define CONSOLE_CRIT_INLINE_TX_HEX8(byte)     
303 #define CONSOLE_CRIT_TX_HEX32(lword)          
304 #define CONSOLE_CRIT_INLINE_TX_HEX32(lword)   
305 #define CONSOLE_CRIT_TX_STRING(string)        
306 #define CONSOLE_CRIT_INLINE_TX_STRING(string) 
307 #endif
308
309 #if ASM_CONSOLE_LOGLEVEL <= BIOS_ERR
310 #undef  CONSOLE_ERR_TX_CHAR
311 #undef  CONSOLE_ERR_INLINE_TX_CHAR
312 #undef  CONSOLE_ERR_TX_HEX8
313 #undef  CONSOLE_ERR_INLINE_TX_HEX8
314 #undef  CONSOLE_ERR_TX_HEX32
315 #undef  CONSOLE_ERR_INLINE_TX_HEX32
316 #undef  CONSOLE_ERR_TX_STRING
317 #undef  CONSOLE_ERR_INLINE_TX_STRING
318 #define CONSOLE_ERR_TX_CHAR(byte)            
319 #define CONSOLE_ERR_INLINE_TX_CHAR(byte)     
320 #define CONSOLE_ERR_TX_HEX8(byte)            
321 #define CONSOLE_ERR_INLINE_TX_HEX8(byte)     
322 #define CONSOLE_ERR_TX_HEX32(lword)          
323 #define CONSOLE_ERR_INLINE_TX_HEX32(lword)   
324 #define CONSOLE_ERR_TX_STRING(string)        
325 #define CONSOLE_ERR_INLINE_TX_STRING(string) 
326 #endif
327
328 #if ASM_CONSOLE_LOGLEVEL <= BIOS_WARNING
329 #undef  CONSOLE_WARNING_TX_CHAR
330 #undef  CONSOLE_WARNING_INLINE_TX_CHAR
331 #undef  CONSOLE_WARNING_TX_HEX8
332 #undef  CONSOLE_WARNING_INLINE_TX_HEX8
333 #undef  CONSOLE_WARNING_TX_HEX32
334 #undef  CONSOLE_WARNING_INLINE_TX_HEX32
335 #undef  CONSOLE_WARNING_TX_STRING
336 #undef  CONSOLE_WARNING_INLINE_TX_STRING
337 #define CONSOLE_WARNING_TX_CHAR(byte)            
338 #define CONSOLE_WARNING_INLINE_TX_CHAR(byte)     
339 #define CONSOLE_WARNING_TX_HEX8(byte)            
340 #define CONSOLE_WARNING_INLINE_TX_HEX8(byte)     
341 #define CONSOLE_WARNING_TX_HEX32(lword)          
342 #define CONSOLE_WARNING_INLINE_TX_HEX32(lword)   
343 #define CONSOLE_WARNING_TX_STRING(string)        
344 #define CONSOLE_WARNING_INLINE_TX_STRING(string) 
345 #endif
346
347 #if ASM_CONSOLE_LOGLEVEL <= BIOS_NOTICE
348 #undef  CONSOLE_NOTICE_TX_CHAR
349 #undef  CONSOLE_NOTICE_INLINE_TX_CHAR
350 #undef  CONSOLE_NOTICE_TX_HEX8
351 #undef  CONSOLE_NOTICE_INLINE_TX_HEX8
352 #undef  CONSOLE_NOTICE_TX_HEX32
353 #undef  CONSOLE_NOTICE_INLINE_TX_HEX32
354 #undef  CONSOLE_NOTICE_TX_STRING
355 #undef  CONSOLE_NOTICE_INLINE_TX_STRING
356 #define CONSOLE_NOTICE_TX_CHAR(byte)            
357 #define CONSOLE_NOTICE_INLINE_TX_CHAR(byte)     
358 #define CONSOLE_NOTICE_TX_HEX8(byte)            
359 #define CONSOLE_NOTICE_INLINE_TX_HEX8(byte)     
360 #define CONSOLE_NOTICE_TX_HEX32(lword)          
361 #define CONSOLE_NOTICE_INLINE_TX_HEX32(lword)   
362 #define CONSOLE_NOTICE_TX_STRING(string)        
363 #define CONSOLE_NOTICE_INLINE_TX_STRING(string) 
364 #endif
365
366 #if ASM_CONSOLE_LOGLEVEL <= BIOS_INFO
367 #undef  CONSOLE_INFO_TX_CHAR
368 #undef  CONSOLE_INFO_INLINE_TX_CHAR
369 #undef  CONSOLE_INFO_TX_HEX8
370 #undef  CONSOLE_INFO_INLINE_TX_HEX8
371 #undef  CONSOLE_INFO_TX_HEX32
372 #undef  CONSOLE_INFO_INLINE_TX_HEX32
373 #undef  CONSOLE_INFO_TX_STRING
374 #undef  CONSOLE_INFO_INLINE_TX_STRING
375 #define CONSOLE_INFO_TX_CHAR(byte)            
376 #define CONSOLE_INFO_INLINE_TX_CHAR(byte)     
377 #define CONSOLE_INFO_TX_HEX8(byte)            
378 #define CONSOLE_INFO_INLINE_TX_HEX8(byte)     
379 #define CONSOLE_INFO_TX_HEX32(lword)          
380 #define CONSOLE_INFO_INLINE_TX_HEX32(lword)   
381 #define CONSOLE_INFO_TX_STRING(string)        
382 #define CONSOLE_INFO_INLINE_TX_STRING(string) 
383 #endif
384
385 #if ASM_CONSOLE_LOGLEVEL <= BIOS_DEBUG
386 #undef  CONSOLE_DEBUG_TX_CHAR
387 #undef  CONSOLE_DEBUG_INLINE_TX_CHAR
388 #undef  CONSOLE_DEBUG_TX_HEX8
389 #undef  CONSOLE_DEBUG_INLINE_TX_HEX8
390 #undef  CONSOLE_DEBUG_TX_HEX32
391 #undef  CONSOLE_DEBUG_INLINE_TX_HEX32
392 #undef  CONSOLE_DEBUG_TX_STRING
393 #undef  CONSOLE_DEBUG_INLINE_TX_STRING
394 #define CONSOLE_DEBUG_TX_CHAR(byte)            
395 #define CONSOLE_DEBUG_INLINE_TX_CHAR(byte)     
396 #define CONSOLE_DEBUG_TX_HEX8(byte)            
397 #define CONSOLE_DEBUG_INLINE_TX_HEX8(byte)     
398 #define CONSOLE_DEBUG_TX_HEX32(lword)          
399 #define CONSOLE_DEBUG_INLINE_TX_HEX32(lword)   
400 #define CONSOLE_DEBUG_TX_STRING(string)        
401 #define CONSOLE_DEBUG_INLINE_TX_STRING(string) 
402 #endif
403
404 #if ASM_CONSOLE_LOGLEVEL <= BIOS_SPEW
405 #undef  CONSOLE_SPEW_TX_CHAR
406 #undef  CONSOLE_SPEW_INLINE_TX_CHAR
407 #undef  CONSOLE_SPEW_TX_HEX8
408 #undef  CONSOLE_SPEW_INLINE_TX_HEX8
409 #undef  CONSOLE_SPEW_TX_HEX32
410 #undef  CONSOLE_SPEW_INLINE_TX_HEX32
411 #undef  CONSOLE_SPEW_TX_STRING
412 #undef  CONSOLE_SPEW_INLINE_TX_STRING
413 #define CONSOLE_SPEW_TX_CHAR(byte)            
414 #define CONSOLE_SPEW_INLINE_TX_CHAR(byte)     
415 #define CONSOLE_SPEW_TX_HEX8(byte)            
416 #define CONSOLE_SPEW_INLINE_TX_HEX8(byte)     
417 #define CONSOLE_SPEW_TX_HEX32(lword)          
418 #define CONSOLE_SPEW_INLINE_TX_HEX32(lword)   
419 #define CONSOLE_SPEW_TX_STRING(string)        
420 #define CONSOLE_SPEW_INLINE_TX_STRING(string) 
421 #endif
422
423
424         /* uses:        esp, ax, dx */
425 console_tx_al:  
426         __CONSOLE_INLINE_TX_AL
427         RETSP
428
429         /* uses:         esp, ax, edx */
430 console_tx_hex8:
431         __CONSOLE_INLINE_TX_HEX8(%al)
432         RETSP
433
434
435         /* uses:         esp, ebx, eax, dx */
436 console_tx_hex32:
437         mov     %eax, %ebx
438         shr     $28, %eax
439         add     $'0', %al
440         cmp     $'9', %al
441         jle     9f
442         add     $39, %al
443 9:
444         __CONSOLE_INLINE_TX_AL
445
446         mov     %ebx, %eax
447         shr     $24, %eax
448         and     $0x0f, %al
449         add     $'0', %al
450         cmp     $'9', %al
451         jle     9f
452         add     $39, %al
453 9:
454         __CONSOLE_INLINE_TX_AL
455
456         mov     %ebx, %eax
457         shr     $20, %eax
458         and     $0x0f, %al
459         add     $'0', %al
460         cmp     $'9', %al
461         jle     9f
462         add     $39, %al
463 9:
464         __CONSOLE_INLINE_TX_AL
465
466         mov     %ebx, %eax
467         shr     $16, %eax
468         and     $0x0f, %al
469         add     $'0', %al
470         cmp     $'9', %al
471         jle     9f
472         add     $39, %al
473 9:
474         __CONSOLE_INLINE_TX_AL
475
476         mov     %ebx, %eax
477         shr     $12, %eax
478         and     $0x0f, %al
479         add     $'0', %al
480         cmp     $'9', %al
481         jle     9f
482         add     $39, %al
483 9:
484         __CONSOLE_INLINE_TX_AL
485
486         mov     %ebx, %eax
487         shr     $8, %eax
488         and     $0x0f, %al
489         add     $'0', %al
490         cmp     $'9', %al
491         jle     9f
492         add     $39, %al
493 9:
494         __CONSOLE_INLINE_TX_AL
495
496         mov     %ebx, %eax
497         shr     $4, %eax
498         and     $0x0f, %al
499         add     $'0', %al
500         cmp     $'9', %al
501         jle     9f
502         add     $39, %al
503 9:
504         __CONSOLE_INLINE_TX_AL
505
506         mov     %ebx, %eax
507         and     $0x0f, %al
508         add     $'0', %al
509         cmp     $'9', %al
510         jle     9f
511         add     $39, %al
512 9:
513         __CONSOLE_INLINE_TX_AL
514         RETSP
515
516         /* Uses esp, ebx, ax, dx  */
517
518 console_tx_string:
519         mov     (%ebx), %al
520         inc     %ebx
521         cmp     $0, %al
522         jne     9f
523         RETSP
524 9:      
525         __CONSOLE_INLINE_TX_AL
526         jmp     console_tx_string
527
528 console0:
529         CONSOLE_INFO_TX_STRING($console_test)
530