Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > C > Re: Installing ...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 13 of 17 Topic 26124 of 26822
Post > Topic >>

Re: Installing a C function into the IDT

by jt@[EMAIL PROTECTED] (Jens Thoms Toerring) May 8, 2008 at 11:17 PM

The Prisoner <nospam@[EMAIL PROTECTED]
> wrote:
> Jens Thoms Toerring wrote:
> > The Prisoner <nospam@[EMAIL PROTECTED]
> wrote:
> > 
> >>I was reading about interrupts, and I got to thinking it would be a
real 
> >>neat thing to use interrupts for program-wide exception handling. What
I 
> >>haven't been able to find is a clear guide or example program for how
to 
> >>install a C function into the IDT.
> > 
> > 
> > This is completely system dependent (assuming a system has an
> > "IDT" at all and the operating system lets you get at something
> > that low level which many probably won't, even if you have root
> > or admistrator privileges). And what about a multi-tasking
> > system? Just think about the situation that you would get in
> > if each programs would mess around with the IDT. I guess the
> > only system this could somehow be made to work would be DOS.
> > If that's you're system you probably better ask in a group
> > that specializes on system specific programming under DOS.

> Are you 100% sure about that? I understood that in Real Mode, the IVT is

> used, while in Protected Mode the IDT is used. So it should be possible 
> to make use of the IDT under Windows or Linux.

I don't know about Windows but I am rather sure that Linux won't
let you get at something that essential for the systems health
from a userland program (I would also guess that Windows will
also not let you do that unless the guys in Redmond completely
lost their minds;-). And, while we're talking about Linux, that
would only work (if it would be possible at all) when running
on a x86-like architecture (the IDT seems to be something rather
x86-specific). But Linux runs on lots of different architectures
which may use completely different methods for dealing with
interrupts. So if you want to write for "Linux" stick to standard
C (plus the system specific extensions from e.g. POSIX you can't
avoid) and don't try to throw assembler into the mix (unless you
have an extremely specialized project to do, but exception hand-
ling for failures of memory allocations don't sound like that).

> What I don't know is how to write a function's address into the IDT...

Again, absolutely system specific. On an x86-kind of architecture
(in protected mode) I think you will have to read the IDTR regis-
ter (something you can't do with C, you will have to resort to
assembler and which other architectures rather likely don't have),
calculate where the slot for the function pointer is and write the
functions address there. If you really want to do something like
that you will have to get yourself the specifications for your
processor and figure it out from there.

But none of this has really anything to do with the language C,
the topic of this group. Several things needed can't be done in
C and those that can be done could also be done using some other
language...
                                Regards, Jens
-- 
  \   Jens Thoms Toerring  ___      jt@[EMAIL PROTECTED]
   \__________________________      http://toerring.de
 




 17 Posts in Topic:
Installing a C function into the IDT
The Prisoner <nospam@[  2008-05-08 21:47:34 
Re: Installing a C function into the IDT
jacob navia <jacob@[EM  2008-05-08 23:00:44 
Re: Installing a C function into the IDT
The Prisoner <nospam@[  2008-05-08 22:34:27 
Re: Installing a C function into the IDT
Ian Collins <ian-news@  2008-05-09 09:42:17 
Re: Installing a C function into the IDT
Keith Thompson <kst-u@  2008-05-08 15:17:31 
Re: Installing a C function into the IDT
Keith Thompson <kst-u@  2008-05-08 15:31:59 
Re: Installing a C function into the IDT
Ian Collins <ian-news@  2008-05-09 10:46:21 
Re: Installing a C function into the IDT
Erik Trulsson <ertr101  2008-05-08 23:58:43 
Re: Installing a C function into the IDT
jt@[EMAIL PROTECTED] (Je  2008-05-08 22:14:45 
Re: Installing a C function into the IDT
Keith Thompson <kst-u@  2008-05-08 15:23:50 
Re: Installing a C function into the IDT
The Prisoner <nospam@[  2008-05-08 23:29:32 
Re: Installing a C function into the IDT
Ian Collins <ian-news@  2008-05-09 10:51:44 
Re: Installing a C function into the IDT
jt@[EMAIL PROTECTED] (Je  2008-05-08 23:17:28 
Re: Installing a C function into the IDT
"cr88192" <c  2008-05-09 16:33:26 
Re: Installing a C function into the IDT
Antoninus Twink <nospa  2008-05-09 14:58:07 
Re: Installing a C function into the IDT
Ben Bacarisse <ben.use  2008-05-09 00:46:39 
Re: Installing a C function into the IDT
Owen Jacobson <angryba  2008-05-08 22:01:14 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Wed Jul 9 1:36:13 CDT 2008.