Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

possible -mdpmi extensions #132

Open
stsp opened this issue Jan 17, 2023 · 2 comments
Open

possible -mdpmi extensions #132

stsp opened this issue Jan 17, 2023 · 2 comments

Comments

@stsp
Copy link

stsp commented Jan 17, 2023

Hi.

Currently it seems -mdpmi does the
same as -mdosx, and -mdpmi32 seems
not available.
I'd like to propose a few changes to
that picture to get more value from -mdpmi.

  1. add -mdpmi32
  2. in mdpmi mode prefer the existing DPMI.
    Currently cw32 does everything possible
    to avoid the installed dpmi: it is trying to
    install its own dpmi from real-mode or via
    VCPI. This is perfectly fine for -mdosx, but
    should probably be changed for -mdpmi.
  3. query for "MS-DOS" extension, and if it is
    there - restore all interrupt vectors to their
    original values, effectively disabling cw32.
    It is not needed in -mdpmi mode when
    "MS-DOS" extension is there, as it means
    the extender is already there.
  4. add a function to get the old value of an
    interrupt vector (i.e. the value before cw32
    set it to its own handler). This will allow to
    communicate with the DPMI server and
    bypass cw32 when needed. If there is no
    "old" value (i.e. cw32 is not hooking that
    vector), then such func should return NULL
    or some error.

Thanks!

@tkchia
Copy link
Owner

tkchia commented Jan 21, 2023

Hello @stsp,

In mdpmi mode prefer the existing DPMI. Currently cw32 does everything possible to avoid the installed dpmi: it is trying to install its own dpmi from real-mode or via VCPI.

CauseWay will prefer using an existing DPMI server if it sees a CAUSEWAY=DPMI environment variable setting. But indeed, it will be good if there is a way to specify this as a system flag setting in a compiled program.

query for "MS-DOS" extension, and if it is there - restore all interrupt vectors to their original values

I do not think there is any simple way to figure out if a DPMI host does full int 0x21 translation — if you know of such a way, I would like to hear about it. The best I can think of so far is to maybe pass an invalid pointer to some int 0x21 service, and see if a crash happens (?).

Thank you!

@stsp
Copy link
Author

stsp commented Jan 21, 2023

Just like I said, you need to query
dpmi for "MS-DOS":
http://www.ctyme.com/intr/rb-4624.htm
But of course if you provide the func
to get the old int vector value (and err
if its not hooked by cw32), then it would
be easy to implement in client's code.
So whether or not it should be automatic,
is probably a matter of the taste.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants