You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(35) |
Dec
(2) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(37) |
Feb
(10) |
Mar
|
Apr
(2) |
May
(17) |
Jun
(1) |
Jul
(14) |
Aug
(14) |
Sep
(4) |
Oct
|
Nov
(14) |
Dec
(4) |
2005 |
Jan
(6) |
Feb
|
Mar
|
Apr
(6) |
May
|
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
|
Nov
(92) |
Dec
(12) |
2006 |
Jan
(3) |
Feb
(4) |
Mar
|
Apr
(5) |
May
(3) |
Jun
(15) |
Jul
(3) |
Aug
(1) |
Sep
(29) |
Oct
(1) |
Nov
(6) |
Dec
(5) |
2007 |
Jan
(2) |
Feb
(2) |
Mar
|
Apr
(3) |
May
(14) |
Jun
(2) |
Jul
(16) |
Aug
(73) |
Sep
(12) |
Oct
(9) |
Nov
(27) |
Dec
(3) |
2008 |
Jan
(4) |
Feb
(4) |
Mar
(3) |
Apr
(8) |
May
(23) |
Jun
(4) |
Jul
(1) |
Aug
(3) |
Sep
(7) |
Oct
(5) |
Nov
(1) |
Dec
(1) |
2009 |
Jan
|
Feb
(10) |
Mar
|
Apr
(4) |
May
(4) |
Jun
(10) |
Jul
|
Aug
(1) |
Sep
|
Oct
(7) |
Nov
|
Dec
(1) |
2010 |
Jan
|
Feb
(1) |
Mar
|
Apr
(6) |
May
|
Jun
(3) |
Jul
(11) |
Aug
(1) |
Sep
|
Oct
(15) |
Nov
(1) |
Dec
(5) |
2011 |
Jan
(4) |
Feb
(1) |
Mar
(6) |
Apr
|
May
(22) |
Jun
|
Jul
(8) |
Aug
(2) |
Sep
|
Oct
|
Nov
|
Dec
(2) |
2012 |
Jan
|
Feb
(10) |
Mar
(1) |
Apr
(6) |
May
(27) |
Jun
(48) |
Jul
(30) |
Aug
(4) |
Sep
|
Oct
(3) |
Nov
(1) |
Dec
(11) |
2013 |
Jan
(4) |
Feb
(7) |
Mar
(6) |
Apr
(18) |
May
(28) |
Jun
(20) |
Jul
|
Aug
(4) |
Sep
(1) |
Oct
(1) |
Nov
(2) |
Dec
(7) |
2014 |
Jan
(3) |
Feb
(2) |
Mar
(4) |
Apr
(9) |
May
(11) |
Jun
(10) |
Jul
|
Aug
(18) |
Sep
(12) |
Oct
(17) |
Nov
(10) |
Dec
(16) |
2015 |
Jan
(5) |
Feb
(1) |
Mar
(5) |
Apr
(4) |
May
(28) |
Jun
(2) |
Jul
|
Aug
|
Sep
(6) |
Oct
|
Nov
(2) |
Dec
(1) |
2016 |
Jan
(14) |
Feb
|
Mar
(3) |
Apr
|
May
|
Jun
(3) |
Jul
(4) |
Aug
(4) |
Sep
(1) |
Oct
(1) |
Nov
|
Dec
(1) |
2017 |
Jan
(11) |
Feb
|
Mar
(21) |
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
2018 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
(2) |
Sep
(4) |
Oct
(4) |
Nov
|
Dec
(1) |
2019 |
Jan
(1) |
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
(13) |
Sep
(4) |
Oct
|
Nov
|
Dec
|
2020 |
Jan
(10) |
Feb
(9) |
Mar
(5) |
Apr
(4) |
May
(3) |
Jun
(18) |
Jul
(4) |
Aug
(2) |
Sep
(20) |
Oct
(2) |
Nov
|
Dec
|
2021 |
Jan
|
Feb
|
Mar
|
Apr
(2) |
May
(1) |
Jun
(2) |
Jul
(1) |
Aug
(2) |
Sep
|
Oct
|
Nov
|
Dec
(2) |
2022 |
Jan
(1) |
Feb
(2) |
Mar
(2) |
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
(5) |
Sep
|
Oct
(1) |
Nov
|
Dec
(1) |
2023 |
Jan
(10) |
Feb
(7) |
Mar
(29) |
Apr
(31) |
May
(29) |
Jun
(34) |
Jul
(3) |
Aug
(24) |
Sep
(22) |
Oct
(10) |
Nov
(38) |
Dec
(27) |
2024 |
Jan
(15) |
Feb
(8) |
Mar
(4) |
Apr
(20) |
May
(33) |
Jun
(18) |
Jul
(15) |
Aug
(23) |
Sep
(26) |
Oct
(32) |
Nov
(6) |
Dec
(4) |
2025 |
Jan
(7) |
Feb
(1) |
Mar
(1) |
Apr
(4) |
May
(46) |
Jun
(19) |
Jul
(26) |
Aug
(48) |
Sep
(30) |
Oct
(3) |
Nov
|
Dec
|
From: kosmirror <kos...@us...> - 2025-10-04 19:05:18
|
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 62f93b8ab81c39ee6c794d03d79270f5d5c63771 (commit) via f2a478156b6c2956bca53823574e4a229a621d73 (commit) from 89817fd127fc605af3f49e28853918171fbd6229 (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 62f93b8ab81c39ee6c794d03d79270f5d5c63771 Author: Paul Cercueil <pa...@cr...> Date: Sat Oct 4 17:18:17 2025 +0200 pvr: Add missing 'return' to pvr_set_vertical_scale() The success path did not return anything. Signed-off-by: Paul Cercueil <pa...@cr...> commit f2a478156b6c2956bca53823574e4a229a621d73 Author: Paul Cercueil <pa...@cr...> Date: Sat Oct 4 17:11:27 2025 +0200 Mark linker symbols as uint8_t arrays And move the definitions to the new <kos/linker.h> header. Referencing the linker symbols as "extern uintptr_t" has a drawback: the compiler considers that the memory area covered is just 4 bytes, and will therefore complain if memcpy() tries to copy more than 4 bytes from/to there. This happens in Bloom, which stores some init data into the BSS section. Signed-off-by: Paul Cercueil <pa...@cr...> ----------------------------------------------------------------------- Summary of changes: include/kos.h | 1 + include/kos/linker.h | 27 +++++++++++++++++++++++++++ kernel/arch/dreamcast/hardware/pvr/pvr_misc.c | 2 ++ kernel/arch/dreamcast/kernel/init.c | 6 ++---- 4 files changed, 32 insertions(+), 4 deletions(-) create mode 100644 include/kos/linker.h diff --git a/include/kos.h b/include/kos.h index 06fa977f..17d5f02f 100644 --- a/include/kos.h +++ b/include/kos.h @@ -39,6 +39,7 @@ __BEGIN_DECLS #include <kos/fs_dev.h> #include <kos/fs_pty.h> #include <kos/limits.h> +#include <kos/linker.h> #include <kos/thread.h> #include <kos/sem.h> #include <kos/rwsem.h> diff --git a/include/kos/linker.h b/include/kos/linker.h new file mode 100644 index 00000000..7a4e6e52 --- /dev/null +++ b/include/kos/linker.h @@ -0,0 +1,27 @@ +/* KallistiOS ##version## + + include/kos/linker.h + Copyright (C) 2025 Paul Cercueil +*/ + +/** \file kos/linker.h + \brief Linker script related definitions and macros. + \ingroup linker + + \author Paul Cercueil +*/ + +#ifndef __KOS_LINKER_H +#define __KOS_LINKER_H + +#include <kos/cdefs.h> +__BEGIN_DECLS + +#include <stdint.h> + +extern uint8_t _bss_start[]; +extern uint8_t end[]; + +__END_DECLS + +#endif /* __KOS_LINKER_H */ diff --git a/kernel/arch/dreamcast/hardware/pvr/pvr_misc.c b/kernel/arch/dreamcast/hardware/pvr/pvr_misc.c index 8e6cd09b..eff80f2e 100644 --- a/kernel/arch/dreamcast/hardware/pvr/pvr_misc.c +++ b/kernel/arch/dreamcast/hardware/pvr/pvr_misc.c @@ -304,4 +304,6 @@ int pvr_set_vertical_scale(float factor) { cfg |= FIELD_PREP(PVR_SCALER_CFG_VSCALE_FACTOR, f16); PVR_SET(PVR_SCALER_CFG, cfg); + + return 0; } diff --git a/kernel/arch/dreamcast/kernel/init.c b/kernel/arch/dreamcast/kernel/init.c index d459ad19..2287c6c2 100644 --- a/kernel/arch/dreamcast/kernel/init.c +++ b/kernel/arch/dreamcast/kernel/init.c @@ -14,6 +14,7 @@ #include <kos/dbgio.h> #include <kos/dbglog.h> #include <kos/init.h> +#include <kos/linker.h> #include <kos/platform.h> #include <kos/timer.h> #include <arch/arch.h> @@ -30,8 +31,6 @@ #include "initall_hdrs.h" -extern uintptr_t _bss_start, end; - /* ctor/dtor stuff from libgcc. */ #if __GNUC__ == 4 #define _init init @@ -281,7 +280,6 @@ void __weak_symbol arch_auto_shutdown(void) { /* This is the entry point inside the C program */ void arch_main(void) { - uint8 *bss_start = (uint8 *)(&_bss_start); int rv; dma_init(); @@ -297,7 +295,7 @@ void arch_main(void) { __kos_init_early_fn(); /* Clear out the BSS area */ - memset(bss_start, 0, (uintptr_t)(&end) - (uintptr_t)bss_start); + memset(_bss_start, 0, (uintptr_t)end - (uintptr_t)_bss_start); /* Do auto-init stuff */ arch_auto_init(); hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: kosmirror <kos...@us...> - 2025-10-03 01:03:21
|
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 89817fd127fc605af3f49e28853918171fbd6229 (commit) via c1b2ec788d2e584f892fd67fbcf2fca00726ca74 (commit) via c624e70a7fdf4bfdef1b513323e567c953bd115c (commit) from c9465a67e9ca5df6a82a1c10d1145febb2915ee8 (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 89817fd127fc605af3f49e28853918171fbd6229 Author: Paul Cercueil <pa...@cr...> Date: Thu Oct 2 12:15:41 2025 +0200 examples: pvr/fb_tex: Force vertical scale to 1.0f The default vertical scale is actually 0.999f when a regular A/V cable is plugged. This won't work properly here, as the error will accumulate in the framebuffer, causing a rather neat fading effect towards the center (but not what we want in this example). Signed-off-by: Paul Cercueil <pa...@cr...> commit c1b2ec788d2e584f892fd67fbcf2fca00726ca74 Author: Paul Cercueil <pa...@cr...> Date: Thu Oct 2 12:09:46 2025 +0200 pvr: Add function pvr_set_vertical_scale() This function can be used to configure a different vertical scale factor used when the PVR scene is rendered to the framebuffer. It can be used by an application when the default setting (1.0x for VGA and 0.999x for RGB) is not good enough. Signed-off-by: Paul Cercueil <pa...@cr...> commit c624e70a7fdf4bfdef1b513323e567c953bd115c Author: Paul Cercueil <pa...@cr...> Date: Thu Oct 2 12:08:24 2025 +0200 pvr: Clean up handling of PVR_SCALER_CFG register Rework the code a bit so that it is more understandable. Use regfield macros to clean it up. Signed-off-by: Paul Cercueil <pa...@cr...> ----------------------------------------------------------------------- Summary of changes: examples/dreamcast/pvr/fb_tex/fb_tex.c | 6 ++++++ .../dreamcast/hardware/pvr/pvr_init_shutdown.c | 21 +++++++++------------ kernel/arch/dreamcast/hardware/pvr/pvr_misc.c | 22 ++++++++++++++++++++++ kernel/arch/dreamcast/include/dc/pvr/pvr_misc.h | 14 ++++++++++++++ kernel/arch/dreamcast/include/dc/pvr/pvr_regs.h | 10 ++++++++++ 5 files changed, 61 insertions(+), 12 deletions(-) diff --git a/examples/dreamcast/pvr/fb_tex/fb_tex.c b/examples/dreamcast/pvr/fb_tex/fb_tex.c index 2eb896e5..661d27f4 100644 --- a/examples/dreamcast/pvr/fb_tex/fb_tex.c +++ b/examples/dreamcast/pvr/fb_tex/fb_tex.c @@ -203,6 +203,12 @@ int main(int argc, char **argv) { /* Set the stride length for strided textures. */ pvr_txr_set_stride(640); + /* The default vertical scale is actually 0.999f when a regular A/V cable + * is plugged. This won't work properly here, as the error will accumulate + * in the framebuffer, causing a rather neat fading effect towards the + * center (but not what we want in this example). */ + pvr_set_vertical_scale(1.0f); + fake_tex = pvr_mem_malloc(sizeof(fake_tex_data)); pvr_txr_load(fake_tex_data, fake_tex, sizeof(fake_tex_data)); diff --git a/kernel/arch/dreamcast/hardware/pvr/pvr_init_shutdown.c b/kernel/arch/dreamcast/hardware/pvr/pvr_init_shutdown.c index 7aa3b019..44df16e4 100644 --- a/kernel/arch/dreamcast/hardware/pvr/pvr_init_shutdown.c +++ b/kernel/arch/dreamcast/hardware/pvr/pvr_init_shutdown.c @@ -57,6 +57,8 @@ int pvr_init_defaults(void) { come from the texture memory pool! Expects that a 2D mode was initialized already using the vid_* API. */ int pvr_init(const pvr_init_params_t *params) { + uint16_t vscale = 1024; + /* If we're already initialized, fail */ if(pvr_state.valid == 1) { dbglog(DBG_WARNING, "pvr: pvr_init called twice!\n"); @@ -130,21 +132,16 @@ int pvr_init(const pvr_init_params_t *params) { /* If we're on a VGA box, disable vertical smoothing */ if(vid_mode->cable_type == CT_VGA) { dbglog(DBG_KDEBUG, "pvr: disabling vertical scaling for VGA\n"); - - if(pvr_state.fsaa) - PVR_SET(PVR_SCALER_CFG, 0x10400); - else - PVR_SET(PVR_SCALER_CFG, 0x400); - } - else { + } else { dbglog(DBG_KDEBUG, "pvr: enabling vertical scaling for non-VGA\n"); - - if(pvr_state.fsaa) - PVR_SET(PVR_SCALER_CFG, 0x10401); - else - PVR_SET(PVR_SCALER_CFG, 0x401); + vscale++; } + /* Set horizontal / vertical scale factors */ + PVR_SET(PVR_SCALER_CFG, + FIELD_PREP(PVR_SCALER_CFG_FSAA, pvr_state.fsaa) | + FIELD_PREP(PVR_SCALER_CFG_VSCALE_FACTOR, vscale)); + /* Hook the PVR interrupt events on G2 */ pvr_state.vbl_handle = vblank_handler_add(pvr_vblank_handler, NULL); diff --git a/kernel/arch/dreamcast/hardware/pvr/pvr_misc.c b/kernel/arch/dreamcast/hardware/pvr/pvr_misc.c index e9ebf611..8e6cd09b 100644 --- a/kernel/arch/dreamcast/hardware/pvr/pvr_misc.c +++ b/kernel/arch/dreamcast/hardware/pvr/pvr_misc.c @@ -283,3 +283,25 @@ pvr_ptr_t pvr_get_front_buffer(void) { addressable from the 64-bit memory */ return (pvr_ptr_t)(addr * 2 + PVR_RAM_BASE); } + +int pvr_set_vertical_scale(float factor) { + uint32_t f16; + uint32_t cfg; + + if(factor == 0.0f) + return -1; + + f16 = 1024.0f / factor; + + if(f16 == 0 || f16 >= 65536) + return -1; + + irq_disable_scoped(); + + cfg = PVR_GET(PVR_SCALER_CFG); + + cfg &= ~PVR_SCALER_CFG_VSCALE_FACTOR; + cfg |= FIELD_PREP(PVR_SCALER_CFG_VSCALE_FACTOR, f16); + + PVR_SET(PVR_SCALER_CFG, cfg); +} diff --git a/kernel/arch/dreamcast/include/dc/pvr/pvr_misc.h b/kernel/arch/dreamcast/include/dc/pvr/pvr_misc.h index 22478a1f..5c7bdbaf 100644 --- a/kernel/arch/dreamcast/include/dc/pvr/pvr_misc.h +++ b/kernel/arch/dreamcast/include/dc/pvr/pvr_misc.h @@ -115,6 +115,20 @@ void pvr_set_shadow_scale(bool enable, float scale_value); */ void pvr_set_zclip(float zc); +/** \brief Set the vertical scale factor. + \ingroup pvr_global + + This function sets the vertical scale factor used when the PVR scene is + rendered to the framebuffer. Generally you want 1.0f or near-1.0f values + here. The default used by the PVR driver is 1.0f when using VGA, and 0.999f + otherwise. Having a value slightly below 1.0f gives the image a pleasant + smoothing. + + \retval 0 On success + \retval -1 On invalid factor value +*/ +int pvr_set_vertical_scale(float factor); + /** \brief Set the translucent polygon sort mode for the next frame. \ingroup pvr_scene_mgmt diff --git a/kernel/arch/dreamcast/include/dc/pvr/pvr_regs.h b/kernel/arch/dreamcast/include/dc/pvr/pvr_regs.h index 8905596a..10076d6e 100644 --- a/kernel/arch/dreamcast/include/dc/pvr/pvr_regs.h +++ b/kernel/arch/dreamcast/include/dc/pvr/pvr_regs.h @@ -218,6 +218,16 @@ __BEGIN_DECLS #define PVR_TXR_STRIDE_MULT GENMASK(4, 0) /**< \brief Bottom 5 bits contain the size when using PVR_TXRFMT_X32_STRIDE */ /** @} */ +/** \defgroup pvr_scaler PVR_SCALER_CFG Values + \brief Definitions for the fields of the PVR_SCALER_CFG register. + \ingroup pvr_registers + @{ +*/ +#define PVR_SCALER_CFG_FSAA BIT(16) /**< \brief Enable FSAA */ + +#define PVR_SCALER_CFG_VSCALE_FACTOR GENMASK(15, 0) /**< \brief Vertical scale factor = 1024 / value */ +/** @} */ + __END_DECLS #endif /* __DC_PVR_PVR_REGS_H */ hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: kosmirror <kos...@us...> - 2025-10-02 19:32:05
|
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 c9465a67e9ca5df6a82a1c10d1145febb2915ee8 (commit) from c601a70e93d67872953d2c091d496101c5692c56 (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 c9465a67e9ca5df6a82a1c10d1145febb2915ee8 Author: darc <da...@pr...> Date: Thu Oct 2 12:27:00 2025 -0500 environ.sh.sample: Fix the comment describing the behavior of the no-PIC KOS_CFLAG ----------------------------------------------------------------------- Summary of changes: doc/environ.sh.sample | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/environ.sh.sample b/doc/environ.sh.sample index efccb33d..ad6ce82b 100644 --- a/doc/environ.sh.sample +++ b/doc/environ.sh.sample @@ -161,7 +161,7 @@ export KOS_CFLAGS="${KOS_CFLAGS} -O2" # Position-Independent Code # -# Comment this line out to enable position-dependent code. Codegen is slightly +# Comment this line out to enable position-independent code. Codegen is slightly # slower, and you lose a register, but it's required when building dynamically # linked libraries or code whose symbols aren't resolved until runtime. # hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: kosmirror <kos...@us...> - 2025-09-29 23:23:31
|
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 c601a70e93d67872953d2c091d496101c5692c56 (commit) from c6df54ce9cb887569312e929a59dd12539bf1b85 (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 c601a70e93d67872953d2c091d496101c5692c56 Author: QuzarDC <qu...@co...> Date: Mon Sep 29 19:13:11 2025 -0400 dc-chain: Update docs and mingw patch for sys/sched.h removal Cleaning up after the removal of the patch in #1208. The default `sys/sched.h` from newlib is used instead. ----------------------------------------------------------------------- Summary of changes: utils/dc-chain/doc/mingw/packages/fixup-sh4-newlib.sh | 1 - utils/dc-chain/patches/README.md | 1 - 2 files changed, 2 deletions(-) diff --git a/utils/dc-chain/doc/mingw/packages/fixup-sh4-newlib.sh b/utils/dc-chain/doc/mingw/packages/fixup-sh4-newlib.sh index ddc49717..b8f218b2 100644 --- a/utils/dc-chain/doc/mingw/packages/fixup-sh4-newlib.sh +++ b/utils/dc-chain/doc/mingw/packages/fixup-sh4-newlib.sh @@ -17,4 +17,3 @@ cp -r $kos_base/kernel/arch/dreamcast/include/dc $newlib_inc # they are already "cp" instructions. cp $kos_base/include/pthread.h $newlib_inc cp $kos_base/include/sys/_pthread.h $newlib_inc/sys -cp $kos_base/include/sys/sched.h $newlib_inc/sys diff --git a/utils/dc-chain/patches/README.md b/utils/dc-chain/patches/README.md index 29f447a1..9b60d6a6 100644 --- a/utils/dc-chain/patches/README.md +++ b/utils/dc-chain/patches/README.md @@ -25,7 +25,6 @@ Generic `newlib` fixups (applied directly after `newlib` is installed): ``` cp $(kos_base)/include/pthread.h $(newlib_inc) # KOS pthread.h is modified cp $(kos_base)/include/sys/_pthread.h $(newlib_inc)/sys # to define _POSIX_THREADS -cp $(kos_base)/include/sys/sched.h $(newlib_inc)/sys # pthreads to kthreads mapping ln -nsf $(kos_base)/include/kos $(newlib_inc) # so KOS includes are available as kos/file.h ln -nsf $(kos_base)/kernel/arch/dreamcast/include/arch $(newlib_inc) # kos/thread.h requires arch/arch.h ln -nsf $(kos_base)/kernel/arch/dreamcast/include/dc $(newlib_inc) # arch/arch.h requires dc/video.h hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: kosmirror <kos...@us...> - 2025-09-29 21:29:26
|
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 c6df54ce9cb887569312e929a59dd12539bf1b85 (commit) via 026575d488a452af85bcec93223265b5818d1064 (commit) via faec4393a9701910544d87a59675572c522a14eb (commit) via 12a1e70747317a978d457e93a7ce2dcd621f7bd9 (commit) via dc6f500d559658cf0deb0876653f2d2b5592240a (commit) via f6b5f2da9abd67d28e45d0f863f91db629ad4179 (commit) via 498d9d3bca9a1a8cdee451fae02d6117500f86f9 (commit) via ba0cb2b6a3583f2d3340f43bbc104d6f315917d8 (commit) from 694e333fa60be8eaf078156c7d89a5e05d369254 (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 c6df54ce9cb887569312e929a59dd12539bf1b85 Author: QuzarDC <qu...@co...> Date: Thu Sep 25 22:46:29 2025 -0400 libppp: Remove incorrect usages of `__fallthrough` The fallthrough attribute is only correctly used when in a switch statement after a preceeding statement. In these cases there were no preceeding statements, so there will also be no implicit fallthrough warnings. commit 026575d488a452af85bcec93223265b5818d1064 Author: QuzarDC <qu...@co...> Date: Thu Sep 25 21:11:14 2025 -0400 libkosext2fs: Avoid shifting signed values too far. commit faec4393a9701910544d87a59675572c522a14eb Author: QuzarDC <qu...@co...> Date: Thu Sep 25 21:10:30 2025 -0400 net: Set appropriate printf format specifier for size_t values. commit 12a1e70747317a978d457e93a7ce2dcd621f7bd9 Author: QuzarDC <qu...@co...> Date: Thu Sep 25 21:04:46 2025 -0400 fs_pty: Use unsigned int for id value. It's not possible for the id to be set to a negative value, and having it as a signed int created a mismatch with `sscanf`'s prototype. commit dc6f500d559658cf0deb0876653f2d2b5592240a Author: QuzarDC <qu...@co...> Date: Thu Sep 25 20:43:25 2025 -0400 fs_dclsocket: Initialize stat before passing to syscall. commit f6b5f2da9abd67d28e45d0f863f91db629ad4179 Author: QuzarDC <qu...@co...> Date: Thu Sep 25 20:17:20 2025 -0400 entry.s: Add newline to end of file. Assembler was warning about it and inserting one to avoid the file ending with a comment. commit 498d9d3bca9a1a8cdee451fae02d6117500f86f9 Author: QuzarDC <qu...@co...> Date: Thu Sep 25 19:31:25 2025 -0400 fs_dclsocket: Avoid possible null deref. This could happen when building for naomi as no net device is being specified. This code should be unreachable in those cases, but this will quiet the warnings. commit ba0cb2b6a3583f2d3340f43bbc104d6f315917d8 Author: QuzarDC <qu...@co...> Date: Thu Sep 25 15:28:30 2025 -0400 timer: Explicitly cast ticks to `long int` `timespec.tv_nsec` is implemented as a `long int` while our `timer_val_t.ticks` is a `uint32_t`. The value will always be limited to 999999999 as it's a count of ns, but without explicit casting this will trigger a narrowing warning. ----------------------------------------------------------------------- Summary of changes: addons/libkosext2fs/bitops.c | 8 ++++---- addons/libppp/ipcp.c | 3 --- kernel/arch/dreamcast/fs/fs_dclsocket.c | 4 +++- kernel/arch/dreamcast/include/arch/timer.h | 2 +- kernel/arch/dreamcast/kernel/entry.s | 2 +- kernel/fs/fs_pty.c | 6 +++--- kernel/net/net_icmp.c | 4 ++-- kernel/net/net_icmp6.c | 4 ++-- 8 files changed, 16 insertions(+), 17 deletions(-) diff --git a/addons/libkosext2fs/bitops.c b/addons/libkosext2fs/bitops.c index f37ed673..71982e82 100644 --- a/addons/libkosext2fs/bitops.c +++ b/addons/libkosext2fs/bitops.c @@ -18,7 +18,7 @@ uint32_t ext2_bit_find_nonzero(const uint32_t *btbl, uint32_t start, tmp = btbl[i]; if(tmp != 0) { for(; j < 32; ++j) { - if(tmp & (1 << j)) + if(tmp & (1u << j)) return (i << 5) | j; } } @@ -31,7 +31,7 @@ uint32_t ext2_bit_find_nonzero(const uint32_t *btbl, uint32_t start, tmp = btbl[i]; if(tmp != 0) { for(; j < (end & 0x1F); ++j) { - if(tmp & (1 << j)) + if(tmp & (1u << j)) return (i << 5) | j; } } @@ -52,7 +52,7 @@ uint32_t ext2_bit_find_zero(const uint32_t *btbl, uint32_t start, tmp = btbl[i]; if(tmp != 0xFFFFFFFF) { for(; j < 32; ++j) { - if(!(tmp & (1 << j))) + if(!(tmp & (1u << j))) return (i << 5) | j; } } @@ -65,7 +65,7 @@ uint32_t ext2_bit_find_zero(const uint32_t *btbl, uint32_t start, tmp = btbl[i]; if(tmp != 0xFFFFFFFF) { for(; j < (end & 0x1F); ++j) { - if(!(tmp & (1 << j))) + if(!(tmp & (1u << j))) return (i << 5) | j; } } diff --git a/addons/libppp/ipcp.c b/addons/libppp/ipcp.c index 80051b51..a1654882 100644 --- a/addons/libppp/ipcp.c +++ b/addons/libppp/ipcp.c @@ -177,7 +177,6 @@ static int ipcp_handle_configure_req(ppp_protocol_t *self, case PPP_STATE_OPENED: /* XXXX: This layer down. */ - __fallthrough; case PPP_STATE_STOPPED: ipcp_send_client_cfg(self, 0); @@ -390,7 +389,6 @@ static int ipcp_handle_configure_ack(ppp_protocol_t *self, case PPP_STATE_OPENED: /* Uh oh... Something's gone wrong. */ /* XXXX: This layer down. */ - __fallthrough; case PPP_STATE_ACK_RECEIVED: /* Well, this isn't good... Resend the configure request and back @@ -440,7 +438,6 @@ static int ipcp_handle_configure_nak(ppp_protocol_t *self, case PPP_STATE_OPENED: /* XXXX: This layer down. */ - __fallthrough; case PPP_STATE_REQUEST_SENT: case PPP_STATE_ACK_RECEIVED: diff --git a/kernel/arch/dreamcast/fs/fs_dclsocket.c b/kernel/arch/dreamcast/fs/fs_dclsocket.c index 72e32466..b91a6bff 100644 --- a/kernel/arch/dreamcast/fs/fs_dclsocket.c +++ b/kernel/arch/dreamcast/fs/fs_dclsocket.c @@ -171,6 +171,8 @@ static void dcls_recv_loop(void) { while(!escape) { /* If we're in an interrupt, this works differently.... */ if(irq_inside_int()) { + if(!net_default_dev) + break; /* Since we can't count on an interrupt happening, handle it manually, and poll the default device... */ net_default_dev->if_rx_poll(net_default_dev); @@ -512,7 +514,7 @@ static int dcls_unlink(vfs_handler_t *vfs, const char *fn) { static int dcls_stat(vfs_handler_t *vfs, const char *fn, struct stat *rv, int flag) { command_t *cmd = (command_t *)pktbuf; - dcload_stat_t filestat; + dcload_stat_t filestat = { 0 }; (void)flag; diff --git a/kernel/arch/dreamcast/include/arch/timer.h b/kernel/arch/dreamcast/include/arch/timer.h index 99694a32..6a235152 100644 --- a/kernel/arch/dreamcast/include/arch/timer.h +++ b/kernel/arch/dreamcast/include/arch/timer.h @@ -262,7 +262,7 @@ static inline struct timespec arch_timer_gettime(void) { /* Convert from ticks to nanoseconds: each clock tick is 80ns. */ return (struct timespec){ .tv_sec = time.secs, - .tv_nsec = time.ticks * 80, + .tv_nsec = (long int)(time.ticks * 80), }; } diff --git a/kernel/arch/dreamcast/kernel/entry.s b/kernel/arch/dreamcast/kernel/entry.s index 1ee06592..c7416cc7 100644 --- a/kernel/arch/dreamcast/kernel/entry.s +++ b/kernel/arch/dreamcast/kernel/entry.s @@ -342,4 +342,4 @@ _vma_table_400: ! TLB miss exceptions (MMU) _vma_table_600: ! IRQs nop bra _irq_save_regs - mov #3,r4 ! Set exception code \ No newline at end of file + mov #3,r4 ! Set exception code diff --git a/kernel/fs/fs_pty.c b/kernel/fs/fs_pty.c index 11f5c90e..c843fcb2 100644 --- a/kernel/fs/fs_pty.c +++ b/kernel/fs/fs_pty.c @@ -60,7 +60,7 @@ typedef struct ptyhalf { int refcnt; /* When this reaches zero, we close */ - int id; + unsigned int id; mutex_t mutex; condvar_t ready_read, ready_write; @@ -329,7 +329,7 @@ static void *pty_open_file(const char *fn, int mode) { handle fds of our own here thanks to the VFS layer, just reference counting so a pty can be opened by more than one process. */ int master; - int id; + unsigned int id; ptyhalf_t *ph; pipefd_t *fdobj; @@ -678,7 +678,7 @@ static dirent_t *pty_readdir(void *h) { static int pty_stat(vfs_handler_t *vfs, const char *path, struct stat *st, int flag) { ptyhalf_t *ph; - int id; + unsigned int id; int master; size_t len = strlen(path); diff --git a/kernel/net/net_icmp.c b/kernel/net/net_icmp.c index 4559377b..de29f5cc 100644 --- a/kernel/net/net_icmp.c +++ b/kernel/net/net_icmp.c @@ -60,12 +60,12 @@ static void icmp_default_echo_cb(const uint8_t *ip, uint16_t seq, uint64_t delta (void)data; if(delta_us != (uint64_t) - 1) { - printf("%d bytes from %d.%d.%d.%d: icmp_seq=%d ttl=%d time=%.3f ms\n", + printf("%zu bytes from %d.%d.%d.%d: icmp_seq=%d ttl=%d time=%.3f ms\n", data_sz, ip[0], ip[1], ip[2], ip[3], seq, ttl, delta_us / 1000.0); } else { - printf("%d bytes from %d.%d.%d.%d: icmp_seq=%d ttl=%d\n", data_sz, + printf("%zu bytes from %d.%d.%d.%d: icmp_seq=%d ttl=%d\n", data_sz, ip[0], ip[1], ip[2], ip[3], seq, ttl); } } diff --git a/kernel/net/net_icmp6.c b/kernel/net/net_icmp6.c index d3ce4e7d..52cb5111 100644 --- a/kernel/net/net_icmp6.c +++ b/kernel/net/net_icmp6.c @@ -53,11 +53,11 @@ static void icmp6_default_echo_cb(const struct in6_addr *ip, uint16_t seq, inet_ntop(AF_INET6, ip, ipstr, INET6_ADDRSTRLEN); if(delta_us != (uint64_t) - 1) { - printf("%d bytes from %s, icmp_seq=%d hlim=%d time=%.3f ms\n", data_sz, + printf("%zu bytes from %s, icmp_seq=%d hlim=%d time=%.3f ms\n", data_sz, ipstr, seq, hlim, delta_us / 1000.0); } else { - printf("%d bytes from %s, icmp_seq=%d hlim=%d\n", data_sz, ipstr, seq, + printf("%zu bytes from %s, icmp_seq=%d hlim=%d\n", data_sz, ipstr, seq, hlim); } } hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: kosmirror <kos...@us...> - 2025-09-29 21:28:46
|
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 694e333fa60be8eaf078156c7d89a5e05d369254 (commit) from 8fb6ea27eb3fd8f6f1d08bdafffa627883b17185 (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 694e333fa60be8eaf078156c7d89a5e05d369254 Author: QuzarDC <qu...@co...> Date: Sun Sep 28 21:29:29 2025 -0400 `maple`: Add attribute to non-NUL-terminated strings. `maple_devinfo_t::product_*` are stored in the device and are not guaranteed to be NUL-terminated. Since #551 these haven't been force-truncated to ensure that. The attribute should help produce more appropriate warnings when using the struct members. ----------------------------------------------------------------------- Summary of changes: kernel/arch/dreamcast/include/dc/maple.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/kernel/arch/dreamcast/include/dc/maple.h b/kernel/arch/dreamcast/include/dc/maple.h index 4c359459..eb539e05 100644 --- a/kernel/arch/dreamcast/include/dc/maple.h +++ b/kernel/arch/dreamcast/include/dc/maple.h @@ -229,7 +229,7 @@ typedef struct maple_frame { This structure is used by the hardware to deliver the response to the device info request. - \note product_name and product_license are not guaranteed to be NULL terminated. + \note product_name and product_license are not guaranteed to be NUL terminated. \headerfile dc/maple.h */ @@ -238,8 +238,8 @@ typedef struct maple_devinfo { uint32 function_data[3]; /**< \brief Additional data per function */ uint8 area_code; /**< \brief Region code */ uint8 connector_direction; /**< \brief 0: UP (most controllers), 1: DOWN (lightgun, microphones) */ - char product_name[30]; /**< \brief Name of device */ - char product_license[60]; /**< \brief License statement */ + char product_name[30] __attribute__ ((nonstring)); /**< \brief Name of device */ + char product_license[60] __attribute__ ((nonstring)); /**< \brief License statement */ uint16 standby_power; /**< \brief Power consumption (standby) */ uint16 max_power; /**< \brief Power consumption (max) */ } maple_devinfo_t; hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: quzar <qu...@us...> - 2025-09-29 03:12:35
|
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 "An image loading library.". The branch, master has been updated via d77ceb46f196f1866515524ed6d814eb5108268a (commit) from 0b66623cea623ac7478b501704af432c57e0475a (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 d77ceb46f196f1866515524ed6d814eb5108268a Author: QuzarDC <qu...@co...> Date: Tue Sep 23 21:27:39 2025 -0400 Update to use stdint types. This was the last piece of in-house software that was using the `<arch/types.h>` types implicitly via the way they were being inappropriately added to `<sys/_types.h>`. ----------------------------------------------------------------------- Summary of changes: imageload.c | 22 +++++++++++----------- include/imageload.h | 26 +++++++++++++------------- readjpeg.c | 10 +++++----- readpcx.c | 42 +++++++++++++++++++++--------------------- 4 files changed, 50 insertions(+), 50 deletions(-) diff --git a/imageload.c b/imageload.c index 4e48a49..57578fe 100644 --- a/imageload.c +++ b/imageload.c @@ -24,13 +24,13 @@ IMG_FILE img_guess(const char *filename) } void -img_copy_texture(uint16 *dest, uint8 *source, uint32 channels, uint32 stride, - const IMG_INFO *info, uint32 w, uint32 h) +img_copy_texture(uint16_t *dest, uint8_t *source, uint32_t channels, uint32_t stride, + const IMG_INFO *info, uint32_t w, uint32_t h) { - uint32 i,j; - uint16 *destRow; - uint8 *pRow; - uint8 r,g,b; + uint32_t i,j; + uint16_t *destRow; + uint8_t *pRow; + uint8_t r,g,b; for(i = 0; i < h; i++) { @@ -241,9 +241,9 @@ int img_load_file(const char *filename, IMG_INFO *info, kos_img_t *img) int img_load_data(FILE *f, IMG_INFO *info, kos_img_t *img) { - uint32 channels, rowBytes; - uint8 *data = NULL; - uint8 allocate = 0; + uint32_t channels, rowBytes; + uint8_t *data = NULL; + uint8_t allocate = 0; if (info == NULL) { @@ -294,8 +294,8 @@ int img_load_data(FILE *f, IMG_INFO *info, kos_img_t *img) if (info->dither_height == 0) info->dither_height = img->h; - img->data = (uint16 *)malloc(sizeof(uint16)*img->w*img->h); - img->byte_count = sizeof(uint16)*img->w*img->h; + img->data = (uint16_t *)malloc(sizeof(uint16_t)*img->w*img->h); + img->byte_count = sizeof(uint16_t)*img->w*img->h; img_copy_texture(img->data, data, channels, rowBytes, info, img->w, img->h); diff --git a/include/imageload.h b/include/imageload.h index fec2cc4..4a821ef 100644 --- a/include/imageload.h +++ b/include/imageload.h @@ -31,11 +31,11 @@ typedef struct { IMG_FILE type; IMG_ALPHA alpha; - uint32 key; + uint32_t key; IMG_DITHER dither; - uint32 dither_width; - uint32 dither_height; - uint32 noise; + uint32_t dither_width; + uint32_t dither_height; + uint32_t noise; } IMG_INFO; #define IMG_INFO_DEFAULTS {IMG_FILE_GUESS,IMG_ALPHA_NONE,0,IMG_DITHER_NONE,0,0,0} @@ -52,27 +52,27 @@ int img_load_file(const char *filename, IMG_INFO *info, kos_img_t *img); * create a jitter table at compile time */ void jitter_init(void); -uint8 jitter(uint8 c, uint8 n, uint8 shift, uint8 noise, uint16 x, uint16 y); +uint8 jitter(uint8_t c, uint8_t n, uint8_t shift, uint8_t noise, uint16_t x, uint16_t y); /* Format specific loaders */ uint32 readbmp_init(FILE *infile); -uint8 *readbmp_get_image(uint32 *pChannels, uint32 *pRowbytes, - uint32 *pWidth, uint32 *pHeight); +uint8 *readbmp_get_image(uint32_t *pChannels, uint32_t *pRowbytes, + uint32_t *pWidth, uint32_t *pHeight); void readbmp_cleanup(void); uint32 readpng_init(FILE *infile); -uint8 *readpng_get_image(uint32 *pChannels, uint32 *pRowbytes, - uint32 *pWidth, uint32 *pHeight); +uint8 *readpng_get_image(uint32_t *pChannels, uint32_t *pRowbytes, + uint32_t *pWidth, uint32_t *pHeight); void readpng_cleanup(void); uint32 readjpeg_init(FILE *infile); -uint8 *readjpeg_get_image(uint32 *pChannels, uint32 *pRowbytes, - uint32 *pWidth, uint32 *pHeight); +uint8 *readjpeg_get_image(uint32_t *pChannels, uint32_t *pRowbytes, + uint32_t *pWidth, uint32_t *pHeight); void readjpeg_cleanup(void); uint32 readpcx_init(FILE *infile); -uint8 *readpcx_get_image(uint32 *pChannels, uint32 *pRowbytes, - uint32 *pWidth, uint32 *pHeight); +uint8 *readpcx_get_image(uint32_t *pChannels, uint32_t *pRowbytes, + uint32_t *pWidth, uint32_t *pHeight); void readpcx_cleanup(void); #endif diff --git a/readjpeg.c b/readjpeg.c index 99c4a52..39e67c7 100644 --- a/readjpeg.c +++ b/readjpeg.c @@ -6,7 +6,7 @@ static struct jpeg_decompress_struct cinfo; static struct jpeg_error_mgr jerr; -uint32 readjpeg_init(FILE *infile) +uint32_t readjpeg_init(FILE *infile) { /* Step 1: allocate and initialize JPEG decompression object */ @@ -33,10 +33,10 @@ uint32 readjpeg_init(FILE *infile) /* load n x n textures from jpegs */ -uint8 *readjpeg_get_image(uint32 *pChannels, uint32 *pRowbytes, uint32 *pWidth, uint32 *pHeight) +uint8_t *readjpeg_get_image(uint32_t *pChannels, uint32_t *pRowbytes, uint32_t *pWidth, uint32_t *pHeight) { - uint32 i; - uint8 *ourbuffer; + uint32_t i; + uint8_t *ourbuffer; JSAMPARRAY buffer; *pRowbytes = cinfo.output_width * cinfo.output_components; @@ -44,7 +44,7 @@ uint8 *readjpeg_get_image(uint32 *pChannels, uint32 *pRowbytes, uint32 *pWidth, *pWidth = cinfo.output_width; *pHeight = cinfo.output_height; - ourbuffer = (uint8 *)malloc(*pRowbytes**pHeight); + ourbuffer = (uint8_t *)malloc(*pRowbytes**pHeight); buffer = (*cinfo.mem->alloc_sarray)((j_common_ptr) &cinfo, JPOOL_IMAGE, *pRowbytes, 1); diff --git a/readpcx.c b/readpcx.c index 0b8601a..fdcb3a4 100644 --- a/readpcx.c +++ b/readpcx.c @@ -12,38 +12,38 @@ typedef struct { char ver; /* encoder version number (5) */ char enc; /* encoding code, always 1 */ char bpp; /* bits per pixel, 8 in mode 0x13 */ - uint16 xmin,ymin; /* image origin, usually 0,0 */ - uint16 xmax,ymax; /* image dimensions */ - uint16 hres; /* horizontal resolution value */ - uint16 vres; /* vertical resolution value */ + uint16_t xmin,ymin; /* image origin, usually 0,0 */ + uint16_t xmax,ymax; /* image dimensions */ + uint16_t hres; /* horizontal resolution value */ + uint16_t vres; /* vertical resolution value */ char pal[48]; /* palette (not in mode 0x13) */ char reserved; /* who knows? */ char clrplanes; /* number of planes, 1 in mode 0x13 */ - uint16 bpl; /* bytes per line, 80 in mode 0x13 */ - uint16 pltype; /* Grey or Color palette flag */ + uint16_t bpl; /* bytes per line, 80 in mode 0x13 */ + uint16_t pltype; /* Grey or Color palette flag */ char filler[58]; /* Zsoft wanted a 128 byte header */ } pcx_hdr; FILE *pcxfile; -uint32 readpcx_init(FILE *infile) +uint32_t readpcx_init(FILE *infile) { pcxfile = infile; return 0; } -uint8 *readpcx_get_image(uint32 *pChannels, uint32 *pRowBytes, - uint32 *pWidth, uint32 *pHeight) +uint8_t *readpcx_get_image(uint32_t *pChannels, uint32_t *pRowBytes, + uint32_t *pWidth, uint32_t *pHeight) { - pcx_hdr header; - uint32 bytesRead; - uint8 *preImage; - uint8 *image; - uint8 *palette; - uint32 numBytes; - uint32 i; - uint8 pixel; - uint8 runlen; + pcx_hdr header; + uint32_t bytesRead; + uint8_t *preImage; + uint8_t *image; + uint8_t *palette; + uint32_t numBytes; + uint32_t i; + uint8_t pixel; + uint8_t runlen; bytesRead = fread(&header, sizeof(pcx_hdr), 1, pcxfile); @@ -60,12 +60,12 @@ uint8 *readpcx_get_image(uint32 *pChannels, uint32 *pRowBytes, for(i = 0; i < numBytes;) { - fread(&pixel, sizeof(uint8), 1, pcxfile); + fread(&pixel, sizeof(uint8_t), 1, pcxfile); if (pixel & 0xc0) { runlen = (pixel & 0x3f); - fread(&pixel, sizeof(uint8), 1, pcxfile); + fread(&pixel, sizeof(uint8_t), 1, pcxfile); while(runlen--) preImage[i++] = pixel; } @@ -74,7 +74,7 @@ uint8 *readpcx_get_image(uint32 *pChannels, uint32 *pRowBytes, } - fread(&pixel, sizeof(uint8), 1, pcxfile); + fread(&pixel, sizeof(uint8_t), 1, pcxfile); palette = malloc(768); fread(palette, 768, 1, pcxfile); hooks/post-receive -- An image loading library. |
From: kosmirror <kos...@us...> - 2025-09-29 02:18:15
|
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 8fb6ea27eb3fd8f6f1d08bdafffa627883b17185 (commit) from 9cfdd89884e8674cccc4372af5c60342ab67fae7 (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 8fb6ea27eb3fd8f6f1d08bdafffa627883b17185 Author: DC-SWAT <sw...@21...> Date: Wed Sep 24 13:58:05 2025 +0700 g2dma: Fixed race condition for DMA progress checking. ----------------------------------------------------------------------- Summary of changes: kernel/arch/dreamcast/hardware/g2dma.c | 1 + 1 file changed, 1 insertion(+) diff --git a/kernel/arch/dreamcast/hardware/g2dma.c b/kernel/arch/dreamcast/hardware/g2dma.c index 6d1120e2..bdd4305a 100644 --- a/kernel/arch/dreamcast/hardware/g2dma.c +++ b/kernel/arch/dreamcast/hardware/g2dma.c @@ -184,6 +184,7 @@ int g2_dma_transfer(void *sh4, void *g2bus, size_t length, uint32_t block, errno = EFAULT; return -1; } + irq_disable_scoped(); /* Make sure we're not already DMA'ing */ if(dma_progress[g2chn] != 0) { hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: kosmirror <kos...@us...> - 2025-09-25 16:09:50
|
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 9cfdd89884e8674cccc4372af5c60342ab67fae7 (commit) from 91e03e8fbb7b217647faf38fedf4a5ae7499674a (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 9cfdd89884e8674cccc4372af5c60342ab67fae7 Author: QuzarDC <qu...@co...> Date: Thu Sep 25 11:52:19 2025 -0400 g2bus: Shift to stdint types ----------------------------------------------------------------------- Summary of changes: kernel/arch/dreamcast/hardware/g2bus.c | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/kernel/arch/dreamcast/hardware/g2bus.c b/kernel/arch/dreamcast/hardware/g2bus.c index 568646e2..09dbfcec 100644 --- a/kernel/arch/dreamcast/hardware/g2bus.c +++ b/kernel/arch/dreamcast/hardware/g2bus.c @@ -27,10 +27,10 @@ /* Read one byte from G2 */ uint8_t g2_read_8(uintptr_t address) { g2_ctx_t ctx; - uint8 out; + uint8_t out; ctx = g2_lock(); - out = *((vuint8*)address); + out = *((volatile uint8_t*)address); g2_unlock(ctx); return out; @@ -41,17 +41,17 @@ void g2_write_8(uintptr_t address, uint8_t value) { g2_ctx_t ctx; ctx = g2_lock(); - *((vuint8*)address) = value; + *((volatile uint8_t*)address) = value; g2_unlock(ctx); } /* Read one word from G2 */ uint16_t g2_read_16(uintptr_t address) { g2_ctx_t ctx; - uint16 out; + uint16_t out; ctx = g2_lock(); - out = *((vuint16*)address); + out = *((volatile uint16_t*)address); g2_unlock(ctx); return out; @@ -62,17 +62,17 @@ void g2_write_16(uintptr_t address, uint16_t value) { g2_ctx_t ctx; ctx = g2_lock(); - *((vuint16*)address) = value; + *((volatile uint16_t*)address) = value; g2_unlock(ctx); } /* Read one dword from G2 */ uint32_t g2_read_32(uintptr_t address) { g2_ctx_t ctx; - uint32 out; + uint32_t out; ctx = g2_lock(); - out = *((vuint32*)address); + out = *((volatile uint32_t*)address); g2_unlock(ctx); return out; @@ -83,13 +83,13 @@ void g2_write_32(uintptr_t address, uint32_t value) { g2_ctx_t ctx; ctx = g2_lock(); - *((vuint32*)address) = value; + *((volatile uint32_t*)address) = value; g2_unlock(ctx); } /* Read a block of 8-bit values from G2 */ void g2_read_block_8(uint8_t * output, uintptr_t address, size_t amt) { - const vuint8 * input = (const vuint8 *)address; + const volatile uint8_t * input = (const volatile uint8_t *)address; g2_ctx_t ctx; ctx = g2_lock(); @@ -102,8 +102,8 @@ void g2_read_block_8(uint8_t * output, uintptr_t address, size_t amt) { } /* Write a block 8-bit values to G2 */ -void g2_write_block_8(const uint8 * input, uintptr_t address, size_t amt) { - vuint8 * output = (vuint8 *)address; +void g2_write_block_8(const uint8_t * input, uintptr_t address, size_t amt) { + volatile uint8_t * output = (volatile uint8_t *)address; g2_ctx_t ctx; ctx = g2_lock(); @@ -117,7 +117,7 @@ void g2_write_block_8(const uint8 * input, uintptr_t address, size_t amt) { /* Read a block of 16-bit values from G2 */ void g2_read_block_16(uint16_t * output, uintptr_t address, size_t amt) { - const vuint16 * input = (const vuint16 *)address; + const volatile uint16_t * input = (const volatile uint16_t *)address; g2_ctx_t ctx; ctx = g2_lock(); @@ -131,7 +131,7 @@ void g2_read_block_16(uint16_t * output, uintptr_t address, size_t amt) { /* Write a block of 16-bit values to G2 */ void g2_write_block_16(const uint16_t * input, uintptr_t address, size_t amt) { - vuint16 * output = (vuint16 *)address; + volatile uint16_t * output = (volatile uint16_t *)address; g2_ctx_t ctx; ctx = g2_lock(); @@ -145,7 +145,7 @@ void g2_write_block_16(const uint16_t * input, uintptr_t address, size_t amt) { /* Read a block of 32-bit values from G2 */ void g2_read_block_32(uint32_t * output, uintptr_t address, size_t amt) { - const vuint32 * input = (const vuint32 *)address; + const volatile uint32_t * input = (const volatile uint32_t *)address; g2_ctx_t ctx; ctx = g2_lock(); @@ -159,7 +159,7 @@ void g2_read_block_32(uint32_t * output, uintptr_t address, size_t amt) { /* Write a block of 32-bit values to G2 */ void g2_write_block_32(const uint32_t * input, uintptr_t address, size_t amt) { - vuint32 * output = (vuint32 *)address; + volatile uint32_t * output = (volatile uint32_t *)address; g2_ctx_t ctx; ctx = g2_lock(); @@ -173,7 +173,7 @@ void g2_write_block_32(const uint32_t * input, uintptr_t address, size_t amt) { /* A memset-like function for G2 */ void g2_memset_8(uintptr_t address, uint8_t c, size_t amt) { - vuint8 * output = (vuint8 *)address; + volatile uint8_t * output = (volatile uint8_t *)address; g2_ctx_t ctx; ctx = g2_lock(); hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: kosmirror <kos...@us...> - 2025-09-25 15:45:15
|
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 91e03e8fbb7b217647faf38fedf4a5ae7499674a (commit) via 8767beb0305dedc3727e88bba9ff2fa9d92a2aa3 (commit) via d21f3323a31a8b31002f9a5b521362b6943fff23 (commit) via e392dbac1bbb0dd358bf25885b70b5b85fb83de8 (commit) via 12083926c41f7d8b40bcc9fdff5c21af2ef0d96a (commit) from 7d8cba2c46866dd4b757557826fe2967844fb520 (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 91e03e8fbb7b217647faf38fedf4a5ae7499674a Author: QuzarDC <qu...@co...> Date: Tue Sep 23 21:59:03 2025 -0400 newlib: Remove patching of `<sys/sched.h>` This may have been needed when it was originally added, but the file is effectively identical to what is provided by newlib and there doesn't seem to be any need for it anymore. commit 8767beb0305dedc3727e88bba9ff2fa9d92a2aa3 Author: QuzarDC <qu...@co...> Date: Tue Sep 23 21:41:40 2025 -0400 newlib: Stop including `<arch/types.h>` in `<sys/_types.h>` This prevents the types from unavoidably leaking out into standard headers, which has been a cause of a number of issues for users especially with 3rd party libs. A number of internal files were relying on this though, and had to be modified to either get those types through explicit use of `<arch/types.h>` or to stop using those types (in the cases where it was a minimal change). In kos-ports this was still being relied on by libimageload, which has also been updated to match. commit d21f3323a31a8b31002f9a5b521362b6943fff23 Author: QuzarDC <qu...@co...> Date: Tue Sep 23 20:40:45 2025 -0400 newlib: Move kos time implementation to correct path. We were forcing this time implementation info to be included in most of the same places it should be by tacking it onto `<sys/_types.h>`. Instead, place it in `<machine/time.h>` which is where newlib is set up to pick up this info by including that in `<time.h>`. commit e392dbac1bbb0dd358bf25885b70b5b85fb83de8 Author: QuzarDC <qu...@co...> Date: Tue Sep 23 20:11:40 2025 -0400 newlib: Remove endian defines already provided by newlib. These should be accesible easily from various `sys` headers' include chains (so nobody should have needed it from _types). I added the narrowest include to byteorder.h to have it access them and removed from our sys/_types. commit 12083926c41f7d8b40bcc9fdff5c21af2ef0d96a Author: QuzarDC <qu...@co...> Date: Tue Sep 23 02:38:17 2025 -0400 newlib: Remove patching of `AT_` fcntl defines. These are now corectly provided by versions of newlib that KOS supports, but require `__BSD_VISIBLE || __POSIX_VISIBLE >= 200809` so the language standard for `libkosext2fs` had to be updated to have gnu extensions in order to levereage them. ----------------------------------------------------------------------- Summary of changes: addons/libkosext2fs/Makefile | 2 +- include/{kos => machine}/time.h | 6 ++-- include/sys/_types.h | 42 ---------------------- include/sys/sched.h | 29 --------------- kernel/arch/dreamcast/hardware/ubc.c | 14 ++++---- kernel/arch/dreamcast/hardware/vblank.c | 3 +- kernel/arch/dreamcast/include/arch/byteorder.h | 3 ++ kernel/arch/dreamcast/include/dc/fb_console.h | 1 + kernel/arch/dreamcast/include/dc/modem/modem.h | 2 ++ .../dreamcast/include/dc/net/broadband_adapter.h | 2 ++ utils/dc-chain/scripts/newlib.mk | 1 - 11 files changed, 21 insertions(+), 84 deletions(-) rename include/{kos => machine}/time.h (97%) delete mode 100644 include/sys/sched.h diff --git a/addons/libkosext2fs/Makefile b/addons/libkosext2fs/Makefile index 0a4f9a79..108d7d21 100644 --- a/addons/libkosext2fs/Makefile +++ b/addons/libkosext2fs/Makefile @@ -6,6 +6,6 @@ OBJS = ext2fs.o bitops.o block.o inode.o superblock.o fs_ext2.o symlink.o \ directory.o # Make sure everything compiles nice and cleanly (or not at all). -KOS_CFLAGS += -W -pedantic -Werror -std=c99 +KOS_CFLAGS += -W -pedantic -Werror -std=gnu99 include $(KOS_BASE)/addons/Makefile.prefab diff --git a/include/kos/time.h b/include/machine/time.h similarity index 97% rename from include/kos/time.h rename to include/machine/time.h index 5fa1f7ba..c47a5c9f 100644 --- a/include/kos/time.h +++ b/include/machine/time.h @@ -1,11 +1,11 @@ /* KallistiOS ##version## - kos/time.h + machine/time.h Copyright (C) 2023 Lawrence Sebald Copyright (C) 2024 Falco Girgis */ -/** \file kos/time.h +/** \file machine/time.h \brief KOS-implementation of select C11 and POSIX extensions Add select POSIX extensions, C11, and C23 functionality to time.h which are not @@ -40,7 +40,7 @@ __BEGIN_DECLS #define __STDC_VERSION_TIME_H__ 202311L /* Microsecond resolution for clock(), per POSIX standard.. */ -#define CLOCKS_PER_SEC 1000000 +#define _CLOCKS_PER_SEC_ 1000000 /* =============== Enable the following for >=c11, >=c++17 =================== */ #if (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L)) || \ diff --git a/include/sys/_types.h b/include/sys/_types.h index 3110877d..cb8d653b 100644 --- a/include/sys/_types.h +++ b/include/sys/_types.h @@ -155,48 +155,11 @@ typedef _TIMER_T_ __timer_t; typedef _CLOCK_T_ __clock_t; -/* The architecture should define the macro BYTE_ORDER in <arch/types.h> to - equal one of these macros for code that looks for these BSD-style macros. */ -/** \brief Little Endian test macro */ -#define LITTLE_ENDIAN 1234 - -/** \brief Big Endian test macro */ -#define BIG_ENDIAN 4321 - -/** \brief PDP Endian test macro */ -#define PDP_ENDIAN 3412 - -/* Sigh... for some reason, Newlib only bothers defining these on Cygwin... - We're only actually concerned with AT_SYMLINK_NOFOLLOW currently. These - should all be defined in <fcntl.h>, by the way. */ -#ifndef AT_EACCESS -/** \brief Check access using effective user and group ID */ -#define AT_EACCESS 1 -#endif - -#ifndef AT_SYMLINK_NOFOLLOW -/** \brief Do not follow symlinks */ -#define AT_SYMLINK_NOFOLLOW 2 -#endif - -#ifndef AT_SYMLINK_FOLLOW -/** \brief Follow symbolic links */ -#define AT_SYMLINK_FOLLOW 4 -#endif - -#ifndef AT_REMOVEDIR -/** \brief Remove directory instead of file */ -#define AT_REMOVEDIR 8 -#endif - #ifndef IOV_MAX /** \brief Maximum length of an iovec, in elements. */ #define IOV_MAX 1024 #endif -/* This is for old KOS source compatibility. */ -#include <arch/types.h> - #if __GNUC_MINOR__ > 95 || __GNUC__ >= 3 typedef __builtin_va_list __va_list; #else @@ -209,11 +172,6 @@ __END_DECLS #endif /* _SYS__TYPES_H */ -/* Grab our C11 time stuff if we got here from <time.h>. */ -#ifdef _TIME_H_ -#include <kos/time.h> -#endif - #ifdef _STDLIB_H_ #include <kos/stdlib.h> #endif diff --git a/include/sys/sched.h b/include/sys/sched.h deleted file mode 100644 index 2e040f62..00000000 --- a/include/sys/sched.h +++ /dev/null @@ -1,29 +0,0 @@ -/** \file sys/sched.h - \brief Basic sys/sched.h file for newlib. - - This file specifies a few things to make sure pthreads stuff compiles. -*/ - -#ifndef __SYS_SCHED_H -#define __SYS_SCHED_H - -#include <sys/cdefs.h> -__BEGIN_DECLS - -// These are copied from Newlib to make stuff compile as expected. - -#define SCHED_OTHER 0 /**< \brief Other scheduling */ -#define SCHED_FIFO 1 /**< \brief FIFO scheduling */ -#define SCHED_RR 2 /**< \brief Round-robin scheduling */ - -/** \brief Scheduling Parameters, P1003.1b-1993, p. 249. - \note Fields whose name begins with "ss_" added by P1003.4b/D8, p. 33. - \headerfile sys/sched.h -*/ -struct sched_param { - int sched_priority; /**< \brief Process execution scheduling priority */ -}; - -__END_DECLS - -#endif /* __SYS_SCHED_H */ diff --git a/kernel/arch/dreamcast/hardware/ubc.c b/kernel/arch/dreamcast/hardware/ubc.c index 4e96c666..75d685f6 100755 --- a/kernel/arch/dreamcast/hardware/ubc.c +++ b/kernel/arch/dreamcast/hardware/ubc.c @@ -15,10 +15,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) (*((volatile uint32_t *)(uintptr_t)(SH4_REG_UBC_BARA + (unsigned)(o) * 0xc))) /* Address */ +#define BASR(o) (*((volatile uint8_t *)(uintptr_t)(SH4_REG_UBC_BASRA + (unsigned)(o) * 0x4))) /* ASID */ +#define BAMR(o) (*((volatile uint8_t *)(uintptr_t)(SH4_REG_UBC_BAMRA + (unsigned)(o) * 0xc))) /* Address Mask */ +#define BBR(o) (*((volatile uint16_t *)(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 */ @@ -29,9 +29,9 @@ #define BASRB (BASR(ubc_channel_b)) /**< Break ASID B */ #define BAMRB (BAMR(ubc_channel_b)) /**< Break Address Mask B */ #define BBRB (BBR(ubc_channel_b)) /**< Break Bus Cycle B */ -#define BDRB (*((vuint32 *)SH4_REG_UBC_BDRB)) /**< Break Data B */ -#define BDMRB (*((vuint32 *)SH4_REG_UBC_BDMRB)) /**< Break Data Mask B */ -#define BRCR (*((vuint16 *)SH4_REG_UBC_BRCR)) /**< Break Control */ +#define BDRB (*((volatile uint32_t *)SH4_REG_UBC_BDRB)) /**< Break Data B */ +#define BDMRB (*((volatile uint32_t *)SH4_REG_UBC_BDMRB)) /**< Break Data Mask B */ +#define BRCR (*((volatile uint16_t *)SH4_REG_UBC_BRCR)) /**< Break Control */ /* BASR Fields */ #define BASM (1 << 2) /* No ASID (1), use ASID (0) */ diff --git a/kernel/arch/dreamcast/hardware/vblank.c b/kernel/arch/dreamcast/hardware/vblank.c index abf93c88..175c84fa 100644 --- a/kernel/arch/dreamcast/hardware/vblank.c +++ b/kernel/arch/dreamcast/hardware/vblank.c @@ -4,6 +4,7 @@ Copyright (C)2003 Megan Potter */ +#include <stdint.h> #include <stdlib.h> #include <errno.h> #include <sys/queue.h> @@ -28,7 +29,7 @@ static TAILQ_HEAD(vhlist, vblhnd) vblhnds; static int vblid_high; /* Our internal IRQ handler */ -static void vblank_handler(uint32 src, void *data) { +static void vblank_handler(uint32_t src, void *data) { struct vblhnd * t; (void)data; diff --git a/kernel/arch/dreamcast/include/arch/byteorder.h b/kernel/arch/dreamcast/include/arch/byteorder.h index 2d352621..0bb1f2fc 100644 --- a/kernel/arch/dreamcast/include/arch/byteorder.h +++ b/kernel/arch/dreamcast/include/arch/byteorder.h @@ -25,6 +25,9 @@ #include <kos/cdefs.h> __BEGIN_DECLS +/* Included to get the `LITTLE_ENDIAN` define */ +#include <machine/endian.h> + #ifdef BYTE_ORDER /* If we've included <arch/types.h>, this might already be defined... */ #undef BYTE_ORDER diff --git a/kernel/arch/dreamcast/include/dc/fb_console.h b/kernel/arch/dreamcast/include/dc/fb_console.h index 31dde8ee..8a718707 100644 --- a/kernel/arch/dreamcast/include/dc/fb_console.h +++ b/kernel/arch/dreamcast/include/dc/fb_console.h @@ -27,6 +27,7 @@ #include <kos/cdefs.h> __BEGIN_DECLS +#include <arch/types.h> #include <kos/dbgio.h> /* \cond */ diff --git a/kernel/arch/dreamcast/include/dc/modem/modem.h b/kernel/arch/dreamcast/include/dc/modem/modem.h index 1362c92d..81df223f 100644 --- a/kernel/arch/dreamcast/include/dc/modem/modem.h +++ b/kernel/arch/dreamcast/include/dc/modem/modem.h @@ -20,6 +20,8 @@ #ifndef __DC_MODEM_MODEM_H #define __DC_MODEM_MODEM_H +#include <arch/types.h> + #include "mconst.h" /** \defgroup modem Modem diff --git a/kernel/arch/dreamcast/include/dc/net/broadband_adapter.h b/kernel/arch/dreamcast/include/dc/net/broadband_adapter.h index 7d6548b0..969ce44f 100644 --- a/kernel/arch/dreamcast/include/dc/net/broadband_adapter.h +++ b/kernel/arch/dreamcast/include/dc/net/broadband_adapter.h @@ -22,6 +22,8 @@ #include <kos/cdefs.h> __BEGIN_DECLS +#include <arch/types.h> + /** \defgroup bba Broadband Adapter \brief Driver for the Dreamcast's BBA (RTL8139C). \ingroup networking_drivers diff --git a/utils/dc-chain/scripts/newlib.mk b/utils/dc-chain/scripts/newlib.mk index 48e833f3..0e665b03 100644 --- a/utils/dc-chain/scripts/newlib.mk +++ b/utils/dc-chain/scripts/newlib.mk @@ -44,7 +44,6 @@ fixup-newlib-apply: fixup-newlib-init cp $(kos_base)/include/pthread.h $(newlib_inc) cp $(kos_base)/include/sys/_pthreadtypes.h $(newlib_inc)/sys cp $(kos_base)/include/sys/_pthread.h $(newlib_inc)/sys - cp $(kos_base)/include/sys/sched.h $(newlib_inc)/sys ifndef MINGW32 ln -nsf $(kos_base)/include/kos $(newlib_inc) ln -nsf $(kos_base)/kernel/arch/$(platform)/include/arch $(newlib_inc) hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: kosmirror <kos...@us...> - 2025-09-25 15:44:23
|
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 7d8cba2c46866dd4b757557826fe2967844fb520 (commit) via db7081ba931f97d241fa9e8e684f566544da531d (commit) via 0a673d1bff9d2c454d71df1064d73b808d5c4876 (commit) via 4e9d15d687d3bd527f9cec3abf337bcc1bccaee3 (commit) from d8f7df2599dc3e147ae585855f396d74e8a28ef4 (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 7d8cba2c46866dd4b757557826fe2967844fb520 Author: QuzarDC <qu...@co...> Date: Thu Sep 11 11:47:09 2025 -0400 init: Privatize prototype for `arch_real_exit` This is clearly meant to be internal, and was described as such. Just actually doing so. commit db7081ba931f97d241fa9e8e684f566544da531d Author: QuzarDC <qu...@co...> Date: Thu Sep 11 10:44:58 2025 -0400 Remove extraneous includes of <arch/spinlock.h> I was looking for *any* unneeded includes and for some reason these were all over the place. I don't see any reason that they'd be needed and things build fine without. commit 0a673d1bff9d2c454d71df1064d73b808d5c4876 Author: QuzarDC <qu...@co...> Date: Thu Sep 11 00:36:58 2025 -0400 thread: Move definition of `tid_t` to thread.h Almost every place internally that was using it was doing so by including <kos/thread.h> rather than <arch/types.h> (though partially due to previous cleanups). commit 4e9d15d687d3bd527f9cec3abf337bcc1bccaee3 Author: QuzarDC <qu...@co...> Date: Wed Sep 10 22:20:55 2025 -0400 library: Remove unnecessary use of `tid_t`. The two types have nothing to do with each other. Instead unrolled it to the type it has always been, an int. ----------------------------------------------------------------------- Summary of changes: include/kos/library.h | 4 +--- include/kos/thread.h | 4 ++++ kernel/arch/dreamcast/hardware/asic.c | 1 - kernel/arch/dreamcast/hardware/g2bus.c | 1 - kernel/arch/dreamcast/hardware/scif.c | 1 - kernel/arch/dreamcast/include/arch/arch.h | 10 ---------- kernel/arch/dreamcast/include/arch/types.h | 9 --------- kernel/arch/dreamcast/kernel/init.c | 3 +++ kernel/libc/koslib/malloc.c | 6 ++++-- 9 files changed, 12 insertions(+), 27 deletions(-) diff --git a/include/kos/library.h b/include/kos/library.h index da0d718c..feb4b114 100644 --- a/include/kos/library.h +++ b/include/kos/library.h @@ -31,7 +31,6 @@ #include <kos/cdefs.h> __BEGIN_DECLS -#include <kos/thread.h> #include <kos/elf.h> #include <kos/fs.h> @@ -49,8 +48,7 @@ TAILQ_HEAD(klqueue, klibrary); LIST_HEAD(kllist, klibrary); /** \endcond */ -/* Thread IDs are ok for us */ -typedef tid_t libid_t; /**< \brief Library ID type. */ +typedef int libid_t; /**< \brief Library ID type. */ /** \brief Loaded library structure. diff --git a/include/kos/thread.h b/include/kos/thread.h index 22a798ae..e0b8f9c6 100644 --- a/include/kos/thread.h +++ b/include/kos/thread.h @@ -151,6 +151,10 @@ typedef enum kthread_state { STATE_FINISHED = 0x0004 /**< \brief Finished execution */ } kthread_state_t; +/* Thread and priority types */ +typedef int tid_t; /**< \brief Thread ID type */ +typedef int prio_t; /**< \brief Priority value type */ + /** \brief Structure describing one running thread. Each thread has one of these structures assigned to it, which holds all the diff --git a/kernel/arch/dreamcast/hardware/asic.c b/kernel/arch/dreamcast/hardware/asic.c index 725ff3ae..9cc0329b 100644 --- a/kernel/arch/dreamcast/hardware/asic.c +++ b/kernel/arch/dreamcast/hardware/asic.c @@ -100,7 +100,6 @@ #include <assert.h> #include <arch/irq.h> #include <dc/asic.h> -#include <arch/spinlock.h> #include <kos/genwait.h> #include <kos/regfield.h> #include <kos/worker_thread.h> diff --git a/kernel/arch/dreamcast/hardware/g2bus.c b/kernel/arch/dreamcast/hardware/g2bus.c index 0b1bdf44..568646e2 100644 --- a/kernel/arch/dreamcast/hardware/g2bus.c +++ b/kernel/arch/dreamcast/hardware/g2bus.c @@ -20,7 +20,6 @@ #include <string.h> #include <stdio.h> #include <dc/g2bus.h> -#include <arch/spinlock.h> /* Always use these functions to access G2 bus memory (includes the SPU and the expansion port, e.g., BBA) */ diff --git a/kernel/arch/dreamcast/hardware/scif.c b/kernel/arch/dreamcast/hardware/scif.c index 41eb0b55..c61d2d77 100644 --- a/kernel/arch/dreamcast/hardware/scif.c +++ b/kernel/arch/dreamcast/hardware/scif.c @@ -8,7 +8,6 @@ #include <errno.h> #include <kos/dbgio.h> #include <arch/arch.h> -#include <arch/spinlock.h> #include <arch/irq.h> #include <dc/fs_dcload.h> #include <dc/scif.h> diff --git a/kernel/arch/dreamcast/include/arch/arch.h b/kernel/arch/dreamcast/include/arch/arch.h index 2fd7981e..a152d691 100644 --- a/kernel/arch/dreamcast/include/arch/arch.h +++ b/kernel/arch/dreamcast/include/arch/arch.h @@ -213,16 +213,6 @@ void * mm_sbrk(unsigned long increment); #include <kos/init.h> /* Dreamcast-specific arch init things */ -/** \brief Jump back to the bootloader. - \ingroup arch - - You generally shouldn't use this function, but rather use arch_exit() or - exit() instead. - - \note This function will never return! -*/ -void arch_real_exit(int ret_code) __noreturn; - /** \brief Initialize bare-bones hardware systems. \ingroup arch diff --git a/kernel/arch/dreamcast/include/arch/types.h b/kernel/arch/dreamcast/include/arch/types.h index 295bc031..ae1b2439 100644 --- a/kernel/arch/dreamcast/include/arch/types.h +++ b/kernel/arch/dreamcast/include/arch/types.h @@ -48,15 +48,6 @@ typedef volatile int32 vint32; /**< \brief 32-bit volatile signed type */ typedef volatile int16 vint16; /**< \brief 16-bit volatile signed type */ typedef volatile int8 vint8; /**< \brief 8-bit volatile signed type */ -/* This type may be used for any generic handle type that is allowed - to be negative (for errors) and has no specific bit count - restraints. */ -typedef int handle_t; /**< \brief Generic "handle" type */ - -/* Thread and priority types */ -typedef handle_t tid_t; /**< \brief Thread ID type */ -typedef handle_t prio_t; /**< \brief Priority value type */ - /** @} */ __END_DECLS diff --git a/kernel/arch/dreamcast/kernel/init.c b/kernel/arch/dreamcast/kernel/init.c index 73221e63..d459ad19 100644 --- a/kernel/arch/dreamcast/kernel/init.c +++ b/kernel/arch/dreamcast/kernel/init.c @@ -43,6 +43,9 @@ extern void _fini(void); extern void __verify_newlib_patch(); extern void dma_init(void); +/* Jump back to the bootloader. From startup.S */ +void arch_real_exit(int ret_code) __noreturn; + void (*__kos_init_early_fn)(void) __attribute__((weak,section(".data"))) = NULL; int main(int argc, char **argv); diff --git a/kernel/libc/koslib/malloc.c b/kernel/libc/koslib/malloc.c index aedfeaec..ef2c918e 100644 --- a/kernel/libc/koslib/malloc.c +++ b/kernel/libc/koslib/malloc.c @@ -1650,6 +1650,10 @@ static pthread_mutex_t mALLOC_MUTEx = PTHREAD_MUTEX_INITIALIZER; #ifdef KM_DBG +#include <stdlib.h> +#include <kos/dbgio.h> +#include <kos/thread.h> + #define BLOCK_MAGIC 0x1c518a74 #define PRE_MAGIC 0x6765adb8 #define POST_MAGIC 0x29d4ca6d @@ -1679,8 +1683,6 @@ static LIST_HEAD(memctl_list, memctl) block_list; #define get_cur_tid_safe ((thd_current == NULL) ? (tid_t)0 : thd_current->tid) -#include <kos/dbgio.h> -#include <stdlib.h> char dbg_print_buffer[256]; enum func_type_names { name_MALLOC = 0, name_REALLOC = 1, name_MEMALIGN = 2, name_CALLOC = 3, hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: kosmirror <kos...@us...> - 2025-09-25 15:39:47
|
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 d8f7df2599dc3e147ae585855f396d74e8a28ef4 (commit) via 183f3caa980500ee5ef4386920befd0ba2077fb9 (commit) via 57eac6bf98c1b549df19e81efd433161f846f24c (commit) via b8ca37df81ce110ef6156c118fc04d9a0b236b6e (commit) via be56dc0eef09b433f6bb50f260c482c865b6c382 (commit) via dc2f7b2e5524557dbb03f676d296c680edc31bb1 (commit) via 8a0b8d10df3819988dfb1495a2cb1ea3af7e6bc3 (commit) via 43b0ab08ef9cd8b51a060d2cec0c5598394d05c6 (commit) via 5eaa446f8e63def5a245b011d2418e306f1e36af (commit) via 4d71ba186d4a9ca2a7fa5f375841dcdb6578ccc9 (commit) via 583490490f4c194821c95aec365d1a65635be9ac (commit) via 1cf3ca4c592700e1799a057a1d9076caa646e3fd (commit) via 946586d1ad3349e1381dde236990d1bae986cb3e (commit) via 530af522581825b4ae9152e68357bb5a168079eb (commit) via ab38ca87b30f641d50fdf5b35ad357b370b1c469 (commit) via 4837c4b9b8a3481ba5f02c6f66b904e629007fa2 (commit) via b62400ea86be0266c095fa80a72aefe1caa06f2d (commit) via 4daa9835b384abe87fbeef274a5e434e43d5207a (commit) via 826789b2574552848bdd0b1b4160f96da2947805 (commit) from 2babea38ec32a10203c373a9d77b53cf3d1a8d53 (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 d8f7df2599dc3e147ae585855f396d74e8a28ef4 Author: QuzarDC <qu...@co...> Date: Sun Sep 21 19:50:18 2025 -0400 fs_dcload: Drop dir list. The dir list was a means to track which handles were dirs or not. Instead use the `path` member of the object to do the same and return an opaque token to that object rather than the `hnd` used by the host-side. commit 183f3caa980500ee5ef4386920befd0ba2077fb9 Author: QuzarDC <qu...@co...> Date: Sun Sep 21 18:41:10 2025 -0400 fs_dcload: Set errno on not finding a file. `ENOENT` to match the `ENOTDIR` set by the dir path. commit 57eac6bf98c1b549df19e81efd433161f846f24c Author: QuzarDC <qu...@co...> Date: Wed Jun 25 04:11:50 2025 -0400 Update filebrowser example to show file stats. Simple addition to draw the Filesize and modification time as provided by stat. Was updated in order to help validate functionality of stat over `/pc/` after updating to use a standardized stat rather than custom dcload one. commit b8ca37df81ce110ef6156c118fc04d9a0b236b6e Author: QuzarDC <qu...@co...> Date: Tue Jun 24 20:18:55 2025 -0400 fs_dcload: Protect against possible buffer overflow in readdir. commit be56dc0eef09b433f6bb50f260c482c865b6c382 Author: QuzarDC <qu...@co...> Date: Tue Jun 24 17:17:12 2025 -0400 dcload: Replace dcload_dirent with our standard one. The sizes and defined types match. The risk in doing this is only in if the host side needs to change its data types. In that case though, there would have to be changes on the KOS side as well. commit dc2f7b2e5524557dbb03f676d296c680edc31bb1 Author: QuzarDC <qu...@co...> Date: Tue Jun 24 15:52:46 2025 -0400 dcload: Implement each unimplemented dcload command. chdir, chmod, fstat, time, utime, and exit had never been implemented in KOS. utime has been left as a commented out stub to note how there would likely need to be updates to the tool in order for it to work. commit 8a0b8d10df3819988dfb1495a2cb1ea3af7e6bc3 Author: QuzarDC <qu...@co...> Date: Tue Jun 24 03:58:05 2025 -0400 dcload: Whitespace and junk cleanup. Mostly moving stars, but also some lining up of comments and removal of a prototype that had no function. commit 43b0ab08ef9cd8b51a060d2cec0c5598394d05c6 Author: QuzarDC <qu...@co...> Date: Tue Jun 24 02:11:44 2025 -0400 dcload: Add assignwrkmem function. commit 5eaa446f8e63def5a245b011d2418e306f1e36af Author: QuzarDC <qu...@co...> Date: Tue Jun 24 03:50:02 2025 -0400 dcload: Add dir related functions. Open, close, read, and rewind. Additionally move the dirent type over. commit 4d71ba186d4a9ca2a7fa5f375841dcdb6578ccc9 Author: QuzarDC <qu...@co...> Date: Tue Jun 24 03:28:47 2025 -0400 dcload: Create function for stat. Bigger than others as the bespoke stat type was moved. commit 583490490f4c194821c95aec365d1a65635be9ac Author: QuzarDC <qu...@co...> Date: Tue Jun 24 03:19:16 2025 -0400 dcload: Create functions for link, unlink, and lseek. commit 1cf3ca4c592700e1799a057a1d9076caa646e3fd Author: QuzarDC <qu...@co...> Date: Tue Jun 24 03:04:36 2025 -0400 dcload: Create functions for read, write, open, and close commands. commit 946586d1ad3349e1381dde236990d1bae986cb3e Author: QuzarDC <qu...@co...> Date: Tue Jun 24 02:53:30 2025 -0400 dcload: Create function for `gethostinfo` command. commit 530af522581825b4ae9152e68357bb5a168079eb Author: QuzarDC <qu...@co...> Date: Tue Jun 24 02:43:34 2025 -0400 dcload: Move gdb packet function to new file. commit ab38ca87b30f641d50fdf5b35ad357b370b1c469 Author: QuzarDC <qu...@co...> Date: Tue Jun 24 02:04:31 2025 -0400 dcload: Rename internal vfs functions. To follow our standard naming convention as well as `dcloadgetgdbpacket` a lot of the syscall functions for the file ops would overlap with these names. So renaming in order to get the conflict out of the way. commit 4837c4b9b8a3481ba5f02c6f66b904e629007fa2 Author: QuzarDC <qu...@co...> Date: Mon Jun 23 20:33:07 2025 -0400 fs_dcload: Reduce scope and severity of locking. Currently `fs_dcload` uses fairly broad spinlocks over most of each function. From the history it looks as though these are spinlocks simply because we didn't have other sorts of locks when this was originally written. It can't have to do with the actual operations as the syscall has always been called with irqs disabled. So here I make three changes: First: Implement a rwsem to protect the shared dir list. This is specifically for protecting access to that data structure. Second: Reduce the scope of the 'mutex' locks. Leave them only in cases where multiple dcload commands must be issued and we should expect that others wouldn't be issued between them. It may be that these can be shrunken down slightly more. Third: Change the spinlocks to mutexes. commit b62400ea86be0266c095fa80a72aefe1caa06f2d Author: QuzarDC <qu...@co...> Date: Mon Jun 23 15:06:27 2025 -0400 dcload: Change last remaining arch/types to stdint commit 4daa9835b384abe87fbeef274a5e434e43d5207a Author: QuzarDC <qu...@co...> Date: Sun Jun 22 23:36:56 2025 -0400 dcload: Migrate syscall into our BIOS syscalls file. Create a proper C function for dcload's syscall to match the way we do for other syscalls rather than as a macro wrapper around an asm file. Additionally move the definitions of the commands for the syscall to accompany it. I had considered whether this might be better as its own `syscalls-custom` since it does operate differently, including having a function to detect whether it's present or not. It may be that this could represent a defining pattern for the use of other custom syscalls from modded BIOS or alternative loaders (dcload NG/3). commit 826789b2574552848bdd0b1b4160f96da2947805 Author: QuzarDC <qu...@co...> Date: Sun May 11 01:50:52 2025 -0400 Rename and expose if the dcload syscall is installed. Removed two usages that were redundant. There is no condition where `dcload_type` could be set to `TYPE_SER` while dcload is not detected. Renamed to indicate that it's not a part of the dcload vfs. ----------------------------------------------------------------------- Summary of changes: addons/libppp/ppp_scif.c | 2 +- examples/dreamcast/filesystem/browse/browse.c | 44 +++- examples/dreamcast/filesystem/browse/browse.h | 2 + kernel/arch/dreamcast/fs/Makefile | 3 +- kernel/arch/dreamcast/fs/dcload-syscall.s | 19 -- kernel/arch/dreamcast/fs/fs_dcload.c | 296 +++++++++++--------------- kernel/arch/dreamcast/fs/fs_dclsocket.c | 15 +- kernel/arch/dreamcast/hardware/Makefile | 2 +- kernel/arch/dreamcast/hardware/dcload.c | 134 ++++++++++++ kernel/arch/dreamcast/hardware/scif-spi.c | 2 +- kernel/arch/dreamcast/include/dc/dcload.h | 114 ++++++++++ kernel/arch/dreamcast/include/dc/fs_dcload.h | 74 +------ kernel/arch/dreamcast/kernel/gdb_stub.c | 2 +- kernel/arch/dreamcast/kernel/init.c | 3 +- 14 files changed, 427 insertions(+), 285 deletions(-) delete mode 100644 kernel/arch/dreamcast/fs/dcload-syscall.s create mode 100644 kernel/arch/dreamcast/hardware/dcload.c create mode 100644 kernel/arch/dreamcast/include/dc/dcload.h diff --git a/addons/libppp/ppp_scif.c b/addons/libppp/ppp_scif.c index c22aacca..ed57902d 100644 --- a/addons/libppp/ppp_scif.c +++ b/addons/libppp/ppp_scif.c @@ -80,7 +80,7 @@ static ppp_device_t scif_dev = { int ppp_scif_init(int bps) { /* Make sure we're not using dcload-serial. If we are, we really shouldn't take over the serial port from it. */ - if(*DCLOADMAGICADDR == DCLOADMAGICVALUE && dcload_type == DCLOAD_TYPE_SER) { + if(dcload_type == DCLOAD_TYPE_SER) { dbglog(DBG_KDEBUG, "ppp_scif_init: aborting -- using dcload-serial.\n"); return -1; } diff --git a/examples/dreamcast/filesystem/browse/browse.c b/examples/dreamcast/filesystem/browse/browse.c index ccd3bf29..35552ffc 100644 --- a/examples/dreamcast/filesystem/browse/browse.c +++ b/examples/dreamcast/filesystem/browse/browse.c @@ -51,6 +51,7 @@ int main(int argc, char **argv) { directory_file_t directory_contents[100]; bool prompting = false; + bool statting = false; bool highlight_yes = true; bool mounted_sd = false; bool changed_directory = true; @@ -74,8 +75,14 @@ int main(int argc, char **argv) { changed_buttons = current_buttons ^ previous_buttons; previous_buttons = current_buttons; + /* Clear the stat if any button is pressed */ + if(statting && button_pressed(current_buttons, changed_buttons, 0)) { + statting = false; /* Get us out of captivity */ + changed_directory = true; /* Force redraw of the screen to clear stat */ + } + /* Enter a directory */ - if(button_pressed(current_buttons, changed_buttons, CONT_A)) { + else if(button_pressed(current_buttons, changed_buttons, CONT_A)) { if(prompting) { prompting = false; changed_directory = true; @@ -134,7 +141,7 @@ int main(int argc, char **argv) { } /* Exit a directory */ - if(button_pressed(current_buttons, changed_buttons, CONT_B)) { + else if(button_pressed(current_buttons, changed_buttons, CONT_B)) { if(prompting) { prompting = false; changed_directory = true; @@ -156,9 +163,19 @@ int main(int argc, char **argv) { } } } + + /* Stat an entry */ + else if(button_pressed(current_buttons, changed_buttons, CONT_Y)) { + if(!prompting) { + memset(directory_temp, 0, BUFFER_LENGTH); + fs_path_append(directory_temp, current_directory, BUFFER_LENGTH); + fs_path_append(directory_temp, directory_contents[selector_index].filename, BUFFER_LENGTH); + statting = draw_stat(directory_temp); + } + } /* Navigate the directory */ - if(button_pressed(current_buttons, changed_buttons, CONT_DPAD_DOWN)) { + else if(button_pressed(current_buttons, changed_buttons, CONT_DPAD_DOWN)) { if(prompting) { highlight_yes = !highlight_yes; show_prompt(current_directory, mounted_sd, highlight_yes); @@ -170,7 +187,7 @@ int main(int argc, char **argv) { } } } - if(button_pressed(current_buttons, changed_buttons, CONT_DPAD_UP)) { + else if(button_pressed(current_buttons, changed_buttons, CONT_DPAD_UP)) { if(prompting) { highlight_yes = !highlight_yes; show_prompt(current_directory, mounted_sd, highlight_yes); @@ -184,7 +201,7 @@ int main(int argc, char **argv) { } /* Exit Program */ - if(button_pressed(current_buttons, changed_buttons, CONT_START)) + else if(button_pressed(current_buttons, changed_buttons, CONT_START)) break; /* Update the screen if we navigate a directory */ @@ -353,6 +370,23 @@ static void draw_directory_contents(directory_file_t *directory_contents, int nu } } +static bool draw_stat(const char *path) { + int x = 20 + BFONT_HEIGHT, y = 350; + struct stat path_stat; + + /* If stat fails */ + if(stat(path, &path_stat) < 0) + return false; + + /* We got a stat, so lets draw it */ + bfont_draw_str_fmt(vram_s + y*SCREEN_WIDTH+x, SCREEN_WIDTH, true, + "Stat succeeded:\n\tFile size: %lu\n\tLast Modified: %s\n", + S_ISDIR(path_stat.st_mode) ? 0 : path_stat.st_size, + asctime(gmtime(&path_stat.st_mtime))); + + return true; +} + static cont_state_t *get_cont_state() { maple_device_t *cont; cont_state_t *state; diff --git a/examples/dreamcast/filesystem/browse/browse.h b/examples/dreamcast/filesystem/browse/browse.h index 2aa62012..506c39db 100644 --- a/examples/dreamcast/filesystem/browse/browse.h +++ b/examples/dreamcast/filesystem/browse/browse.h @@ -17,6 +17,8 @@ static void delete_file(char *filename, bool mounted_sd); static void prompt_message(char *message, bool highlight_yes); +static bool draw_stat(const char *path); + static void draw_directory_selector(int index); static void draw_directory_contents(directory_file_t *directory_contents, int num); diff --git a/kernel/arch/dreamcast/fs/Makefile b/kernel/arch/dreamcast/fs/Makefile index 2fbcde5c..0e080ec3 100644 --- a/kernel/arch/dreamcast/fs/Makefile +++ b/kernel/arch/dreamcast/fs/Makefile @@ -6,8 +6,7 @@ # Dreamcast-specific file systems -OBJS = fs_iso9660.o fs_vmu.o fs_dcload.o dcload-syscall.o vmufs.o \ - fs_dclsocket.o +OBJS = fs_iso9660.o fs_vmu.o fs_dcload.o vmufs.o fs_dclsocket.o SUBDIRS = include $(KOS_BASE)/Makefile.prefab diff --git a/kernel/arch/dreamcast/fs/dcload-syscall.s b/kernel/arch/dreamcast/fs/dcload-syscall.s deleted file mode 100644 index 80976acb..00000000 --- a/kernel/arch/dreamcast/fs/dcload-syscall.s +++ /dev/null @@ -1,19 +0,0 @@ -! KallistiOS ##version## -! -! dcload-syscall.s -! (c)2000-2001 Andrew Kieschnick -! - - .section .text - .global _dcloadsyscall - -_dcloadsyscall: - mov.l dcloadsyscall_k,r0 - mov.l @r0,r0 - jmp @r0 - nop - -.align 4 -dcloadsyscall_k: - .long 0x8c004008 - diff --git a/kernel/arch/dreamcast/fs/fs_dcload.c b/kernel/arch/dreamcast/fs/fs_dcload.c index 93e7ca5e..fb17f46c 100644 --- a/kernel/arch/dreamcast/fs/fs_dcload.c +++ b/kernel/arch/dreamcast/fs/fs_dcload.c @@ -18,62 +18,35 @@ printf goes to the dc-tool console */ -#include <dc/fifo.h> +#include <dc/dcload.h> #include <dc/fs_dcload.h> -#include <arch/spinlock.h> #include <kos/dbgio.h> #include <kos/dbglog.h> #include <kos/fs.h> #include <kos/init.h> +#include <kos/mutex.h> +#include <kos/rwsem.h> #include <errno.h> #include <stdint.h> #include <stdio.h> #include <stdlib.h> #include <string.h> +#include <sys/dirent.h> #include <sys/queue.h> -/* A linked list of dir entries. */ -typedef struct dcl_dir { - LIST_ENTRY(dcl_dir) fhlist; +typedef struct dcl_obj { int hnd; char *path; dirent_t dirent; -} dcl_dir_t; +} dcl_obj_t; -LIST_HEAD(dcl_de, dcl_dir); +static mutex_t mutex = MUTEX_INITIALIZER; -static struct dcl_de dir_head = LIST_HEAD_INITIALIZER(0); - -static dcl_dir_t *hnd_is_dir(int hnd) { - dcl_dir_t *i; - - if(!hnd) return NULL; - - LIST_FOREACH(i, &dir_head, fhlist) { - if(i->hnd == (int)hnd) - break; - } - - return i; -} - -static spinlock_t mutex = SPINLOCK_INITIALIZER; - -#define dclsc(...) ({ \ - irq_disable_scoped(); \ - while(FIFO_STATUS & FIFO_SH4) \ - ; \ - dcloadsyscall(__VA_ARGS__); \ - }) - -/* Printk replacement */ - -int dcload_write_buffer(const uint8 *data, int len, int xlat) { +int dcload_write_buffer(const uint8_t *data, int len, int xlat) { (void)xlat; - spinlock_lock_scoped(&mutex); - dclsc(DCLOAD_WRITE, 1, data, len); + dcload_write(STDOUT_FILENO, data, len); return len; } @@ -82,18 +55,8 @@ int dcload_read_cons(void) { return -1; } -size_t dcload_gdbpacket(const char* in_buf, size_t in_size, char* out_buf, size_t out_size) { - - spinlock_lock_scoped(&mutex); - - /* we have to pack the sizes together because the dcloadsyscall handler - can only take 4 parameters */ - return dclsc(DCLOAD_GDBPACKET, in_buf, (in_size << 16) | (out_size & 0xffff), out_buf); -} - -static void *dcload_open(vfs_handler_t * vfs, const char *fn, int mode) { - char *dcload_path = NULL; - dcl_dir_t *entry; +static void *fs_dcload_open(vfs_handler_t *vfs, const char *fn, int mode) { + dcl_obj_t *entry; int hnd = 0; int dcload_mode = 0; int mm = (mode & O_MODE_MASK); @@ -101,14 +64,18 @@ static void *dcload_open(vfs_handler_t * vfs, const char *fn, int mode) { (void)vfs; - spinlock_lock_scoped(&mutex); + entry = calloc(1, sizeof(dcl_obj_t)); + if(!entry) { + errno = ENOMEM; + return (void *)NULL; + } if(mode & O_DIR) { if(fn[0] == '\0') { fn = "/"; } - hnd = dclsc(DCLOAD_OPENDIR, fn); + hnd = dcload_opendir(fn); if(!hnd) { /* It could be caused by other issues, such as @@ -116,34 +83,23 @@ static void *dcload_open(vfs_handler_t * vfs, const char *fn, int mode) { ENOTDIR seems to be the best generic and we should set something */ errno = ENOTDIR; - return (void *)NULL; - } - - /* We got something back so create an dir list entry for it */ - entry = malloc(sizeof(dcl_dir_t)); - if(!entry) { - errno = ENOMEM; + free(entry); return (void *)NULL; } fn_len = strlen(fn); if(fn[fn_len - 1] == '/') fn_len--; - dcload_path = malloc(fn_len + 2); - if(!dcload_path) { + entry->path = malloc(fn_len + 2); + if(!entry->path) { errno = ENOMEM; free(entry); return (void *)NULL; } - memcpy(dcload_path, fn, fn_len); - dcload_path[fn_len] = '/'; - dcload_path[fn_len+1] = '\0'; - - /* Now that everything is ready, add to list */ - entry->hnd = hnd; - entry->path = dcload_path; - LIST_INSERT_HEAD(&dir_head, entry, fhlist); + memcpy(entry->path, fn, fn_len); + entry->path[fn_len] = '/'; + entry->path[fn_len+1] = '\0'; } else { if(mm == O_RDONLY) @@ -159,131 +115,121 @@ static void *dcload_open(vfs_handler_t * vfs, const char *fn, int mode) { if(mode & O_TRUNC) dcload_mode |= 0x0400; - hnd = dclsc(DCLOAD_OPEN, fn, dcload_mode, 0644); - hnd++; /* KOS uses 0 for error, not -1 */ + hnd = dcload_open(fn, dcload_mode, 0644); + + if(hnd == -1) { + errno = ENOENT; + free(entry); + return (void *)NULL; + } } - return (void *)hnd; + entry->hnd = hnd; + return (void *)entry; } -static int dcload_close(void * h) { - uint32 hnd = (uint32)h; - dcl_dir_t *i; +static int fs_dcload_close(void *h) { + dcl_obj_t *obj = h; - spinlock_lock_scoped(&mutex); + if(!obj) return 0; - if(hnd) { - /* Check if it's a dir */ - i = hnd_is_dir(hnd); + /* It has a path so it's a dir */ + if(obj->path) { + dcload_closedir(obj->hnd); - /* We found it in the list, so it's a dir */ - if(i) { - dclsc(DCLOAD_CLOSEDIR, hnd); - LIST_REMOVE(i, fhlist); - free(i->path); - free(i); - } - else { - hnd--; /* KOS uses 0 for error, not -1 */ - dclsc(DCLOAD_CLOSE, hnd); - } + free(obj->path); } + else + dcload_close(obj->hnd); + free(obj); return 0; } -static ssize_t dcload_read(void * h, void *buf, size_t cnt) { +static ssize_t fs_dcload_read(void *h, void *buf, size_t cnt) { ssize_t ret = -1; - uint32 hnd = (uint32)h; - - spinlock_lock_scoped(&mutex); + dcl_obj_t *obj = h; - if(hnd) { - hnd--; /* KOS uses 0 for error, not -1 */ - ret = dclsc(DCLOAD_READ, hnd, buf, cnt); - } + if(obj) + ret = dcload_read(obj->hnd, buf, cnt); return ret; } -static ssize_t dcload_write(void * h, const void *buf, size_t cnt) { +static ssize_t fs_dcload_write(void *h, const void *buf, size_t cnt) { ssize_t ret = -1; - uint32 hnd = (uint32)h; + dcl_obj_t *obj = h; - spinlock_lock_scoped(&mutex); - - if(hnd) { - hnd--; /* KOS uses 0 for error, not -1 */ - ret = dclsc(DCLOAD_WRITE, hnd, buf, cnt); - } + if(obj) + ret = dcload_write(obj->hnd, buf, cnt); return ret; } -static off_t dcload_seek(void * h, off_t offset, int whence) { +static off_t fs_dcload_seek(void *h, off_t offset, int whence) { off_t ret = -1; - uint32 hnd = (uint32)h; + dcl_obj_t *obj = h; - spinlock_lock_scoped(&mutex); - - if(hnd) { - hnd--; /* KOS uses 0 for error, not -1 */ - ret = dclsc(DCLOAD_LSEEK, hnd, offset, whence); - } + if(obj) + ret = dcload_lseek(obj->hnd, offset, whence); return ret; } -static off_t dcload_tell(void * h) { +static off_t fs_dcload_tell(void *h) { off_t ret = -1; - uint32 hnd = (uint32)h; + dcl_obj_t *obj = h; - spinlock_lock_scoped(&mutex); - - if(hnd) { - hnd--; /* KOS uses 0 for error, not -1 */ - ret = dclsc(DCLOAD_LSEEK, hnd, 0, SEEK_CUR); - } + if(obj) + ret = dcload_lseek(obj->hnd, 0, SEEK_CUR); return ret; } -static size_t dcload_total(void * h) { +static size_t fs_dcload_total(void *h) { size_t ret = -1; - size_t cur; - uint32 hnd = (uint32)h; + off_t cur; + dcl_obj_t *obj = h; - spinlock_lock_scoped(&mutex); + if(obj) { + /* Lock to ensure commands are sent sequentially. */ + mutex_lock_scoped(&mutex); - if(hnd) { - hnd--; /* KOS uses 0 for error, not -1 */ - cur = dclsc(DCLOAD_LSEEK, hnd, 0, SEEK_CUR); - ret = dclsc(DCLOAD_LSEEK, hnd, 0, SEEK_END); - dclsc(DCLOAD_LSEEK, hnd, cur, SEEK_SET); + cur = dcload_lseek(obj->hnd, 0, SEEK_CUR); + ret = dcload_lseek(obj->hnd, 0, SEEK_END); + dcload_lseek(obj->hnd, cur, SEEK_SET); } return ret; } -static dirent_t *dcload_readdir(void * h) { +static dirent_t *fs_dcload_readdir(void *h) { dirent_t *rv = NULL; - dcload_dirent_t *dcld; + struct dirent *dcld; dcload_stat_t filestat; char *fn; - uint32 hnd = (uint32)h; - dcl_dir_t *entry; + dcl_obj_t *entry = h; - spinlock_lock_scoped(&mutex); + /* Lock to ensure commands are sent sequentially. */ + mutex_lock_scoped(&mutex); ...<truncated>... hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: kosmirror <kos...@us...> - 2025-09-21 21:32:46
|
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 2babea38ec32a10203c373a9d77b53cf3d1a8d53 (commit) from 6db4a90398c1bdec72c24c76e68f334de8f1ab02 (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 2babea38ec32a10203c373a9d77b53cf3d1a8d53 Author: QuzarDC <qu...@co...> Date: Sun Sep 21 17:24:40 2025 -0400 `.gitignore`: Ignore generated authors and banner files. These got left behind accidentally after the changes for #1153 ----------------------------------------------------------------------- Summary of changes: kernel/{arch/dreamcast/kernel => }/.gitignore | 1 - kernel/arch/dreamcast/kernel/.gitignore | 2 -- 2 files changed, 3 deletions(-) copy kernel/{arch/dreamcast/kernel => }/.gitignore (55%) diff --git a/kernel/arch/dreamcast/kernel/.gitignore b/kernel/.gitignore similarity index 55% copy from kernel/arch/dreamcast/kernel/.gitignore copy to kernel/.gitignore index 96d28f98..19ce7979 100644 --- a/kernel/arch/dreamcast/kernel/.gitignore +++ b/kernel/.gitignore @@ -1,3 +1,2 @@ -arch_exports.c authors.h banner.h diff --git a/kernel/arch/dreamcast/kernel/.gitignore b/kernel/arch/dreamcast/kernel/.gitignore index 96d28f98..100d6f1a 100644 --- a/kernel/arch/dreamcast/kernel/.gitignore +++ b/kernel/arch/dreamcast/kernel/.gitignore @@ -1,3 +1 @@ arch_exports.c -authors.h -banner.h hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: kosmirror <kos...@us...> - 2025-09-21 01:19:21
|
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 6db4a90398c1bdec72c24c76e68f334de8f1ab02 (commit) from afedb3ac510ddaafb8780adfc9f8435c12a651cf (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 6db4a90398c1bdec72c24c76e68f334de8f1ab02 Author: QuzarDC <qu...@co...> Date: Sat Sep 20 21:15:20 2025 -0400 Update version number for current master (v2.2.2) ----------------------------------------------------------------------- Summary of changes: include/kos/version.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/kos/version.h b/include/kos/version.h index 19f28f34..11372be6 100644 --- a/include/kos/version.h +++ b/include/kos/version.h @@ -99,7 +99,7 @@ #define KOS_VERSION_MAJOR 2 /**< KOS's current major revision number. */ #define KOS_VERSION_MINOR 2 /**< KOS's current minor revision number. */ -#define KOS_VERSION_PATCH 1 /**< KOS's current patch revision number. */ +#define KOS_VERSION_PATCH 2 /**< KOS's current patch revision number. */ /** KOS's current version as an integer ID. */ #define KOS_VERSION \ hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: kosmirror <kos...@us...> - 2025-09-21 01:12:57
|
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 afedb3ac510ddaafb8780adfc9f8435c12a651cf (commit) from 1675181e4460d44b9d03d5f7123d4074826029e7 (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 afedb3ac510ddaafb8780adfc9f8435c12a651cf Author: darc <da...@pr...> Date: Sat Sep 20 14:03:37 2025 -0500 Ignore .cache/, .clangd, .envrc and compile_commands.json For users of language servers, these files are used to specify compilation parameters or are generated for use by the language server. They should be ignored by git as they are not relevant to the repo itself. ----------------------------------------------------------------------- Summary of changes: .gitignore | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.gitignore b/.gitignore index a4e8474b..fc95a5a1 100644 --- a/.gitignore +++ b/.gitignore @@ -9,7 +9,11 @@ *~ .*.swp .DS_Store +.cache/ .vscode/ +.clangd +.envrc +compile_commands.json environ.sh romdisk.img /doc/reference/ hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: kosmirror <kos...@us...> - 2025-09-21 01:12:34
|
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 1675181e4460d44b9d03d5f7123d4074826029e7 (commit) from bf083e62190e1aaf20a66095ee265b0b721cc34c (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 1675181e4460d44b9d03d5f7123d4074826029e7 Author: QuzarDC <qu...@co...> Date: Sat Sep 20 13:06:43 2025 -0400 environ: Move default setting of SUBARCH to `environ_dreamcast.sh` All the other default setting tests happen at this level. Now the value can more clearly be simply set in environ or by IDE. ----------------------------------------------------------------------- Summary of changes: doc/environ.sh.sample | 8 +++----- environ_dreamcast.sh | 5 +++++ 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/doc/environ.sh.sample b/doc/environ.sh.sample index abfb4733..efccb33d 100644 --- a/doc/environ.sh.sample +++ b/doc/environ.sh.sample @@ -23,15 +23,13 @@ export KOS_ARCH="dreamcast" # is targeting or uses an existing value that # can be set externally via your IDE. # +# Only needs to be set if not using default. +# # Valid values: # "pristine" - Dreamcast console or HKT-0120 devkit (default) # "naomi" - NAOMI or NAOMI 2 arcade board # -if [ -z "${KOS_SUBARCH}" ] ; then - export KOS_SUBARCH="pristine" -else - export KOS_SUBARCH -fi +#export KOS_SUBARCH="naomi" # KOS Root Path # diff --git a/environ_dreamcast.sh b/environ_dreamcast.sh index e947323b..43454ac7 100644 --- a/environ_dreamcast.sh +++ b/environ_dreamcast.sh @@ -1,6 +1,11 @@ # KallistiOS environment variable settings. These are the shared pieces # for the Dreamcast(tm) platform. +# Add the default subarch (DC) if one hasn't already been set. +if [ -z "${KOS_SUBARCH}" ] ; then + export KOS_SUBARCH="pristine" +fi + # Add the default external DC tools path if it isn't already set. if [ -z "${DC_TOOLS_BASE}" ] ; then export DC_TOOLS_BASE="${KOS_CC_BASE}/../bin" hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: kosmirror <kos...@us...> - 2025-09-20 13:00:15
|
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 bf083e62190e1aaf20a66095ee265b0b721cc34c (commit) from 29147166323bb4cd5d5279c8b6fb17cc4128f65c (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 bf083e62190e1aaf20a66095ee265b0b721cc34c Author: QuzarDC <qu...@co...> Date: Fri Sep 19 00:17:10 2025 -0400 cmake: Add compatibility cmake files. We've recently changed the old `Dreamcast` to `kallistios` files. Providing passthrough wrappers + warning to aid compatibility. ----------------------------------------------------------------------- Summary of changes: utils/cmake/dreamcast.cmake | 2 ++ utils/cmake/dreamcast.toolchain.cmake | 2 ++ 2 files changed, 4 insertions(+) create mode 100644 utils/cmake/dreamcast.cmake create mode 100644 utils/cmake/dreamcast.toolchain.cmake diff --git a/utils/cmake/dreamcast.cmake b/utils/cmake/dreamcast.cmake new file mode 100644 index 00000000..9c378737 --- /dev/null +++ b/utils/cmake/dreamcast.cmake @@ -0,0 +1,2 @@ +message(AUTHOR_WARNING "dreamcast.cmake is deprecated, please use kallistios.cmake") +include(kallistios) diff --git a/utils/cmake/dreamcast.toolchain.cmake b/utils/cmake/dreamcast.toolchain.cmake new file mode 100644 index 00000000..7fd78404 --- /dev/null +++ b/utils/cmake/dreamcast.toolchain.cmake @@ -0,0 +1,2 @@ +message(AUTHOR_WARNING "dreamcast.toolchain.cmake is deprecated, please use kallistios.toolchain.cmake") +include($ENV{KOS_BASE}/utils/cmake/kallistios.toolchain.cmake) hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: kosmirror <kos...@us...> - 2025-09-20 03:52:07
|
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 29147166323bb4cd5d5279c8b6fb17cc4128f65c (commit) via 1b25ccf992b01266c136f7f4cabd9e43499867ee (commit) via a155e806a420b66d61365d858c93be9e3394f8ce (commit) via a01ed5dcc9a79efcd7acbb9184ef518fcbc5484c (commit) via d039cafaaee08ded731c1f74cbf397fb62fe0d34 (commit) via 4327aaf000f39cc31d42a42099da79a2c7f3081e (commit) via 527e0fdc516739e44a76651e93359b25f70bebf8 (commit) via 228ccc0014fb99dc24095bc0d11501328c0d8ae1 (commit) via 399d89a0b27d473033b62fab4784afd1aff63c51 (commit) via 0b5e4c8939f9bd58061bd04542060699a99bb3d6 (commit) via 9e77aa19ba54c31ffd336386c253494e879d7797 (commit) via c3779fa61906deb0255211f7913e62df69e121e8 (commit) via 40e8394ae4d1c0a38ffe608917b1de49b04a199e (commit) from 7346fd704ba489b7d9cf1234282b85957e7625dc (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 29147166323bb4cd5d5279c8b6fb17cc4128f65c Author: Paul Cercueil <pa...@cr...> Date: Fri Sep 19 12:08:00 2025 +0200 treewide: Include <kos/timer.h> instead of <arch/timer.h> Use the top-level API file <kos/timer.h> everywhere where it makes sense. Signed-off-by: Paul Cercueil <pa...@cr...> commit 1b25ccf992b01266c136f7f4cabd9e43499867ee Author: Paul Cercueil <pa...@cr...> Date: Fri Sep 19 12:00:15 2025 +0200 timer: Re-introduce timer_spin_sleep() as a deprecated API function Maintain compatibility with old code by re-introducing timer_spin_sleep(), but in the top-level API this time, and implemented on top of the arch API. Tag is as deprecated, since thd_sleep() should really be used instead. Signed-off-by: Paul Cercueil <pa...@cr...> commit a155e806a420b66d61365d858c93be9e3394f8ce Author: Paul Cercueil <pa...@cr...> Date: Tue Aug 26 23:12:46 2025 +0200 timer: Move older API functions to arch-agnostic header Move the timer_XX_gettime() and timer_XX_gettime64() functions from the SH4-specific timer code, to be arch-agnostic inline wrappers around the new timer_gettime() function. Also move timer_spin_delay_XX() functions to be arch-agnostic inline functions that just use the other ones above. Signed-off-by: Paul Cercueil <pa...@cr...> commit a01ed5dcc9a79efcd7acbb9184ef518fcbc5484c Author: Paul Cercueil <pa...@cr...> Date: Tue Jul 22 20:44:09 2025 +0200 timer: Add new arch-agnostic API function timer_gettime() Add API function timer_gettime(). This function will simply call arch_timer_gettime(), which has to be implemented by all the platforms supported by KallistiOS. Signed-off-by: Paul Cercueil <pa...@cr...> commit d039cafaaee08ded731c1f74cbf397fb62fe0d34 Author: Paul Cercueil <pa...@cr...> Date: Tue Aug 26 14:32:06 2025 +0200 timer: Add function arch_timer_gettime() This function can be used to return the time since KOS was started, in a standard timespec format (number of seconds + number of nanoseconds). Signed-off-by: Paul Cercueil <pa...@cr...> commit 4327aaf000f39cc31d42a42099da79a2c7f3081e Author: Paul Cercueil <pa...@cr...> Date: Tue Aug 26 14:30:10 2025 +0200 timer: Add arch function __dreamcast_get_ticks() This function returns the number of seconds since boot, and the number of ticks in the current second. It will later be used to implement the Dreamcast-specific implementation of the generic timer functions. Signed-off-by: Paul Cercueil <pa...@cr...> commit 527e0fdc516739e44a76651e93359b25f70bebf8 Author: Paul Cercueil <pa...@cr...> Date: Tue Aug 26 14:59:25 2025 +0200 timer: Use compile-time-known offset for TNS array Instead of reading back the scaling factor (TPSC value) from the hardware registers and use it as the offset into the TNS array, use the compile-time-known TIMER_TPSC macro as the offset, because we know for sure this is the same value. The compiler will then be able to optimize the code better. Signed-off-by: Paul Cercueil <pa...@cr...> commit 228ccc0014fb99dc24095bc0d11501328c0d8ae1 Author: Paul Cercueil <pa...@cr...> Date: Tue Jul 29 18:17:24 2025 +0200 timer: Drop timer_ms_{enable,disable} Those functions serve no purpose and don't belong in the public API. Signed-off-by: Paul Cercueil <pa...@cr...> commit 399d89a0b27d473033b62fab4784afd1aff63c51 Author: Paul Cercueil <pa...@cr...> Date: Tue Aug 26 15:13:48 2025 +0200 timer: Remove timer_spin_sleep() Nobody needs to busy-wait for that long and it'd be a terrible idea anyway. Remove this function as it is not used anywhere anymore, and to prevent people from having the bad idea of using it. This frees up the TMU1 to be used by applications. Signed-off-by: Paul Cercueil <pa...@cr...> commit 0b5e4c8939f9bd58061bd04542060699a99bb3d6 Author: Paul Cercueil <pa...@cr...> Date: Tue Aug 26 23:23:08 2025 +0200 sound: Use thd_sleep() instead of timer_spin_sleep() One millisecond is about 6% of the time we have to render a frame. As such, it does not make sense to busy-wait for such long times, especially when we can avoid it. Update the sound code to sleep instead of busy-waiting. Signed-off-by: Paul Cercueil <pa...@cr...> commit 9e77aa19ba54c31ffd336386c253494e879d7797 Author: Paul Cercueil <pa...@cr...> Date: Tue Aug 26 23:22:35 2025 +0200 modem: Use thd_sleep() instead of timer_spin_sleep() One millisecond is about 6% of the time we have to render a frame. As such, it does not make sense to busy-wait for such long times, especially when we can avoid it. Update the modem code to sleep instead of busy-waiting. Signed-off-by: Paul Cercueil <pa...@cr...> commit c3779fa61906deb0255211f7913e62df69e121e8 Author: Paul Cercueil <pa...@cr...> Date: Tue Aug 26 23:19:59 2025 +0200 g1ata: Use thd_sleep() instead of timer_spin_sleep() One millisecond is about 6% of the time we have to render a frame. As such, it does not make sense to busy-wait for such long times, especially when we can avoid it. Update the g1ata code to sleep instead of busy-waiting. Signed-off-by: Paul Cercueil <pa...@cr...> commit 40e8394ae4d1c0a38ffe608917b1de49b04a199e Author: Paul Cercueil <pa...@cr...> Date: Tue Aug 26 16:32:22 2025 +0200 thread: Make thd_sleep() fail if not using threading thd_sleep() (or any threading function for that matter) should not be called when the threading system is disabled. Also drop an extra <assert.h> include, we don't need two. Signed-off-by: Paul Cercueil <pa...@cr...> ----------------------------------------------------------------------- Summary of changes: include/kos/timer.h | 211 ++++++++++++++++++++++++ kernel/arch/dreamcast/hardware/cdrom.c | 2 +- kernel/arch/dreamcast/hardware/g1ata.c | 12 +- kernel/arch/dreamcast/hardware/maple/keyboard.c | 3 +- kernel/arch/dreamcast/hardware/maple/vmu.c | 2 +- kernel/arch/dreamcast/hardware/modem/modem.c | 10 +- kernel/arch/dreamcast/hardware/pvr/pvr_misc.c | 2 +- kernel/arch/dreamcast/hardware/sci.c | 2 +- kernel/arch/dreamcast/hardware/scif-spi.c | 2 +- kernel/arch/dreamcast/hardware/spu.c | 4 +- kernel/arch/dreamcast/include/arch/timer.h | 159 +++--------------- kernel/arch/dreamcast/kernel/init.c | 3 +- kernel/arch/dreamcast/kernel/initall_hdrs.h | 2 +- kernel/arch/dreamcast/kernel/irq.c | 2 +- kernel/arch/dreamcast/kernel/perf_monitor.c | 2 +- kernel/arch/dreamcast/kernel/perfctr.c | 2 +- kernel/arch/dreamcast/kernel/rtc.c | 2 +- kernel/arch/dreamcast/kernel/timer.c | 124 +------------- kernel/arch/dreamcast/sound/snd_iface.c | 4 +- kernel/arch/dreamcast/sound/snd_stream.c | 2 +- kernel/arch/dreamcast/util/screenshot.c | 2 +- kernel/exports.txt | 1 - kernel/libc/newlib/newlib_gettimeofday.c | 2 +- kernel/libc/newlib/newlib_times.c | 2 +- kernel/libc/posix/clock_gettime.c | 2 +- kernel/net/net_arp.c | 2 +- kernel/net/net_dhcp.c | 2 +- kernel/net/net_icmp.c | 2 +- kernel/net/net_icmp6.c | 2 +- kernel/net/net_ipv4.c | 2 +- kernel/net/net_ipv4_frag.c | 2 +- kernel/net/net_ndp.c | 2 +- kernel/net/net_tcp.c | 2 +- kernel/net/net_thd.c | 2 +- kernel/thread/genwait.c | 2 +- kernel/thread/mutex.c | 2 +- kernel/thread/thread.c | 10 +- 37 files changed, 292 insertions(+), 301 deletions(-) create mode 100644 include/kos/timer.h diff --git a/include/kos/timer.h b/include/kos/timer.h new file mode 100644 index 00000000..fba1db59 --- /dev/null +++ b/include/kos/timer.h @@ -0,0 +1,211 @@ +/* KallistiOS ##version## + + include/kos/timer.h + Copyright (C) 2025 Paul Cercueil +*/ + +/** \file kos/timer.h + \brief Timer functionality. + \ingroup timers + + This file contains functions for reading the internal timer provided + by the architecture. + + \sa arch/timer.h + + \author Paul Cercueil +*/ +#ifndef __KOS_TIMER_H +#define __KOS_TIMER_H + +#include <sys/cdefs.h> +__BEGIN_DECLS + +#include <arch/timer.h> +#include <stdint.h> +#include <time.h> + +typedef struct timespec timespec_t; + +/** \brief Get the current uptime of the system. + \ingroup timers + + This function retrieves the number of seconds and nanoseconds since KOS was + started. + + \return The current uptime of the system as a timespec struct. +*/ +static inline timespec_t timer_gettime(void) { + return arch_timer_gettime(); +} + +/** \brief Get the current uptime of the system (in milliseconds). + \ingroup timers + + This function retrieves the number of milliseconds since KOS was started. It + is equivalent to calling timer_ms_gettime() and combining the number of + seconds and milliseconds into one 64-bit value. + + \return The number of milliseconds since KOS started. +*/ +static inline uint64_t timer_ms_gettime64(void) { + timespec_t time = timer_gettime(); + + return (uint64_t)time.tv_sec * 1000 + time.tv_nsec / 1000000; +} + +/** \brief Get the current uptime of the system (in microseconds). + \ingroup timers + + This function retrieves the number of microseconds since KOS was started. + + \return The uptime in microseconds. +*/ +static inline uint64_t timer_us_gettime64(void) { + timespec_t time = timer_gettime(); + + return (uint64_t)time.tv_sec * 1000000 + time.tv_nsec / 1000; +} + +/** \brief Get the current uptime of the system (in nanoseconds). + \ingroup timers + + This function retrieves the number of nanoseconds since KOS was started. + + \return The uptime in nanoseconds. +*/ +static inline uint64_t timer_ns_gettime64(void) { + timespec_t time = timer_gettime(); + + return (uint64_t)time.tv_sec * 1000000000 + time.tv_nsec; +} + +/** \brief Get the current uptime of the system (in secs and millisecs). + \ingroup timers + + This function retrieves the number of seconds and milliseconds since KOS was + started. + + \param secs A pointer to store the number of seconds since boot + into. + \param msecs A pointer to store the number of milliseconds past + a second since boot. + \note To get the total number of milliseconds since boot, + calculate (*secs * 1000) + *msecs, or use the + timer_ms_gettime64() function. +*/ +static inline void timer_ms_gettime(uint32_t *secs, uint32_t *msecs) { + timespec_t time = timer_gettime(); + + if(secs) *secs = time.tv_sec; + if(msecs) *msecs = time.tv_nsec / 1000000; +} + +/** \brief Get the current uptime of the system (in secs and microsecs). + \ingroup timers + + This function retrieves the number of seconds and microseconds since KOS was + started. + + \note To get the total number of microseconds since boot, + calculate (*secs * 1000000) + *usecs, or use the + timer_us_gettime64() function. + + \param secs A pointer to store the number of seconds since boot + into. + \param usecs A pointer to store the number of microseconds past + a second since boot. +*/ +static inline void timer_us_gettime(uint32_t *secs, uint32_t *usecs) { + timespec_t time = timer_gettime(); + + if(secs) *secs = time.tv_sec; + if(usecs) *usecs = time.tv_nsec / 1000; +} + +/** \brief Get the current uptime of the system (in secs and nanosecs). + \ingroup timers + + This function retrieves the number of seconds and nanoseconds since KOS was + started. + + \note To get the total number of nanoseconds since boot, + calculate (*secs * 1000000000) + *nsecs, or use the + timer_ns_gettime64() function. + + \param secs A pointer to store the number of seconds since boot + into. + \param nsecs A pointer to store the number of nanoseconds past + a second since boot. +*/ +static inline void timer_ns_gettime(uint32_t *secs, uint32_t *nsecs) { + timespec_t time = timer_gettime(); + + if(secs) *secs = time.tv_sec; + if(nsecs) *nsecs = time.tv_nsec; +} + +/** \brief Spin-loop delay function with microsecond granularity + \ingroup timers + + This function is meant as a very accurate delay function, even if threading + and interrupts are disabled. It is a delay and not a sleep, which means that + the CPU will be busy-looping during that time frame. For any time frame + bigger than a few hundred microseconds, it is recommended to sleep instead. + + Note that the parameter is 16-bit, which means that the maximum acceptable + value is 65535 microseconds. + + \param us The number of microseconds to wait for. + \sa timer_spin_delay_ns, thd_sleep +*/ +static inline void timer_spin_delay_us(unsigned short us) { + uint64_t timeout = timer_us_gettime64() + us; + + /* Note that we don't actually care about the counter overflowing. + Nobody will run their Dreamcast straight for 584942 years. */ + while(timer_us_gettime64() < timeout); +} + + +/** \brief Spin-loop delay function with nanosecond granularity + \ingroup timers + + This function is meant as a very accurate delay function, even if threading + and interrupts are disabled. It is a delay and not a sleep, which means that + the CPU will be busy-looping during that time frame. + + Note that the parameter is 16-bit, which means that the maximum acceptable + value is 65535 nanoseconds. + + \param ns The number of nanoseconds to wait for. + \sa timer_spin_delay_us, thd_sleep +*/ +static inline void timer_spin_delay_ns(unsigned short ns) { + uint64_t timeout = timer_ns_gettime64() + ns; + + /* Note that we don't actually care about the counter overflowing. + Nobody will run their Dreamcast straight for 585 years. */ + while(timer_ns_gettime64() < timeout); +} + +/** \brief Spin-loop delay function with millisecond granularity + \ingroup timers + + This function should never be used, and is only used for compatibility with + older code. It makes no sense to busy-wait for that long. + + \param ms The number of microseconds to wait for. + \sa thd_sleep +*/ + +__depr("Do not use timer_spin_sleep(), use thd_sleep() instead") +static inline void timer_spin_sleep(unsigned int ms) { + uint64_t timeout = timer_ms_gettime64() + ms; + + while(timer_ms_gettime64() < timeout); +} + +__END_DECLS + +#endif /* __KOS_TIMER_H */ diff --git a/kernel/arch/dreamcast/hardware/cdrom.c b/kernel/arch/dreamcast/hardware/cdrom.c index 7b0766a9..c4c21ed1 100644 --- a/kernel/arch/dreamcast/hardware/cdrom.c +++ b/kernel/arch/dreamcast/hardware/cdrom.c @@ -12,7 +12,7 @@ #include <assert.h> #include <arch/cache.h> -#include <arch/timer.h> +#include <kos/timer.h> #include <arch/memory.h> #include <arch/irq.h> diff --git a/kernel/arch/dreamcast/hardware/g1ata.c b/kernel/arch/dreamcast/hardware/g1ata.c index c447fee1..b6716b80 100644 --- a/kernel/arch/dreamcast/hardware/g1ata.c +++ b/kernel/arch/dreamcast/hardware/g1ata.c @@ -17,7 +17,7 @@ #include <kos/mutex.h> #include <kos/thread.h> -#include <arch/timer.h> +#include <kos/timer.h> #include <arch/cache.h> #include <arch/irq.h> #include <arch/memory.h> @@ -965,7 +965,7 @@ int g1_ata_flush(void) { /* Select the slave device. */ g1_ata_select_device(G1_ATA_SLAVE | G1_ATA_LBA_MODE); - timer_spin_sleep(1); + thd_sleep(1); /* Flush the disk's write cache to make sure everything gets written out. */ if(CAN_USE_LBA48()) @@ -973,7 +973,7 @@ int g1_ata_flush(void) { else OUT8(G1_ATA_COMMAND_REG, ATA_CMD_FLUSH_CACHE); - timer_spin_sleep(1); + thd_sleep(1); g1_ata_wait_bsydrq(); g1_ata_mutex_unlock(); @@ -1006,7 +1006,7 @@ static int g1_ata_set_transfer_mode(uint8_t mode) { /* Send the SET FEATURES command. */ OUT8(G1_ATA_COMMAND_REG, ATA_CMD_SET_FEATURES); - timer_spin_sleep(1); + thd_sleep(1); /* Wait for command completion. */ g1_ata_wait_nbsy(); @@ -1034,7 +1034,7 @@ static int g1_ata_scan(void) { /* For now, just check if there's a slave device. We don't care about the primary device, since it should always be the GD-ROM drive. */ OUT8(G1_ATA_DEVICE_SELECT, 0xF0); - timer_spin_sleep(1); + thd_sleep(1); OUT8(G1_ATA_SECTOR_COUNT, 0); OUT8(G1_ATA_LBA_LOW, 0); @@ -1043,7 +1043,7 @@ static int g1_ata_scan(void) { /* Send the IDENTIFY command. */ OUT8(G1_ATA_COMMAND_REG, ATA_CMD_IDENTIFY); - timer_spin_sleep(1); + thd_sleep(1); st = IN8(G1_ATA_STATUS_REG); /* Check if there's anything on the bus. */ diff --git a/kernel/arch/dreamcast/hardware/maple/keyboard.c b/kernel/arch/dreamcast/hardware/maple/keyboard.c index 8599f774..4ecfe5c5 100644 --- a/kernel/arch/dreamcast/hardware/maple/keyboard.c +++ b/kernel/arch/dreamcast/hardware/maple/keyboard.c @@ -15,7 +15,8 @@ #include <kos/dbglog.h> -#include <arch/timer.h> +#include <kos/timer.h> +#include <arch/irq.h> #include <dc/maple.h> #include <dc/maple/keyboard.h> diff --git a/kernel/arch/dreamcast/hardware/maple/vmu.c b/kernel/arch/dreamcast/hardware/maple/vmu.c index 922f1754..86fa12eb 100644 --- a/kernel/arch/dreamcast/hardware/maple/vmu.c +++ b/kernel/arch/dreamcast/hardware/maple/vmu.c @@ -25,7 +25,7 @@ #include <dc/math.h> #include <dc/biosfont.h> #include <dc/vmufs.h> -#include <arch/timer.h> +#include <kos/timer.h> #define VMU_BLOCK_WRITE_RETRY_TIME 100 /* time to sleep until retrying a failed write */ diff --git a/kernel/arch/dreamcast/hardware/modem/modem.c b/kernel/arch/dreamcast/hardware/modem/modem.c index 940a02b2..f71146d6 100644 --- a/kernel/arch/dreamcast/hardware/modem/modem.c +++ b/kernel/arch/dreamcast/hardware/modem/modem.c @@ -448,14 +448,14 @@ void modemHardReset(void) { /* This zeroes out all of the modem's registers */ modemWrite(G2_8BP_RST, 0); - timer_spin_sleep(25); /* A slight delay just to be safe */ + thd_sleep(25); /* A slight delay just to be safe */ /* This sets the modem's registers to their default settings */ modemWrite(G2_8BP_RST, 1); /* Wait for a little while so the modem has time to reset itself completely */ - timer_spin_sleep(150); + thd_sleep(150); } void modemSoftReset(void) { @@ -465,7 +465,7 @@ void modemSoftReset(void) { while(modemRead(REGLOC(0x1F)) & 0x1); /* Wait for NEWC to clear */ /* Wait a minimum of 10ms before using the MDP again */ - timer_spin_sleep(100); + thd_sleep(100); } void modemConfigurationReset(void) { @@ -600,7 +600,7 @@ int modem_set_mode(int mode, modem_speed_t speed) { modemSetBits(REGLOC(0x1F), 0x1); /* Set NEWC */ /* Delay at least 4ms */ - timer_spin_sleep(10); + thd_sleep(10); /* Dial using DTMF tones, and set the modem in origination mode */ @@ -801,7 +801,7 @@ void modemEstablishConnection(void) { can be answered */ if(!(modemCfg.flags & MODEM_CFG_FLAG_ORIGINATE)) { modemSetBits(REGLOC(0x7), 0x2); /* Set RA */ - timer_spin_sleep(10); + thd_sleep(10); } /* Note that in all modes of operation RTS will be turned on as soon diff --git a/kernel/arch/dreamcast/hardware/pvr/pvr_misc.c b/kernel/arch/dreamcast/hardware/pvr/pvr_misc.c index 8e814195..e9ebf611 100644 --- a/kernel/arch/dreamcast/hardware/pvr/pvr_misc.c +++ b/kernel/arch/dreamcast/hardware/pvr/pvr_misc.c @@ -10,7 +10,7 @@ #include <string.h> #include <float.h> -#include <arch/timer.h> +#include <kos/timer.h> #include <dc/pvr.h> #include <dc/video.h> #include <kos/regfield.h> diff --git a/kernel/arch/dreamcast/hardware/sci.c b/kernel/arch/dreamcast/hardware/sci.c index 82322412..8b839880 100644 --- a/kernel/arch/dreamcast/hardware/sci.c +++ b/kernel/arch/dreamcast/hardware/sci.c @@ -8,7 +8,7 @@ #include <dc/math.h> #include <arch/cache.h> #include <arch/dmac.h> -#include <arch/timer.h> +#include <kos/timer.h> #include <kos/dbglog.h> #include <kos/regfield.h> diff --git a/kernel/arch/dreamcast/hardware/scif-spi.c b/kernel/arch/dreamcast/hardware/scif-spi.c index 0485a9e5..171e3ea1 100644 --- a/kernel/arch/dreamcast/hardware/scif-spi.c +++ b/kernel/arch/dreamcast/hardware/scif-spi.c @@ -8,7 +8,7 @@ #include <dc/scif.h> #include <dc/fs_dcload.h> -#include <arch/timer.h> +#include <kos/timer.h> #include <kos/dbglog.h> #include <kos/regfield.h> diff --git a/kernel/arch/dreamcast/hardware/spu.c b/kernel/arch/dreamcast/hardware/spu.c index 21136e39..78de2315 100644 --- a/kernel/arch/dreamcast/hardware/spu.c +++ b/kernel/arch/dreamcast/hardware/spu.c @@ -9,7 +9,7 @@ #include <dc/spu.h> #include <dc/g2bus.h> #include <dc/sq.h> -#include <arch/timer.h> +#include <kos/timer.h> #include <errno.h> /* @@ -355,7 +355,7 @@ int spu_init(void) { spu_enable(); /* Wait a few clocks */ - timer_spin_sleep(10); + thd_sleep(10); /* Initialize CDDA channels */ spu_cdda_init(); diff --git a/kernel/arch/dreamcast/include/arch/timer.h b/kernel/arch/dreamcast/include/arch/timer.h index caf1290c..99694a32 100644 --- a/kernel/arch/dreamcast/include/arch/timer.h +++ b/kernel/arch/dreamcast/include/arch/timer.h @@ -34,6 +34,8 @@ __BEGIN_DECLS #include <arch/irq.h> +#include <time.h> + /** \defgroup timers Timer Unit \brief SH4 CPU peripheral providing timers and counters \ingroup timing @@ -82,8 +84,7 @@ __BEGIN_DECLS /** \brief SH4 Timer Channel 1. \warning - This timer channel is used for the timer_spin_sleep() function, which also - backs the kthread, C, C++, and POSIX sleep functions. + This timer channel is free to use. */ #define TMU1 1 @@ -231,148 +232,39 @@ int timer_ints_enabled(int channel); The highest actual tick resolution of \ref TMU2 is 80ns. */ -/** \brief Enable the millisecond timer. - \ingroup tmu_uptime - - This function enables the timer used for the gettime functions. This is on - by default. These functions use \ref TMU2 to do their work. -*/ -void timer_ms_enable(void); - -/** \brief Disable the millisecond timer. - \ingroup tmu_uptime - - This function disables the timer used for the gettime functions. Generally, - you will not want to do this, unless you have some need to use the timer - \ref TMU2 for something else. -*/ -void timer_ms_disable(void); - -/** \brief Get the current uptime of the system (in secs and millisecs). - \ingroup tmu_uptime - - This function retrieves the number of seconds and milliseconds since KOS was ...<truncated>... hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: kosmirror <kos...@us...> - 2025-09-19 17:42:05
|
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 7346fd704ba489b7d9cf1234282b85957e7625dc (commit) from 3348accdbc8a4869ef6eeaf7799067d84af64466 (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 7346fd704ba489b7d9cf1234282b85957e7625dc Author: Paul Cercueil <pa...@cr...> Date: Fri Sep 19 15:55:36 2025 +0200 Add C11's static_assert() to <assert.h> C11 adds the _Static_assert keyword, and a static_assert macro in <assert.h>. Add the static_assert() macro to our <assert.h> copy. Signed-off-by: Paul Cercueil <pa...@cr...> ----------------------------------------------------------------------- Summary of changes: include/assert.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/assert.h b/include/assert.h index fc7e78ec..a818cdc7 100644 --- a/include/assert.h +++ b/include/assert.h @@ -40,6 +40,10 @@ __BEGIN_DECLS error message. */ /** \cond */ #define _assert(e) assert(e) + +#if __STDC_VERSION__ >= 201112L && !defined __cplusplus +#define static_assert _Static_assert +#endif /** \endcond */ #ifdef NDEBUG hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: kosmirror <kos...@us...> - 2025-09-16 18:58:19
|
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 3348accdbc8a4869ef6eeaf7799067d84af64466 (commit) from 0e0205c10c910340bb9c31cced19ba4cb24fb51a (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 3348accdbc8a4869ef6eeaf7799067d84af64466 Author: Paul Cercueil <pa...@cr...> Date: Mon Sep 15 19:11:08 2025 +0200 maple: Fix race between driver attach and vblank irq The device at unit 0 is probed using a shared frame dedicated to device detection; devices at unit > 0 are probed using the frame of the unit 0. This means that as soon as a unit 0 device is registered, its frame can be used to auto-detect itself (if previously unplugged) or its children. Therefore, prior to registering a unit 0 device into the device table, we must ensure that all fields have been properly initialized, or we will race with the vblank interrupt handler. Signed-off-by: Paul Cercueil <pa...@cr...> ----------------------------------------------------------------------- Summary of changes: kernel/arch/dreamcast/hardware/maple/maple_driver.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/kernel/arch/dreamcast/hardware/maple/maple_driver.c b/kernel/arch/dreamcast/hardware/maple/maple_driver.c index 00b9ba0b..f84468d6 100644 --- a/kernel/arch/dreamcast/hardware/maple/maple_driver.c +++ b/kernel/arch/dreamcast/hardware/maple/maple_driver.c @@ -73,6 +73,7 @@ int maple_driver_attach(maple_frame_t *det) { maple_devinfo_t *devinfo; maple_device_t *dev = maple_state.ports[det->dst_port].units[det->dst_unit]; bool attached = false; + bool dev_allocated = false; /* Resolve some pointers first */ resp = (maple_response_t *)det->recv_buf; @@ -89,12 +90,11 @@ int maple_driver_attach(maple_frame_t *det) { if(!dev) return 1; - maple_state.ports[det->dst_port].units[det->dst_unit] = dev; - /* Add the basics for the initial version of the struct */ dev->port = det->dst_port; dev->unit = det->dst_unit; dev->frame.state = MAPLE_FRAME_VACANT; + dev_allocated = true; } memcpy(&dev->info, devinfo, sizeof(maple_devinfo_t)); @@ -102,10 +102,16 @@ int maple_driver_attach(maple_frame_t *det) { /* Now lets allocate a new status buffer */ if(i->status_size && !dev->status) { dev->status = calloc(1, i->status_size); - if(!dev->status) + if(!dev->status) { + if(dev_allocated) + free(dev); return 1; + } } + if(dev_allocated) + maple_state.ports[det->dst_port].units[det->dst_unit] = dev; + if(!i->status_size || dev->status) { /* Try to attach if we need to then break out. */ if(!(i->attach) || (i->attach(i, dev) >= 0)) { hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: kosmirror <kos...@us...> - 2025-09-10 16:45:08
|
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 0e0205c10c910340bb9c31cced19ba4cb24fb51a (commit) from 60ef57f4c1a55b1e515b9c577527b07a3a0ed971 (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 0e0205c10c910340bb9c31cced19ba4cb24fb51a Author: QuzarDC <qu...@co...> Date: Wed Sep 10 11:02:18 2025 -0400 romdisk: Have romdisk building use our standard `kos-cc` This brings it in-line with the rest of the build system in not echoing the block of args being passed to gcc unless verbose mode is being set. ----------------------------------------------------------------------- Summary of changes: Makefile.rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.rules b/Makefile.rules index 6c34c9ed..f125a25f 100644 --- a/Makefile.rules +++ b/Makefile.rules @@ -82,7 +82,7 @@ romdisk.img: romdisk.o: romdisk.img $(KOS_BASE)/utils/bin2c/bin2c romdisk.img romdisk_tmp.c romdisk - $(KOS_CC) $(KOS_CFLAGS) -o romdisk_tmp.o -c romdisk_tmp.c + kos-cc -o romdisk_tmp.o -c romdisk_tmp.c $(KOS_CC) -o romdisk.o -r romdisk_tmp.o $(KOS_LIB_PATHS) -Wl,--whole-archive -lromdiskbase rm romdisk_tmp.c romdisk_tmp.o endif hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: kosmirror <kos...@us...> - 2025-09-08 15:33:48
|
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 60ef57f4c1a55b1e515b9c577527b07a3a0ed971 (commit) from c2350046b3111d6550a8ccb583a0f21fc15b0c29 (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 60ef57f4c1a55b1e515b9c577527b07a3a0ed971 Author: dfchil <dan...@gm...> Date: Mon Sep 8 17:33:30 2025 +0200 pvr: Modifier volume header texture address fix (#1189) The inside texture in modifier volumes was erroneously getting the texture address of the outside texture Co-authored-by: Daniel Fairchild <da...@vi...> ----------------------------------------------------------------------- Summary of changes: kernel/arch/dreamcast/hardware/pvr/pvr_prim.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/arch/dreamcast/hardware/pvr/pvr_prim.c b/kernel/arch/dreamcast/hardware/pvr/pvr_prim.c index 904c0511..7909c111 100644 --- a/kernel/arch/dreamcast/hardware/pvr/pvr_prim.c +++ b/kernel/arch/dreamcast/hardware/pvr/pvr_prim.c @@ -446,7 +446,7 @@ void pvr_poly_mod_compile(pvr_poly_mod_hdr_t *dst, const pvr_poly_cxt_t *src) { | FIELD_PREP(PVR_TA_PM2_VSIZE, __builtin_ctz(src->txr2.height) - 3); /* Convert the texture address */ - txr_base = to_pvr_txr_ptr(src->txr.base); + txr_base = to_pvr_txr_ptr(src->txr2.base); /* Polygon mode 3 */ mode3 = FIELD_PREP(PVR_TA_PM3_MIPMAP, src->txr2.mipmap) hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: kosmirror <kos...@us...> - 2025-09-06 17:33:25
|
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 c2350046b3111d6550a8ccb583a0f21fc15b0c29 (commit) from 05037ccd3d7318d9f2c1cd8e436adea24501e759 (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 c2350046b3111d6550a8ccb583a0f21fc15b0c29 Author: QuzarDC <qu...@co...> Date: Fri Sep 5 01:49:39 2025 -0400 genwait: Keep queues in order by thread priority. Currently, new waiting threads are always added to the end of their genwait tailq and the first thread in the tailq is the first woken. This means that unless a thread is being woken and readded (like can happen with a `genwait_wake_all`) they will always be awoken based on how long they have been waiting. The downside to this method is that it ignores thread priorities, which should be the controlling factor in which thread gets woken first. By inserting into the queue by priority order, wakes will now happen based on priority rather than time waiting. The mild overhead of seeking through the waiting queues should be outweighed greatly by allowing priority management via thread priorities. ----------------------------------------------------------------------- Summary of changes: kernel/thread/genwait.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/kernel/thread/genwait.c b/kernel/thread/genwait.c index 3653edf5..bc874c2c 100644 --- a/kernel/thread/genwait.c +++ b/kernel/thread/genwait.c @@ -69,7 +69,7 @@ static kthread_t *tq_next(void) { } int genwait_wait(void *obj, const char *mesg, int timeout, void (*callback)(void *)) { - kthread_t *me; + kthread_t *me, *t; /* Twiddle interrupt state */ if(irq_inside_int()) { @@ -95,8 +95,17 @@ int genwait_wait(void *obj, const char *mesg, int timeout, void (*callback)(void me->wait_callback = callback; - /* Insert us on the appropriate wait queue */ - TAILQ_INSERT_TAIL(&slpque[LOOKUP(obj)], me, thdq); + /* Go through and find where to insert */ + TAILQ_FOREACH(t, &slpque[LOOKUP(obj)], thdq) { + if(me->prio < t->prio) { + TAILQ_INSERT_BEFORE(t, me, thdq); + break; + } + } + + /* We got to the end of the list, so insert at end */ + if(!t) + TAILQ_INSERT_TAIL(&slpque[LOOKUP(obj)], me, thdq); /* Block us until we're signaled */ return thd_block_now(&me->context); hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: kosmirror <kos...@us...> - 2025-09-05 19:43:12
|
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 05037ccd3d7318d9f2c1cd8e436adea24501e759 (commit) from 0db67b99b154ec06dda311ce8a91615cd4654729 (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 05037ccd3d7318d9f2c1cd8e436adea24501e759 Author: QuzarDC <qu...@co...> Date: Fri Sep 5 15:40:41 2025 -0400 irq.c: Replace old `__unlikely` with newlib standard macro ----------------------------------------------------------------------- Summary of changes: kernel/arch/dreamcast/kernel/irq.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/arch/dreamcast/kernel/irq.c b/kernel/arch/dreamcast/kernel/irq.c index 3e3be5a8..00e8a4a4 100644 --- a/kernel/arch/dreamcast/kernel/irq.c +++ b/kernel/arch/dreamcast/kernel/irq.c @@ -217,7 +217,7 @@ void irq_handle_exception(int code) { int handled = 0; if(__is_defined(__SH_ATOMIC_MODEL_SOFT_GUSA__) - && __unlikely((int32_t)irq_srt_addr->r[15] >= -128 + && __predict_false((int32_t)irq_srt_addr->r[15] >= -128 && irq_srt_addr->pc != irq_srt_addr->r[0])) { /* The stack pointer has been altered: it means we are in the middle of an atomic section, and we need to roll-back. @@ -458,4 +458,4 @@ void irq_set_priority(irq_src_t src, unsigned int prio) { unsigned int irq_get_priority(irq_src_t src) { return (REG_IPR(src / 4) >> (src % 4) * 4) & 0xf; -} \ No newline at end of file +} hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: kosmirror <kos...@us...> - 2025-09-05 19:36:04
|
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 0db67b99b154ec06dda311ce8a91615cd4654729 (commit) from a337be07e09bd884d224d39b0b4c7034ac681b97 (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 0db67b99b154ec06dda311ce8a91615cd4654729 Author: QuzarDC <qu...@co...> Date: Fri Sep 5 15:32:45 2025 -0400 sys/_types: Readd `_TIME_T_` define. Seems it is required and can throw complaints in some gcc versions/settings. ----------------------------------------------------------------------- Summary of changes: include/sys/_types.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/sys/_types.h b/include/sys/_types.h index 0be7feae..3110877d 100644 --- a/include/sys/_types.h +++ b/include/sys/_types.h @@ -137,7 +137,8 @@ typedef unsigned long __mode_t; typedef unsigned short __nlink_t; typedef long __suseconds_t; /* microseconds (signed) */ typedef unsigned long __useconds_t; /* microseconds (unsigned) */ -typedef long long __time_t; +#define _TIME_T_ long long +typedef _TIME_T_ __time_t; #ifndef __clockid_t_defined #define _CLOCKID_T_ unsigned long hooks/post-receive -- A pseudo Operating System for the Dreamcast. |