|
From: <ljs...@us...> - 2007-08-04 17:39:52
|
Revision: 433
http://cadcdev.svn.sourceforge.net/cadcdev/?rev=433&view=rev
Author: ljsebald
Date: 2007-08-04 10:39:47 -0700 (Sat, 04 Aug 2007)
Log Message:
-----------
A little cleaner way of dealing with those lvalue casts.
Modified Paths:
--------------
kos/kernel/arch/dreamcast/kernel/exec.c
kos/kernel/arch/dreamcast/kernel/init.c
Modified: kos/kernel/arch/dreamcast/kernel/exec.c
===================================================================
--- kos/kernel/arch/dreamcast/kernel/exec.c 2007-08-04 02:42:38 UTC (rev 432)
+++ kos/kernel/arch/dreamcast/kernel/exec.c 2007-08-04 17:39:47 UTC (rev 433)
@@ -84,8 +84,9 @@
/* Jump to the trampoline */
{
- void (*trampoline)() __noreturn;
- *((uint32 *) &trampoline) = (uint32)buffer;
+ typedef void (*trampoline_func)() __noreturn;
+ trampoline_func trampoline = (trampoline_func)buffer;
+
trampoline();
}
}
Modified: kos/kernel/arch/dreamcast/kernel/init.c
===================================================================
--- kos/kernel/arch/dreamcast/kernel/init.c 2007-08-04 02:42:38 UTC (rev 432)
+++ kos/kernel/arch/dreamcast/kernel/init.c 2007-08-04 17:39:47 UTC (rev 433)
@@ -253,14 +253,15 @@
/* Called to jump back to the BIOS menu; assumes a normal shutdown is possible */
void arch_menu() {
- void (*menu)(int) __noreturn;
+ typedef void (*menufunc)(int) __noreturn;
+ menufunc menu;
/* Shut down */
arch_shutdown();
/* Jump to the menus */
dbglog(DBG_CRITICAL, "arch: exiting the system to the BIOS menu\n");
- *((uint32 *) &menu) = *((uint32 *) 0x8c0000e0);
+ menu = (menufunc)(*((uint32 *) 0x8c0000e0));
menu(1);
}
@@ -291,7 +292,8 @@
/* Called to reboot the system; assume the system is in peril and don't
try to call the dtors */
void arch_reboot() {
- void (*rb)() __noreturn;
+ typedef void (*reboot_func)() __noreturn;
+ reboot_func rb;
dbglog(DBG_CRITICAL, "arch: rebooting the system\n");
@@ -299,6 +301,6 @@
irq_disable();
/* Reboot */
- *((uint32 *) &rb) = 0xa0000000;
+ rb = (reboot_func)0xa0000000;
rb();
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|