Re: Real mode int from protected mode and back



gerotica <spamtrap@xxxxxxxxxx> wrote:

On 21 fev, 01:31, Tim Roberts <spamt...@xxxxxxxxxx> wrote:

What operating system and compiler are you using?  You have a strange mix
of 16-bit and 32-bit concepts here.

MS-DOS. The main program is in protected mode, dont know the
compiler.

Yes, I think I simply failed to understand a big chunk of your plan. The
program you are patching is in 32-bit protect mode using a DOS extender of
some kind. But, you have installed an ISR using a 16-bit compiler. Right?
If so, then my comments are mostly just litter on the information
superhighway.

Apparently, I've been away from MS-DOS way too long...

How did you compile and install the interrupt handler?  Remember that a
software interrupt is going to expect to all 16-bit code.
I am compiling the ISR in DOS c++. The install is made in main(),
using dos int to stay resident.

What do you mean by "DOS c++"? It has to be 16-bit code, but since the
compiler has the "interrupt" keyword, I'm guessing that it is.

Yeah, that's my problem. I really dont know the issues about
mixing 16 and 32 bit codes. Using int 31h 300h I thought DPMI would
take care of the needed conversions or whatever.

Yes, I was thinking about it backwards. You are right. DPMI will shift to
16-bit real mode to make the call, and your ISR will run.

You can't call C run-time functions like fprintf inside an interrupt
handler.  Where do you think it's going to find the C runtime library?

Hum.. ok. fprintf maybe... but I've used file functions from ISR
successfuly. As long as I take care of reentrancy, right?
I thought runtime routines were compiled toghether in the code...

Yes, my brain no longer thinks automatically of the single-tasking MS-DOS
environment. Your ISR should have its own 16-bit C runtime library
available to it.

So, let's get back to your issue:
Page fault at eip=000f7250, error=0006

F7250 is inside the BIOS (f000:7250), so somehow you're getting a bad
pointer into the BIOS. Was there a register dump?
--
Tim Roberts, timr@xxxxxxxxx
Providenza & Boekelheide, Inc.

.



Relevant Pages

  • Re: PIC mplab c18 C compiler
    ... A colleague of mine is using MPLAB C compiler and is struggling with the ... > work out what registers to save/restore in interrupt routines. ... Yes the older version of C18 had many 'problems' ... the ISR but NOT for functions called in the ISR. ...
    (comp.arch.embedded)
  • Re: interrupt service routine using VC++ 2005
    ... I know that VC++ is intended to write programs running under Windows ... will actually be no need for a user to think about writing an own ISR. ... will it be possible to force the VC++ compiler to code a function ... ISR and it will be called by the hardware interrupt, ...
    (microsoft.public.vc.language)
  • Re: PIC mplab c18 C compiler
    ... Apparently the compiler manual says you ... >work out what registers to save/restore in interrupt routines... ... RAM location is used for several automatic variables, ... Therefore automatic variables used in an ISR cannot share any RAM ...
    (comp.arch.embedded)
  • Re: goto across functions/isrs?
    ... (Few compiler support it). ... It is a always advisable to keep ISR ... re-entrant on and older version of IAR 8051. ... If one had XDATA space, one could switch to a different memory model, ...
    (comp.arch.embedded)
  • Re: CLOCKS_PER_SEC
    ... MS-DOS compilers? ... Microsoft C Compiler Version 2.00.000 V 6.00A ... These examples are rather irrelevant since the clock frequency in these ... However they all do modify their clockticks in some way. ...
    (comp.lang.c)