diff options
author | Ian Moffett <ian@osmora.org> | 2024-07-02 21:15:01 -0400 |
---|---|---|
committer | Ian Moffett <ian@osmora.org> | 2024-07-02 21:15:01 -0400 |
commit | 52760e9c5e677b76c81e921bbab95da26478f425 (patch) | |
tree | 9fe19c1b26c0efb6596a06f036df7bbfe29c284d /sys/include/arch | |
parent | 3d71ccf45452f6899b44ac9aea9ae3f3ec7f161e (diff) |
kernel/amd64: Add INTRENTRY() and TRAPENTRY()
Add macros that perform certain operations before invoking the actual
handler. This will be useful in the future for more complicated
operations that need to be done before the handler is ran.
Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'sys/include/arch')
-rw-r--r-- | sys/include/arch/amd64/frameasm.h | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/sys/include/arch/amd64/frameasm.h b/sys/include/arch/amd64/frameasm.h index b6d4f39..b8791ba 100644 --- a/sys/include/arch/amd64/frameasm.h +++ b/sys/include/arch/amd64/frameasm.h @@ -100,4 +100,28 @@ pop_trapframe_ec add $8, %rsp /* Pop error code */ .endm + +/* + * Generic interrupt entry. + */ +#define INTRENTRY(ENTLABEL, HANDLER) \ + ENTLABEL: \ + push_trapframe $0 ; \ + mov %rsp, %rdi ; \ + call HANDLER ; \ + pop_trapframe ; \ + iretq + +/* + * Trap entry where an error code is on + * the stack. + */ +#define TRAPENTRY(ENTLABEL, TRAPNO) \ + ENTLABEL: \ + push_trapframe_ec TRAPNO ; \ + mov %rsp, %rdi ; \ + call trap_handler ; \ + pop_trapframe_ec ; \ + iretq + #endif /* !_MACHINE_FRAMEASM_H_ */ |