XyrisOS / xyris

The Xyris Kernel
https://xyr.is
MIT License
153 stars 11 forks source link

Investigate Rewriting Interrupt/Exception Handlers Purely in C/C++ #344

Open Kfeavel opened 2 years ago

Kfeavel commented 2 years ago
struct interrupt_frame;

__attribute__ ((interrupt))
void
f (struct interrupt_frame *frame)
{
}
#ifdef __x86_64__
typedef unsigned long long int uword_t;
#else
typedef unsigned int uword_t;
#endif

struct interrupt_frame;

__attribute__ ((interrupt))
void
f (struct interrupt_frame *frame, uword_t error_code)
{
  ...
}

https://gcc.gnu.org/onlinedocs/gcc/x86-Function-Attributes.html

Kfeavel commented 2 years ago

As much as I would like to use this, unfortunately there's no way to differentiate interrupts from one another using this method, unless we want to do something similar to what we're already doing in assembly where we have a separate function for each interrupt/exception.

That might be worth doing, but it wouldn't really gain us anything (other than removing more assembly).