From: ljsebald <ljs...@us...> - 2024-02-04 15:29:52
|
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 d059b922625b6fd1f05dac4381b48d0ba571650b (commit) via 98efab32800bbabe844959d88980aed00c4fe543 (commit) via f99a1ccc24d10993feb1a189efddea92bfdd5e47 (commit) via 169e7c2c95eb6ba7f0b11bc29107c7f8bed5df12 (commit) via fc20f7d94f5c3da0cf0ae3ef5c6fe540a592b037 (commit) from 04c4dfa47d060320d0cf8b46c96f5b97e5183884 (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 d059b922625b6fd1f05dac4381b48d0ba571650b Merge: 98efab32 f99a1ccc Author: Lawrence Sebald <ljs...@us...> Date: Sun Feb 4 10:29:14 2024 -0500 Merge pull request #482 from Tchan0/Naomi_Allow_dcload Allow use of dcload for dbgio/fs on NAOMI. commit 98efab32800bbabe844959d88980aed00c4fe543 Merge: 04c4dfa4 169e7c2c Author: Lawrence Sebald <ljs...@us...> Date: Sun Feb 4 10:27:12 2024 -0500 Merge pull request #481 from KallistiOS/define_safe Add parens to macros for usage safety commit f99a1ccc24d10993feb1a189efddea92bfdd5e47 Author: Tchan0 <617...@us...> Date: Sun Feb 4 10:28:05 2024 +0100 Naomi: allow dcload Allow dcload to work when compiling for Naomi subarch commit 169e7c2c95eb6ba7f0b11bc29107c7f8bed5df12 Author: QuzarDC <qu...@co...> Date: Sat Feb 3 11:24:21 2024 -0500 Add safety parens around macro args commit fc20f7d94f5c3da0cf0ae3ef5c6fe540a592b037 Author: QuzarDC <qu...@co...> Date: Fri Feb 2 23:50:24 2024 -0500 Add safety parens around macro args ----------------------------------------------------------------------- Summary of changes: examples/dreamcast/gldc/basic/gl/pvr-texture.c | 2 +- examples/dreamcast/gldc/nehe/nehe06/pvr-texture.c | 2 +- examples/dreamcast/gldc/nehe/nehe08/pvr-texture.c | 2 +- examples/dreamcast/gldc/nehe/nehe09/pvr-texture.c | 2 +- examples/dreamcast/gldc/nehe/nehe16/pvr-texture.c | 2 +- examples/dreamcast/mruby/dreampresent/dckos.c | 2 +- examples/dreamcast/mruby/mrbtris/dckos.c | 2 +- examples/dreamcast/pvr/bumpmap/bump.c | 2 +- examples/dreamcast/pvr/cheap_shadow/shadow.c | 2 +- kernel/arch/dreamcast/hardware/asic.c | 2 +- kernel/arch/dreamcast/hardware/g1ata.c | 12 ++++++------ kernel/arch/dreamcast/hardware/pvr/pvr_buffers.c | 2 +- kernel/arch/dreamcast/hardware/sd.c | 2 +- kernel/arch/dreamcast/hardware/ubc.c | 8 ++++---- kernel/arch/dreamcast/include/arch/arch.h | 4 ++-- kernel/arch/dreamcast/kernel/init.c | 13 ++----------- kernel/arch/dreamcast/kernel/wdt.c | 2 +- kernel/net/net_tcp.c | 2 +- 18 files changed, 28 insertions(+), 37 deletions(-) diff --git a/examples/dreamcast/gldc/basic/gl/pvr-texture.c b/examples/dreamcast/gldc/basic/gl/pvr-texture.c index 00592c37..05c5af77 100644 --- a/examples/dreamcast/gldc/basic/gl/pvr-texture.c +++ b/examples/dreamcast/gldc/basic/gl/pvr-texture.c @@ -16,7 +16,7 @@ #include <GL/glext.h> #define PVR_HDR_SIZE 0x20 -#define MAX(x, y) ((x > y) ? x : y) +#define MAX(x, y) ((x) > (y) ? (x) : (y)) static GLuint PVR_TextureHeight(unsigned char *HDR); static GLuint PVR_TextureWidth(unsigned char *HDR); diff --git a/examples/dreamcast/gldc/nehe/nehe06/pvr-texture.c b/examples/dreamcast/gldc/nehe/nehe06/pvr-texture.c index 00592c37..05c5af77 100644 --- a/examples/dreamcast/gldc/nehe/nehe06/pvr-texture.c +++ b/examples/dreamcast/gldc/nehe/nehe06/pvr-texture.c @@ -16,7 +16,7 @@ #include <GL/glext.h> #define PVR_HDR_SIZE 0x20 -#define MAX(x, y) ((x > y) ? x : y) +#define MAX(x, y) ((x) > (y) ? (x) : (y)) static GLuint PVR_TextureHeight(unsigned char *HDR); static GLuint PVR_TextureWidth(unsigned char *HDR); diff --git a/examples/dreamcast/gldc/nehe/nehe08/pvr-texture.c b/examples/dreamcast/gldc/nehe/nehe08/pvr-texture.c index 00592c37..05c5af77 100644 --- a/examples/dreamcast/gldc/nehe/nehe08/pvr-texture.c +++ b/examples/dreamcast/gldc/nehe/nehe08/pvr-texture.c @@ -16,7 +16,7 @@ #include <GL/glext.h> #define PVR_HDR_SIZE 0x20 -#define MAX(x, y) ((x > y) ? x : y) +#define MAX(x, y) ((x) > (y) ? (x) : (y)) static GLuint PVR_TextureHeight(unsigned char *HDR); static GLuint PVR_TextureWidth(unsigned char *HDR); diff --git a/examples/dreamcast/gldc/nehe/nehe09/pvr-texture.c b/examples/dreamcast/gldc/nehe/nehe09/pvr-texture.c index 00592c37..05c5af77 100644 --- a/examples/dreamcast/gldc/nehe/nehe09/pvr-texture.c +++ b/examples/dreamcast/gldc/nehe/nehe09/pvr-texture.c @@ -16,7 +16,7 @@ #include <GL/glext.h> #define PVR_HDR_SIZE 0x20 -#define MAX(x, y) ((x > y) ? x : y) +#define MAX(x, y) ((x) > (y) ? (x) : (y)) static GLuint PVR_TextureHeight(unsigned char *HDR); static GLuint PVR_TextureWidth(unsigned char *HDR); diff --git a/examples/dreamcast/gldc/nehe/nehe16/pvr-texture.c b/examples/dreamcast/gldc/nehe/nehe16/pvr-texture.c index 00592c37..05c5af77 100644 --- a/examples/dreamcast/gldc/nehe/nehe16/pvr-texture.c +++ b/examples/dreamcast/gldc/nehe/nehe16/pvr-texture.c @@ -16,7 +16,7 @@ #include <GL/glext.h> #define PVR_HDR_SIZE 0x20 -#define MAX(x, y) ((x > y) ? x : y) +#define MAX(x, y) ((x) > (y) ? (x) : (y)) static GLuint PVR_TextureHeight(unsigned char *HDR); static GLuint PVR_TextureWidth(unsigned char *HDR); diff --git a/examples/dreamcast/mruby/dreampresent/dckos.c b/examples/dreamcast/mruby/dreampresent/dckos.c index e34c1e8a..53dc7ec6 100644 --- a/examples/dreamcast/mruby/dreampresent/dckos.c +++ b/examples/dreamcast/mruby/dreampresent/dckos.c @@ -42,7 +42,7 @@ #define CONV1555TO565(colour) ( (((colour) & 0x7C00) << 1) | (((colour) & 0x03E0) << 1) | ((colour) & 0x001F) ) // CONVERT R, G, B to RGB565 -#define PACK_PIXEL(r, g, b) ( ((r & 0xF8) << 8) | ((g & 0xFC) << 3) | (b >> 3) ) +#define PACK_PIXEL(r, g, b) ( (((r) & 0xF8) << 8) | (((g) & 0xFC) << 3) | ((b) >> 3) ) int PX_PER_LINE = 640; diff --git a/examples/dreamcast/mruby/mrbtris/dckos.c b/examples/dreamcast/mruby/mrbtris/dckos.c index 68fe87a8..ea2e3e51 100644 --- a/examples/dreamcast/mruby/mrbtris/dckos.c +++ b/examples/dreamcast/mruby/mrbtris/dckos.c @@ -36,7 +36,7 @@ #include <stdio.h> #include <inttypes.h> -#define PACK_PIXEL(r, g, b) ( ((r & 0xF8) << 8) | ((g & 0xFC) << 3) | (b >> 3) ) +#define PACK_PIXEL(r, g, b) ( (((r) & 0xF8) << 8) | (((g) & 0xFC) << 3) | ((b) >> 3) ) #define BUFSIZE 100 diff --git a/examples/dreamcast/pvr/bumpmap/bump.c b/examples/dreamcast/pvr/bumpmap/bump.c index fc33a989..c33d669b 100644 --- a/examples/dreamcast/pvr/bumpmap/bump.c +++ b/examples/dreamcast/pvr/bumpmap/bump.c @@ -30,7 +30,7 @@ static int textured = 1; #define SIZE 256 -#define CLAMP(low, high, value) (value < low ? low : (value > high ? high : value)) +#define CLAMP(low, high, value) ((value) < (low) ? (low) : ((value) > (high) ? (high) : (value))) static pvr_ptr_t load_texture(const char fn[]) { FILE *fp; diff --git a/examples/dreamcast/pvr/cheap_shadow/shadow.c b/examples/dreamcast/pvr/cheap_shadow/shadow.c index 43619103..08e38724 100644 --- a/examples/dreamcast/pvr/cheap_shadow/shadow.c +++ b/examples/dreamcast/pvr/cheap_shadow/shadow.c @@ -25,7 +25,7 @@ static float mx = 320.0f, my = 240.0f; static pvr_list_t list = PVR_LIST_OP_POLY; static float shadow = 0.5f; -#define CLAMP(low, high, value) (value < low ? low : (value > high ? high : value)) +#define CLAMP(low, high, value) ((value) < (low) ? (low) : ((value) > (high) ? (high) : (value))) void setup(void) { pvr_poly_cxt_t cxt; diff --git a/kernel/arch/dreamcast/hardware/asic.c b/kernel/arch/dreamcast/hardware/asic.c index c45978c6..ab939568 100644 --- a/kernel/arch/dreamcast/hardware/asic.c +++ b/kernel/arch/dreamcast/hardware/asic.c @@ -105,7 +105,7 @@ #define OUT32(addr, data) IN32(addr) = (data) /* The set of asic regs are spaced by 0x10 with 0x4 between each sub reg */ -#define ASIC_EVT_REG_ADDR(irq, sub) (ASIC_IRQD_A + (irq * 0x10) + (sub * 0x4)) +#define ASIC_EVT_REG_ADDR(irq, sub) (ASIC_IRQD_A + ((irq) * 0x10) + ((sub) * 0x4)) #define ASIC_EVT_REGS 3 #define ASIC_EVT_REG_HNDS 32 diff --git a/kernel/arch/dreamcast/hardware/g1ata.c b/kernel/arch/dreamcast/hardware/g1ata.c index 41927be6..9de6b30a 100644 --- a/kernel/arch/dreamcast/hardware/g1ata.c +++ b/kernel/arch/dreamcast/hardware/g1ata.c @@ -155,12 +155,12 @@ typedef struct ata_devdata { #define G1_DMA_TO_MEMORY 1 /* Macros to access the ATA registers */ -#define OUT32(addr, data) *((volatile uint32_t *)addr) = data -#define OUT16(addr, data) *((volatile uint16_t *)addr) = data -#define OUT8(addr, data) *((volatile uint8_t *)addr) = data -#define IN32(addr) *((volatile uint32_t *)addr) -#define IN16(addr) *((volatile uint16_t *)addr) -#define IN8(addr) *((volatile uint8_t *)addr) +#define OUT32(addr, data) *((volatile uint32_t *)(addr)) = data +#define OUT16(addr, data) *((volatile uint16_t *)(addr)) = data +#define OUT8(addr, data) *((volatile uint8_t *)(addr)) = data +#define IN32(addr) *((volatile uint32_t *)(addr)) +#define IN16(addr) *((volatile uint16_t *)(addr)) +#define IN8(addr) *((volatile uint8_t *)(addr)) static int initted = 0; static int devices = 0; diff --git a/kernel/arch/dreamcast/hardware/pvr/pvr_buffers.c b/kernel/arch/dreamcast/hardware/pvr/pvr_buffers.c index 18791f97..0c4d2dcb 100644 --- a/kernel/arch/dreamcast/hardware/pvr/pvr_buffers.c +++ b/kernel/arch/dreamcast/hardware/pvr/pvr_buffers.c @@ -28,7 +28,7 @@ #define IS_ALIGNED(x, m) ((x) % (m) == 0) -#define LIST_ENABLED(i) (pvr_state.lists_enabled & (1 << i)) +#define LIST_ENABLED(i) (pvr_state.lists_enabled & (1 << (i))) /* Fill Tile Matrix buffers. This function takes a base address and sets up diff --git a/kernel/arch/dreamcast/hardware/sd.c b/kernel/arch/dreamcast/hardware/sd.c index 43f05a87..ca6b8af8 100644 --- a/kernel/arch/dreamcast/hardware/sd.c +++ b/kernel/arch/dreamcast/hardware/sd.c @@ -24,7 +24,7 @@ #define READ_RETRIES 50000 #define WRITE_RETRIES 150000 -#define CMD(n) (n | 0x40) +#define CMD(n) ((n) | 0x40) static int byte_mode = 0; static int is_mmc = 0; diff --git a/kernel/arch/dreamcast/hardware/ubc.c b/kernel/arch/dreamcast/hardware/ubc.c index 8d66122b..01796808 100755 --- a/kernel/arch/dreamcast/hardware/ubc.c +++ b/kernel/arch/dreamcast/hardware/ubc.c @@ -16,10 +16,10 @@ #include <assert.h> /* Macros for accessing SFRs common to both channels by index */ -#define BAR(o) (*((vuint32 *)(uintptr_t)(SH4_REG_UBC_BARA + (unsigned)o * 0xc))) /* Address */ -#define BASR(o) (*((vuint8 *)(uintptr_t)(SH4_REG_UBC_BASRA + (unsigned)o * 0x4))) /* ASID */ -#define BAMR(o) (*((vuint8 *)(uintptr_t)(SH4_REG_UBC_BAMRA + (unsigned)o * 0xc))) /* Address Mask */ -#define BBR(o) (*((vuint16 *)(uintptr_t)(SH4_REG_UBC_BBRA + (unsigned)o * 0xc))) /* Bus Cycle */ +#define BAR(o) (*((vuint32 *)(uintptr_t)(SH4_REG_UBC_BARA + (unsigned)(o) * 0xc))) /* Address */ +#define BASR(o) (*((vuint8 *)(uintptr_t)(SH4_REG_UBC_BASRA + (unsigned)(o) * 0x4))) /* ASID */ +#define BAMR(o) (*((vuint8 *)(uintptr_t)(SH4_REG_UBC_BAMRA + (unsigned)(o) * 0xc))) /* Address Mask */ +#define BBR(o) (*((vuint16 *)(uintptr_t)(SH4_REG_UBC_BBRA + (unsigned)(o) * 0xc))) /* Bus Cycle */ /* Macros for accessing individual, channel-specific SFRs */ #define BARA (BAR(ubc_channel_a)) /**< Break Address A */ diff --git a/kernel/arch/dreamcast/include/arch/arch.h b/kernel/arch/dreamcast/include/arch/arch.h index 0db64c95..e16b4eec 100644 --- a/kernel/arch/dreamcast/include/arch/arch.h +++ b/kernel/arch/dreamcast/include/arch/arch.h @@ -370,7 +370,7 @@ const char *kos_get_authors(void); \param fptr The frame pointer to look at. \return The return address of the pointer. */ -#define arch_fptr_ret_addr(fptr) (*((uint32*)fptr)) +#define arch_fptr_ret_addr(fptr) (*((uint32*)(fptr))) /** \brief Pass in a frame pointer value to get the previous frame pointer for the given frame. @@ -379,7 +379,7 @@ const char *kos_get_authors(void); \param fptr The frame pointer to look at. \return The previous frame pointer. */ -#define arch_fptr_next(fptr) (*((uint32*)(fptr+4))) +#define arch_fptr_next(fptr) (*((uint32*)((fptr)+4))) /** \brief Returns true if the passed address is likely to be valid. Doesn't have to be exact, just a sort of general idea. diff --git a/kernel/arch/dreamcast/kernel/init.c b/kernel/arch/dreamcast/kernel/init.c index 72b23790..ee6ecf89 100644 --- a/kernel/arch/dreamcast/kernel/init.c +++ b/kernel/arch/dreamcast/kernel/init.c @@ -50,16 +50,11 @@ uint32 _fs_dclsocket_get_ip(void); /* We have to put this here so we can include plat-specific devices */ dbgio_handler_t * dbgio_handlers[] = { -#ifndef _arch_sub_naomi &dbgio_dcload, &dbgio_dcls, &dbgio_scif, &dbgio_null, &dbgio_fb -#else - &dbgio_null, - &dbgio_fb -#endif }; int dbgio_handler_cnt = sizeof(dbgio_handlers) / sizeof(dbgio_handler_t *); @@ -133,13 +128,11 @@ int __weak arch_auto_init(void) { ubc_init(); -#ifndef _arch_sub_naomi if(!(__kos_init_flags & INIT_NO_DCLOAD)) fs_dcload_init_console(); /* Init dc-load console, if applicable */ /* Init SCIF for debug stuff (maybe) */ scif_init(); -#endif /* Init debug IO */ dbgio_init(); @@ -183,12 +176,12 @@ int __weak arch_auto_init(void) { if(!KOS_INIT_FLAG_CALL(fs_romdisk_mount_builtin)) KOS_INIT_FLAG_CALL(fs_romdisk_mount_builtin_legacy); -#ifndef _arch_sub_naomi if(!(__kos_init_flags & INIT_NO_DCLOAD) && *DCLOADMAGICADDR == DCLOADMAGICVALUE) { dbglog(DBG_INFO, "dc-load console support enabled\n"); fs_dcload_init(); } +#ifndef _arch_sub_naomi fs_iso9660_init(); #endif @@ -211,8 +204,8 @@ int __weak arch_auto_init(void) { } void __weak arch_auto_shutdown(void) { -#ifndef _arch_sub_naomi fs_dclsocket_shutdown(); +#ifndef _arch_sub_naomi KOS_INIT_FLAG_CALL(net_shutdown); #endif @@ -222,9 +215,7 @@ void __weak arch_auto_shutdown(void) { hardware_shutdown(); pvr_shutdown(); library_shutdown(); -#ifndef _arch_sub_naomi fs_dcload_shutdown(); -#endif KOS_INIT_FLAG_CALL(vmu_fs_shutdown); #ifndef _arch_sub_naomi fs_iso9660_shutdown(); diff --git a/kernel/arch/dreamcast/kernel/wdt.c b/kernel/arch/dreamcast/kernel/wdt.c index bf874d9f..68f9c3d9 100644 --- a/kernel/arch/dreamcast/kernel/wdt.c +++ b/kernel/arch/dreamcast/kernel/wdt.c @@ -10,7 +10,7 @@ #include <arch/irq.h> /* Macros for accessing WDT registers */ -#define WDT(o, t) (*((volatile t *)(WDT_BASE + o))) +#define WDT(o, t) (*((volatile t *)(WDT_BASE + (o)))) #define WDT_READ(o) (WDT(o, uint8_t)) #define WDT_WRITE(o, v) (WDT(o, uint16_t) = ((o##_HIGH << 8) | ((v) & 0xff))) diff --git a/kernel/net/net_tcp.c b/kernel/net/net_tcp.c index 04bff2ff..4df7834a 100644 --- a/kernel/net/net_tcp.c +++ b/kernel/net/net_tcp.c @@ -240,7 +240,7 @@ static int thd_cb_id = 0; #define SEQ_GT(x, y) (((int32_t)((x) - (y))) > 0) #define SEQ_GE(x, y) (((int32_t)((x) - (y))) >= 0) -#define MAX(x, y) (x > y ? x : y) +#define MAX(x, y) ((x) > (y) ? (x) : (y)) /* Forward declarations */ static fs_socket_proto_t proto; hooks/post-receive -- A pseudo Operating System for the Dreamcast. |