Re: interrupt service routine using VC++ 2005
- From: mysli@xxxxxx
- Date: 14 Aug 2006 15:25:48 -0700
As I mentioned, I will not run the generated code under Windows
afterwards, I'm abusing the compiler more or less to generate code
which can be executed in a protected mode environment, where I have the
complete control over the system, I'm the OS let's say.
My question points just in that way how do I have to write the C++ code
with VC++ to generate the functions I need, in this case a function
which works as a ISR, with the mentioned saving of registers and ending
the function with IRETD.
I know that VC++ is intended to write programs running under Windows
(Ring3), the OS (Windows in this case) takes care of the ISRs so there
will actually be no need for a user to think about writing an own ISR.
But since my code will not talk to any Win32 kernel or so, I'm really
about to program it low-level, also running on ring0 afterwards, in my
own environment.
So, will it be possible to force the VC++ compiler to code a function
as a ISR with all the requirement of an ISR?
Daniel
Scott McPhillips [MVP] schrieb:
mysli@xxxxxx wrote:
Hi all,
I need to write a ISR using Microsoft VC++ 2005. The proplem is I did
not found any hint on how to do it. I can register any function as a
ISR and it will be called by the hardware interrupt, interrupt 8
(timer) i.e., works fine in my little example progam. But the problem
is the compiler ends every function with RETN, after disassembling the
result of the compilation this can be seen easiely.
Every function starts and ends with:
push ebp //function entry
mov ebp,esp
...
pop ebp
retn //function exit
That's pretty fine for regular functions but as an interrupt handler
the function first of all should save all used registers, EAX is not
save by VC++ since its holding the return value, but ISR doesn't have
any return value. And second it needs to end with a IRETD !!!
Does anyone of you know how to solve this problem, maybe it points out
the VC++ is not the appropiated tool for my project. BTW, I do use VC++
only as editor and compiler, I do not program for windows, I just
generate code which can be executed in protected mode.
Many thanks,
Daniel
VC++ is not the appropriate tool. If you did try this and it traps the
interrupt you are working with some dreadfully ancient operating system.
Modern Windows will not permit your program to access the int vectors.
The required tools and documentation are available (for 32 bit Windows)
as the DDK (device driver kit).
--
Scott McPhillips [VC++ MVP]
.
- Follow-Ups:
- Re: interrupt service routine using VC++ 2005
- From: Igor Tandetnik
- Re: interrupt service routine using VC++ 2005
- References:
- interrupt service routine using VC++ 2005
- From: mysli
- Re: interrupt service routine using VC++ 2005
- From: Scott McPhillips [MVP]
- interrupt service routine using VC++ 2005
- Prev by Date: Re: A question!
- Next by Date: Re: interrupt service routine using VC++ 2005
- Previous by thread: Re: interrupt service routine using VC++ 2005
- Next by thread: Re: interrupt service routine using VC++ 2005
- Index(es):
Relevant Pages
|