diff options
-rw-r--r-- | sys/arch/amd64/amd64/intr.c | 10 | ||||
-rw-r--r-- | sys/arch/amd64/amd64/vector.S | 3 | ||||
-rw-r--r-- | sys/include/arch/amd64/intr.h | 18 |
3 files changed, 30 insertions, 1 deletions
diff --git a/sys/arch/amd64/amd64/intr.c b/sys/arch/amd64/amd64/intr.c index cb38cd8..685a16d 100644 --- a/sys/arch/amd64/amd64/intr.c +++ b/sys/arch/amd64/amd64/intr.c @@ -79,6 +79,8 @@ intr_register(const char *name, const struct intr_hand *ih) { uint32_t vec = MAX(ih->priority << IPL_SHIFT, 0x20); struct intr_hand *ih_new; + struct intr_data *idp_new; + const struct intr_data *idp; size_t name_len; /* Sanity check */ @@ -115,6 +117,14 @@ intr_register(const char *name, const struct intr_hand *ih) } memcpy(ih_new->name, name, name_len); + idp_new = &ih_new->data; + idp = &ih->data; + + /* Pass the interrupt data */ + idp_new->ihp = ih_new; + idp_new->data_u64 = idp->data_u64; + + /* Setup the new intr_hand */ ih_new->func = ih->func; ih_new->priority = ih->priority; ih_new->irq = ih->irq; diff --git a/sys/arch/amd64/amd64/vector.S b/sys/arch/amd64/amd64/vector.S index e348ff4..c820a41 100644 --- a/sys/arch/amd64/amd64/vector.S +++ b/sys/arch/amd64/amd64/vector.S @@ -51,7 +51,8 @@ ioapic_common_func: jz 1f // Nope, return mov (%rdx), %rbx // intr_hand.func - xor %rdi, %rdi // No data + add $8, %rdx // Get interrupt data + mov %rdx, %rdi // Pass the interrupt data push %rcx // Save our counter call *%rbx // Call the handler pop %rcx // Restore our counter diff --git a/sys/include/arch/amd64/intr.h b/sys/include/arch/amd64/intr.h index b640e4b..c848b6f 100644 --- a/sys/include/arch/amd64/intr.h +++ b/sys/include/arch/amd64/intr.h @@ -47,6 +47,22 @@ #define IPL_CLOCK 2 /* Clock */ #define IPL_HIGH 3 /* Defer everything */ +struct intr_hand; + +/* + * Contains information passed to driver + * + * @ihp: Interrupt handler + * @data: Driver specific data + */ +struct intr_data { + struct intr_hand *ihp; + union { + void *data; + uint64_t data_u64; + }; +}; + /* * Interrupt handler * @@ -55,6 +71,7 @@ * [v]: Returned by intr_register() * * @func: The actual handler [r] + * @data: Interrupt data [o/v] * @name: Interrupt name [v] * @priority: Interrupt priority [r] * @irq: Interrupt request number [o] @@ -74,6 +91,7 @@ */ struct intr_hand { int(*func)(void *); + struct intr_data data; char *name; int priority; int irq; |