]> git.pld-linux.org Git - packages/dosemu.git/blob - pmstack.diff
98200010f8f0520cbbf8596640666d9485f93714
[packages/dosemu.git] / pmstack.diff
1 --- src/base/dev/pic/pic.c      Tue Mar 19 19:45:50 2002
2 +++ src/base/dev/pic/pic.c      Tue Mar 19 19:54:14 2002
3 @@ -806,7 +806,7 @@
4  #endif
5       if(pic_ilevel < 16) pic_push(pic_ilevel);
6       if (in_dpmi) {
7 -      run_pm_int(intr);
8 +      run_pm_int(intr, 1);
9       } else {
10  #ifndef USE_NEW_INT
11        pic_cli();
12 --- src/dosext/dpmi/dpmi.h      Tue Mar 19 19:45:49 2002
13 +++ src/dosext/dpmi/dpmi.h      Tue Mar 19 19:56:56 2002
14 @@ -37,6 +37,7 @@
15  EXTERN int in_win31 INIT(0);       /* Set to 1 when running Windows 3.1 */
16  EXTERN int dpmi_eflags INIT(0);    /* used for virtual interruptflag and pending interrupts */
17  EXTERN int in_dpmi_dos_int INIT(0);
18 +EXTERN int in_dpmi_hw_int INIT(0);
19  EXTERN int in_dpmi_timer_int INIT(0);
20  EXTERN int dpmi_mhp_TF INIT(0);
21  EXTERN unsigned char dpmi_mhp_intxxtab[256] INIT({0});
22 @@ -47,7 +48,7 @@
23  void dpmi_fault(struct sigcontext_struct *);
24  #endif
25  void dpmi_realmode_hlt(unsigned char *);
26 -void run_pm_int(int);
27 +void run_pm_int(int, int);
28  void run_pm_mouse();
29  void fake_pm_int(void);
30  
31 --- src/dosext/dpmi/dpmi.c      Tue Mar 19 19:45:51 2002
32 +++ src/dosext/dpmi/dpmi.c      Tue Mar 19 21:01:00 2002
33 @@ -2016,8 +2016,9 @@
34   * DANG_END_FUNCTION
35   */
36  
37 -void run_pm_int(int i)
38 +void run_pm_int(int i, int async)
39  {
40 +  unsigned short CLIENT_PMSTACK_SEL;
41    us *ssp;
42  
43  #ifndef USE_NEW_INT
44 @@ -2044,9 +2045,19 @@
45      return;
46    }
47  
48 -  if (dpmi_stack_frame[current_client].ss == PMSTACK_SEL)
49 +  if (async && !in_dpmi_hw_int) {
50 +    D_printf("DPMI: Switching to locked stack\n");
51 +    CLIENT_PMSTACK_SEL = PMSTACK_SEL;
52 +  }
53 +  else {
54 +    D_printf("DPMI: Not switching to locked stack, in_dpmi_hw_int=%d\n",
55 +      in_dpmi_hw_int);
56 +    CLIENT_PMSTACK_SEL = dpmi_stack_frame[current_client].ss;
57 +  }
58 +
59 +  if (dpmi_stack_frame[current_client].ss == PMSTACK_SEL || in_dpmi_hw_int)
60      PMSTACK_ESP = client_esp(0);
61 -  ssp = (us *) (GetSegmentBaseAddress(PMSTACK_SEL) +
62 +  ssp = (us *) (GetSegmentBaseAddress(CLIENT_PMSTACK_SEL) +
63                 (DPMIclient_is_32 ? PMSTACK_ESP : (PMSTACK_ESP&0xffff)));
64  /* ---------------------------------------------------
65         | 000FC925 | <- ssp here, executes pm int
66 @@ -2087,10 +2098,12 @@
67    }
68    dpmi_stack_frame[current_client].cs = Interrupt_Table[i].selector;
69    dpmi_stack_frame[current_client].eip = Interrupt_Table[i].offset;
70 -  dpmi_stack_frame[current_client].ss = PMSTACK_SEL;
71 +  dpmi_stack_frame[current_client].ss = CLIENT_PMSTACK_SEL;
72    dpmi_stack_frame[current_client].esp = PMSTACK_ESP;
73    if (i == 0x08 || in_dpmi_timer_int) in_dpmi_timer_int++;
74    in_dpmi_dos_int = 0;
75 +  if (async || in_dpmi_hw_int)
76 +    in_dpmi_hw_int++;
77  #ifdef USE_NEW_INT
78    dpmi_cli();
79  #endif /* USE_NEW_INT */
80 @@ -2200,7 +2213,7 @@
81                   case 0x1c:    /* ROM BIOS timer tick interrupt */
82                   case 0x23:    /* DOS Ctrl+C interrupt */
83                   case 0x24:    /* DOS critical error interrupt */
84 -                       run_pm_int(VM86_ARG(retval));
85 +                       run_pm_int(VM86_ARG(retval), 0);
86                         break;
87                   default:
88  #ifdef USE_MHPDBG
89 @@ -2506,6 +2519,7 @@
90    in_dpmi++;
91    in_win31 = 0;
92    in_dpmi_dos_int = 0;
93 +  in_dpmi_hw_int = 0;
94    pm_block_root[current_client] = 0;
95    memset((void *)(&realModeCallBack[current_client][0]), 0,
96          sizeof(RealModeCallBack)*0x10);
97 @@ -2983,5 +2997,13 @@
98  
99          } else if (_eip==DPMI_OFF+1+HLT_OFF(DPMI_return_from_pm)) {
100            D_printf("DPMI: Return from protected mode interrupt hander\n");
101 +          D_printf("DPMI: Return from protected mode interrupt handler\n");
102 +         if (in_dpmi_hw_int) {
103 +           in_dpmi_hw_int--;
104 +           if (!in_dpmi_hw_int && _ss != PMSTACK_SEL) {
105 +             error("DPMI: Client's PM Stack corrupted!\n");
106 +             leavedos(91);
107 +           }
108 +         }
109  /* ---------------------------------------------------
110         |(000FC925)|
111         |(dpmi_sel)|
This page took 0.311077 seconds and 2 git commands to generate.