[1460] in linux-announce channel archive

home help back first fref pref prev next nref lref last post

DPMI Patch against plain 0.60.4

daemon@ATHENA.MIT.EDU (Lars Wirzenius)
Tue Dec 12 01:47:04 1995

Date: Tue, 12 Dec 1995 01:25:06 +0200
From: Lars Wirzenius <wirzeniu@cc.helsinki.fi>
To: linux-announce@vger.rutgers.edu

From: Michael Leodolter <michael@lab1.psy.univie.ac.at>
Newsgroups: comp.os.linux.announce
Subject: DPMI Patch against plain 0.60.4
Organization: Vienna University, Austria
Approved: linux-announce@news.ornl.gov (Lars Wirzenius)
Followup-to: comp.os.linux.development.system

-----BEGIN PGP SIGNED MESSAGE-----


Hi all DOSEMU-Users/Developers,
with the following patch it is possible to run PM make/compiler
compinations.
I tried it with DJ200 make on a dir with 15 obj-files, and it works fine.

- ----- cut here -----
*** dpmi/dpmi.c.orig	Sat Nov  4 18:46:44 1995
- --- dpmi/dpmi.c	Wed Dec  6 11:33:33 1995
***************
*** 190,195 ****
- --- 190,205 ----
  #define vm86_regs sigcontext
  #endif
  unsigned long RealModeContext;
+ /*
+  * With this stack nested PM programs like DJ200's make/compiler work fine
+  * (maybe Borkland's protected mode make/compiler too).
+  * For do_int31
+  * 	0x0300:	Simulate Real Mode Interrupt
+  * 	0x0301:	Call Real Mode Procedure With Far Return Frame
+  * 	0x0302:	Call Real Mode Procedure With Iret Frame
+  */
+ unsigned long RealModeContext_Stack[DPMI_max_rec_rm_func];
+ unsigned long RealModeContext_Running = 0;
  
  static INTDESC Interrupt_Table[0x100];
  static INTDESC Exception_Table[0x20];
***************
*** 982,987 ****
- --- 992,1013 ----
    /*2ch*/	*++lp = 0xffffffff;
  }
  
+ static inline void save_rm_context()
+ {
+   if (RealModeContext_Running >= DPMI_max_rec_rm_func) {
+     error("DPMI: RealModeContext_Running = 0x%4x\n",RealModeContext_Running++);
+     return;
+   }
+   RealModeContext_Stack[RealModeContext_Running++] = RealModeContext;
+ }
+ 
+ static inline void restore_rm_context()
+ {
+   if (RealModeContext_Running-- > DPMI_max_rec_rm_func)
+     return;
+   RealModeContext = RealModeContext_Stack[RealModeContext_Running];
+ }
+ 
  static inline void save_rm_regs()
  {
    if (DPMI_rm_procedure_running >= DPMI_max_rec_rm_func) {
***************
*** 1231,1236 ****
- --- 1257,1263 ----
    case 0x0301:	/* Call Real Mode Procedure With Far Return Frame */
    case 0x0302:	/* Call Real Mode Procedure With Iret Frame */
      save_rm_regs();
+     save_rm_context();
      RealModeContext = GetSegmentBaseAddress(_es) + (DPMIclient_is_32 ? _edi : _LWORD(edi));
      {
        struct RealModeCallStructure *rmreg = (struct RealModeCallStructure *) RealModeContext;
***************
*** 2088,2094 ****
    my_sp = LWORD(esp);
    NOCARRY;
  
!   save_rm_regs();
  
    REG(cs) = DPMI_SEG;
    REG(eip) = DPMI_OFF + HLT_OFF(DPMI_return_from_dos);
- --- 2115,2123 ----
    my_sp = LWORD(esp);
    NOCARRY;
  
!   if(!in_dpmi) { /* Don't eat rm regs if already in dpmi */
!     save_rm_regs();
!   }
  
    REG(cs) = DPMI_SEG;
    REG(eip) = DPMI_OFF + HLT_OFF(DPMI_return_from_dos);
***************
*** 2944,2949 ****
- --- 2973,2979 ----
  
    } else if (lina == (unsigned char *) (DPMI_ADD + HLT_OFF(DPMI_return_from_realmode))) {
      struct RealModeCallStructure *rmreg = (struct RealModeCallStructure *) RealModeContext;
+     restore_rm_context();
  
      D_printf("DPMI: Return from Real Mode Procedure\n");
  #ifdef SHOWREGS

- ----- cut here -----
- -------------------------------------------------------
- -  Michael Leodolter         Brain Research Lab (BRL)  -
- -  Inst. of Psychologie               Univ. of Vienna  -
- -  EMail:       <Michael.Leodolter@univie.ac.at>       -
- -  or       <Michael.Leodolter@lab1.psy.univie.ac.at>  -
- -  Tel: <+43-222-40103-2436> Fax: <+43-222-406 64 22>  -	
- -------------------------------------------------------- 


-----BEGIN PGP SIGNATURE-----
Version: 2.6.2i

iQCVAwUBMMy5Y4QRll5MupLRAQEdswQAs1iQy4Zm481Cje1jnKdDkkEZ0nZ5qtmU
d/7WXJmhjNoJuKQRsTmUYM2YRMN5jQ5i09LqRmrFVTUmIXh8zTfEbVCn+ZTuZzuS
UyfkrSNgFlGUnnqyL7jL8aA3a/ZwQ58lVy+2pBeUEO8mThM2SArbnoKBJ/JmUNJS
7Z10KvM89U8=
=uBl9
-----END PGP SIGNATURE-----

-- 
This article has been digitally signed by the moderator, using PGP.
Finger wirzeniu@kruuna.helsinki.fi for PGP key needed for validating signature.
Send submissions for comp.os.linux.announce to: linux-announce@news.ornl.gov
PLEASE remember a short description of the software and the LOCATION.


home help back first fref pref prev next nref lref last post