Function return to an Interrupt

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
stafe
Posts: 22
Joined: Fri Oct 29, 2004 11:00 pm

Function return to an Interrupt

Post by stafe »

Helllo,

I have a question about interrupts ...
In my OS I use the Interrupt (int 30h) to call all functions ... If I call a function without a function return it works fine ... but if i have an function with an function return, I don't konow how to give the return value to the application (back to the application that call the interrupt) back ?? ...

Here is an example how I call a simple function (without a function return) from an application of my OS:

Code: Select all

void Test( unsigned int A )
{
    asm("movl %0, %%ebx":: "r"(A));
    asm("movl $0x01, %eax");
    asm("int $0x30");
}
It works fine .. In eax there is the function number (example: eax=1 -> Print a Text ,... )
But If i need a return Value in the Appliction I don't know how does it work ...

Example:

Code: Select all

int Test( unsigned int A )
{
    int B;
    ...??
    ...??
    ...??
    return(B);
}
In this example i need the inline asm codelines, that write the return value in B ...
I hope that somebody can help me ... ;-)
User avatar
gaf
Member
Member
Posts: 349
Joined: Thu Oct 21, 2004 11:00 pm
Location: Munich, Germany

Re: Function return to an Interrupt

Post by gaf »

Hello,
the return value of a normal procedure is stored in eax and I don't see why you shouldn't do it just the same way with interrupts. Just store the value in eax at the end of your ISR and read it out in your test-function.

regards,
gaf
Post Reply