next up previous contents
Next: Spinlocks Up: Hardware Abstraction Layer: Portable Previous: Program Image Replacement   Contents

Subsections

Syscall

There are times when you want to transition into a ``kernel mode'' state as if an interrupt had occured, but you don't want to have to wait for one. Most processors have a ``trap'' or ``int'' instruction which will manually cause this processor state. These functions wrap that functionality.

void syscall_set_return(irq_context_t * context, int value)

Sets the ``return value'' for context to value. If a user performed a syscall, then the target routine might call this function to set the value that the program will think it was returned.

This generally just pokes a value into one of the registers in the context, but it's platform dependent.

SET_RETURN(thread, value)

Macro that sets a return value for the named thread. This is just a wrapper for syscall_set_return.

SET_MY_RETURN(value)

Like SET_RETURN, but it sets the value on the ``current'' thread, which would generally be the one who invoked the syscall target.

RETURN(value

Sets the return value on the current thread and then causes a thread schedule.

SYSCALL(routine)

Use this macro to insert the platform-dependent code for invoking a syscall at the given address. routine is generally a function pointer.


next up previous contents
Next: Spinlocks Up: Hardware Abstraction Layer: Portable Previous: Program Image Replacement   Contents
Dan Potter 2002-07-29