Commit 7e6c3f34bf800da6a8db461a6099047905c34f3a
1 parent
39d22439
new bochs BIOS - 16 bit APM support (initial patch by Struan Bartlett)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1352 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
2 changed files
with
57 additions
and
154 deletions
pc-bios/bios.bin
No preview for this file type
pc-bios/bios.diff
| 1 | Index: rombios.c | 1 | Index: rombios.c |
| 2 | =================================================================== | 2 | =================================================================== |
| 3 | RCS file: /cvsroot/bochs/bochs/bios/rombios.c,v | 3 | RCS file: /cvsroot/bochs/bochs/bios/rombios.c,v |
| 4 | -retrieving revision 1.110 | ||
| 5 | -diff -u -w -r1.110 rombios.c | ||
| 6 | ---- rombios.c 31 May 2004 13:11:27 -0000 1.110 | ||
| 7 | -+++ rombios.c 7 Oct 2004 21:23:50 -0000 | ||
| 8 | -@@ -137,6 +137,7 @@ | ||
| 9 | - #define DEBUG_INT16 0 | ||
| 10 | - #define DEBUG_INT1A 0 | ||
| 11 | - #define DEBUG_INT74 0 | ||
| 12 | -+#define DEBUG_APM 0 | ||
| 13 | - | ||
| 14 | - #define BX_CPU 3 | ||
| 15 | - #define BX_USE_PS2_MOUSE 1 | ||
| 16 | -@@ -145,6 +146,7 @@ | ||
| 17 | - #define BX_SUPPORT_FLOPPY 1 | ||
| 18 | - #define BX_FLOPPY_ON_CNT 37 // 2 seconds | ||
| 19 | - #define BX_PCIBIOS 1 | ||
| 20 | -+#define BX_APM 1 | ||
| 21 | - | ||
| 22 | - #define BX_USE_ATADRV 1 | ||
| 23 | - #define BX_ELTORITO_BOOT 1 | ||
| 24 | -@@ -230,17 +232,6 @@ | ||
| 25 | - out dx,ax | ||
| 26 | - MEND | ||
| 27 | - | ||
| 28 | --MACRO HALT2 | ||
| 29 | -- ;; the HALT macro is called with the line number of the HALT call. | ||
| 30 | -- ;; The line number is then sent to the PANIC_PORT, causing Bochs/Plex | ||
| 31 | -- ;; to print a BX_PANIC message. This will normally halt the simulation | ||
| 32 | -- ;; with a message such as "BIOS panic at rombios.c, line 4091". | ||
| 33 | -- ;; However, users can choose to make panics non-fatal and continue. | ||
| 34 | -- mov dx,#PANIC_PORT2 | ||
| 35 | -- mov ax,#?1 | ||
| 36 | -- out dx,ax | ||
| 37 | --MEND | ||
| 38 | -- | ||
| 39 | - MACRO JMP_AP | ||
| 40 | - db 0xea | ||
| 41 | - dw ?2 | ||
| 42 | -@@ -1543,15 +1534,12 @@ | ||
| 43 | - } | ||
| 44 | - | ||
| 45 | - if (action & BIOS_PRINTF_HALT) { | ||
| 46 | -- // freeze in a busy loop. If I do a HLT instruction, then in versions | ||
| 47 | -- // 1.3.pre1 and earlier, it will panic without ever updating the VGA | ||
| 48 | -- // display, so the panic message will not be visible. By waiting | ||
| 49 | -- // forever, you are certain to see the panic message on screen. | ||
| 50 | -- // After a few more versions have passed, we can turn this back into | ||
| 51 | -- // a halt or something. | ||
| 52 | -- // do {} while (1); | ||
| 53 | -+ // freeze in a busy loop. | ||
| 54 | - ASM_START | ||
| 55 | -- HALT2(__LINE__) | ||
| 56 | -+ cli | ||
| 57 | -+ halt2_loop: | ||
| 58 | -+ hlt | ||
| 59 | -+ jmp halt2_loop | ||
| 60 | - ASM_END | ||
| 61 | - } | ||
| 62 | - } | ||
| 63 | -@@ -5412,8 +5400,8 @@ | ||
| 64 | - case 0x03: SET_BL( 0x06 ); break; | ||
| 65 | - } | ||
| 66 | - | ||
| 67 | -- DI = 0xefc7; | ||
| 68 | -- ES = 0xf000; | ||
| 69 | -+ DI = read_word(0x00, 0x1e*4); // INT vector 0x1E | ||
| 70 | -+ ES = read_word(0x00, 0x1e*4+2); | ||
| 71 | - goto int13_success; | ||
| 72 | - break; | ||
| 73 | - | ||
| 74 | -@@ -6984,8 +6972,8 @@ | ||
| 75 | - } | ||
| 76 | - | ||
| 77 | - /* set es & di to point to 11 byte diskette param table in ROM */ | ||
| 78 | -- DI = 0xefc7; | ||
| 79 | -- ES = 0xf000; | ||
| 80 | -+ DI = read_word(0x00, 0x1e*4); // INT vector 0x1E | ||
| 81 | -+ ES = read_word(0x00, 0x1e*4+2); | ||
| 82 | - CLEAR_CF(); // success | ||
| 83 | - /* disk status not changed upon success */ | ||
| 84 | - return; | ||
| 85 | -@@ -7880,7 +7868,7 @@ | ||
| 86 | - mov al, #0x02 | ||
| 87 | - out #0x0a, al ;; clear DMA-1 channel 2 mask bit | ||
| 88 | - | ||
| 89 | -- SET_INT_VECTOR(0x1E, #0xF000, #diskette_param_table) | ||
| 90 | -+ SET_INT_VECTOR(0x1E, #0xF000, #diskette_param_table2) | ||
| 91 | - SET_INT_VECTOR(0x40, #0xF000, #int13_diskette) | ||
| 92 | - SET_INT_VECTOR(0x0E, #0xF000, #int0e_handler) ;; IRQ 6 | ||
| 93 | - | ||
| 94 | -@@ -8344,6 +8332,19 @@ | ||
| 95 | - pop ax | ||
| 96 | - iret | ||
| 97 | - | ||
| 98 | -+ | ||
| 99 | -+;-------------------- | ||
| 100 | -+#if BX_APM | ||
| 101 | -+use32 386 | ||
| 102 | -+#define APM_PROT32 | ||
| 103 | -+#include "apmbios.S" | ||
| 104 | -+use16 386 | 4 | +retrieving revision 1.130 |
| 5 | +diff -u -w -r1.130 rombios.c | ||
| 6 | +--- rombios.c 13 Feb 2005 08:47:30 -0000 1.130 | ||
| 7 | ++++ rombios.c 6 Apr 2005 22:38:16 -0000 | ||
| 8 | +@@ -8570,7 +8570,10 @@ | ||
| 9 | + use32 386 | ||
| 10 | + #define APM_PROT32 | ||
| 11 | + #include "apmbios.S" | ||
| 105 | + | 12 | + |
| 106 | -+#define APM_REAL | 13 | + use16 386 |
| 14 | ++#define APM_PROT16 | ||
| 107 | +#include "apmbios.S" | 15 | +#include "apmbios.S" |
| 108 | -+ | ||
| 109 | -+#endif | ||
| 110 | -+ | ||
| 111 | - ;-------------------- | ||
| 112 | - #if BX_PCIBIOS | ||
| 113 | - use32 386 | ||
| 114 | -@@ -9515,6 +9516,26 @@ | ||
| 115 | - pop ds | ||
| 116 | - iret | ||
| 117 | 16 | ||
| 118 | -+diskette_param_table2: | ||
| 119 | -+;; New diskette parameter table adding 3 parameters from IBM | ||
| 120 | -+;; Since no provisions are made for multiple drive types, most | ||
| 121 | -+;; values in this table are ignored. I set parameters for 1.44M | ||
| 122 | -+;; floppy here | ||
| 123 | -+db 0xAF | ||
| 124 | -+db 0x02 ;; head load time 0000001, DMA used | ||
| 125 | -+db 0x25 | ||
| 126 | -+db 0x02 | ||
| 127 | -+db 18 | ||
| 128 | -+db 0x1B | ||
| 129 | -+db 0xFF | ||
| 130 | -+db 0x6C | ||
| 131 | -+db 0xF6 | ||
| 132 | -+db 0x0F | ||
| 133 | -+db 0x08 | ||
| 134 | -+db 79 ;; maximum track | ||
| 135 | -+db 0 ;; data transfer rate | ||
| 136 | -+db 4 ;; drive type in cmos | 17 | + #define APM_REAL |
| 18 | + #include "apmbios.S" | ||
| 19 | +Index: apmbios.S | ||
| 20 | +=================================================================== | ||
| 21 | +RCS file: /cvsroot/bochs/bochs/bios/apmbios.S,v | ||
| 22 | +retrieving revision 1.1 | ||
| 23 | +diff -u -w -r1.1 apmbios.S | ||
| 24 | +--- apmbios.S 20 Jun 2004 18:27:09 -0000 1.1 | ||
| 25 | ++++ apmbios.S 6 Apr 2005 22:38:16 -0000 | ||
| 26 | +@@ -1,6 +1,9 @@ | ||
| 27 | + // APM BIOS support for the Bochs BIOS | ||
| 28 | + // Copyright (C) 2004 Fabrice Bellard | ||
| 29 | + // | ||
| 30 | ++// 16-bit interface activation | ||
| 31 | ++// Copyright (C) 2005 Struan Bartlett | ||
| 32 | ++// | ||
| 33 | + // This library is free software; you can redistribute it and/or | ||
| 34 | + // modify it under the terms of the GNU Lesser General Public | ||
| 35 | + // License as published by the Free Software Foundation; either | ||
| 36 | +@@ -111,13 +114,28 @@ | ||
| 37 | + mov bl, #0x4d // 'M' | ||
| 38 | + // bit 0 : 16 bit interface supported | ||
| 39 | + // bit 1 : 32 bit interface supported | ||
| 40 | +- mov cx, #0x2 | ||
| 41 | ++ mov cx, #0x3 | ||
| 42 | + jmp APMSYM(ok) | ||
| 43 | + | ||
| 44 | + ;----------------- | ||
| 45 | + ; APM real mode interface connect | ||
| 46 | + APMSYM(01): | ||
| 47 | + cmp al, #0x01 | ||
| 48 | ++ jne APMSYM(02) | ||
| 49 | ++ jmp APMSYM(ok) | ||
| 50 | ++ | ||
| 51 | ++;----------------- | ||
| 52 | ++; APM 16 bit protected mode interface connect | ||
| 53 | ++APMSYM(02): | ||
| 54 | ++ cmp al, #0x02 | ||
| 55 | ++ jne APMSYM(03) | ||
| 137 | + | 56 | + |
| 138 | - .org 0xf045 ; INT 10 Functions 0-Fh Entry Point | ||
| 139 | - HALT(__LINE__) | ||
| 140 | - iret | ||
| 141 | -@@ -9560,6 +9581,10 @@ | ||
| 142 | - .org 0xf859 ; INT 15h System Services Entry Point | ||
| 143 | - int15_handler: | ||
| 144 | - pushf | ||
| 145 | -+#if BX_APM | ||
| 146 | -+ cmp ah, #0x53 | ||
| 147 | -+ je apm_call | ||
| 148 | -+#endif | ||
| 149 | - push ds | ||
| 150 | - push es | ||
| 151 | - pushad | ||
| 152 | -@@ -9570,6 +9595,10 @@ | ||
| 153 | - popf | ||
| 154 | - //JMPL(iret_modify_cf) | ||
| 155 | - jmp iret_modify_cf | ||
| 156 | -+#if BX_APM | ||
| 157 | -+apm_call: | ||
| 158 | -+ jmp _apmreal_entry | ||
| 159 | -+#endif | 57 | ++ mov bx, #_apm16_entry |
| 58 | ++ | ||
| 59 | ++ mov ax, #0xf000 // 16 bit code segment base | ||
| 60 | ++ mov si, #0xfff0 // 16 bit code segment size | ||
| 61 | ++ mov cx, #0xf000 // data segment address | ||
| 62 | ++ mov di, #0xfff0 // data segment length | ||
| 63 | + jne APMSYM(03) | ||
| 64 | + jmp APMSYM(ok) | ||
| 160 | 65 | ||
| 161 | - ;; Protected mode IDT descriptor | ||
| 162 | - ;; |