🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.msdos.programmer
Article #5560

MS C/QC "_loadds" and stack checking

#5560
From: Matt Fichtenbaum
Date: Mon, 01 Apr 1991 13:24
25 lines
1506 bytes
Well, I thought I'd solved this before, but it turned up
again, so now I've _really_ solved it :-).

I used the mouse driver call (int 33h, func. 0Ch) to set a
routine that would be called to handle mouse interrupts.
According to the mouse driver documentation, the routine is
called with a far call, with DS set to the mouse driver's
data segment.

Fine.  MS C and QuickC (and Borland, too) provide the "_loadds"
keyword to tell the compiler to set DS appropriately when the
routine is entered.  Only, sometimes the program would crash
on a mouse interrupt.  Changing the order in which object
modules were linked sometimes helped.

Well, the problem is the "check stack" option of the Microsoft
compilers.  Programs call the stack checking routine on entry;
in a "loadds" routine, the stack check occurs _before_ the loadds.
If conditions are unfavorable, things fail.

Solution: (1) use the
#pragma check_stack(off)
macro to suppress stack checking around the handler, or (2) don't
use stack checking at all.  Or, (3), I suppose, use different
compilers.
Technical Details
Message-ID: <41070@genrad.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!sdd.hp.com!spool.mu.edu!snorkelwacker.mit.edu!hsdndev!husc6!genrad!mlf

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!sdd.hp.com!spool.mu.edu!snorkelwacker.mit.edu!hsdndev!husc6!genrad!mlf
From: mlf@genrad.UUCP (Matt Fichtenbaum)
Newsgroups: comp.os.msdos.programmer
Subject: MS C/QC "_loadds" and stack checking
Message-ID: <41070@genrad.UUCP>
Date: 1 Apr 91 13:24:41 GMT
Article-I.D.: genrad.41070
Organization: GenRad, Inc., Concord, Mass.
Lines: 25