|
From: kosmirror <kos...@us...> - 2025-08-04 16:56:53
|
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "A pseudo Operating System for the Dreamcast.".
The branch, master has been updated
via d8b442870398cd20937a7dcce4d23b3f3da5bc1c (commit)
via 7c26e725c440fd5cd475aa5696116423795734a1 (commit)
via 6ec1f394e3e450712816e07b3e156f6ff398a1ba (commit)
from b71353ca0095787e8d1ed9428cdeec65230ed7e4 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit d8b442870398cd20937a7dcce4d23b3f3da5bc1c
Author: QuzarDC <qu...@co...>
Date: Tue Apr 8 22:53:49 2025 -0400
Catch undefined exceptions as panic.
This should not happen.
commit 7c26e725c440fd5cd475aa5696116423795734a1
Author: QuzarDC <qu...@co...>
Date: Tue Apr 8 22:52:37 2025 -0400
Whitespace and comment cleanups.
Somehow there was quite a bit of stray whitespace.
commit 6ec1f394e3e450712816e07b3e156f6ff398a1ba
Author: QuzarDC <qu...@co...>
Date: Tue Apr 8 22:29:25 2025 -0400
Remove unneeded defines.
-----------------------------------------------------------------------
Summary of changes:
kernel/arch/dreamcast/include/arch/irq.h | 25 ++----------------
kernel/arch/dreamcast/kernel/irq.c | 45 ++++++++++++++++----------------
2 files changed, 25 insertions(+), 45 deletions(-)
diff --git a/kernel/arch/dreamcast/include/arch/irq.h b/kernel/arch/dreamcast/include/arch/irq.h
index f4858bd5..f0a50bf9 100644
--- a/kernel/arch/dreamcast/include/arch/irq.h
+++ b/kernel/arch/dreamcast/include/arch/irq.h
@@ -263,27 +263,6 @@ typedef enum irq_exception {
EXC_UNHANDLED_EXC = 0x07e0 /**< `[SOFT ]` Exception went unhandled */
} irq_t;
-
-/** \defgroup irq_type_offsets Exception type offsets
- \brief Offsets within exception types
- \ingroup irqs
-
- The following are a table of "type offsets" (see the Hitachi PDF). These are
- the 0x000, 0x100, 0x400, and 0x600 offsets.
-
- @{
-*/
-#define EXC_OFFSET_000 0 /**< \brief Offset 0x000 */
-#define EXC_OFFSET_100 1 /**< \brief Offset 0x100 */
-#define EXC_OFFSET_400 2 /**< \brief Offset 0x400 */
-#define EXC_OFFSET_600 3 /**< \brief Offset 0x600 */
-/** @} */
-
-/** \brief The value of the timer IRQ
- \ingroup irqs
-*/
-#define TIMER_IRQ EXC_TMU0_TUNI0
-
/** \defgroup irq_state State
\brief Methods for querying active IRQ information.
@@ -433,14 +412,14 @@ typedef struct irq_cb {
*/
/** Set or remove an IRQ handler.
-
+
Passing a NULL value for hnd will remove the current handler, if any.
\param code The IRQ type to set the handler for
(see #irq_t).
\param hnd A pointer to a procedure to handle the exception.
\param data A pointer that will be passed along to the callback.
-
+
\retval 0 On success.
\retval -1 If the code is invalid.
diff --git a/kernel/arch/dreamcast/kernel/irq.c b/kernel/arch/dreamcast/kernel/irq.c
index a7b4c127..0e641380 100644
--- a/kernel/arch/dreamcast/kernel/irq.c
+++ b/kernel/arch/dreamcast/kernel/irq.c
@@ -131,22 +131,22 @@ static char *irq_exception_string(irq_t evt) {
case EXC_DATA_ADDRESS_WRITE:
return "Data address error (write)";
case EXC_DTLB_MISS_READ: /* or EXC_ITLB_MISS */
- return "Instruction or Data(read) TLB miss";
- case EXC_DTLB_MISS_WRITE:
+ return "Instruction or Data(read) TLB miss";
+ case EXC_DTLB_MISS_WRITE:
return "Data(write) TLB miss";
case EXC_DTLB_PV_READ: /* or EXC_ITLB_PV */
- return "Instruction or Data(read) TLB protection violation";
+ return "Instruction or Data(read) TLB protection violation";
case EXC_DTLB_PV_WRITE:
return "Data TLB protection violation (write)";
case EXC_FPU:
return "FPU exception";
- case EXC_INITIAL_PAGE_WRITE:
- return "Initial page write exception";
- case EXC_TRAPA:
- return "Unconditional trap (trapa)";
+ case EXC_INITIAL_PAGE_WRITE:
+ return "Initial page write exception";
+ case EXC_TRAPA:
+ return "Unconditional trap (trapa)";
case EXC_USER_BREAK_POST: /* or EXC_USER_BREAK_PRE */
- return "User break";
- default:
+ return "User break";
+ default:
return "Unknown exception";
}
}
@@ -169,17 +169,17 @@ void irq_dump_regs(int code, irq_t evt) {
dbglog(DBG_DEAD, " SR %08lx PR %08lx\n", irq_srt_addr->sr, irq_srt_addr->pr);
fp = regs[14];
arch_stk_trace_at(fp, 0);
-
+
if(code == 1) {
- dbglog(DBG_DEAD, "\nEncountered %s. ", irq_exception_string(evt));
-
+ dbglog(DBG_DEAD, "\nEncountered %s. ", irq_exception_string(evt));
+
valid_pc = arch_valid_text_address(irq_srt_addr->pc);
valid_pr = arch_valid_text_address(irq_srt_addr->pr);
/* Construct template message only if either PC/PR address is valid */
if(valid_pc || valid_pr) {
dbglog(DBG_DEAD, "Use this template terminal command to help"
" diagnose:\n\n\t$KOS_ADDR2LINE -f -C -i -e prog.elf");
-
+
if(valid_pc)
dbglog(DBG_DEAD, " %08lx", irq_srt_addr->pc);
@@ -217,20 +217,21 @@ void irq_handle_exception(int code) {
int handled = 0;
switch(code) {
- /* If it's a code 0, well, we shouldn't be here. */
- case 0:
- arch_panic("spurious RESET exception");
+ /* If it's a code 3, grab the event from intevt. */
+ case 3:
+ evt = INTEVT;
break;
/* If it's a code 1 or 2, grab the event from expevt. */
- case 1:
case 2:
+ case 1:
evt = EXPEVT;
break;
- /* If it's a code 3, grab the event from intevt. */
- case 3:
- evt = INTEVT;
+ /* If it's a code 0, well, we shouldn't be here. */
+ case 0:
+ default:
+ arch_panic("spurious RESET exception");
break;
}
@@ -246,7 +247,7 @@ void irq_handle_exception(int code) {
arch_panic("double fault");
}
- /* Reveal this info about the int to inside_int for better
+ /* Reveal this info about the int to inside_int for better
diagnostics returns if we try to do something in the int. */
inside_int = ((code&0xf)<<16) | (evt&0xffff);
@@ -380,7 +381,7 @@ int irq_init(void) {
/* Default to not in an interrupt */
inside_int = 0;
- /* Set a default timer handlers */
+ /* Set default timer handlers */
irq_set_handler(EXC_TMU0_TUNI0, irq_def_timer, (void *)TMU0);
irq_set_handler(EXC_TMU1_TUNI1, irq_def_timer, (void *)TMU1);
irq_set_handler(EXC_TMU2_TUNI2, irq_def_timer, (void *)TMU2);
hooks/post-receive
--
A pseudo Operating System for the Dreamcast.
|