Changeset 667 for GPL/branches/uniaud32-next/drv32/startup.asm
- Timestamp:
- Jan 27, 2021, 9:35:47 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GPL/branches/uniaud32-next/drv32/startup.asm
r655 r667 1040 1040 extrn ALSA_Interrupt : near 1041 1041 extrn _rdOffset: dword 1042 1043 IFDEF KEE1044 1042 extrn KernThunkStackTo16 : near 1045 1043 extrn KernThunkStackTo32 : near 1046 ELSE1047 extrn GetTKSSBase : near1048 extrn StackAlloc : near1049 extrn StackFree : near1050 ENDIF1051 1044 1052 1045 ;Called by Watcom to set the DS … … 1087 1080 ret 1088 1081 DevHlp_ModifiedDS endp 1089 1090 1091 IFNDEF KEE1092 ;;******************************************************************************1093 ;FixSelDPL:1094 ;1095 ; Set DPL of DOS32FLATDS selector to 0 or else we'll get a trap D when loading1096 ; it into the SS register (DPL must equal CPL when loading a selector into SS)1097 ;;******************************************************************************1098 PUBLIC FixSelDPL1099 ALIGN 41100 FixSelDPL proc near1101 cmp fWrongDPL, 11102 jne short @@fixdpl_end1103 cmp SelRef, 01104 jne short @@fixdpl_endfix1105 push eax1106 push ebx1107 push edx1108 sgdt fword ptr [gdtsave] ; access the GDT ptr1109 mov ebx, dword ptr [gdtsave+2] ; get lin addr of GDT1110 mov eax, ds ; build offset into table1111 and eax, 0fffffff8h ; mask away DPL1112 add ebx, eax ; build address1113 1114 mov eax, dword ptr [ebx+4]1115 mov edx, eax1116 shr edx, 131117 and edx, 31118 1119 ;has the OS/2 kernel finally changed the DPL to 0?1120 cmp edx, 01121 jne @@changedpl1122 mov fWrongDPL, 0 ;don't bother anymore1123 mov SelRef, 01124 jmp short @@endchange1125 1126 @@changedpl:1127 mov oldDPL, eax1128 and eax, NOT 6000h ;clear bits 5 & 6 in the high word (DPL)1129 mov dword ptr [ebx+4], eax1130 @@endchange:1131 pop edx1132 pop ebx1133 pop eax1134 @@fixdpl_endfix:1135 inc SelRef1136 @@fixdpl_end:1137 ret1138 FixSelDPL endp1139 ;;******************************************************************************1140 ; RestoreSelDPL:1141 ;1142 ; Restore DPL of DOS32FLATDS selector or else OS/2 kernel code running in ring 31143 ; will trap (during booting only; this sel has a DPL of 0 when PM starts up)1144 ;;******************************************************************************1145 PUBLIC RestoreSelDPL1146 ALIGN 41147 RestoreSelDPL proc near1148 cmp fWrongDPL, 11149 jne short @@restdpl_end1150 1151 cmp SelRef, 11152 jne short @@restdpl_endrest1153 push eax1154 push ebx1155 sgdt fword ptr [gdtsave] ; access the GDT ptr1156 mov ebx, dword ptr [gdtsave+2] ; get lin addr of GDT1157 mov eax, ds ; build offset into table1158 and eax, 0fffffff8h ; mask away DPL1159 add ebx, eax ; build address1160 1161 mov eax, oldDPL1162 mov dword ptr [ebx+4], eax1163 pop ebx1164 pop eax1165 @@restdpl_endrest:1166 dec SelRef1167 @@restdpl_end:1168 ret1169 RestoreSelDPL endp1170 ENDIF1171 1082 1172 1083 ;******************************************************************************* … … 1184 1095 mov ebp, esp 1185 1096 push ebx 1186 1187 1097 lea ebx, [ebp+8] 1188 1098 DevThunkStackTo16_Int 1189 1190 1099 push dword ptr [ebx+16] ;param2 1191 1100 push dword ptr [ebx+12] ;param1 … … 1193 1102 call fword ptr [ebx] 1194 1103 add sp, 12 1195 1196 1104 DevThunkStackTo32_Int 1197 1198 1105 pop ebx 1199 1106 pop ebp … … 1215 1122 mov ds, eax 1216 1123 mov es, eax 1217 IFNDEF KEE1218 ;done in init.cpp for the KEE version1219 cmp dword ptr [intSwitchStack], 01220 jne stratcontinue1221 ;get TKSSBase & intSwitchStack pointers1222 call GetTKSSBase1223 stratcontinue:1224 ENDIF1225 1124 DevThunkStackTo32 1226 cmp eax, 01227 jne @@stackswitchfail_strat1228 1125 call ALSA_STRATEGY 1229 1126 DevThunkStackTo16 1230 @@stackswitchfail_strat:1231 1127 pop gs 1232 1128 pop fs … … 1253 1149 mov es, eax 1254 1150 DevThunkStackTo32 1255 cmp eax, 01256 jne @@stackswitchfail_idc1257 1151 call ALSA_IDC 1258 1152 DevThunkStackTo16 1259 @@stackswitchfail_idc:1260 1153 pop gs 1261 1154 pop fs … … 1281 1174 ENDIF 1282 1175 DevThunkStackTo32 1283 cmp eax, 01284 jne @@stackswitchfail_timer1285 1176 call ALSA_TIMER_ 1286 1177 DevThunkStackTo16 1287 @@stackswitchfail_timer:1288 1178 IFDEF DEBUG 1289 1179 add DbgU32TimerCnt, -1 … … 1322 1212 ;cli 1323 1213 DevThunkStackTo32 1324 cmp eax, 01325 jne @@stackswitchfail_irq1326 1214 ;returns irq status in eax (1=handled; 0=unhandled) 1327 1215 call ALSA_Interrupt 1328 1216 DevThunkStackTo16 1329 @@stackswitchfail_irq:1330 1217 IFDEF DEBUG 1331 1218 add DbgU32IntCnt, -1 … … 1502 1389 _RMHandleToResourceHandleList endp 1503 1390 1391 ; shifted from devhlp.asm 1392 extrn DOSIODELAYCNT : ABS 1393 ALIGN 4 1394 public iodelay32_ 1395 iodelay32_ proc near 1396 mov eax, DOSIODELAYCNT 1397 align 4 1398 @@: dec eax 1399 jnz @b 1400 loop iodelay32_ 1401 ret 1402 iodelay32_ endp 1504 1403 1505 1404 CODE32 ends … … 1530 1429 public _ISR07 1531 1430 1532 IFDEF KEE1533 1431 public stackbase 1534 1432 public stacksel … … 1536 1434 stackbase dd 0 1537 1435 stacksel dd 0 1538 ELSE1539 extrn intSwitchStack : dword1540 1541 public gdtsave1542 public fWrongDPL1543 public oldDPL1544 public SelRef1545 1546 tempeax dd 01547 tempedx dd 01548 tempesi dd 01549 cpuflags dd 01550 1551 gdtsave dq 01552 fWrongDPL dd 1 ;DOS32FLATDS has the wrong DPL for SS1553 SelRef dd 01554 oldDPL dd 01555 1556 fInitStack dd 01557 ENDIF1558 1436 1559 1437 __OffsetFinalCS16 dw OFFSET CODE16:__OffFinalCS16
Note:
See TracChangeset
for help on using the changeset viewer.