Page 1 of 1

Function return to an Interrupt

Posted: Mon Aug 22, 2005 11:00 pm
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 ... ;-)

Re: Function return to an Interrupt

Posted: Tue Aug 23, 2005 11:00 pm
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