3 * Daniel Engström, Omicron Ceti AB, daniel@omicron.se
5 * See file CREDITS for list of people who contributed to this
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation; either version 2 of
11 * the License, or (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
25 * Based on msbios.c from rolo 1.6:
26 *----------------------------------------------------------------------
28 * Sysgo Real-Time Solutions GmbH
29 * Klein-Winternheim, Germany
30 *----------------------------------------------------------------------
34 * During it's initialization phase, before switching to protected
35 * mode, the Linux Kernel makes a few BIOS calls. This won't work
36 * if the board does not have a BIOS.
38 * This is a very minimalisic BIOS that supplies just enough
39 * functionality to keep the Linux Kernel happy. It is NOT
40 * a general purpose replacement for a real BIOS !!
54 #define OFFS_VECTOR 22
60 #define STACK 0x800 /* stack at 0x40:0x800 -> 0x800 */
200 * All interrupt jumptable entries jump to here
201 * after pushing the interrupt vector number onto the
205 pusha /* save general registers */
206 pushw %ds /* save some segments */
209 pushw %ss /* save callers stack segment .. */
210 popw %gs /* ... in gs */
211 movw $SEGMENT,%ax /* setup my segments */
216 movw $STACK,%sp /* setup BIOS stackpointer */
218 gs movw OFFS_VECTOR(%bp), %ax
231 Lint_10h: /* VGA BIOS services */
237 Lint_13h: /* BIOS disk services */
240 Lint_15h: /* Misc. BIOS services */
243 Lint_16h: /* keyboard services */
250 /* Insert code for unhandeled INTs here.
252 * ROLO prints a message to the console
253 * (we could do that but then we're in 16bit mode
254 * so we'll have to get back into 32bit mode
255 * to use the console I/O routines (if we do this
256 * we shuls make int 0x10 and int 0x16 work as well))
260 pushw %gs /* restore callers stack segment */
262 movw %bp,%sp /* restore stackpointer */
264 popw %es /* restore segment selectors */
268 popa /* restore GP registers */
269 addw $2,%sp /* dump vector number */
270 iret /* return from interrupt */
274 ************************************************************
275 * BIOS interrupt 10h -- VGA services
276 ************************************************************
279 gs movw OFFS_AX(%bp), %ax
289 Lcur_pos: /* Read Cursor Position and Size */
290 gs movw $0, OFFS_CX(%bp)
291 gs movw $0, OFFS_DX(%bp)
294 Lvid_state: /* Get Video State */
295 gs movw $(80 << 8|0x03), OFFS_AX(%bp) /* 80 columns, 80x25, 16 colors */
296 gs movw $0, OFFS_BX(%bp)
299 Lvid_cfg: /* Video Subsystem Configuration (EGA/VGA) */
300 gs movw $0x10, OFFS_BX(%bp) /* indicate CGA/MDA/HGA */
306 ************************************************************
307 * BIOS interrupt 11h -- Equipment determination
308 ************************************************************
312 movw bios_equipment, %ax
313 gs movw %ax, OFFS_AX(%bp)
319 ************************************************************
320 * BIOS interrupt 13h -- Disk services
321 ************************************************************
324 gs movw OFFS_AX(%bp), %ax
331 gs movw OFFS_AX(%bp), %ax
332 andw $0xff, %ax /* return AH=0->drive not present */
333 gs movw %ax, OFFS_AX(%bp)
340 ***********************************************************
341 * BIOS interrupt 15h -- Miscellaneous services
342 ***********************************************************
345 gs movw OFFS_AX(%bp), %ax
356 Lfunc_c0h: /* Return System Configuration Parameters (PS2 only) */
357 gs movw OFFS_FLAGS(%bp), %ax
358 orw $1, %ax /* return carry -- function not supported */
359 gs movw %ax, OFFS_FLAGS(%bp)
364 gs movw OFFS_AX(%bp), %ax
368 gs movw OFFS_FLAGS(%bp), %ax
369 orw $1, %ax /* return carry -- function not supported */
370 gs movw %ax, OFFS_FLAGS(%bp)
374 Lfunc_e801h: /* Get memory size for >64M Configurations */
375 movw $ram_in_64kb_chunks, %ax
378 shlw $6, %ax /* multiply by 64 */
379 gs movw %ax, OFFS_AX(%bp) /* return memory size in 1kb chunks in AX and CX */
380 gs movw %ax, OFFS_CX(%bp)
382 gs movw %ax, OFFS_BX(%bp) /* set BX and DX to 0*/
383 gs movw %ax, OFFS_DX(%bp)
384 gs movw OFFS_FLAGS(%bp), %ax
385 andw $0xfffe, %ax /* clear carry -- function succeeded */
386 gs movw %ax, OFFS_FLAGS(%bp)
391 subw $0x100, %ax /* subtract 16MB */
393 gs movw $0x3c00, OFFS_AX(%bp) /* return 0x3c00 (16MB-384k) in AX and CX */
394 gs movw $0x3c00, OFFS_CX(%bp)
395 gs movw %ax, OFFS_BX(%bp) /* set BX and DX to number of 64kb chunks - 256 */
396 gs movw %ax, OFFS_DX(%bp)
398 gs movw OFFS_FLAGS(%bp), %ax
399 andw $0xfffe, %ax /* clear carry -- function succeeded */
400 gs movw %ax, OFFS_FLAGS(%bp)
405 movw ram_in_64kb_chunks, %ax
409 gs movw %ax, OFFS_AX(%bp) /* return number of kilobytes in ax */
411 gs movw OFFS_FLAGS(%bp), %ax
412 andw $0xfffe, %ax /* clear carry -- function succeeded */
413 gs movw %ax, OFFS_FLAGS(%bp)
420 ************************************************************
421 * BIOS interrupt 16h -- keyboard services
422 ************************************************************
425 gs movw OFFS_AX(%bp), %ax
432 xorw %ax, %ax /* do nothing -- function not supported */
436 .globl ram_in_64kb_chunks
440 .globl bios_equipment