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
(33) |
Sep
|
Oct
|
Nov
|
Dec
|
From: kosmirror <kos...@us...> - 2025-08-16 17:02: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 011c420e0b5c843591fb8258c4784eab4459fdac (commit) via 4e79be987997f5e1250da90d0cf89b443da3d439 (commit) from a6cf282777a0aa3477f725695c38eb072f97e599 (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 011c420e0b5c843591fb8258c4784eab4459fdac Author: darc <da...@pr...> Date: Wed Aug 6 10:22:31 2025 -0500 Add arch_stk_setup function for setting up a new stack during thread creation Some architectures, like PowerPC, need the stack to be adjusted before thread creation. This is unnecessary on Dreamcast, so the implementation added to Dreamcast is empty. commit 4e79be987997f5e1250da90d0cf89b443da3d439 Author: darc <da...@pr...> Date: Wed Aug 6 10:10:44 2025 -0500 Move stack functions from arch.h to stack.h ----------------------------------------------------------------------- Summary of changes: addons/libpthread/pthread_attr_init.c | 2 +- .../basic/stackprotector/stackprotector.c | 2 +- kernel/arch/dreamcast/hardware/pvr/pvr_mem.c | 2 + kernel/arch/dreamcast/include/arch/arch.h | 71 +----------------- kernel/arch/dreamcast/include/arch/stack.h | 87 ++++++++++++++++++++-- kernel/arch/dreamcast/kernel/mm.c | 4 +- kernel/arch/dreamcast/kernel/stack.c | 10 ++- kernel/thread/thread.c | 17 ++++- 8 files changed, 109 insertions(+), 86 deletions(-) diff --git a/addons/libpthread/pthread_attr_init.c b/addons/libpthread/pthread_attr_init.c index 6eab4ace..43732e16 100644 --- a/addons/libpthread/pthread_attr_init.c +++ b/addons/libpthread/pthread_attr_init.c @@ -11,7 +11,7 @@ #include <string.h> #include <kos/thread.h> -#include <arch/arch.h> +#include <arch/stack.h> int pthread_attr_init(pthread_attr_t *attr) { if(!attr) diff --git a/examples/dreamcast/basic/stackprotector/stackprotector.c b/examples/dreamcast/basic/stackprotector/stackprotector.c index 235840fc..710360f1 100644 --- a/examples/dreamcast/basic/stackprotector/stackprotector.c +++ b/examples/dreamcast/basic/stackprotector/stackprotector.c @@ -26,7 +26,7 @@ #include <string.h> #include <stdio.h> -#include <arch/arch.h> +#include <arch/stack.h> #include <stdlib.h> /* This function will override the default stack protector handler that is diff --git a/kernel/arch/dreamcast/hardware/pvr/pvr_mem.c b/kernel/arch/dreamcast/hardware/pvr/pvr_mem.c index b9cff2bf..fc6ac904 100644 --- a/kernel/arch/dreamcast/hardware/pvr/pvr_mem.c +++ b/kernel/arch/dreamcast/hardware/pvr/pvr_mem.c @@ -15,6 +15,8 @@ #include <kos/opts.h> #include <kos/dbglog.h> +#include <arch/stack.h> + /* This module basically serves as a KOS-friendly front end and support routines diff --git a/kernel/arch/dreamcast/include/arch/arch.h b/kernel/arch/dreamcast/include/arch/arch.h index 1f9d227c..2414f919 100644 --- a/kernel/arch/dreamcast/include/arch/arch.h +++ b/kernel/arch/dreamcast/include/arch/arch.h @@ -10,8 +10,7 @@ \brief Dreamcast architecture specific options. \ingroup arch - This file has various architecture specific options defined in it. Also, any - functions that start with arch_ are in here. + This file has various architecture specific options defined in it. \author Megan Potter */ @@ -80,21 +79,6 @@ extern char _etext; static const unsigned HZ __depr("Please use the new THD_SCHED_HZ macro.") = THD_SCHED_HZ; -#ifndef THD_STACK_ALIGNMENT -/** \brief Required alignment for stack. */ -#define THD_STACK_ALIGNMENT 8 -#endif - -#ifndef THD_STACK_SIZE -/** \brief Default thread stack size. */ -#define THD_STACK_SIZE 32768 -#endif - -#ifndef THD_KERNEL_STACK_SIZE -/** \brief Main/kernel thread's stack size. */ -#define THD_KERNEL_STACK_SIZE (64 * 1024) -#endif - /** \brief Default video mode. */ #define DEFAULT_VID_MODE DM_640x480 @@ -376,59 +360,6 @@ static inline void arch_sleep(void) { __asm__ __volatile__("sleep\n"); } -/** \brief DC specific "function" to get the return address from the current - function. - \ingroup arch - - \return The return address of the current function. -*/ -static __always_inline uintptr_t arch_get_ret_addr(void) { - uintptr_t pr; - - __asm__ __volatile__("sts pr,%0\n" : "=r"(pr)); - - return pr; -} - -/* Please note that all of the following frame pointer macros are ONLY - valid if you have compiled your code WITHOUT -fomit-frame-pointer. These - are mainly useful for getting a stack trace from an error. */ - -/** \brief DC specific "function" to get the frame pointer from the current - function. - \ingroup arch - - \return The frame pointer from the current function. - \note This only works if you don't disable frame pointers. -*/ -static __always_inline uintptr_t arch_get_fptr(void) { - register uintptr_t fp __asm__("r14"); - - return fp; -} - -/** \brief Pass in a frame pointer value to get the return address for the - given frame. - \ingroup arch - - \param fptr The frame pointer to look at. - \return The return address of the pointer. -*/ -static inline uintptr_t arch_fptr_ret_addr(uintptr_t fptr) { - return *(uintptr_t *)fptr; -} - -/** \brief Pass in a frame pointer value to get the previous frame pointer for - the given frame. - \ingroup arch - - \param fptr The frame pointer to look at. - \return The previous frame pointer. -*/ -static inline uintptr_t arch_fptr_next(uintptr_t fptr) { - return arch_fptr_ret_addr(fptr + 4); -} - /** \brief Returns true if the passed address is likely to be valid. Doesn't have to be exact, just a sort of general idea. \ingroup arch diff --git a/kernel/arch/dreamcast/include/arch/stack.h b/kernel/arch/dreamcast/include/arch/stack.h index d587aa25..6612bf4f 100644 --- a/kernel/arch/dreamcast/include/arch/stack.h +++ b/kernel/arch/dreamcast/include/arch/stack.h @@ -2,19 +2,22 @@ arch/dreamcast/include/arch/stack.h (c)2002 Megan Potter + (c)2025 Eric Fradella */ /** \file arch/stack.h - \brief Stack tracing. + \brief Stack functions \ingroup debugging_stacktrace - The functions in this file deal with doing stack traces. These functions - will do a stack trace, as specified, printing it out to stdout (usually a - dcload terminal). These functions only work if frame pointers have been - enabled at compile time (-DFRAME_POINTERS and no -fomit-frame-pointer flag). + This file contains arch-specific stack implementations, including defining + stack sizes and alignments, as well as functions for stack tracing and + debugging. On Dreamcast, the stack tracing functions only work if frame + pointers have been enabled at compile time (-DFRAME_POINTERS and no + -fomit-frame-pointer flag). \author Megan Potter + \author Eric Fradella */ #ifndef __ARCH_STACK_H @@ -24,6 +27,7 @@ __BEGIN_DECLS #include <stdint.h> +#include <kos/thread.h> /** \defgroup debugging_stacktrace Stack Traces \brief API for managing stack backtracing @@ -32,6 +36,79 @@ __BEGIN_DECLS @{ */ +#ifndef THD_STACK_ALIGNMENT +/** \brief Required alignment for stack. */ +#define THD_STACK_ALIGNMENT 8 +#endif + +#ifndef THD_STACK_SIZE +/** \brief Default thread stack size. */ +#define THD_STACK_SIZE 32768 +#endif + +#ifndef THD_KERNEL_STACK_SIZE +/** \brief Main/kernel thread's stack size. */ +#define THD_KERNEL_STACK_SIZE (64 * 1024) +#endif + +/** \brief DC specific "function" to get the return address from the current + function. + + \return The return address of the current function. +*/ +static __always_inline uintptr_t arch_get_ret_addr(void) { + uintptr_t pr; + + __asm__ __volatile__("sts pr,%0\n" : "=r"(pr)); + + return pr; +} + +/* Please note that all of the following frame pointer macros are ONLY + valid if you have compiled your code WITHOUT -fomit-frame-pointer. These + are mainly useful for getting a stack trace from an error. */ + +/** \brief DC specific "function" to get the frame pointer from the current + function. + + \return The frame pointer from the current function. + \note This only works if you don't disable frame pointers. +*/ +static __always_inline uintptr_t arch_get_fptr(void) { + register uintptr_t fp __asm__("r14"); + + return fp; +} + +/** \brief Pass in a frame pointer value to get the return address for the + given frame. + + \param fptr The frame pointer to look at. + \return The return address of the pointer. +*/ +static inline uintptr_t arch_fptr_ret_addr(uintptr_t fptr) { + return *(uintptr_t *)fptr; +} + +/** \brief Pass in a frame pointer value to get the previous frame pointer for + the given frame. + + \param fptr The frame pointer to look at. + \return The previous frame pointer. +*/ +static inline uintptr_t arch_fptr_next(uintptr_t fptr) { + return arch_fptr_ret_addr(fptr + 4); +} + +/** \brief Set up new stack before running. + + This function does nothing as it is unnecessary on Dreamcast. + + \param nt A pointer to the new thread for which a stack + is to be set up. +*/ +void arch_stk_setup(kthread_t *nt); + /** \brief Do a stack trace from the current function. This function does a stack trace from the current function, printing the diff --git a/kernel/arch/dreamcast/kernel/mm.c b/kernel/arch/dreamcast/kernel/mm.c index 37641fe0..03cfe32c 100644 --- a/kernel/arch/dreamcast/kernel/mm.c +++ b/kernel/arch/dreamcast/kernel/mm.c @@ -13,10 +13,10 @@ /* Note: right now we only support system RAM */ - -#include <arch/types.h> #include <arch/arch.h> +#include <arch/types.h> #include <arch/irq.h> +#include <arch/stack.h> #include <kos/dbglog.h> #include <errno.h> #include <stdio.h> diff --git a/kernel/arch/dreamcast/kernel/stack.c b/kernel/arch/dreamcast/kernel/stack.c index 31dffb16..32404b92 100644 --- a/kernel/arch/dreamcast/kernel/stack.c +++ b/kernel/arch/dreamcast/kernel/stack.c @@ -7,10 +7,7 @@ /* Functions to tinker with the stack, including obtaining a stack trace when frame pointers are enabled. If frame pointers are enabled, then you'll need to also define FRAME_POINTERS to get support for stack - traces. - - We could probably technically move this into arch indep with a bit more - work... */ + traces. */ #include <kos/dbgio.h> #include <arch/arch.h> @@ -23,6 +20,11 @@ static uintptr_t arch_stack_32m_dft = 0x8e000000; extern uintptr_t arch_stack_16m __attribute__((weak,alias("arch_stack_16m_dft"))); extern uintptr_t arch_stack_32m __attribute__((weak,alias("arch_stack_32m_dft"))); +/* This function is unnecessary and does nothing on Dreamcast */ +void arch_stk_setup(kthread_t *nt) { + (void)nt; +} + /* Do a stack trace from the current function; leave off the first n frames (i.e., in assert()). */ __noinline void arch_stk_trace(int n) { diff --git a/kernel/thread/thread.c b/kernel/thread/thread.c index 36e57aa1..66d9a5af 100644 --- a/kernel/thread/thread.c +++ b/kernel/thread/thread.c @@ -26,9 +26,10 @@ #include <kos/cond.h> #include <kos/genwait.h> +#include <arch/arch.h> #include <arch/irq.h> +#include <arch/stack.h> #include <arch/timer.h> -#include <arch/arch.h> #include <arch/tls_static.h> /* @@ -361,8 +362,11 @@ int thd_remove_from_runnable(kthread_t *thd) { } /* New thread function; given a routine address, it will create a - new kernel thread with the given attributes. When the routine - returns, the thread will exit. Returns the new thread struct. */ + new thread with the given attributes. When the routine returns, + the thread will exit. Returns the new thread struct. + Note that this function is also used in thd_init() to add the + already running kernel thread to the thread scheduler. This is + the only circumstance in which routine should be NULL. */ kthread_t *thd_create_ex(const kthread_attr_t *restrict attr, void *(*routine)(void *param), void *param) { kthread_t *nt = NULL; @@ -430,6 +434,13 @@ kthread_t *thd_create_ex(const kthread_attr_t *restrict attr, ((uint32_t)nt->stack) + nt->stack_size, (uint32_t)thd_birth, params, 0); + /* Some architectures require setting up a new stack before use. + We won't do this if routine is NULL, however, as this means + we are creating the kernel thread, which is already running. */ + if(routine) { + arch_stk_setup(nt); + } + /* Create static TLS data if the thread hasn't disabled it. */ if(real_attr.disable_tls) { nt->flags |= THD_DISABLE_TLS; hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: kosmirror <kos...@us...> - 2025-08-16 05:16:51
|
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 a6cf282777a0aa3477f725695c38eb072f97e599 (commit) via 2df8eac788c9eb90779171feca7e8ba28e0f965c (commit) via 2ea09fd2eb5ac0ddea0f1998bbe62d7b25b6a561 (commit) via f80867ad3f59d2f1566329d70b7d81d8880b34e5 (commit) via 21418d1705521474d3cd663ab7d0c8a90a124c96 (commit) from ef85bc4e70f3d37c59f2fe57bf6eefa8b1df567f (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 a6cf282777a0aa3477f725695c38eb072f97e599 Author: QuzarDC <qu...@co...> Date: Fri Aug 15 13:01:03 2025 -0400 examples: Remove last arch/types.h type usage from examples. commit 2df8eac788c9eb90779171feca7e8ba28e0f965c Author: QuzarDC <qu...@co...> Date: Fri Aug 15 12:29:10 2025 -0400 addons: Remove arch/types.h types. Additionally minor whitespace cleanups. commit 2ea09fd2eb5ac0ddea0f1998bbe62d7b25b6a561 Author: QuzarDC <qu...@co...> Date: Fri Aug 15 00:41:42 2025 -0400 Replace arch/types.h types in remaining misc kernel files. commit f80867ad3f59d2f1566329d70b7d81d8880b34e5 Author: QuzarDC <qu...@co...> Date: Fri Aug 15 00:28:56 2025 -0400 fs: Remove arch/types.h types. Additionaly some minor whitespace cleanups. commit 21418d1705521474d3cd663ab7d0c8a90a124c96 Author: QuzarDC <qu...@co...> Date: Thu Aug 14 20:44:09 2025 -0400 net: Remove left behind usages of `arch/types.h` types. A reflection of the fact that I did these by hand in #1102, it seems as though I missed a few. ----------------------------------------------------------------------- Summary of changes: addons/include/kos/img.h | 12 ++--- addons/include/kos/md5.h | 14 +++--- addons/include/kos/netcfg.h | 22 ++++----- addons/include/navi/flash.h | 6 +-- addons/include/navi/ide.h | 8 ++-- addons/libkosext2fs/fs_ext2.c | 2 +- addons/libkosfat/fs_fat.c | 2 +- addons/libkosutils/md5.c | 50 ++++++++++---------- addons/libkosutils/netcfg.c | 16 +++---- addons/libkosutils/pcx_small.c | 47 +++++++++---------- addons/libnavi/navi_flash.c | 20 ++++---- addons/libnavi/navi_ide.c | 45 +++++++++--------- addons/libppp/ipcp.c | 24 +++++----- addons/libppp/ppp.c | 6 +-- .../dreamcast/keyboard/keyrawtest/keyrawtest.c | 6 +-- include/kos/dbgio.h | 12 ++--- include/kos/exports.h | 1 - include/kos/fs.h | 12 ++--- include/kos/fs_socket.h | 5 +- include/kos/library.h | 2 +- include/kos/net.h | 2 +- include/kos/thread.h | 2 +- kernel/debug/dbgio.c | 12 ++--- kernel/fs/fs.c | 24 +++++----- kernel/fs/fs_dev.c | 1 - kernel/fs/fs_null.c | 1 - kernel/fs/fs_pty.c | 40 ++++++++-------- kernel/fs/fs_random.c | 1 - kernel/fs/fs_socket.c | 2 +- kernel/fs/fs_utils.c | 12 ++--- kernel/libc/koslib/malloc.c | 54 +++++++++++----------- kernel/mm/malloc_debug.c | 46 +++++++++--------- kernel/net/net_dhcp.c | 4 +- kernel/net/net_icmp6.c | 4 +- kernel/net/net_ipv4.c | 2 +- kernel/net/net_ipv4_frag.c | 4 +- kernel/net/net_ipv6.h | 2 +- kernel/net/net_ndp.c | 2 +- kernel/net/net_tcp.c | 2 +- kernel/net/net_udp.c | 2 +- 40 files changed, 260 insertions(+), 271 deletions(-) diff --git a/addons/include/kos/img.h b/addons/include/kos/img.h index ea13cbc8..70c50dd8 100644 --- a/addons/include/kos/img.h +++ b/addons/include/kos/img.h @@ -26,7 +26,7 @@ #include <sys/cdefs.h> __BEGIN_DECLS -#include <arch/types.h> +#include <stdint.h> /** \defgroup video_img Images \brief Platform-independent image representation @@ -49,13 +49,13 @@ __BEGIN_DECLS \headerfile kos/img.h */ typedef struct kos_img { - void *data; /**< \brief Image data in the specified format. */ - uint32 w; /**< \brief Width of the image. */ - uint32 h; /**< \brief Height of the image. */ - uint32 fmt; /**< \brief Format of the image data. + void *data; /**< \brief Image data in the specified format. */ + uint32_t w; /**< \brief Width of the image. */ + uint32_t h; /**< \brief Height of the image. */ + uint32_t fmt; /**< \brief Format of the image data. \see kos_img_fmts \see kos_img_fmt_macros */ - uint32 byte_count; /**< \brief Length of the image data, in bytes. */ + uint32_t byte_count; /**< \brief Length of the image data, in bytes. */ } kos_img_t; /** \defgroup video_img_fmt Format diff --git a/addons/include/kos/md5.h b/addons/include/kos/md5.h index aecd5e47..63dbd31b 100644 --- a/addons/include/kos/md5.h +++ b/addons/include/kos/md5.h @@ -20,7 +20,7 @@ #include <sys/cdefs.h> __BEGIN_DECLS -#include <arch/types.h> +#include <stdint.h> /** \brief MD5 context. @@ -31,9 +31,9 @@ __BEGIN_DECLS \headerfile kos/md5.h */ typedef struct kos_md5_cxt { - uint64 size; /**< \brief Size of the data in buf. */ - uint32 hash[4]; /**< \brief Intermediate hash value. */ - uint8 buf[64]; /**< \brief Temporary storage of values to be hashed. */ + uint64_t size; /**< \brief Size of the data in buf. */ + uint32_t hash[4]; /**< \brief Intermediate hash value. */ + uint8_t buf[64]; /**< \brief Temporary storage of values to be hashed. */ } kos_md5_cxt_t; /** \brief Initialize a MD5 context. @@ -58,7 +58,7 @@ void kos_md5_start(kos_md5_cxt_t *cxt); \param input The block of data to hash. \param size The number of bytes of input data passed in. */ -void kos_md5_hash_block(kos_md5_cxt_t *cxt, const uint8 *input, uint32 size); +void kos_md5_hash_block(kos_md5_cxt_t *cxt, const uint8_t *input, uint32_t size); /** \brief Complete a MD5 hash. @@ -68,7 +68,7 @@ void kos_md5_hash_block(kos_md5_cxt_t *cxt, const uint8 *input, uint32 size); \param cxt The MD5 context to finalize. \param output Where to store the final digest. */ -void kos_md5_finish(kos_md5_cxt_t *cxt, uint8 output[16]); +void kos_md5_finish(kos_md5_cxt_t *cxt, uint8_t output[16]); /** \brief Compute the hash of a block of data with MD5. @@ -81,7 +81,7 @@ void kos_md5_finish(kos_md5_cxt_t *cxt, uint8 output[16]); \param size The number of bytes of input data passed in. \param output Where to store the final message digest. */ -void kos_md5(const uint8 *input, uint32 size, uint8 output[16]); +void kos_md5(const uint8_t *input, uint32_t size, uint8_t output[16]); __END_DECLS diff --git a/addons/include/kos/netcfg.h b/addons/include/kos/netcfg.h index 5ea10361..3597d42d 100644 --- a/addons/include/kos/netcfg.h +++ b/addons/include/kos/netcfg.h @@ -26,7 +26,7 @@ #include <sys/cdefs.h> __BEGIN_DECLS -#include <arch/types.h> +#include <stdint.h> /** \defgroup netcfg Configuration \brief KOS Network Configuration Management @@ -83,11 +83,11 @@ typedef struct netcfg { */ int method; - uint32 ip; /**< \brief IPv4 address of the console */ - uint32 gateway; /**< \brief IPv4 address of the gateway/router. */ - uint32 netmask; /**< \brief Network mask for the local net. */ - uint32 broadcast; /**< \brief Broadcast address for the local net. */ - uint32 dns[2]; /**< \brief IPv4 address of the DNS servers. */ + uint32_t ip; /**< \brief IPv4 address of the console */ + uint32_t gateway; /**< \brief IPv4 address of the gateway/router. */ + uint32_t netmask; /**< \brief Network mask for the local net. */ + uint32_t broadcast; /**< \brief Broadcast address for the local net. */ + uint32_t dns[2]; /**< \brief IPv4 address of the DNS servers. */ char hostname[64]; /**< \brief DNS/DHCP hostname. */ char email[64]; /**< \brief E-Mail address. */ char smtp[64]; /**< \brief SMTP server address. */ @@ -114,7 +114,7 @@ typedef struct netcfg { \return 0 on success, <0 on failure. */ -int netcfg_load_from(const char * fn, netcfg_t * out); +int netcfg_load_from(const char *fn, netcfg_t *out); /** \brief Load network configuration from the Dreamcast's flashrom. \ingroup netcfg @@ -129,7 +129,7 @@ int netcfg_load_from(const char * fn, netcfg_t * out); \return 0 on success, <0 on failure. */ -int netcfg_load_flash(netcfg_t * out); +int netcfg_load_flash(netcfg_t *out); /** \brief Load network configuration. \ingroup netcfg @@ -144,7 +144,7 @@ int netcfg_load_flash(netcfg_t * out); \return 0 on success, <0 on failure. */ -int netcfg_load(netcfg_t * out); +int netcfg_load(netcfg_t *out); /** \brief Save network configuration to a file. \ingroup netcfg @@ -158,7 +158,7 @@ int netcfg_load(netcfg_t * out); \return 0 on success, <0 on failure. */ -int netcfg_save_to(const char * fn, const netcfg_t * cfg); +int netcfg_save_to(const char *fn, const netcfg_t *cfg); /** \brief Save network configuration to the first available VMU. \ingroup netcfg @@ -170,7 +170,7 @@ int netcfg_save_to(const char * fn, const netcfg_t * cfg); \return 0 on success, <0 on failure. */ -int netcfg_save(const netcfg_t * cfg); +int netcfg_save(const netcfg_t *cfg); __END_DECLS diff --git a/addons/include/navi/flash.h b/addons/include/navi/flash.h index 887ef3b6..13fa2c97 100644 --- a/addons/include/navi/flash.h +++ b/addons/include/navi/flash.h @@ -19,7 +19,7 @@ #ifndef __NAVI_FLASH_H #define __NAVI_FLASH_H -#include <arch/types.h> +#include <stdint.h> /** \brief Try to detect a compatible flashrom. \return 0 if a compatible flashrom is detected, <0 if the @@ -31,7 +31,7 @@ int nvflash_detect(void); \param addr The block of the flashrom to erase. \return 0 on success, <0 on error. */ -int nvflash_erase_block(uint32 addr); +int nvflash_erase_block(uint32_t addr); /** \brief Write data to the flashrom. \param addr The block of the flashrom to write to. @@ -39,7 +39,7 @@ int nvflash_erase_block(uint32 addr); \param len The length of the data, in bytes. \return 0 on success, <0 on error. */ -int nvflash_write_block(uint32 addr, void * data, uint32 len); +int nvflash_write_block(uint32_t addr, void *data, uint32_t len); /* Erase the whole flash chip */ /** \brief Erase the whole flashrom. diff --git a/addons/include/navi/ide.h b/addons/include/navi/ide.h index 346305c0..71ef0fef 100644 --- a/addons/include/navi/ide.h +++ b/addons/include/navi/ide.h @@ -19,7 +19,7 @@ #ifndef __NAVI_IDE_H #define __NAVI_IDE_H -#include <arch/types.h> +#include <stdint.h> /** \brief Read sectors from the hard disk via PIO. \param linear The address to begin reading from. @@ -27,7 +27,7 @@ \param bufptr The buffer to read into. \return 0 on success, <0 on error. */ -int ide_read(uint32 linear, uint32 numsects, void *bufptr); +int ide_read(uint32_t linear, uint32_t numsects, void *bufptr); /** \brief Write sectors from the hard disk via PIO. \param linear The address to begin writing to. @@ -35,12 +35,12 @@ int ide_read(uint32 linear, uint32 numsects, void *bufptr); \param bufptr The buffer to write out of. \return 0 on success, <0 on error. */ -int ide_write(uint32 linear, uint32 numsects, void *bufptr); +int ide_write(uint32_t linear, uint32_t numsects, void *bufptr); /** \brief Retrieve the number of sectors from the hard disk. \returns The total number of linear sectors. */ -uint32 ide_num_sectors(void); +uint32_t ide_num_sectors(void); /** \brief Initialize Navi IDE. \return 0 on success (no error conditions defined). diff --git a/addons/libkosext2fs/fs_ext2.c b/addons/libkosext2fs/fs_ext2.c index fa407b48..e67b4ab9 100644 --- a/addons/libkosext2fs/fs_ext2.c +++ b/addons/libkosext2fs/fs_ext2.c @@ -540,7 +540,7 @@ static _off64_t fs_ext2_tell64(void *h) { return rv; } -static uint64 fs_ext2_total64(void *h) { +static uint64_t fs_ext2_total64(void *h) { file_t fd = ((file_t)h) - 1; size_t rv; diff --git a/addons/libkosfat/fs_fat.c b/addons/libkosfat/fs_fat.c index 373bc3e2..e8cf7b9b 100644 --- a/addons/libkosfat/fs_fat.c +++ b/addons/libkosfat/fs_fat.c @@ -740,7 +740,7 @@ static _off64_t fs_fat_tell64(void *h) { return rv; } -static uint64 fs_fat_total64(void *h) { +static uint64_t fs_fat_total64(void *h) { file_t fd = ((file_t)h) - 1; size_t rv; diff --git a/addons/libkosutils/md5.c b/addons/libkosutils/md5.c index 87667f28..a10d6807 100644 --- a/addons/libkosutils/md5.c +++ b/addons/libkosutils/md5.c @@ -5,18 +5,16 @@ */ #include <string.h> -#include <arch/types.h> - #include <kos/md5.h> /* Initial values used in starting the MD5 checksum */ -static const uint32 md5initial[4] = { +static const uint32_t md5initial[4] = { 0x67452301, 0xEFCDAB89, 0x98BADCFE, 0x10325476 }; /* We will append somewhere between 1 and 64 bytes of padding to every message, depending on its length. This is the padding that is to be used. */ -static const uint8 md5padding[64] = { +static const uint8_t md5padding[64] = { 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -24,7 +22,7 @@ static const uint8 md5padding[64] = { }; /* MD5 "magic" values */ -static const uint32 md5tab[64] = { +static const uint32_t md5tab[64] = { 0xD76AA478, 0xE8C7B756, 0x242070DB, 0xC1BDCEEE, 0xF57C0FAF, 0x4787C62A, 0xA8304613, 0xFD469501, 0x698098D8, 0x8B44F7AF, 0xFFFF5BB1, 0x895CD7BE, @@ -52,7 +50,7 @@ int main(int argc, char *argv[]) { int i; double tmp; - printf("static const uint32 md5tab[64] = {"); + printf("static const uint32_t md5tab[64] = {"); for(i = 0; i < 64; ++i) { if((i % 4) == 0) @@ -119,8 +117,8 @@ void kos_md5_start(kos_md5_cxt_t *cxt) { } /* input must be at least 64 bytes long */ -static void kos_md5_process(kos_md5_cxt_t *cxt, const uint8 *input) { - uint32 a, b, c, d, w[16]; +static void kos_md5_process(kos_md5_cxt_t *cxt, const uint8_t *input) { + uint32_t a, b, c, d, w[16]; int i; /* Read in what we're starting with */ @@ -214,11 +212,11 @@ static void kos_md5_process(kos_md5_cxt_t *cxt, const uint8 *input) { cxt->hash[3] += d; } -void kos_md5_hash_block(kos_md5_cxt_t *cxt, const uint8 *input, uint32 size) { - uint32 left, copy; +void kos_md5_hash_block(kos_md5_cxt_t *cxt, const uint8_t *input, uint32_t size) { + uint32_t left, copy; /* Figure out what we had left over from last time (if anything) */ - left = (uint32)((cxt->size >> 3) & 0x3F); + left = (uint32_t)((cxt->size >> 3) & 0x3F); copy = 64 - left; /* Update the size */ @@ -246,35 +244,35 @@ void kos_md5_hash_block(kos_md5_cxt_t *cxt, const uint8 *input, uint32 size) { } } -void kos_md5_finish(kos_md5_cxt_t *cxt, uint8 output[16]) { - uint64 len = cxt->size; - uint32 blen = (cxt->size >> 3) & 0x3F; - uint32 plen = MD5_PAD_LEN(blen); +void kos_md5_finish(kos_md5_cxt_t *cxt, uint8_t output[16]) { + uint64_t len = cxt->size; + uint32_t blen = (cxt->size >> 3) & 0x3F; + uint32_t plen = MD5_PAD_LEN(blen); int i; - uint8 len_bytes[8]; + uint8_t len_bytes[8]; /* Add in the padding */ kos_md5_hash_block(cxt, md5padding, plen); /* Hash in the length -- this will finish the last 64-byte block */ - len_bytes[0] = (uint8)(len); - len_bytes[1] = (uint8)(len >> 8); - len_bytes[2] = (uint8)(len >> 16); - len_bytes[3] = (uint8)(len >> 24); - len_bytes[4] = (uint8)(len >> 32); - len_bytes[5] = (uint8)(len >> 40); - len_bytes[6] = (uint8)(len >> 48); - len_bytes[7] = (uint8)(len >> 56); + len_bytes[0] = (uint8_t)(len); + len_bytes[1] = (uint8_t)(len >> 8); + len_bytes[2] = (uint8_t)(len >> 16); + len_bytes[3] = (uint8_t)(len >> 24); + len_bytes[4] = (uint8_t)(len >> 32); + len_bytes[5] = (uint8_t)(len >> 40); + len_bytes[6] = (uint8_t)(len >> 48); + len_bytes[7] = (uint8_t)(len >> 56); kos_md5_hash_block(cxt, len_bytes, 8); /* Copy out the hash, since we're done */ for(i = 0; i < 16; ++i) { - output[i] = (uint8)(cxt->hash[i >> 2] >> ((i & 0x03) << 3)); + output[i] = (uint8_t)(cxt->hash[i >> 2] >> ((i & 0x03) << 3)); } } /* Convenience function for computing an MD5 of a complete block. */ -void kos_md5(const uint8 *input, uint32 size, uint8 output[16]) { +void kos_md5(const uint8_t *input, uint32_t size, uint8_t output[16]) { kos_md5_cxt_t cxt; kos_md5_start(&cxt); diff --git a/addons/libkosutils/netcfg.c b/addons/libkosutils/netcfg.c index df38d593..e95ef307 100644 --- a/addons/libkosutils/netcfg.c +++ b/addons/libkosutils/netcfg.c @@ -25,13 +25,13 @@ void netcfg_vmuify(const char *filename_in, const char *filename_out) { int fd, pkg_size; - uint8 *buf; - uint8 *pkg_out; + uint8_t *buf; + uint8_t *pkg_out; vmu_pkg_t pkg; dbgp("Opening source file\n"); fd = fs_open(filename_in, O_RDONLY); - buf = (uint8 *) malloc(fs_total(fd)); + buf = (uint8_t *) malloc(fs_total(fd)); if(buf == NULL) return; @@ -69,7 +69,7 @@ void netcfg_vmuify(const char *filename_in, const char *filename_out) { this fails, we try reading settings from the current dir in the VFS, and then from the root of the CD. If that fails, we give up. */ -int netcfg_load_from(const char * fn, netcfg_t * out) { +int netcfg_load_from(const char *fn, netcfg_t *out) { FILE * f; char buf[64], *b; int l; @@ -189,7 +189,7 @@ int netcfg_load_from(const char * fn, netcfg_t * out) { return 0; } -int netcfg_load_flash(netcfg_t * out) { +int netcfg_load_flash(netcfg_t *out) { flashrom_ispcfg_t cfg; if(flashrom_get_ispcfg(&cfg) < 0) @@ -256,7 +256,7 @@ int netcfg_load_flash(netcfg_t * out) { return 0; } -int netcfg_load(netcfg_t * out) { +int netcfg_load(netcfg_t *out) { file_t f; dirent_t * d; char buf[64]; @@ -305,7 +305,7 @@ int netcfg_load(netcfg_t * out) { return -1; } -int netcfg_save_to(const char * fn, const netcfg_t * cfg) { +int netcfg_save_to(const char *fn, const netcfg_t *cfg) { FILE * f; char buf[256]; @@ -383,7 +383,7 @@ error: return -1; } -int netcfg_save(const netcfg_t * cfg) { +int netcfg_save(const netcfg_t *cfg) { file_t f; dirent_t * d; char buf[64]; diff --git a/addons/libkosutils/pcx_small.c b/addons/libkosutils/pcx_small.c index 0dc8faa6..e133e3d9 100644 --- a/addons/libkosutils/pcx_small.c +++ b/addons/libkosutils/pcx_small.c @@ -7,7 +7,6 @@ */ #include <stdio.h> -#include <arch/types.h> #include <kos/fs.h> #include <kos/pcx.h> @@ -17,15 +16,15 @@ 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 */ ...<truncated>... hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: kosmirror <kos...@us...> - 2025-08-15 01:16:32
|
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 ef85bc4e70f3d37c59f2fe57bf6eefa8b1df567f (commit) from a2dbeec5733a885c1f79345d01387b6be9346e32 (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 ef85bc4e70f3d37c59f2fe57bf6eefa8b1df567f Author: QuzarDC <qu...@co...> Date: Thu Aug 14 19:18:37 2025 -0400 vmu_lcd example: Add wait after draw to throttle animation. The example never attempted to throttle itself because the screen drawing commands were synchronous and would wait to receive a response from the VMU before moving forward with execution. With the changes in #904 there is no wait and the user is responsible for throttling the drawing. Without this the example is illegible on the VMU screen, updating faster than can be seen. This wait amount gets it back down to a pace similar to before. ----------------------------------------------------------------------- Summary of changes: examples/dreamcast/vmu/vmu_lcd/lcd.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/examples/dreamcast/vmu/vmu_lcd/lcd.c b/examples/dreamcast/vmu/vmu_lcd/lcd.c index 7cb4ba68..4e218059 100644 --- a/examples/dreamcast/vmu/vmu_lcd/lcd.c +++ b/examples/dreamcast/vmu/vmu_lcd/lcd.c @@ -76,6 +76,9 @@ int main(int argc, char **argv) { for(vmu = 0; !!(dev = maple_enum_type(vmu, MAPLE_FUNC_LCD)); vmu++) { vmufb_present(&vmufb, dev); } + + /* Now sleep for a bit so we can actually see the new frame */ + usleep(2000); } return 0; hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: kosmirror <kos...@us...> - 2025-08-14 23:34: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 a2dbeec5733a885c1f79345d01387b6be9346e32 (commit) from e655808a8d4b52640f0524210985f3978901d8c6 (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 a2dbeec5733a885c1f79345d01387b6be9346e32 Author: Paul Cercueil <pa...@cr...> Date: Wed Aug 6 14:00:36 2025 +0200 CI: Add whitespace check Fail if some commits in a given pull request have whitespace issues. Signed-off-by: Paul Cercueil <pa...@cr...> ----------------------------------------------------------------------- Summary of changes: .github/workflows/whitespace.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 .github/workflows/whitespace.yml diff --git a/.github/workflows/whitespace.yml b/.github/workflows/whitespace.yml new file mode 100644 index 00000000..79027b72 --- /dev/null +++ b/.github/workflows/whitespace.yml @@ -0,0 +1,18 @@ +name: Whitespace check + +on: pull_request + +jobs: + check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Whitespace check + run: | + git fetch origin ${{ github.base_ref }}:${{ github.base_ref }} + git diff ${{ github.base_ref }} >/tmp/diff1.txt + git diff -w ${{ github.base_ref }} >/tmp/diff2.txt + diff /tmp/diff1.txt /tmp/diff2.txt >/dev/null hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: kosmirror <kos...@us...> - 2025-08-14 20:18: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 e655808a8d4b52640f0524210985f3978901d8c6 (commit) via 03df46db210ee53614bfb31b7c576177d02409c4 (commit) from 1e6a1b3041ee8aebe2845c07b9ac3436b9f5fd81 (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 e655808a8d4b52640f0524210985f3978901d8c6 Author: QuzarDC <qu...@co...> Date: Mon Aug 11 23:59:22 2025 -0400 examples: More stable exec example The changes made in #1112 to make the romdisk vfs dynamically allocate file handles had a side effect of being more likely to break this exec example. This happens because the example was using `fs_mmap` with a hidden assumption that the memory allocated for the open rd file would persist through the `arch_shutdown` that happens during `arch_exec`. This only ever worked because of the specifics of how the example were being crafted: having the subelf in a static romdisk built into the loaded parent binary and could have failed before #1112 with any mildly different use like loading a romdisk from a disc first. commit 03df46db210ee53614bfb31b7c576177d02409c4 Author: QuzarDC <qu...@co...> Date: Tue Aug 12 01:15:59 2025 -0400 fs_romdisk: Correct `fs_romdisk_shutdown` The changes in #1112 broke `fs_romdisk_shutdown` when any files were left open (found via exec example). The problem was that the functionality to free dangling file handles would deadlock with the already open mutex. ----------------------------------------------------------------------- Summary of changes: examples/dreamcast/basic/exec/exec.c | 30 ++++++++++++++++++++++++------ kernel/fs/fs_romdisk.c | 8 ++++---- 2 files changed, 28 insertions(+), 10 deletions(-) diff --git a/examples/dreamcast/basic/exec/exec.c b/examples/dreamcast/basic/exec/exec.c index edcb201d..0fd34be6 100644 --- a/examples/dreamcast/basic/exec/exec.c +++ b/examples/dreamcast/basic/exec/exec.c @@ -9,20 +9,38 @@ int main(int argc, char **argv) { file_t f; - void *subelf; + size_t s; + ssize_t rv; + void *subbin; /* Print a hello */ printf("\n\nHello world from the exec.elf process\n"); - /* Map the sub-elf */ + /* Open the sub-bin. Note normally this wouldn't be from a + romdisk as that means that you'd already have it loaded + in memory. + */ f = fs_open("/rd/sub.bin", O_RDONLY); assert(f); - subelf = fs_mmap(f); - assert(subelf); + + /* Get the size of sub.bin */ + s = fs_total(f); + assert(s); + + /* Allocate space for it */ + subbin = malloc(s); + assert(subbin); + + /* Copy in the sub.bin */ + rv = fs_read(f, subbin, s); + assert(rv == s); + + /* Lets be nice and tidy up after ourselves */ + fs_close(f); /* Tell exec to replace us */ - printf("sub.bin mapped at %08x, jumping to it!\n\n\n", (unsigned int)subelf); - arch_exec(subelf, fs_total(f)); + printf("sub.bin loaded at %08x, jumping to it!\n\n\n", (uintptr_t)subbin); + arch_exec(subbin, s); /* Shouldn't get here */ assert_msg(false, "exec call failed"); diff --git a/kernel/fs/fs_romdisk.c b/kernel/fs/fs_romdisk.c index b2bc3784..39de9e4b 100644 --- a/kernel/fs/fs_romdisk.c +++ b/kernel/fs/fs_romdisk.c @@ -672,6 +672,8 @@ void fs_romdisk_shutdown(void) { if(!initted) return; + initted = 0; + mutex_lock(&fh_mutex); /* Go through and free all the romdisk mount entries */ @@ -679,17 +681,15 @@ void fs_romdisk_shutdown(void) { fs_romdisk_list_remove(c); } + mutex_unlock(&fh_mutex); + /* Iterate through any dangling files and clean them */ TAILQ_FOREACH_SAFE(i, &rd_fd_queue, next, j) { romdisk_close(i); } - mutex_unlock(&fh_mutex); - /* Free mutex */ mutex_destroy(&fh_mutex); - - initted = 0; } /* Mount a romdisk image; must have called fs_romdisk_init() earlier. hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: kosmirror <kos...@us...> - 2025-08-12 00:57:54
|
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 1e6a1b3041ee8aebe2845c07b9ac3436b9f5fd81 (commit) from 92a3b3595f7e66494fedbf55dad9dea281aeb29c (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 1e6a1b3041ee8aebe2845c07b9ac3436b9f5fd81 Author: darc <da...@pr...> Date: Mon Aug 11 15:35:51 2025 -0500 Reorder linker script inputs to place crtn.o after crtend.o Without the proper ordering, C++ applications immediately crash ----------------------------------------------------------------------- Summary of changes: utils/ldscripts/shlelf.xc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/ldscripts/shlelf.xc b/utils/ldscripts/shlelf.xc index 57af3b60..8569537c 100644 --- a/utils/ldscripts/shlelf.xc +++ b/utils/ldscripts/shlelf.xc @@ -5,8 +5,8 @@ OUTPUT_ARCH(sh) STARTUP(_kos_startup.o) INPUT(crti.o) INPUT(crtbegin.o) -INPUT(crtn.o) INPUT(crtend.o) +INPUT(crtn.o) LOAD_OFFSET = DEFINED(LOAD_OFFSET) ? LOAD_OFFSET : 0x8c010000 ; SECTIONS hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: kosmirror <kos...@us...> - 2025-08-08 21:08:58
|
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 92a3b3595f7e66494fedbf55dad9dea281aeb29c (commit) from 09aed298cbfbc1e2a9ab88342f17b44cd9893510 (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 92a3b3595f7e66494fedbf55dad9dea281aeb29c Author: Paul Cercueil <pa...@cr...> Date: Fri Aug 8 16:35:13 2025 +0200 dc-chain: Remove fake KOS objects from libgcc after build This should not be necessary and I don't understand why we need this; the symbols inside fake-kos.o are all weak, and should all be replaced by symbols provided by libkallisti.a. Alas, this does not seem to work reliably, and cause crashes and issues that are hard to debug. Address these issues by just dropping the fake-kos.o object from the libgcc.a archive. Signed-off-by: Paul Cercueil <pa...@cr...> ----------------------------------------------------------------------- Summary of changes: utils/dc-chain/scripts/gcc-pass2.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/utils/dc-chain/scripts/gcc-pass2.mk b/utils/dc-chain/scripts/gcc-pass2.mk index 644eb665..f4096fea 100644 --- a/utils/dc-chain/scripts/gcc-pass2.mk +++ b/utils/dc-chain/scripts/gcc-pass2.mk @@ -32,4 +32,5 @@ ifdef enable_ada endif endif $(MAKE) -C $(build) $(install_mode) DESTDIR=$(DESTDIR) $(to_log) + $(target)-gcc-ar d $(shell $(target)-gcc -print-file-name=libgcc.a) fake-kos.o $(clean_up) hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: kosmirror <kos...@us...> - 2025-08-08 12:57: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 09aed298cbfbc1e2a9ab88342f17b44cd9893510 (commit) from 5f607420fef4b10ff0df073c1bd37b79eb09a136 (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 09aed298cbfbc1e2a9ab88342f17b44cd9893510 Author: darc <da...@pr...> Date: Mon Aug 4 14:47:20 2025 -0500 Update 15.x profiles to 15.2.0/15.2.1-dev. All dev profiles upgraded to Binutils 2.45 and GDB 16.3 ----------------------------------------------------------------------- Summary of changes: utils/dc-chain/Makefile.dreamcast.cfg | 5 ++- utils/dc-chain/Makefile.gamecube.cfg | 2 +- utils/dc-chain/doc/CHANGELOG.md | 1 + .../{gcc-15.1.0-kos.diff => gcc-15.2.0-kos.diff} | 46 +++++++++++----------- .../{gcc-15.1.1-kos.diff => gcc-15.2.1-kos.diff} | 46 +++++++++++----------- utils/dc-chain/profiles/aica/stable.mk | 2 +- utils/dc-chain/profiles/dreamcast/13.4.1-dev.mk | 4 +- utils/dc-chain/profiles/dreamcast/14.3.1-dev.mk | 4 +- utils/dc-chain/profiles/dreamcast/15.0.0-lra.mk | 2 +- .../profiles/dreamcast/{15.1.0.mk => 15.2.0.mk} | 6 +-- .../dreamcast/{15.1.1-dev.mk => 15.2.1-dev.mk} | 8 ++-- utils/dc-chain/profiles/dreamcast/16.0.0-dev.mk | 4 +- utils/dc-chain/profiles/gamecube/stable.mk | 6 +-- 13 files changed, 69 insertions(+), 67 deletions(-) rename utils/dc-chain/patches/targets/{gcc-15.1.0-kos.diff => gcc-15.2.0-kos.diff} (73%) rename utils/dc-chain/patches/targets/{gcc-15.1.1-kos.diff => gcc-15.2.1-kos.diff} (73%) rename utils/dc-chain/profiles/dreamcast/{15.1.0.mk => 15.2.0.mk} (94%) rename utils/dc-chain/profiles/dreamcast/{15.1.1-dev.mk => 15.2.1-dev.mk} (92%) diff --git a/utils/dc-chain/Makefile.dreamcast.cfg b/utils/dc-chain/Makefile.dreamcast.cfg index 14ac30ad..513319e6 100644 --- a/utils/dc-chain/Makefile.dreamcast.cfg +++ b/utils/dc-chain/Makefile.dreamcast.cfg @@ -17,11 +17,12 @@ platform=dreamcast # - stable: Stable: Well-tested; based on GCC 13.2.0, released 2023-07-27. # - 13.4.0: Testing: Latest release in the GCC 13 series, released 2025-06-05. # - 14.3.0: Testing: Latest release in the GCC 14 series, released 2025-05-23. -# - 15.1.0: Testing: Latest release in the GCC 15 series, released 2025-04-25. +# - 15.2.0: Testing: Latest release in the GCC 15 series, released 2025-08-08. # Development toolchains: # - 13.4.1-dev Bleeding edge GCC 13 series from git. # - 14.3.1-dev Bleeding edge GCC 14 series from git. -# - 15.1.1-dev Bleeding edge GCC 15 series from git. +# - 15.0.0-lra GCC 15 branch containing experimental SuperH fixes for LRA. +# - 15.2.1-dev Bleeding edge GCC 15 series from git. # - 16.0.0-dev Bleeding edge GCC 16 series from git. # If unsure, select stable. See README.md for more detailed descriptions. toolchain_profile=stable diff --git a/utils/dc-chain/Makefile.gamecube.cfg b/utils/dc-chain/Makefile.gamecube.cfg index 2018bde0..aa6491d2 100644 --- a/utils/dc-chain/Makefile.gamecube.cfg +++ b/utils/dc-chain/Makefile.gamecube.cfg @@ -12,7 +12,7 @@ platform=gamecube # Choose a toolchain profile from the following available options: -# - stable: Stable: Well-tested; based on GCC 15.1.0, released 2025-04-25. +# - stable: Stable: Well-tested; based on GCC 15.2.0, released 2025-08-08. # If unsure, select stable. See README.md for more detailed descriptions. toolchain_profile=stable diff --git a/utils/dc-chain/doc/CHANGELOG.md b/utils/dc-chain/doc/CHANGELOG.md index 8704aa20..e8aceb4e 100644 --- a/utils/dc-chain/doc/CHANGELOG.md +++ b/utils/dc-chain/doc/CHANGELOG.md @@ -2,6 +2,7 @@ | Date<br/>_____________ | Author(s)<br/>_____________ | Changes<br/>_____________ | |:-----------------------|:----------------------------|---------------------------| +| 2025-08-03 | Eric Fradella | Update 15.x profiles to 15.2.0/15.2.1-dev. All dev profiles upgraded to Binutils 2.45 and GDB 16.3 | | 2025-07-13 | Paul Cercueil | Add new profile for the LRA development toolchain | | 2025-07-13 | Paul Cercueil | Re-introduce ARM toolchain support | | 2025-07-13 | Paul Cercueil | Add support for PPC toolchains and add GameCube profile | diff --git a/utils/dc-chain/patches/targets/gcc-15.1.0-kos.diff b/utils/dc-chain/patches/targets/gcc-15.2.0-kos.diff similarity index 73% rename from utils/dc-chain/patches/targets/gcc-15.1.0-kos.diff rename to utils/dc-chain/patches/targets/gcc-15.2.0-kos.diff index 7b4c5364..e71c5109 100644 --- a/utils/dc-chain/patches/targets/gcc-15.1.0-kos.diff +++ b/utils/dc-chain/patches/targets/gcc-15.2.0-kos.diff @@ -1,6 +1,6 @@ -diff -ruN gcc-15.1.0/gcc/config/elfos.h gcc-15.1.0-kos/gcc/config/elfos.h ---- gcc-15.1.0/gcc/config/elfos.h 2025-04-17 16:01:33.790051712 -0600 -+++ gcc-15.1.0-kos/gcc/config/elfos.h 2025-04-17 16:01:42.910094466 -0600 +diff -ruN gcc-15.2.0/gcc/config/elfos.h gcc-15.2.0-kos/gcc/config/elfos.h +--- gcc-15.2.0/gcc/config/elfos.h 2025-04-17 16:01:33.790051712 -0600 ++++ gcc-15.2.0-kos/gcc/config/elfos.h 2025-04-17 16:01:42.910094466 -0600 @@ -486,3 +486,6 @@ #undef TARGET_LIBC_HAS_FUNCTION @@ -8,9 +8,9 @@ diff -ruN gcc-15.1.0/gcc/config/elfos.h gcc-15.1.0-kos/gcc/config/elfos.h + +#define TARGET_OS_CPP_BUILTINS() \ + builtin_define ("__KOS_GCC_PATCHLEVEL__=2025062800") -diff -ruN gcc-15.1.0/gcc/configure gcc-15.1.0-kos/gcc/configure ---- gcc-15.1.0/gcc/configure 2025-04-18 16:01:33.801051764 -0600 -+++ gcc-15.1.0-kos/gcc/configure 2025-04-18 16:01:42.913094480 -0600 +diff -ruN gcc-15.2.0/gcc/configure gcc-15.2.0-kos/gcc/configure +--- gcc-15.2.0/gcc/configure 2025-04-18 16:01:33.801051764 -0600 ++++ gcc-15.2.0-kos/gcc/configure 2025-04-18 16:01:42.913094480 -0600 @@ -13165,7 +13165,7 @@ target_thread_file='single' ;; @@ -20,9 +20,9 @@ diff -ruN gcc-15.1.0/gcc/configure gcc-15.1.0-kos/gcc/configure target_thread_file=${enable_threads} ;; *) -diff --color -ruN gcc-15.1.0/libgcc/config.host gcc-15.1.0-kos/libgcc/config.host ---- gcc-15.1.0/libgcc/config.host 2025-04-27 14:45:09.695053718 -0600 -+++ gcc-15.1.0-kos/libgcc/config.host 2025-04-27 15:10:10.267714917 -0600 +diff --color -ruN gcc-15.2.0/libgcc/config.host gcc-15.2.0-kos/libgcc/config.host +--- gcc-15.2.0/libgcc/config.host 2025-04-27 14:45:09.695053718 -0600 ++++ gcc-15.2.0-kos/libgcc/config.host 2025-04-27 15:10:10.267714917 -0600 @@ -71,7 +71,7 @@ asm_hidden_op=.hidden enable_execute_stack= @@ -32,14 +32,14 @@ diff --color -ruN gcc-15.1.0/libgcc/config.host gcc-15.1.0-kos/libgcc/config.hos tm_file= tm_define= md_unwind_def_header=no-unwind.h -diff -ruN /dev/null gcc-15.1.0-kos/libgcc/config/t-kos +diff -ruN /dev/null gcc-15.2.0-kos/libgcc/config/t-kos --- /dev/null 2025-04-27 14:45:09.695053718 -0600 -+++ gcc-15.1.0-kos/libgcc/config/t-kos 2025-04-27 15:10:10.267714917 -0600 ++++ gcc-15.2.0-kos/libgcc/config/t-kos 2025-04-27 15:10:10.267714917 -0600 @@ -0,0 +1 @@ +LIB2ADD = $(srcdir)/config/fake-kos.c -diff -ruN gcc-15.1.0/libgcc/configure gcc-15.1.0-kos/libgcc/configure ---- gcc-15.1.0/libgcc/configure 2025-04-18 16:01:37.139067412 -0600 -+++ gcc-15.1.0-kos/libgcc/configure 2025-04-18 16:01:42.914094485 -0600 +diff -ruN gcc-15.2.0/libgcc/configure gcc-15.2.0-kos/libgcc/configure +--- gcc-15.2.0/libgcc/configure 2025-04-18 16:01:37.139067412 -0600 ++++ gcc-15.2.0-kos/libgcc/configure 2025-04-18 16:01:42.914094485 -0600 @@ -5733,6 +5733,7 @@ tpf) thread_header=config/s390/gthr-tpf.h ;; vxworks) thread_header=config/gthr-vxworks.h ;; @@ -48,9 +48,9 @@ diff -ruN gcc-15.1.0/libgcc/configure gcc-15.1.0-kos/libgcc/configure mcf) thread_header=config/i386/gthr-mcf.h ;; esac -diff -ruN gcc-15.1.0/libobjc/Makefile.in gcc-15.1.0-kos/libobjc/Makefile.in ---- gcc-15.1.0/libobjc/Makefile.in 2025-04-18 16:01:37.499069099 -0600 -+++ gcc-15.1.0-kos/libobjc/Makefile.in 2025-04-18 16:01:42.915094489 -0600 +diff -ruN gcc-15.2.0/libobjc/Makefile.in gcc-15.2.0-kos/libobjc/Makefile.in +--- gcc-15.2.0/libobjc/Makefile.in 2025-04-18 16:01:37.499069099 -0600 ++++ gcc-15.2.0-kos/libobjc/Makefile.in 2025-04-18 16:01:42.915094489 -0600 @@ -308,14 +308,16 @@ $(srcdir)/aclocal.m4: @MAINT@ $(aclocal_deps) cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) @@ -81,9 +81,9 @@ diff -ruN gcc-15.1.0/libobjc/Makefile.in gcc-15.1.0-kos/libobjc/Makefile.in mostlyclean: -$(LIBTOOL_CLEAN) rm -f libobjc$(libsuffix).la libobjc_gc$(libsuffix).la *.lo -diff -ruN gcc-15.1.0/libstdc++-v3/config/cpu/sh/atomicity.h gcc-15.1.0-kos/libstdc++-v3/config/cpu/sh/atomicity.h ---- gcc-15.1.0/libstdc++-v3/config/cpu/sh/atomicity.h 2025-04-18 16:01:37.608069611 -0600 -+++ gcc-15.1.0-kos/libstdc++-v3/config/cpu/sh/atomicity.h 2025-04-18 16:01:42.916094494 -0600 +diff -ruN gcc-15.2.0/libstdc++-v3/config/cpu/sh/atomicity.h gcc-15.2.0-kos/libstdc++-v3/config/cpu/sh/atomicity.h +--- gcc-15.2.0/libstdc++-v3/config/cpu/sh/atomicity.h 2025-04-18 16:01:37.608069611 -0600 ++++ gcc-15.2.0-kos/libstdc++-v3/config/cpu/sh/atomicity.h 2025-04-18 16:01:42.916094494 -0600 @@ -22,14 +22,40 @@ // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. @@ -134,9 +134,9 @@ diff -ruN gcc-15.1.0/libstdc++-v3/config/cpu/sh/atomicity.h gcc-15.1.0-kos/libst + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace -diff -ruN gcc-15.1.0/libstdc++-v3/configure gcc-15.1.0-kos/libstdc++-v3/configure ---- gcc-15.1.0/libstdc++-v3/configure 2025-04-18 16:01:37.616069648 -0600 -+++ gcc-15.1.0-kos/libstdc++-v3/configure 2025-04-18 16:01:42.919094508 -0600 +diff -ruN gcc-15.2.0/libstdc++-v3/configure gcc-15.2.0-kos/libstdc++-v3/configure +--- gcc-15.2.0/libstdc++-v3/configure 2025-04-18 16:01:37.616069648 -0600 ++++ gcc-15.2.0-kos/libstdc++-v3/configure 2025-04-18 16:01:42.919094508 -0600 @@ -15974,6 +15974,7 @@ tpf) thread_header=config/s390/gthr-tpf.h ;; vxworks) thread_header=config/gthr-vxworks.h ;; diff --git a/utils/dc-chain/patches/targets/gcc-15.1.1-kos.diff b/utils/dc-chain/patches/targets/gcc-15.2.1-kos.diff similarity index 73% rename from utils/dc-chain/patches/targets/gcc-15.1.1-kos.diff rename to utils/dc-chain/patches/targets/gcc-15.2.1-kos.diff index a18cea83..f4659e82 100644 --- a/utils/dc-chain/patches/targets/gcc-15.1.1-kos.diff +++ b/utils/dc-chain/patches/targets/gcc-15.2.1-kos.diff @@ -1,6 +1,6 @@ -diff -ruN gcc-15.1.1/gcc/config/elfos.h gcc-15.1.1-kos/gcc/config/elfos.h ---- gcc-15.1.1/gcc/config/elfos.h 2025-04-17 16:01:33.790051712 -0600 -+++ gcc-15.1.1-kos/gcc/config/elfos.h 2025-04-17 16:01:42.910094466 -0600 +diff -ruN gcc-15.2.1/gcc/config/elfos.h gcc-15.2.1-kos/gcc/config/elfos.h +--- gcc-15.2.1/gcc/config/elfos.h 2025-04-17 16:01:33.790051712 -0600 ++++ gcc-15.2.1-kos/gcc/config/elfos.h 2025-04-17 16:01:42.910094466 -0600 @@ -486,3 +486,6 @@ #undef TARGET_LIBC_HAS_FUNCTION @@ -8,9 +8,9 @@ diff -ruN gcc-15.1.1/gcc/config/elfos.h gcc-15.1.1-kos/gcc/config/elfos.h + +#define TARGET_OS_CPP_BUILTINS() \ + builtin_define ("__KOS_GCC_PATCHLEVEL__=2025062800") -diff -ruN gcc-15.1.1/gcc/configure gcc-15.1.1-kos/gcc/configure ---- gcc-15.1.1/gcc/configure 2025-04-18 16:01:33.801051764 -0600 -+++ gcc-15.1.1-kos/gcc/configure 2025-04-18 16:01:42.913094480 -0600 +diff -ruN gcc-15.2.1/gcc/configure gcc-15.2.1-kos/gcc/configure +--- gcc-15.2.1/gcc/configure 2025-04-18 16:01:33.801051764 -0600 ++++ gcc-15.2.1-kos/gcc/configure 2025-04-18 16:01:42.913094480 -0600 @@ -13165,7 +13165,7 @@ target_thread_file='single' ;; @@ -20,9 +20,9 @@ diff -ruN gcc-15.1.1/gcc/configure gcc-15.1.1-kos/gcc/configure target_thread_file=${enable_threads} ;; *) -diff --color -ruN gcc-15.1.1/libgcc/config.host gcc-15.1.1-kos/libgcc/config.host ---- gcc-15.1.1/libgcc/config.host 2025-04-27 14:45:09.695053718 -0600 -+++ gcc-15.1.1-kos/libgcc/config.host 2025-04-27 15:10:10.267714917 -0600 +diff --color -ruN gcc-15.2.1/libgcc/config.host gcc-15.2.1-kos/libgcc/config.host +--- gcc-15.2.1/libgcc/config.host 2025-04-27 14:45:09.695053718 -0600 ++++ gcc-15.2.1-kos/libgcc/config.host 2025-04-27 15:10:10.267714917 -0600 @@ -71,7 +71,7 @@ asm_hidden_op=.hidden enable_execute_stack= @@ -32,14 +32,14 @@ diff --color -ruN gcc-15.1.1/libgcc/config.host gcc-15.1.1-kos/libgcc/config.hos tm_file= tm_define= md_unwind_def_header=no-unwind.h -diff -ruN /dev/null gcc-15.1.1-kos/libgcc/config/t-kos +diff -ruN /dev/null gcc-15.2.1-kos/libgcc/config/t-kos --- /dev/null 2025-04-27 14:45:09.695053718 -0600 -+++ gcc-15.1.1-kos/libgcc/config/t-kos 2025-04-27 15:10:10.267714917 -0600 ++++ gcc-15.2.1-kos/libgcc/config/t-kos 2025-04-27 15:10:10.267714917 -0600 @@ -0,0 +1 @@ +LIB2ADD = $(srcdir)/config/fake-kos.c -diff -ruN gcc-15.1.1/libgcc/configure gcc-15.1.1-kos/libgcc/configure ---- gcc-15.1.1/libgcc/configure 2025-04-18 16:01:37.139067412 -0600 -+++ gcc-15.1.1-kos/libgcc/configure 2025-04-18 16:01:42.914094485 -0600 +diff -ruN gcc-15.2.1/libgcc/configure gcc-15.2.1-kos/libgcc/configure +--- gcc-15.2.1/libgcc/configure 2025-04-18 16:01:37.139067412 -0600 ++++ gcc-15.2.1-kos/libgcc/configure 2025-04-18 16:01:42.914094485 -0600 @@ -5733,6 +5733,7 @@ tpf) thread_header=config/s390/gthr-tpf.h ;; vxworks) thread_header=config/gthr-vxworks.h ;; @@ -48,9 +48,9 @@ diff -ruN gcc-15.1.1/libgcc/configure gcc-15.1.1-kos/libgcc/configure mcf) thread_header=config/i386/gthr-mcf.h ;; esac -diff -ruN gcc-15.1.1/libobjc/Makefile.in gcc-15.1.1-kos/libobjc/Makefile.in ---- gcc-15.1.1/libobjc/Makefile.in 2025-04-18 16:01:37.499069099 -0600 -+++ gcc-15.1.1-kos/libobjc/Makefile.in 2025-04-18 16:01:42.915094489 -0600 +diff -ruN gcc-15.2.1/libobjc/Makefile.in gcc-15.2.1-kos/libobjc/Makefile.in +--- gcc-15.2.1/libobjc/Makefile.in 2025-04-18 16:01:37.499069099 -0600 ++++ gcc-15.2.1-kos/libobjc/Makefile.in 2025-04-18 16:01:42.915094489 -0600 @@ -308,14 +308,16 @@ $(srcdir)/aclocal.m4: @MAINT@ $(aclocal_deps) cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) @@ -81,9 +81,9 @@ diff -ruN gcc-15.1.1/libobjc/Makefile.in gcc-15.1.1-kos/libobjc/Makefile.in mostlyclean: -$(LIBTOOL_CLEAN) rm -f libobjc$(libsuffix).la libobjc_gc$(libsuffix).la *.lo -diff -ruN gcc-15.1.1/libstdc++-v3/config/cpu/sh/atomicity.h gcc-15.1.1-kos/libstdc++-v3/config/cpu/sh/atomicity.h ---- gcc-15.1.1/libstdc++-v3/config/cpu/sh/atomicity.h 2025-04-18 16:01:37.608069611 -0600 -+++ gcc-15.1.1-kos/libstdc++-v3/config/cpu/sh/atomicity.h 2025-04-18 16:01:42.916094494 -0600 +diff -ruN gcc-15.2.1/libstdc++-v3/config/cpu/sh/atomicity.h gcc-15.2.1-kos/libstdc++-v3/config/cpu/sh/atomicity.h +--- gcc-15.2.1/libstdc++-v3/config/cpu/sh/atomicity.h 2025-04-18 16:01:37.608069611 -0600 ++++ gcc-15.2.1-kos/libstdc++-v3/config/cpu/sh/atomicity.h 2025-04-18 16:01:42.916094494 -0600 @@ -22,14 +22,40 @@ // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. @@ -134,9 +134,9 @@ diff -ruN gcc-15.1.1/libstdc++-v3/config/cpu/sh/atomicity.h gcc-15.1.1-kos/libst + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace -diff -ruN gcc-15.1.1/libstdc++-v3/configure gcc-15.1.1-kos/libstdc++-v3/configure ---- gcc-15.1.1/libstdc++-v3/configure 2025-04-18 16:01:37.616069648 -0600 -+++ gcc-15.1.1-kos/libstdc++-v3/configure 2025-04-18 16:01:42.919094508 -0600 +diff -ruN gcc-15.2.1/libstdc++-v3/configure gcc-15.2.1-kos/libstdc++-v3/configure +--- gcc-15.2.1/libstdc++-v3/configure 2025-04-18 16:01:37.616069648 -0600 ++++ gcc-15.2.1-kos/libstdc++-v3/configure 2025-04-18 16:01:42.919094508 -0600 @@ -15974,6 +15974,7 @@ tpf) thread_header=config/s390/gthr-tpf.h ;; vxworks) thread_header=config/gthr-vxworks.h ;; diff --git a/utils/dc-chain/profiles/aica/stable.mk b/utils/dc-chain/profiles/aica/stable.mk index 3a28606e..b6674548 100644 --- a/utils/dc-chain/profiles/aica/stable.mk +++ b/utils/dc-chain/profiles/aica/stable.mk @@ -6,7 +6,7 @@ target=arm-eabi cpu_configure_args=--with-arch=armv4 --with-mode=arm --disable-multilib # Toolchain versions -binutils_ver=2.44 +binutils_ver=2.45 gcc_ver=8.5.0 newlib_ver=4.5.0.20241231 gdb_ver=16.3 diff --git a/utils/dc-chain/profiles/dreamcast/13.4.1-dev.mk b/utils/dc-chain/profiles/dreamcast/13.4.1-dev.mk index 7766a3ae..6aad0c4f 100644 --- a/utils/dc-chain/profiles/dreamcast/13.4.1-dev.mk +++ b/utils/dc-chain/profiles/dreamcast/13.4.1-dev.mk @@ -13,10 +13,10 @@ target=sh-elf cpu_configure_args=--with-multilib-list=$(precision_modes) --with-endian=little --with-cpu=$(default_precision) # Toolchain versions for SH -binutils_ver=2.44 +binutils_ver=2.45 gcc_ver=13.4.1 newlib_ver=4.5.0.20241231 -gdb_ver=16.2 +gdb_ver=16.3 # Overide SH toolchain download type gcc_download_type=git diff --git a/utils/dc-chain/profiles/dreamcast/14.3.1-dev.mk b/utils/dc-chain/profiles/dreamcast/14.3.1-dev.mk index 6c4803ad..3d3ec9ce 100644 --- a/utils/dc-chain/profiles/dreamcast/14.3.1-dev.mk +++ b/utils/dc-chain/profiles/dreamcast/14.3.1-dev.mk @@ -13,10 +13,10 @@ target=sh-elf cpu_configure_args=--with-multilib-list=$(precision_modes) --with-endian=little --with-cpu=$(default_precision) # Toolchain versions for SH -binutils_ver=2.44 +binutils_ver=2.45 gcc_ver=14.3.1 newlib_ver=4.5.0.20241231 -gdb_ver=16.2 +gdb_ver=16.3 # Overide SH toolchain download type gcc_download_type=git diff --git a/utils/dc-chain/profiles/dreamcast/15.0.0-lra.mk b/utils/dc-chain/profiles/dreamcast/15.0.0-lra.mk index 693c564b..16f45fe7 100644 --- a/utils/dc-chain/profiles/dreamcast/15.0.0-lra.mk +++ b/utils/dc-chain/profiles/dreamcast/15.0.0-lra.mk @@ -13,7 +13,7 @@ target=sh-elf cpu_configure_args=--with-multilib-list=$(precision_modes) --with-endian=little --with-cpu=$(default_precision) # Toolchain versions for SH -binutils_ver=2.44 +binutils_ver=2.45 gcc_ver=15.0.0 newlib_ver=4.5.0.20241231 gdb_ver=16.3 diff --git a/utils/dc-chain/profiles/dreamcast/15.1.0.mk b/utils/dc-chain/profiles/dreamcast/15.2.0.mk similarity index 94% rename from utils/dc-chain/profiles/dreamcast/15.1.0.mk rename to utils/dc-chain/profiles/dreamcast/15.2.0.mk index f3a7c7e4..98e17bb7 100644 --- a/utils/dc-chain/profiles/dreamcast/15.1.0.mk +++ b/utils/dc-chain/profiles/dreamcast/15.2.0.mk @@ -6,10 +6,10 @@ target=sh-elf cpu_configure_args=--with-multilib-list=$(precision_modes) --with-endian=little --with-cpu=$(default_precision) # Toolchain versions for SH -binutils_ver=2.44 -gcc_ver=15.1.0 +binutils_ver=2.45 +gcc_ver=15.2.0 newlib_ver=4.5.0.20241231 -gdb_ver=16.2 +gdb_ver=16.3 # GCC custom dependencies # Specify here if you want to use custom GMP, MPFR and MPC libraries when diff --git a/utils/dc-chain/profiles/dreamcast/15.1.1-dev.mk b/utils/dc-chain/profiles/dreamcast/15.2.1-dev.mk similarity index 92% rename from utils/dc-chain/profiles/dreamcast/15.1.1-dev.mk rename to utils/dc-chain/profiles/dreamcast/15.2.1-dev.mk index f71a2bf6..bc20df68 100644 --- a/utils/dc-chain/profiles/dreamcast/15.1.1-dev.mk +++ b/utils/dc-chain/profiles/dreamcast/15.2.1-dev.mk @@ -4,7 +4,7 @@ ############################################################################### ############################################################################### ### THIS CONFIG IS FOR AN EXPERIMENTAL VERSION OF GCC! -## THERE ARE NO KNOWN ISSUES BUILDING THIS VERSION as of 2025-04-18. +## THERE ARE NO KNOWN ISSUES BUILDING THIS VERSION as of 2025-08-03. ############################################################################### ############################################################################### @@ -13,10 +13,10 @@ target=sh-elf cpu_configure_args=--with-multilib-list=$(precision_modes) --with-endian=little --with-cpu=$(default_precision) # Toolchain versions for SH -binutils_ver=2.44 -gcc_ver=15.1.1 +binutils_ver=2.45 +gcc_ver=15.2.1 newlib_ver=4.5.0.20241231 -gdb_ver=16.2 +gdb_ver=16.3 # Overide SH toolchain download type gcc_download_type=git diff --git a/utils/dc-chain/profiles/dreamcast/16.0.0-dev.mk b/utils/dc-chain/profiles/dreamcast/16.0.0-dev.mk index 33f03cf8..e612f905 100644 --- a/utils/dc-chain/profiles/dreamcast/16.0.0-dev.mk +++ b/utils/dc-chain/profiles/dreamcast/16.0.0-dev.mk @@ -13,10 +13,10 @@ target=sh-elf cpu_configure_args=--with-multilib-list=$(precision_modes) --with-endian=little --with-cpu=$(default_precision) # Toolchain versions for SH -binutils_ver=2.44 +binutils_ver=2.45 gcc_ver=16.0.0 newlib_ver=4.5.0.20241231 -gdb_ver=16.2 +gdb_ver=16.3 # Overide SH toolchain download type gcc_download_type=git diff --git a/utils/dc-chain/profiles/gamecube/stable.mk b/utils/dc-chain/profiles/gamecube/stable.mk index 0360dd28..9f34b7bc 100644 --- a/utils/dc-chain/profiles/gamecube/stable.mk +++ b/utils/dc-chain/profiles/gamecube/stable.mk @@ -7,10 +7,10 @@ cpu_configure_args=--with-endian=big --with-cpu=750 --disable-multilib --disable newlib_extra_configure_args += --disable-libgloss # Toolchain versions for PowerPC -binutils_ver=2.44 -gcc_ver=15.1.0 +binutils_ver=2.45 +gcc_ver=15.2.0 newlib_ver=4.5.0.20241231 -gdb_ver=16.2 +gdb_ver=16.3 # GCC custom dependencies # Specify here if you want to use custom GMP, MPFR and MPC libraries when hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: kosmirror <kos...@us...> - 2025-08-07 06:05:41
|
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 5f607420fef4b10ff0df073c1bd37b79eb09a136 (commit) from 7460bf3085ea260de53c8bfd8ad3c31259c73280 (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 5f607420fef4b10ff0df073c1bd37b79eb09a136 Author: darc <da...@pr...> Date: Wed Aug 6 18:01:59 2025 -0500 Move arch-specific includes from kos.h to arch/kos.h ----------------------------------------------------------------------- Summary of changes: include/kos.h | 52 +--------------------- kernel/arch/dreamcast/include/arch/kos.h | 74 ++++++++++++++++++++++++++++++++ 2 files changed, 75 insertions(+), 51 deletions(-) create mode 100644 kernel/arch/dreamcast/include/arch/kos.h diff --git a/include/kos.h b/include/kos.h index 05613170..06fa977f 100644 --- a/include/kos.h +++ b/include/kos.h @@ -71,57 +71,7 @@ __BEGIN_DECLS #include <arch/stack.h> #include <arch/byteorder.h> #include <arch/rtc.h> - -#ifdef _arch_dreamcast -# include <arch/gdb.h> -# include <arch/mmu.h> -# include <arch/memory.h> -# include <arch/wdt.h> - -# include <dc/asic.h> -# include <dc/biosfont.h> -# include <dc/cdrom.h> -# include <dc/fb_console.h> -# include <dc/flashrom.h> -# include <dc/fmath.h> -# include <dc/fs_dcload.h> -# include <dc/fs_dclsocket.h> -# include <dc/fs_iso9660.h> -# include <dc/fs_vmu.h> -# include <dc/g1ata.h> -# include <dc/g2bus.h> -# include <dc/maple.h> -# include <dc/maple/controller.h> -# include <dc/maple/dreameye.h> -# include <dc/maple/keyboard.h> -# include <dc/maple/mouse.h> -# include <dc/maple/purupuru.h> -# include <dc/maple/sip.h> -# include <dc/maple/vmu.h> -# include <dc/matrix3d.h> -# include <dc/matrix.h> -# include <dc/modem/modem.h> -# include <dc/net/broadband_adapter.h> -# include <dc/net/lan_adapter.h> -# include <dc/perfctr.h> -# include <dc/pvr.h> -# include <dc/scif.h> -# include <dc/sci.h> -# include <dc/sd.h> -# include <dc/sound/stream.h> -# include <dc/sound/sfxmgr.h> -# include <dc/spu.h> -# include <dc/sq.h> -# include <dc/ubc.h> -# include <dc/vblank.h> -# include <dc/vec3f.h> -# include <dc/video.h> -# include <dc/vmu_fb.h> -# include <dc/vmu_pkg.h> -# include <dc/vmufs.h> -#else /* _arch_dreamcast */ -# error Invalid architecture or no architecture specified -#endif +#include <arch/kos.h> __END_DECLS diff --git a/kernel/arch/dreamcast/include/arch/kos.h b/kernel/arch/dreamcast/include/arch/kos.h new file mode 100644 index 00000000..27056363 --- /dev/null +++ b/kernel/arch/dreamcast/include/arch/kos.h @@ -0,0 +1,74 @@ +/* KallistiOS ##version## + + arch/dreamcast/include/arch/kos.h + Copyright (C) 2025 Eric Fradella + +*/ + +/** \file arch/kos.h + \brief Include everything this arch implementation has to offer! + + This is the arch-specific implementation of kos.h, the universal header + file that includes all of KallistiOS's functionality. + + This file is already included via the main kos.h, so there's no need + to include it yourself. + + \author Eric Fradella +*/ + +#ifndef __ARCH_KOS_H +#define __ARCH_KOS_H + +__BEGIN_DECLS + +#include <arch/gdb.h> +#include <arch/mmu.h> +#include <arch/memory.h> +#include <arch/wdt.h> + +#include <dc/asic.h> +#include <dc/biosfont.h> +#include <dc/cdrom.h> +#include <dc/fb_console.h> +#include <dc/flashrom.h> +#include <dc/fmath.h> +#include <dc/fs_dcload.h> +#include <dc/fs_dclsocket.h> +#include <dc/fs_iso9660.h> +#include <dc/fs_vmu.h> +#include <dc/g1ata.h> +#include <dc/g2bus.h> +#include <dc/maple.h> +#include <dc/maple/controller.h> +#include <dc/maple/dreameye.h> +#include <dc/maple/keyboard.h> +#include <dc/maple/mouse.h> +#include <dc/maple/purupuru.h> +#include <dc/maple/sip.h> +#include <dc/maple/vmu.h> +#include <dc/matrix3d.h> +#include <dc/matrix.h> +#include <dc/modem/modem.h> +#include <dc/net/broadband_adapter.h> +#include <dc/net/lan_adapter.h> +#include <dc/perfctr.h> +#include <dc/pvr.h> +#include <dc/scif.h> +#include <dc/sci.h> +#include <dc/sd.h> +#include <dc/sound/stream.h> +#include <dc/sound/sfxmgr.h> +#include <dc/spu.h> +#include <dc/sq.h> +#include <dc/ubc.h> +#include <dc/vblank.h> +#include <dc/vec3f.h> +#include <dc/video.h> +#include <dc/vmu_fb.h> +#include <dc/vmu_pkg.h> +#include <dc/vmufs.h> + +__END_DECLS + +#endif hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: kosmirror <kos...@us...> - 2025-08-07 06:01:36
|
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 7460bf3085ea260de53c8bfd8ad3c31259c73280 (commit) from 3c4ee41109de309f7d7765c3eb1c9b48b1f0f1a5 (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 7460bf3085ea260de53c8bfd8ad3c31259c73280 Author: QuzarDC <qu...@co...> Date: Wed Jul 16 18:37:26 2025 -0400 Check for call to `snd_stream_poll` before `snd_stream_start` Add a check matching what was done for `snd_stream_fill` that will assert if called before starting the stream. Without this, it can trigger an otherwise mysterious divide by zero error. ----------------------------------------------------------------------- Summary of changes: kernel/arch/dreamcast/sound/snd_stream.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/kernel/arch/dreamcast/sound/snd_stream.c b/kernel/arch/dreamcast/sound/snd_stream.c index 2b85fcfc..7f6f227a 100644 --- a/kernel/arch/dreamcast/sound/snd_stream.c +++ b/kernel/arch/dreamcast/sound/snd_stream.c @@ -802,6 +802,9 @@ int snd_stream_poll(snd_stream_hnd_t hnd) { return -1; } + /* The stream has been initted but not started, so we don't know stereo/mono. */ + assert(stream->channels != 0); + /* Get channels position */ current_play_pos = g2_read_32(SPU_RAM_UNCACHED_BASE + AICA_CHANNEL(stream->ch[0]) + hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: kosmirror <kos...@us...> - 2025-08-06 22: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 3c4ee41109de309f7d7765c3eb1c9b48b1f0f1a5 (commit) from d4df09a2c3ef4b138840cde3467e66a1ffd9814f (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 3c4ee41109de309f7d7765c3eb1c9b48b1f0f1a5 Author: darc <da...@pr...> Date: Wed Aug 6 13:35:07 2025 -0500 Define byte order for architecture in Dreamcast's CMake file ----------------------------------------------------------------------- Summary of changes: utils/cmake/Platform/dreamcast.cmake | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/utils/cmake/Platform/dreamcast.cmake b/utils/cmake/Platform/dreamcast.cmake index 530369a7..22bfd4ba 100644 --- a/utils/cmake/Platform/dreamcast.cmake +++ b/utils/cmake/Platform/dreamcast.cmake @@ -11,4 +11,8 @@ endif() set(CMAKE_SYSTEM_VERSION 1) set(CMAKE_SYSTEM_PROCESSOR SH4) set(CMAKE_SIZEOF_VOID_P 4) +set(CMAKE_C_BYTE_ORDER LITTLE_ENDIAN) +set(CMAKE_CXX_BYTE_ORDER LITTLE_ENDIAN) +set(CMAKE_OBJC_BYTE_ORDER LITTLE_ENDIAN) +set(CMAKE_OBJCXX_BYTE_ORDER LITTLE_ENDIAN) set(PLATFORM_DREAMCAST TRUE) hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: kosmirror <kos...@us...> - 2025-08-06 19:17:17
|
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 d4df09a2c3ef4b138840cde3467e66a1ffd9814f (commit) from 2d510bcb1402d0af81000cb5eb1f6bcf7cb29d59 (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 d4df09a2c3ef4b138840cde3467e66a1ffd9814f Author: darc <da...@pr...> Date: Wed Aug 6 12:02:23 2025 -0500 examples: Only build one arch's examples dir based on KOS_ARCH ----------------------------------------------------------------------- Summary of changes: examples/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/Makefile b/examples/Makefile index b64be788..f8d7f9ea 100644 --- a/examples/Makefile +++ b/examples/Makefile @@ -9,7 +9,7 @@ # Get a list of the sub-directories that contain a Makefile get_subdirs=$(foreach each,$(wildcard $(1)/*),$(if $(wildcard $(each)/Makefile),$(each),) $(call get_subdirs,$(each))) -DIRS := $(call get_subdirs, $(shell pwd)) +DIRS := $(call get_subdirs, $(shell pwd)/$(KOS_ARCH)) .PHONY: all $(DIRS) hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: kosmirror <kos...@us...> - 2025-08-06 14:35: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 "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via 2d510bcb1402d0af81000cb5eb1f6bcf7cb29d59 (commit) via d8e3229c13744def2876206ffa68a7effbb699b1 (commit) from f68aa6ceeb9a229bb964091fb8786c88d3cd8d68 (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 2d510bcb1402d0af81000cb5eb1f6bcf7cb29d59 Author: QuzarDC <qu...@co...> Date: Tue Aug 5 16:19:40 2025 -0400 arch: Update to `__pure2` on `kos_get_{banner,license,authors}` This maps to the gcc function attribute `const` which is stricter than pure in that it guarantees it will have no observable effect other than to return a value and the value will not change. commit d8e3229c13744def2876206ffa68a7effbb699b1 Author: QuzarDC <qu...@co...> Date: Tue Aug 5 14:50:50 2025 -0400 mutex: Add `__pure` to `mutex_is_locked` prototype. This got lost when rebasing changes in #992 to take into account the changes in #1047 . ----------------------------------------------------------------------- Summary of changes: include/kos/mutex.h | 2 +- kernel/arch/dreamcast/include/arch/arch.h | 6 +++--- kernel/arch/dreamcast/kernel/banner.c | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/include/kos/mutex.h b/include/kos/mutex.h index 3fb273c6..c2f467e9 100644 --- a/include/kos/mutex.h +++ b/include/kos/mutex.h @@ -211,7 +211,7 @@ int mutex_lock_timed(mutex_t *m, int timeout) __nonnull_all; \retval 0 If the mutex is not currently locked \retval 1 If the mutex is currently locked */ -int mutex_is_locked(const mutex_t *m) __nonnull_all; +int __pure mutex_is_locked(const mutex_t *m) __nonnull_all; /** \brief Attempt to lock a mutex. diff --git a/kernel/arch/dreamcast/include/arch/arch.h b/kernel/arch/dreamcast/include/arch/arch.h index 972bbd6a..1f9d227c 100644 --- a/kernel/arch/dreamcast/include/arch/arch.h +++ b/kernel/arch/dreamcast/include/arch/arch.h @@ -340,7 +340,7 @@ int hardware_sys_mode(int *region); \return A pointer to the banner string. */ -const char * __pure kos_get_banner(void); +const char * __pure2 kos_get_banner(void); /** \brief Retrieve the license information for the compiled copy of KOS. \ingroup attribution @@ -351,7 +351,7 @@ const char * __pure kos_get_banner(void); \return A pointer to the license terms. */ -const char * __pure kos_get_license(void); +const char * __pure2 kos_get_license(void); /** \brief Retrieve a list of authors and the dates of their contributions. \ingroup attribution @@ -367,7 +367,7 @@ const char * __pure kos_get_license(void); \return A pointer to the authors' copyright information. */ -const char *__pure kos_get_authors(void); +const char *__pure2 kos_get_authors(void); /** \brief Dreamcast specific sleep mode function. \ingroup arch diff --git a/kernel/arch/dreamcast/kernel/banner.c b/kernel/arch/dreamcast/kernel/banner.c index d18a71dd..e7894b73 100644 --- a/kernel/arch/dreamcast/kernel/banner.c +++ b/kernel/arch/dreamcast/kernel/banner.c @@ -35,15 +35,15 @@ static const char license[] = "OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n" "SUCH DAMAGE."; -const char * __pure kos_get_banner(void) { +const char * __pure2 kos_get_banner(void) { __asm__ __volatile__("nop" : : "r"(license), "r"(authors)); return banner; } -const char * __pure kos_get_license(void) { +const char * __pure2 kos_get_license(void) { return license; } -const char * __pure kos_get_authors(void) { +const char * __pure2 kos_get_authors(void) { return authors; } hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: kosmirror <kos...@us...> - 2025-08-06 13:46:55
|
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 f68aa6ceeb9a229bb964091fb8786c88d3cd8d68 (commit) from 0d611105f71621c9688172ca2988c77065c089c8 (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 f68aa6ceeb9a229bb964091fb8786c88d3cd8d68 Author: Paul Cercueil <pa...@cr...> Date: Tue Aug 5 01:07:16 2025 +0200 cmake: Make CMake toolchain script arch-agnostic Rename the toolchain script kallistios.toolchain.cmake, and move all Dreamcast-specific stuff to the Platform/dreamcast.cmake file (renamed to match $KOS_ARCH). Rename the utility script dreamcast.cmake to kallistios.cmake, as it did not contain anything Dreamcast specific. Also, it is no more included from the toolchain script, which should do the bare minimum. Projects that wish to use the KOS specific macros should include(kallistios) now. Signed-off-by: Paul Cercueil <pa...@cr...> ----------------------------------------------------------------------- Summary of changes: doc/environ.sh.sample | 2 +- utils/build_wrappers/kos-ccmake | 2 +- utils/build_wrappers/kos-cmake | 2 +- utils/cmake/Platform/{Dreamcast.cmake => dreamcast.cmake} | 5 +++++ utils/cmake/{dreamcast.cmake => kallistios.cmake} | 0 .../{dreamcast.toolchain.cmake => kallistios.toolchain.cmake} | 9 ++------- 6 files changed, 10 insertions(+), 10 deletions(-) rename utils/cmake/Platform/{Dreamcast.cmake => dreamcast.cmake} (69%) rename utils/cmake/{dreamcast.cmake => kallistios.cmake} (100%) rename utils/cmake/{dreamcast.toolchain.cmake => kallistios.toolchain.cmake} (92%) diff --git a/doc/environ.sh.sample b/doc/environ.sh.sample index e9cf952d..abfb4733 100644 --- a/doc/environ.sh.sample +++ b/doc/environ.sh.sample @@ -75,7 +75,7 @@ export DC_TOOLS_BASE="/opt/toolchains/dc/bin" # Specifies the path to the toolchain file used to target # KOS with the "cmake" build utility. # -export KOS_CMAKE_TOOLCHAIN="${KOS_BASE}/utils/cmake/dreamcast.toolchain.cmake" +export KOS_CMAKE_TOOLCHAIN="${KOS_BASE}/utils/cmake/kallistios.toolchain.cmake" # Genromfs Utility Path # diff --git a/utils/build_wrappers/kos-ccmake b/utils/build_wrappers/kos-ccmake index c63d2be4..e79d1208 100755 --- a/utils/build_wrappers/kos-ccmake +++ b/utils/build_wrappers/kos-ccmake @@ -13,6 +13,6 @@ if [ -z "$(which ccmake)" ]; then fi ccmake \ - -DCMAKE_TOOLCHAIN_FILE="${KOS_BASE}/utils/cmake/${KOS_ARCH}.toolchain.cmake" \ + -DCMAKE_TOOLCHAIN_FILE="${KOS_BASE}/utils/cmake/kallistios.toolchain.cmake" \ "$@" diff --git a/utils/build_wrappers/kos-cmake b/utils/build_wrappers/kos-cmake index 8db8c946..1603e15c 100755 --- a/utils/build_wrappers/kos-cmake +++ b/utils/build_wrappers/kos-cmake @@ -8,6 +8,6 @@ if [ -z "${KOS_BASE}" ]; then fi cmake \ - -DCMAKE_TOOLCHAIN_FILE="${KOS_BASE}/utils/cmake/${KOS_ARCH}.toolchain.cmake" \ + -DCMAKE_TOOLCHAIN_FILE="${KOS_BASE}/utils/cmake/kallistios.toolchain.cmake" \ "$@" diff --git a/utils/cmake/Platform/Dreamcast.cmake b/utils/cmake/Platform/dreamcast.cmake similarity index 69% rename from utils/cmake/Platform/Dreamcast.cmake rename to utils/cmake/Platform/dreamcast.cmake index 87e31a20..530369a7 100644 --- a/utils/cmake/Platform/Dreamcast.cmake +++ b/utils/cmake/Platform/dreamcast.cmake @@ -7,3 +7,8 @@ set(CMAKE_EXECUTABLE_SUFFIX .elf) if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) set(CMAKE_INSTALL_PREFIX "" CACHE PATH "Install prefix" FORCE) endif() + +set(CMAKE_SYSTEM_VERSION 1) +set(CMAKE_SYSTEM_PROCESSOR SH4) +set(CMAKE_SIZEOF_VOID_P 4) +set(PLATFORM_DREAMCAST TRUE) diff --git a/utils/cmake/dreamcast.cmake b/utils/cmake/kallistios.cmake similarity index 100% rename from utils/cmake/dreamcast.cmake rename to utils/cmake/kallistios.cmake diff --git a/utils/cmake/dreamcast.toolchain.cmake b/utils/cmake/kallistios.toolchain.cmake similarity index 92% rename from utils/cmake/dreamcast.toolchain.cmake rename to utils/cmake/kallistios.toolchain.cmake index 4ff699b6..b7e008c0 100644 --- a/utils/cmake/dreamcast.toolchain.cmake +++ b/utils/cmake/kallistios.toolchain.cmake @@ -7,7 +7,7 @@ # This file is to be passed to CMake when compiling a regular CMake project # to cross-compile for the Dreamcast, using the KOS environment and settings. # -# cmake /path/to/src -DCMAKE_TOOLCHAIN_FILE=${KOS_BASE}/kos/utils/cmake/dreamcast.toolchain.cmake +# cmake /path/to/src -DCMAKE_TOOLCHAIN_FILE=${KOS_BASE}/kos/utils/cmake/kallistios.toolchain.cmake # # or alternatively: # @@ -47,11 +47,7 @@ set(KOS_ADDONS ${KOS_BASE}/addons) list(APPEND CMAKE_MODULE_PATH $ENV{KOS_BASE}/utils/cmake) ##### Configure CMake System ##### -set(CMAKE_SYSTEM_NAME Dreamcast) -set(CMAKE_SYSTEM_VERSION 1) -set(CMAKE_SYSTEM_PROCESSOR SH4) -set(CMAKE_SIZEOF_VOID_P 4) -set(PLATFORM_DREAMCAST TRUE) +set(CMAKE_SYSTEM_NAME ${KOS_ARCH}) ##### Configure Cross-Compiler ##### set(CMAKE_CROSSCOMPILING TRUE) @@ -90,4 +86,3 @@ endif() if(NOT DEFINED CMAKE_INSTALL_LIBDIR) set(CMAKE_INSTALL_LIBDIR ${KOS_ADDONS}/lib/${KOS_ARCH}) endif() -include("${KOS_BASE}/utils/cmake/dreamcast.cmake") hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: kosmirror <kos...@us...> - 2025-08-06 13:05:41
|
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 0d611105f71621c9688172ca2988c77065c089c8 (commit) from 412d64c645f788feed54dd2c1f205b307cae22e9 (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 0d611105f71621c9688172ca2988c77065c089c8 Author: QuzarDC <qu...@co...> Date: Mon Aug 4 18:43:50 2025 -0400 Adjust dbglog usage in examples. After #1118 some examples became completely silent by default as they were written presuming dbglog output set to maximum all the time. ----------------------------------------------------------------------- Summary of changes: examples/dreamcast/cdrom/stream/cd-stream-test.c | 4 ++-- .../filesystem/sd/speedtest/sd-speedtest.c | 24 ++++++++++---------- examples/dreamcast/g1ata/atatest/atatest.c | 26 +++++++++++----------- .../dreamcast/gldc/benchmarks/quadmark/quadmark.c | 2 +- .../dreamcast/gldc/benchmarks/trimark/trimark.c | 2 +- .../gldc/benchmarks/tristripmark/tristripmark.c | 2 +- .../dreamcast/kgl/benchmarks/quadmark/quadmark.c | 2 +- .../dreamcast/kgl/benchmarks/trimark/trimark.c | 2 +- .../kgl/benchmarks/tristripmark/tristripmark.c | 2 +- examples/dreamcast/library/library-test.c | 14 ++++++------ .../loadable-dependence/library-dependence.c | 8 +++---- .../library/loadable-dependent/library-dependent.c | 6 ++--- .../dreamcast/parallax/delay_cube/delay_cube.c | 2 +- examples/dreamcast/parallax/rotocube/rotocube.c | 2 +- examples/dreamcast/parallax/serpent_dma/serpent.c | 2 +- examples/dreamcast/pvr/pvrmark/pvrmark.c | 2 +- .../dreamcast/pvr/pvrmark_strips/pvrmark_strips.c | 2 +- .../pvrmark_strips_direct/pvrmark_strips_direct.c | 2 +- 18 files changed, 53 insertions(+), 53 deletions(-) diff --git a/examples/dreamcast/cdrom/stream/cd-stream-test.c b/examples/dreamcast/cdrom/stream/cd-stream-test.c index 7a9e83bb..12b9846e 100644 --- a/examples/dreamcast/cdrom/stream/cd-stream-test.c +++ b/examples/dreamcast/cdrom/stream/cd-stream-test.c @@ -60,7 +60,7 @@ static int cd_stream_test(uint32_t lba, uint8_t *buffer, size_t size, int mode) size_t cb_count = 0; char *stream_name = (mode == CDROM_READ_PIO ? "PIO" : "DMA"); - dbglog(DBG_DEBUG, "Start %s stream.\n", stream_name); + dbglog(DBG_INFO, "Start %s stream.\n", stream_name); rs = cdrom_stream_start(lba, size / 2048, mode); if (rs != ERR_OK) { @@ -112,7 +112,7 @@ static int cd_stream_test(uint32_t lba, uint8_t *buffer, size_t size, int mode) return -1; } - dbglog(DBG_DEBUG, "%s transfer is done.\n", stream_name); + dbglog(DBG_INFO, "%s transfer is done.\n", stream_name); return 0; } diff --git a/examples/dreamcast/filesystem/sd/speedtest/sd-speedtest.c b/examples/dreamcast/filesystem/sd/speedtest/sd-speedtest.c index f2489049..318d0cc3 100644 --- a/examples/dreamcast/filesystem/sd/speedtest/sd-speedtest.c +++ b/examples/dreamcast/filesystem/sd/speedtest/sd-speedtest.c @@ -68,14 +68,14 @@ static int run_speed_test(sd_interface_t interface, bool check_crc) { const char *interface_name = (interface == SD_IF_SCI) ? "SCI-SPI" : "SCIF-SPI"; while(sd_init_ex(¶ms)) { - dbglog(DBG_DEBUG, "Could not initialize the SD card on %s interface.\n", interface_name); + dbglog(DBG_ERROR, "Could not initialize the SD card on %s interface.\n", interface_name); return -1; } /* Grab the block device for the first partition on the SD card. Note that you must have the SD card formatted with an MBR partitioning scheme. */ if(sd_blockdev_for_partition(0, &sd_dev, &pt)) { - dbglog(DBG_DEBUG, "Could not find the first partition on the SD card!\n"); + dbglog(DBG_ERROR, "Could not find the first partition on the SD card!\n"); sd_shutdown(); return -1; } @@ -84,7 +84,7 @@ static int run_speed_test(sd_interface_t interface, bool check_crc) { begin = timer_ms_gettime64(); if(sd_dev.read_blocks(&sd_dev, 0, TEST_BLOCK_COUNT, tbuf)) { - dbglog(DBG_DEBUG, "couldn't read block: %s\n", strerror(errno)); + dbglog(DBG_ERROR, "couldn't read block: %s\n", strerror(errno)); sd_shutdown(); return -1; } @@ -96,7 +96,7 @@ static int run_speed_test(sd_interface_t interface, bool check_crc) { average = sum / 10; - dbglog(DBG_DEBUG, "%s: read average took %llu ms (%.3f KB/sec)\n", + dbglog(DBG_INFO, "%s: read average took %llu ms (%.3f KB/sec)\n", interface_name, average, (512 * TEST_BLOCK_COUNT) / ((double)average)); sd_shutdown(); @@ -106,27 +106,27 @@ static int run_speed_test(sd_interface_t interface, bool check_crc) { int main(int argc, char *argv[]) { // dbgio_dev_select("fb"); - dbglog(DBG_DEBUG, "Starting SD card speed tests\n"); + dbglog(DBG_INFO, "Starting SD card speed tests\n"); - dbglog(DBG_DEBUG, "Testing SCI-SPI interface with CRC disabled\n"); + dbglog(DBG_INFO, "Testing SCI-SPI interface with CRC disabled\n"); if (run_speed_test(SD_IF_SCI, false) == 0) { - dbglog(DBG_DEBUG, "Testing SCI-SPI interface with CRC enabled\n"); + dbglog(DBG_INFO, "Testing SCI-SPI interface with CRC enabled\n"); run_speed_test(SD_IF_SCI, true); } else { - dbglog(DBG_DEBUG, "Skipping SCI-SPI interface with CRC enabled\n"); + dbglog(DBG_INFO, "Skipping SCI-SPI interface with CRC enabled\n"); } - dbglog(DBG_DEBUG, "Testing SCIF-SPI interface with CRC disabled\n"); + dbglog(DBG_INFO, "Testing SCIF-SPI interface with CRC disabled\n"); if (run_speed_test(SD_IF_SCIF, false) == 0) { - dbglog(DBG_DEBUG, "Testing SCIF-SPI interface with CRC enabled\n"); + dbglog(DBG_INFO, "Testing SCIF-SPI interface with CRC enabled\n"); run_speed_test(SD_IF_SCIF, true); } else { - dbglog(DBG_DEBUG, "Skipping SCIF-SPI interface with CRC enabled\n"); + dbglog(DBG_INFO, "Skipping SCIF-SPI interface with CRC enabled\n"); } - dbglog(DBG_DEBUG, "All tests completed\n"); + dbglog(DBG_INFO, "All tests completed\n"); wait_exit(); return 0; diff --git a/examples/dreamcast/g1ata/atatest/atatest.c b/examples/dreamcast/g1ata/atatest/atatest.c index f3f94f5b..32296e13 100644 --- a/examples/dreamcast/g1ata/atatest/atatest.c +++ b/examples/dreamcast/g1ata/atatest/atatest.c @@ -30,63 +30,63 @@ int main(int argc, char *argv[]) { uint64_t spio, epio, sdma, edma, timer; uint8_t pt; - dbglog(DBG_DEBUG, "Starting G1 ATA test program...\n"); + dbglog(DBG_INFO, "Starting G1 ATA test program...\n"); g1_ata_init(); /* Grab the blockdevs that we'll use to access the partitions. */ - dbglog(DBG_DEBUG, "Looking for first partition...\n"); + dbglog(DBG_INFO, "Looking for first partition...\n"); if(g1_ata_blockdev_for_partition(0, 0, &bd_pio, &pt)) { - dbglog(DBG_DEBUG, "Couldn't get PIO blockdev for partition!\n"); + dbglog(DBG_ERROR, "Couldn't get PIO blockdev for partition!\n"); return -1; } if(g1_ata_blockdev_for_partition(0, 1, &bd_dma, &pt)) { - dbglog(DBG_DEBUG, "Couldn't get DMA blockdev for partition!\n"); + dbglog(DBG_ERROR, "Couldn't get DMA blockdev for partition!\n"); return -1; } /* For some reason, the first DMA read takes a while... So, read one sector and discard it so to not mess up the timing stuff below. */ if(bd_dma.read_blocks(&bd_dma, 1024, 1, tmp)) { - dbglog(DBG_DEBUG, "Couldn't read block 1024 by dma: %s\n", + dbglog(DBG_ERROR, "Couldn't read block 1024 by dma: %s\n", strerror(errno)); return -1; } /* Read blocks 0 - 1023 by DMA and print out timing information. */ - dbglog(DBG_DEBUG, "Reading 1024 blocks by DMA!\n"); + dbglog(DBG_INFO, "Reading 1024 blocks by DMA!\n"); sdma = timer_ms_gettime64(); if(bd_dma.read_blocks(&bd_dma, 0, 1024, dmabuf)) { - dbglog(DBG_DEBUG, "couldn't read block by DMA: %s\n", strerror(errno)); + dbglog(DBG_ERROR, "couldn't read block by DMA: %s\n", strerror(errno)); return -1; } edma = timer_ms_gettime64(); timer = edma - sdma; - dbglog(DBG_DEBUG, "DMA read took %llu ms (%f MB/sec)\n", timer, + dbglog(DBG_INFO, "DMA read took %llu ms (%f MB/sec)\n", timer, (512 * 1024) / ((double)timer) / 1000.0); /* Read blocks 0 - 1023 by PIO and print out timing information. */ - dbglog(DBG_DEBUG, "Reading 1024 blocks by PIO!\n"); + dbglog(DBG_INFO, "Reading 1024 blocks by PIO!\n"); spio = timer_ms_gettime64(); if(bd_pio.read_blocks(&bd_pio, 0, 1024, piobuf)) { - dbglog(DBG_DEBUG, "couldn't read block by PIO: %s\n", strerror(errno)); + dbglog(DBG_ERROR, "couldn't read block by PIO: %s\n", strerror(errno)); return -1; } epio = timer_ms_gettime64(); timer = epio - spio; - dbglog(DBG_DEBUG, "PIO read took %llu ms (%f MB/sec)\n", timer, + dbglog(DBG_INFO, "PIO read took %llu ms (%f MB/sec)\n", timer, (512 * 1024) / ((double)timer) / 1000.0); /* Check the buffers for consistency... */ if(memcmp(piobuf, dmabuf, 1024 * 512)) { - dbglog(DBG_DEBUG, "Buffers do not match?!\n"); + dbglog(DBG_INFO, "Buffers do not match?!\n"); } else { - dbglog(DBG_DEBUG, "Both buffers matched!\n"); + dbglog(DBG_INFO, "Both buffers matched!\n"); } /* Clean up... */ diff --git a/examples/dreamcast/gldc/benchmarks/quadmark/quadmark.c b/examples/dreamcast/gldc/benchmarks/quadmark/quadmark.c index 492470b8..5a9c40ef 100644 --- a/examples/dreamcast/gldc/benchmarks/quadmark/quadmark.c +++ b/examples/dreamcast/gldc/benchmarks/quadmark/quadmark.c @@ -39,7 +39,7 @@ void stats(void) { pvr_stats_t stats; pvr_get_stats(&stats); - dbglog(DBG_DEBUG, "3D Stats: %d VBLs, frame rate ~%f fps\n", + dbglog(DBG_INFO, "3D Stats: %d VBLs, frame rate ~%f fps\n", stats.vbl_count, stats.frame_rate); } diff --git a/examples/dreamcast/gldc/benchmarks/trimark/trimark.c b/examples/dreamcast/gldc/benchmarks/trimark/trimark.c index 39cb93b6..85ea0e00 100644 --- a/examples/dreamcast/gldc/benchmarks/trimark/trimark.c +++ b/examples/dreamcast/gldc/benchmarks/trimark/trimark.c @@ -39,7 +39,7 @@ void stats(void) { pvr_stats_t stats; pvr_get_stats(&stats); - dbglog(DBG_DEBUG, "3D Stats: %d VBLs, frame rate ~%f fps\n", + dbglog(DBG_INFO, "3D Stats: %d VBLs, frame rate ~%f fps\n", stats.vbl_count, stats.frame_rate); } diff --git a/examples/dreamcast/gldc/benchmarks/tristripmark/tristripmark.c b/examples/dreamcast/gldc/benchmarks/tristripmark/tristripmark.c index fd524d4f..65de53d7 100644 --- a/examples/dreamcast/gldc/benchmarks/tristripmark/tristripmark.c +++ b/examples/dreamcast/gldc/benchmarks/tristripmark/tristripmark.c @@ -39,7 +39,7 @@ void stats(void) { pvr_stats_t stats; pvr_get_stats(&stats); - dbglog(DBG_DEBUG, "3D Stats: %d VBLs, frame rate ~%f fps\n", + dbglog(DBG_INFO, "3D Stats: %d VBLs, frame rate ~%f fps\n", stats.vbl_count, stats.frame_rate); } diff --git a/examples/dreamcast/kgl/benchmarks/quadmark/quadmark.c b/examples/dreamcast/kgl/benchmarks/quadmark/quadmark.c index 7c036316..65af5506 100644 --- a/examples/dreamcast/kgl/benchmarks/quadmark/quadmark.c +++ b/examples/dreamcast/kgl/benchmarks/quadmark/quadmark.c @@ -39,7 +39,7 @@ void stats(void) { pvr_stats_t stats; pvr_get_stats(&stats); - dbglog(DBG_DEBUG, "3D Stats: %d VBLs, frame rate ~%f fps\n", + dbglog(DBG_INFO, "3D Stats: %d VBLs, frame rate ~%f fps\n", stats.vbl_count, (double)stats.frame_rate); } diff --git a/examples/dreamcast/kgl/benchmarks/trimark/trimark.c b/examples/dreamcast/kgl/benchmarks/trimark/trimark.c index a27d36ee..c4aeb50a 100644 --- a/examples/dreamcast/kgl/benchmarks/trimark/trimark.c +++ b/examples/dreamcast/kgl/benchmarks/trimark/trimark.c @@ -39,7 +39,7 @@ void stats(void) { pvr_stats_t stats; pvr_get_stats(&stats); - dbglog(DBG_DEBUG, "3D Stats: %d VBLs, frame rate ~%f fps\n", + dbglog(DBG_INFO, "3D Stats: %d VBLs, frame rate ~%f fps\n", stats.vbl_count, (double)stats.frame_rate); } diff --git a/examples/dreamcast/kgl/benchmarks/tristripmark/tristripmark.c b/examples/dreamcast/kgl/benchmarks/tristripmark/tristripmark.c index 67aa529a..cd595491 100644 --- a/examples/dreamcast/kgl/benchmarks/tristripmark/tristripmark.c +++ b/examples/dreamcast/kgl/benchmarks/tristripmark/tristripmark.c @@ -39,7 +39,7 @@ void stats(void) { pvr_stats_t stats; pvr_get_stats(&stats); - dbglog(DBG_DEBUG, "3D Stats: %d VBLs, frame rate ~%f fps\n", + dbglog(DBG_INFO, "3D Stats: %d VBLs, frame rate ~%f fps\n", stats.vbl_count, (double)stats.frame_rate); } diff --git a/examples/dreamcast/library/library-test.c b/examples/dreamcast/library/library-test.c index 680db5c1..d245b43c 100644 --- a/examples/dreamcast/library/library-test.c +++ b/examples/dreamcast/library/library-test.c @@ -42,7 +42,7 @@ static void __attribute__((__noreturn__)) wait_exit(void) { maple_device_t *dev; cont_state_t *state; - dbglog(DBG_DEBUG, "Press any button to exit.\n"); + dbglog(DBG_INFO, "Press any button to exit.\n"); for(;;) { dev = maple_enum_type(0, MAPLE_FUNC_CONTROLLER); @@ -68,7 +68,7 @@ int main(int argc, char *argv[]) { library_test_func2_t library_test_func2; // dbgio_dev_select("fb"); - dbglog(DBG_DEBUG, "Initializing exports.\n"); + dbglog(DBG_INFO, "Initializing exports.\n"); if(nmmgr_handler_add(&st_libtest.nmmgr) < 0) { dbglog(DBG_ERROR, "Failed."); @@ -76,7 +76,7 @@ int main(int argc, char *argv[]) { return -1; } - dbglog(DBG_DEBUG, "Loading /rd/library-dependence.klf\n"); + dbglog(DBG_INFO, "Loading /rd/library-dependence.klf\n"); lib_dependence = library_open("dependence", "/rd/library-dependence.klf"); if (lib_dependence == NULL) { @@ -87,11 +87,11 @@ int main(int argc, char *argv[]) { ver = library_get_version(lib_dependence); - dbglog(DBG_DEBUG, "Successfully loaded: %s v%ld.%ld.%ld\n", + dbglog(DBG_INFO, "Successfully loaded: %s v%ld.%ld.%ld\n", library_get_name(lib_dependence), (ver >> 16) & 0xff, (ver >> 8) & 0xff, ver & 0xff); - dbglog(DBG_DEBUG, "Loading /rd/library-dependence.klf\n"); + dbglog(DBG_INFO, "Loading /rd/library-dependence.klf\n"); lib_dependent = library_open("dependent", "/rd/library-dependent.klf"); if (lib_dependence == NULL) { @@ -102,11 +102,11 @@ int main(int argc, char *argv[]) { ver = library_get_version(lib_dependent); - dbglog(DBG_DEBUG, "Successfully loaded: %s v%ld.%ld.%ld\n", + dbglog(DBG_INFO, "Successfully loaded: %s v%ld.%ld.%ld\n", library_get_name(lib_dependent), (ver >> 16) & 0xff, (ver >> 8) & 0xff, ver & 0xff); - dbglog(DBG_DEBUG, "Testing exports runtime on host\n"); + dbglog(DBG_INFO, "Testing exports runtime on host\n"); sym = export_lookup("library_test_func"); diff --git a/examples/dreamcast/library/loadable-dependence/library-dependence.c b/examples/dreamcast/library/loadable-dependence/library-dependence.c index 28dd0b76..4b22ed71 100644 --- a/examples/dreamcast/library/loadable-dependence/library-dependence.c +++ b/examples/dreamcast/library/loadable-dependence/library-dependence.c @@ -35,21 +35,21 @@ uint32_t lib_get_version() { } int lib_open(klibrary_t *lib) { - dbglog(DBG_DEBUG, "Library \"%s\" opened.\n", lib_get_name()); + dbglog(DBG_INFO, "Library \"%s\" opened.\n", lib_get_name()); return nmmgr_handler_add(&library_hnd.nmmgr); } int lib_close(klibrary_t *lib) { - dbglog(DBG_DEBUG, "Library \"%s\" closed.\n", lib_get_name()); + dbglog(DBG_INFO, "Library \"%s\" closed.\n", lib_get_name()); return nmmgr_handler_remove(&library_hnd.nmmgr); } /* Exported functions */ int library_test_func(int arg) { - dbglog(DBG_DEBUG, "Library \"%s\" test int: %d\n", lib_get_name(), arg); + dbglog(DBG_INFO, "Library \"%s\" test int: %d\n", lib_get_name(), arg); return 0; } void library_test_func2(const char *arg) { - dbglog(DBG_DEBUG, "Library \"%s\" test char: %s\n", lib_get_name(), arg); + dbglog(DBG_INFO, "Library \"%s\" test char: %s\n", lib_get_name(), arg); } diff --git a/examples/dreamcast/library/loadable-dependent/library-dependent.c b/examples/dreamcast/library/loadable-dependent/library-dependent.c index e2fad53a..0b1e4b51 100644 --- a/examples/dreamcast/library/loadable-dependent/library-dependent.c +++ b/examples/dreamcast/library/loadable-dependent/library-dependent.c @@ -27,7 +27,7 @@ uint32_t lib_get_version() { int lib_open(klibrary_t *lib) { uint8_t output[16]; - dbglog(DBG_DEBUG, "Library \"%s\" opened.\n", lib_get_name()); + dbglog(DBG_INFO, "Library \"%s\" opened.\n", lib_get_name()); // Test exports from dependence library library_test_func(333); @@ -35,7 +35,7 @@ int lib_open(klibrary_t *lib) { // Test libkosutils from dependence library kos_md5((const uint8_t *)lib_get_name(), strlen(lib_get_name()), output); - dbglog(DBG_DEBUG, "MD5 of \"%s\": %02X%02X%02X%02X...\n", + dbglog(DBG_INFO, "MD5 of \"%s\": %02X%02X%02X%02X...\n", lib_get_name(), output[0], output[1], output[2], output[3]); // Test host exported newlib @@ -47,6 +47,6 @@ int lib_open(klibrary_t *lib) { } int lib_close(klibrary_t *lib) { - dbglog(DBG_DEBUG, "Library \"%s\" closed.\n", lib_get_name()); + dbglog(DBG_INFO, "Library \"%s\" closed.\n", lib_get_name()); return 0; } diff --git a/examples/dreamcast/parallax/delay_cube/delay_cube.c b/examples/dreamcast/parallax/delay_cube/delay_cube.c index 9b34fcfa..d0b2c58d 100644 --- a/examples/dreamcast/parallax/delay_cube/delay_cube.c +++ b/examples/dreamcast/parallax/delay_cube/delay_cube.c @@ -185,7 +185,7 @@ int main(int argc, char **argv) { // You have to keep a watch on these, especially the vertex used // for really poly intensive effects. pvr_get_stats(&stats); - dbglog(DBG_DEBUG, "3D Stats: %d vblanks, frame rate ~%f fps, max vertex used %d bytes\n", + dbglog(DBG_INFO, "3D Stats: %d vblanks, frame rate ~%f fps, max vertex used %d bytes\n", stats.vbl_count, (double)stats.frame_rate, stats.vtx_buffer_used_max); return 0; diff --git a/examples/dreamcast/parallax/rotocube/rotocube.c b/examples/dreamcast/parallax/rotocube/rotocube.c index 10b54ff9..3b54afaa 100644 --- a/examples/dreamcast/parallax/rotocube/rotocube.c +++ b/examples/dreamcast/parallax/rotocube/rotocube.c @@ -178,7 +178,7 @@ int main(int argc, char **argv) { // You have to keep a watch on these, especially the vertex used // for really poly intensive effects. pvr_get_stats(&stats); - dbglog(DBG_DEBUG, "3D Stats: %d vblanks, frame rate ~%f fps, max vertex used %d bytes\n", + dbglog(DBG_INFO, "3D Stats: %d vblanks, frame rate ~%f fps, max vertex used %d bytes\n", stats.vbl_count, (double)stats.frame_rate, stats.vtx_buffer_used_max); return 0; diff --git a/examples/dreamcast/parallax/serpent_dma/serpent.c b/examples/dreamcast/parallax/serpent_dma/serpent.c index 2ad8f68b..a1d281c7 100644 --- a/examples/dreamcast/parallax/serpent_dma/serpent.c +++ b/examples/dreamcast/parallax/serpent_dma/serpent.c @@ -295,7 +295,7 @@ int main(int argc, char **argv) { do_sphere_test(); pvr_get_stats(&stats); - dbglog(DBG_DEBUG, "3D Stats: %u vblanks, frame rate ~%f fps, max vertex used %u bytes\n", + dbglog(DBG_INFO, "3D Stats: %u vblanks, frame rate ~%f fps, max vertex used %u bytes\n", stats.vbl_count, stats.frame_rate, stats.vtx_buffer_used_max); free(big_sphere.data); diff --git a/examples/dreamcast/pvr/pvrmark/pvrmark.c b/examples/dreamcast/pvr/pvrmark/pvrmark.c index d5f8c32a..200c6add 100644 --- a/examples/dreamcast/pvr/pvrmark/pvrmark.c +++ b/examples/dreamcast/pvr/pvrmark/pvrmark.c @@ -33,7 +33,7 @@ void stats(void) { pvr_stats_t stats; pvr_get_stats(&stats); - dbglog(DBG_DEBUG, "3D Stats: %d VBLs, frame rate ~%f fps\n", + dbglog(DBG_INFO, "3D Stats: %d VBLs, frame rate ~%f fps\n", stats.vbl_count, (double)stats.frame_rate); } diff --git a/examples/dreamcast/pvr/pvrmark_strips/pvrmark_strips.c b/examples/dreamcast/pvr/pvrmark_strips/pvrmark_strips.c index d24d61d4..1a58436a 100644 --- a/examples/dreamcast/pvr/pvrmark_strips/pvrmark_strips.c +++ b/examples/dreamcast/pvr/pvrmark_strips/pvrmark_strips.c @@ -33,7 +33,7 @@ void stats(void) { pvr_stats_t stats; pvr_get_stats(&stats); - dbglog(DBG_DEBUG, "3D Stats: %d VBLs, frame rate ~%f fps\n", + dbglog(DBG_INFO, "3D Stats: %d VBLs, frame rate ~%f fps\n", stats.vbl_count, (double)stats.frame_rate); } diff --git a/examples/dreamcast/pvr/pvrmark_strips_direct/pvrmark_strips_direct.c b/examples/dreamcast/pvr/pvrmark_strips_direct/pvrmark_strips_direct.c index 46de7984..3cf1bc60 100644 --- a/examples/dreamcast/pvr/pvrmark_strips_direct/pvrmark_strips_direct.c +++ b/examples/dreamcast/pvr/pvrmark_strips_direct/pvrmark_strips_direct.c @@ -42,7 +42,7 @@ static void stats(void) { pvr_stats_t stats; pvr_get_stats(&stats); - dbglog(DBG_DEBUG, "3D Stats: %d frames, frame rate ~%f fps\n", + dbglog(DBG_INFO, "3D Stats: %d frames, frame rate ~%f fps\n", stats.vbl_count, (double)stats.frame_rate); } hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: kosmirror <kos...@us...> - 2025-08-06 12:47: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 412d64c645f788feed54dd2c1f205b307cae22e9 (commit) via f43d4bd83719f02e9eb85815a26893a953751a67 (commit) via 28d6de2e3863d68424875b8272997d1c4b667b40 (commit) via 99b905a977d5949f5cf7ff890e55a365f6dfd0cc (commit) from f7ee03a8533adbba8dd6f03cc458a28b69802a89 (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 412d64c645f788feed54dd2c1f205b307cae22e9 Author: QuzarDC <qu...@co...> Date: Tue Jul 29 18:30:38 2025 -0400 Remove trailing whitespaces. commit f43d4bd83719f02e9eb85815a26893a953751a67 Author: QuzarDC <qu...@co...> Date: Tue Jul 29 10:22:59 2025 -0400 Replace windows-style EOL with unix-style. commit 28d6de2e3863d68424875b8272997d1c4b667b40 Author: QuzarDC <qu...@co...> Date: Tue Jul 29 10:17:34 2025 -0400 Replace extraneous tabs with appropriate numbers of spaces. commit 99b905a977d5949f5cf7ff890e55a365f6dfd0cc Author: QuzarDC <qu...@co...> Date: Tue Jul 29 10:07:26 2025 -0400 Remove extraneous spaces between conditionals and parens. ----------------------------------------------------------------------- Summary of changes: addons/libkosutils/netcfg.c | 2 +- addons/libnavi/navi_ide.c | 4 +- kernel/arch/dreamcast/fs/fs_iso9660.c | 4 +- kernel/arch/dreamcast/fs/fs_vmu.c | 4 +- kernel/arch/dreamcast/fs/vmufs.c | 2 +- kernel/arch/dreamcast/hardware/asic.c | 10 +- kernel/arch/dreamcast/hardware/flashrom.c | 2 +- kernel/arch/dreamcast/hardware/g2dma.c | 22 +- kernel/arch/dreamcast/hardware/hardware.c | 8 +- kernel/arch/dreamcast/hardware/maple/keyboard.c | 4 +- kernel/arch/dreamcast/hardware/maple/maple_irq.c | 10 +- kernel/arch/dreamcast/hardware/maple/vmu.c | 6 +- kernel/arch/dreamcast/hardware/modem/modem.c | 8 +- kernel/arch/dreamcast/hardware/pvr/pvr_irq.c | 2 +- kernel/arch/dreamcast/hardware/pvr/pvr_prim.c | 16 +- kernel/arch/dreamcast/hardware/sci.c | 6 +- kernel/arch/dreamcast/hardware/sd.c | 6 +- kernel/arch/dreamcast/hardware/spu.c | 2 +- kernel/arch/dreamcast/hardware/sq.c | 18 +- kernel/arch/dreamcast/hardware/video.c | 26 +- kernel/arch/dreamcast/include/arch/dmac.h | 2 +- kernel/arch/dreamcast/include/arch/memory.h | 730 +++++++++++------------ kernel/arch/dreamcast/include/arch/rtc.h | 2 +- kernel/arch/dreamcast/include/arch/timer.h | 2 +- kernel/arch/dreamcast/include/arch/tls_static.h | 6 +- kernel/arch/dreamcast/include/arch/trap.h | 6 +- kernel/arch/dreamcast/include/arch/wdt.h | 36 +- kernel/arch/dreamcast/include/dc/asic.h | 2 +- kernel/arch/dreamcast/include/dc/biosfont.h | 28 +- kernel/arch/dreamcast/include/dc/fifo.h | 12 +- kernel/arch/dreamcast/include/dc/math.h | 2 +- kernel/arch/dreamcast/include/dc/matrix.h | 4 +- kernel/arch/dreamcast/include/dc/minifont.h | 4 +- kernel/arch/dreamcast/include/dc/perf_monitor.h | 2 +- kernel/arch/dreamcast/include/dc/perfctr.h | 34 +- kernel/arch/dreamcast/include/dc/pvr.h | 30 +- kernel/arch/dreamcast/include/dc/sd.h | 2 +- kernel/arch/dreamcast/include/dc/sound/sfxmgr.h | 12 +- kernel/arch/dreamcast/include/dc/sound/sound.h | 6 +- kernel/arch/dreamcast/include/dc/vmu_fb.h | 2 +- kernel/arch/dreamcast/kernel/irq.c | 2 +- kernel/arch/dreamcast/kernel/perfctr.c | 2 +- kernel/arch/dreamcast/kernel/timer.c | 2 +- kernel/arch/dreamcast/sound/arm/aica.c | 4 +- kernel/arch/dreamcast/sound/snd_sfxmgr.c | 18 +- kernel/arch/dreamcast/util/screenshot.c | 6 +- kernel/arch/dreamcast/util/vmu_fb.c | 6 +- kernel/arch/dreamcast/util/vmu_printf.c | 32 +- kernel/exports/exports.c | 2 +- kernel/fs/fs_dev.c | 8 +- kernel/fs/fs_null.c | 2 +- kernel/fs/fs_pty.c | 2 +- kernel/fs/fs_utils.c | 6 +- kernel/libc/c11/thrd_join.c | 2 +- kernel/thread/oneshot_timer.c | 4 +- kernel/thread/worker.c | 10 +- 56 files changed, 597 insertions(+), 597 deletions(-) diff --git a/addons/libkosutils/netcfg.c b/addons/libkosutils/netcfg.c index 3d5cd963..df38d593 100644 --- a/addons/libkosutils/netcfg.c +++ b/addons/libkosutils/netcfg.c @@ -333,7 +333,7 @@ int netcfg_save_to(const char * fn, const netcfg_t * cfg) { #define WRITESTR(fmt, data) \ sprintf(buf, fmt, data); \ - if (fwrite(buf, strlen(buf), 1, f) != 1) \ + if(fwrite(buf, strlen(buf), 1, f) != 1) \ goto error; WRITESTR("driver=%s\n", cfg->driver); diff --git a/addons/libnavi/navi_ide.c b/addons/libnavi/navi_ide.c index 4e1185ca..7961e0f4 100644 --- a/addons/libnavi/navi_ide.c +++ b/addons/libnavi/navi_ide.c @@ -141,7 +141,7 @@ static int ide_read_chs(uint32 cyl, uint32 head, uint32 sector, uint32 numsects, wait_data(); /* wait for data to be read */ for(o = 0; o < 256; o++) { - /*if (inp(0x1f7) & 1) { + /*if(inp(0x1f7) & 1) { printf("as of %d, error code is %x/%x\n", o, inp(0x1f7), inp(0x1f1)); return -1; } */ @@ -175,7 +175,7 @@ static int ide_write_chs(uint32 cyl, uint32 head, uint32 sector, uint32 numsects wait_data(); /* wait for data to be ready */ for(o = 0; o < 256; o++) { - /* if (inp(0x1f7) & 1) { + /* if(inp(0x1f7) & 1) { printf("as of %d, error code is %x/%x\n", o, inp(0x1f7), inp(0x1f1)); return -1; } */ diff --git a/kernel/arch/dreamcast/fs/fs_iso9660.c b/kernel/arch/dreamcast/fs/fs_iso9660.c index d67e465f..7c745482 100644 --- a/kernel/arch/dreamcast/fs/fs_iso9660.c +++ b/kernel/arch/dreamcast/fs/fs_iso9660.c @@ -1103,7 +1103,7 @@ static int iso_stat(vfs_handler_t *vfs, const char *path, struct stat *st, mode_t md; iso_dirent_t *de; size_t len = strlen(path); - + (void)vfs; (void)flag; @@ -1134,7 +1134,7 @@ static int iso_stat(vfs_handler_t *vfs, const char *path, struct stat *st, errno = ENOENT; return -1; } - + memset(st, 0, sizeof(struct stat)); st->st_dev = (dev_t)('c' | ('d' << 8)); st->st_mode = md | S_IRUSR | S_IRGRP | S_IROTH | S_IXUSR | S_IXGRP | S_IXOTH; diff --git a/kernel/arch/dreamcast/fs/fs_vmu.c b/kernel/arch/dreamcast/fs/fs_vmu.c index 54b97c1f..5c0ac872 100644 --- a/kernel/arch/dreamcast/fs/fs_vmu.c +++ b/kernel/arch/dreamcast/fs/fs_vmu.c @@ -415,8 +415,8 @@ static int vmu_close(void * hnd) { case VMU_FILE: if((fh->mode & O_MODE_MASK) == O_WRONLY || (fh->mode & O_MODE_MASK) == O_RDWR) { - if ((st = vmu_write_close(hnd))) { - if (st == -7) + if((st = vmu_write_close(hnd))) { + if(st == -7) errno = ENOSPC; else errno = EIO; diff --git a/kernel/arch/dreamcast/fs/vmufs.c b/kernel/arch/dreamcast/fs/vmufs.c index f80b8613..d9e2a135 100644 --- a/kernel/arch/dreamcast/fs/vmufs.c +++ b/kernel/arch/dreamcast/fs/vmufs.c @@ -759,7 +759,7 @@ int vmufs_write(maple_device_t * dev, const char * fn, void * inbuf, int insize, fnlength = strlen(fn); fnlength = fnlength > 12 ? 12 : fnlength; memcpy(nd.filename, fn, fnlength); - if (fnlength < 12) { + if(fnlength < 12) { memset(nd.filename + fnlength, '\0', 12 - fnlength); } diff --git a/kernel/arch/dreamcast/hardware/asic.c b/kernel/arch/dreamcast/hardware/asic.c index 30c610e4..725ff3ae 100644 --- a/kernel/arch/dreamcast/hardware/asic.c +++ b/kernel/arch/dreamcast/hardware/asic.c @@ -255,14 +255,14 @@ static void asic_threaded_irq(void *data) { thdata->hdl(thdata->source, thdata->data); - if (thdata->unmask) + if(thdata->unmask) thdata->unmask(thdata->source); } static void asic_thirq_dispatch(uint32_t source, void *data) { struct asic_thdata *thdata = data; - if (thdata->ack_and_mask) + if(thdata->ack_and_mask) thdata->ack_and_mask(source); thdata->source = source; @@ -280,7 +280,7 @@ int asic_evt_request_threaded_handler(uint16_t code, asic_evt_handler hnd, kthread_t *thd; thdata = malloc(sizeof(*thdata)); - if (!thdata) + if(!thdata) return -1; /* TODO: What return code? */ thdata->hdl = hnd; @@ -291,7 +291,7 @@ int asic_evt_request_threaded_handler(uint16_t code, asic_evt_handler hnd, flags = irq_disable(); thdata->worker = thd_worker_create(asic_threaded_irq, thdata); - if (!thdata->worker) { + if(!thdata->worker) { irq_restore(flags); free(thdata); return -1; /* TODO: What return code? */ @@ -325,7 +325,7 @@ void asic_evt_remove_handler(uint16_t code) entry = asic_evt_handlers[evtreg][evt]; asic_evt_set_handler(code, NULL, NULL); - if (entry.hdl == asic_thirq_dispatch) { + if(entry.hdl == asic_thirq_dispatch) { thdata = entry.data; thd_worker_destroy(thdata->worker); diff --git a/kernel/arch/dreamcast/hardware/flashrom.c b/kernel/arch/dreamcast/hardware/flashrom.c index 764e4327..19a66f2a 100644 --- a/kernel/arch/dreamcast/hardware/flashrom.c +++ b/kernel/arch/dreamcast/hardware/flashrom.c @@ -28,7 +28,7 @@ static void strcpy_no_term(char *dest, const char *src, size_t destsize) { srclength = strlen(src); srclength = srclength > destsize ? destsize : srclength; memcpy(dest, src, srclength); - if (srclength < destsize) { + if(srclength < destsize) { memset(dest + srclength, '\0', destsize - srclength); } } diff --git a/kernel/arch/dreamcast/hardware/g2dma.c b/kernel/arch/dreamcast/hardware/g2dma.c index a70a83af..6d1120e2 100644 --- a/kernel/arch/dreamcast/hardware/g2dma.c +++ b/kernel/arch/dreamcast/hardware/g2dma.c @@ -51,11 +51,11 @@ static int dma_init; #define G2_DMA_REG_BASE 0xa05f7800 static volatile g2_dma_reg_t * const g2_dma = (g2_dma_reg_t *)G2_DMA_REG_BASE; -/* +/* List of possible initiation triggers values to assign to trigger_select: CPU_TRIGGER: Software-driven. (Setting enable and start to 1) HARDWARE_TRIGGER: Via AICA (DMA0) or expansion device. - INTERRUPT_TRIGGER: Based on interrupt signals. + INTERRUPT_TRIGGER: Based on interrupt signals. */ #define CPU_TRIGGER 0 #define HARDWARE_TRIGGER 1 @@ -72,9 +72,9 @@ static volatile g2_dma_reg_t * const g2_dma = (g2_dma_reg_t *)G2_DMA_REG_BASE; #define DMA_SUSPEND_ENABLED 0x00000004 #define DMA_SUSPEND_DISABLED 0x00000000 -/* - For sh4 and g2bus addresses, ensure bits 31-29 & 4-0 are '0' to avoid - illegal interrupts. Only bits 28-5 are used for valid addresses. +/* + For sh4 and g2bus addresses, ensure bits 31-29 & 4-0 are '0' to avoid + illegal interrupts. Only bits 28-5 are used for valid addresses. */ #define MASK_ADDRESS 0x1fffffe0 @@ -88,9 +88,9 @@ static volatile g2_dma_reg_t * const g2_dma = (g2_dma_reg_t *)G2_DMA_REG_BASE; #define PRESERVE_ENABLED 0x00000000 #define RESET_ENABLED 0x80000000 -/* +/* Specifies system memory address range for G2-DMA across channels 0-3. - If a DMA transfer is generated outside of this range, an overrun error + If a DMA transfer is generated outside of this range, an overrun error occurs. Previous range (0x4659404f): @@ -115,12 +115,12 @@ static volatile g2_dma_reg_t * const g2_dma = (g2_dma_reg_t *)G2_DMA_REG_BASE; #define DISABLE_SYS_MEM_PROTECTION (SYS_MEM_SECURITY_CODE << 16 | 0x007F) #define ENABLE_SYS_MEM_PROTECTION (SYS_MEM_SECURITY_CODE << 16 | 0x7F00) -/* - Set the DS# (Data Strobe) timeout to 27 clock cycles for the external DMA. +/* + Set the DS# (Data Strobe) timeout to 27 clock cycles for the external DMA. If data isn't ready for latching by this time, an interrupt will be triggered. - - Not sure why its 27 but can be changed later. Default value + + Not sure why its 27 but can be changed later. Default value is 1023 cycles (0x3ff). */ #define DS_CYCLE_OVERRIDE 27 diff --git a/kernel/arch/dreamcast/hardware/hardware.c b/kernel/arch/dreamcast/hardware/hardware.c index d97130f8..9b1ad726 100644 --- a/kernel/arch/dreamcast/hardware/hardware.c +++ b/kernel/arch/dreamcast/hardware/hardware.c @@ -66,7 +66,7 @@ int hardware_periph_init(void) { spu_init(); g2_dma_init(); - if (!KOS_PLATFORM_IS_NAOMI) { + if(!KOS_PLATFORM_IS_NAOMI) { /* Init CD-ROM.. NOTE: NO GD-ROM SUPPORT. ONLY CDs/CDRs. */ KOS_INIT_FLAG_CALL(cdrom_init); } @@ -77,7 +77,7 @@ int hardware_periph_init(void) { /* Init video */ vid_init(DEFAULT_VID_MODE, DEFAULT_PIXEL_MODE); - if (!KOS_PLATFORM_IS_NAOMI) + if(!KOS_PLATFORM_IS_NAOMI) KOS_INIT_FLAG_CALL(bba_la_init); initted = 2; @@ -90,10 +90,10 @@ KOS_INIT_FLAG_WEAK(maple_shutdown, true); void hardware_shutdown(void) { switch(initted) { case 2: - if (!KOS_PLATFORM_IS_NAOMI) + if(!KOS_PLATFORM_IS_NAOMI) KOS_INIT_FLAG_CALL(bba_la_shutdown); KOS_INIT_FLAG_CALL(maple_shutdown); - if (!KOS_PLATFORM_IS_NAOMI) + if(!KOS_PLATFORM_IS_NAOMI) KOS_INIT_FLAG_CALL(cdrom_shutdown); g2_dma_shutdown(); spu_shutdown(); diff --git a/kernel/arch/dreamcast/hardware/maple/keyboard.c b/kernel/arch/dreamcast/hardware/maple/keyboard.c index 13d3d409..8599f774 100644 --- a/kernel/arch/dreamcast/hardware/maple/keyboard.c +++ b/kernel/arch/dreamcast/hardware/maple/keyboard.c @@ -49,7 +49,7 @@ typedef struct kbd_state_private { kbd_leds_t leds; /**< \brief Persistent LED state for toggles */ struct { - kbd_key_t key; /**< \brief Key that is repeating. */ + kbd_key_t key; /**< \brief Key that is repeating. */ uint64_t timeout; /**< \brief Time that the next repeat will trigger. */ } repeater; } kbd_state_private_t; @@ -651,7 +651,7 @@ static void kbd_check_poll(maple_frame_t *frm) { } // Sync persistent LED state to cond - state->cond.leds = pstate->leds; + state->cond.leds = pstate->leds; /* If the key hadn't been pressed. */ if(state->key_states[cond->keys[i]].value == KEY_STATE_CHANGED_DOWN) { if(key != KBD_KEY_NONE) { diff --git a/kernel/arch/dreamcast/hardware/maple/maple_irq.c b/kernel/arch/dreamcast/hardware/maple/maple_irq.c index 0f116a4a..f5d02e41 100644 --- a/kernel/arch/dreamcast/hardware/maple/maple_irq.c +++ b/kernel/arch/dreamcast/hardware/maple/maple_irq.c @@ -64,7 +64,7 @@ static void vbl_chk_next_subdev(maple_state_t *state, maple_frame_t *frm, int p) maple_device_t *dev = maple_enum_dev(p, 0); int u; - if (dev && dev->probe_mask) { + if(dev && dev->probe_mask) { u = __builtin_ffs(dev->probe_mask); dev->probe_mask &= ~(1 << (u - 1)); @@ -78,7 +78,7 @@ static void vbl_chk_next_subdev(maple_state_t *state, maple_frame_t *frm, int p) static void vbl_dev_probed(int p, int u) { maple_device_t *dev = maple_enum_dev(p, 0); - if (dev) + if(dev) dev->dev_mask |= 1 << (u - 1); } @@ -91,7 +91,7 @@ static void vbl_chk_subdevs(maple_state_t *state, int p, uint8 newmask) { /* Disconnect any device that disappeared */ for(u = 1; u < MAPLE_UNIT_COUNT; u++) { - if (dev->dev_mask & ~newmask & (1 << (u - 1))) { + if(dev->dev_mask & ~newmask & (1 << (u - 1))) { vbl_chk_disconnect(state, p, u); } } @@ -115,7 +115,7 @@ static void vbl_autodet_callback(maple_state_t *state, maple_frame_t *frm) { maple_device_t *dev; int p, u; - if (irq_inside_int() && !malloc_irq_safe()) { + if(irq_inside_int() && !malloc_irq_safe()) { /* We can't create or remove a device now. Fail silently as the device * will be re-probed in the next loop of the periodic IRQ. */ maple_frame_unlock(frm); @@ -200,7 +200,7 @@ static void vbl_autodetect(maple_state_t *state) { state->detect_port_next, 0); /* Move to the next device */ - if (queued) { + if(queued) { state->detect_port_next++; if(state->detect_port_next >= MAPLE_PORT_COUNT) diff --git a/kernel/arch/dreamcast/hardware/maple/vmu.c b/kernel/arch/dreamcast/hardware/maple/vmu.c index 30420641..d95a392c 100644 --- a/kernel/arch/dreamcast/hardware/maple/vmu.c +++ b/kernel/arch/dreamcast/hardware/maple/vmu.c @@ -177,7 +177,7 @@ void vmu_set_buttons_enabled(int enable) { } /* Determine whether polling for button input is enabled or not by presence of periodic callback. */ -int vmu_get_buttons_enabled(void) { +int vmu_get_buttons_enabled(void) { return !!vmu_drv.periodic; } @@ -249,7 +249,7 @@ int vmu_set_custom_color(maple_device_t *dev, uint8_t red, uint8_t green, uint8_ int vmu_set_icon_shape(maple_device_t *dev, uint8_t icon_shape) { vmu_root_t root; - if (KOS_PLATFORM_IS_NAOMI) + if(KOS_PLATFORM_IS_NAOMI) return -1; if(icon_shape < BFONT_ICON_VMUICON || icon_shape > BFONT_ICON_EMBROIDERY) @@ -351,7 +351,7 @@ int vmu_draw_lcd_rotated(maple_device_t *dev, const void *bitmap) { uint32_t bitmap_inverted[48]; unsigned int i; - for (i = 0; i < 48; i++) { + for(i = 0; i < 48; i++) { bitmap_inverted[i] = bit_reverse(((uint32 *)bitmap)[47 - i]); } diff --git a/kernel/arch/dreamcast/hardware/modem/modem.c b/kernel/arch/dreamcast/hardware/modem/modem.c index 90052809..940a02b2 100644 --- a/kernel/arch/dreamcast/hardware/modem/modem.c +++ b/kernel/arch/dreamcast/hardware/modem/modem.c @@ -744,8 +744,8 @@ void modem_disconnect(void) { modemSetBits(REGLOC(0x15), 0x4); /* Set RREN */ /* Wait for a disconnection or a timeout */ - for (i = 0; i < 500; i++) { - if (!(modemRead(REGLOC(0xF)) & 0x80)) + for(i = 0; i < 500; i++) { + if(!(modemRead(REGLOC(0xF)) & 0x80)) break; thd_sleep(10); @@ -756,8 +756,8 @@ void modem_disconnect(void) { modemWrite(REGLOC(0x12), 0xC0); modemSetBits(REGLOC(0x15), 0x4); /* Set RREN */ - for (i = 0; i < 500; i++) { - if (!(modemRead(REGLOC(0xF)) & 0x80) || + for(i = 0; i < 500; i++) { + if(!(modemRead(REGLOC(0xF)) & 0x80) || modemRead(REGLOC(0x14)) == 0x96) { break; } diff --git a/kernel/arch/dreamcast/hardware/pvr/pvr_irq.c b/kernel/arch/dreamcast/hardware/pvr/pvr_irq.c index fe298e21..4bbcb747 100644 --- a/kernel/arch/dreamcast/hardware/pvr/pvr_irq.c +++ b/kernel/arch/dreamcast/hardware/pvr/pvr_irq.c @@ -166,7 +166,7 @@ void pvr_int_handler(uint32 code, void *data) { case ASIC_EVT_PVR_RENDERDONE_TSP: //DBG(("irq_renderdone\n")); pvr_state.render_busy = 0; - if (!pvr_state.was_to_texture) + if(!pvr_state.was_to_texture) pvr_state.render_completed = 1; pvr_sync_stats(PVR_SYNC_RNDDONE); diff --git a/kernel/arch/dreamcast/hardware/pvr/pvr_prim.c b/kernel/arch/dreamcast/hardware/pvr/pvr_prim.c index a7460a4e..904c0511 100644 --- a/kernel/arch/dreamcast/hardware/pvr/pvr_prim.c +++ b/kernel/arch/dreamcast/hardware/pvr/pvr_prim.c @@ -68,9 +68,9 @@ void pvr_poly_compile(pvr_poly_hdr_t *dst, const pvr_poly_cxt_t *src) { } else { assert_msg(__builtin_popcount(src->txr.width) == 1 - && src->txr.width <= 1024, "Invalid texture U size"); + && src->txr.width <= 1024, "Invalid texture U size"); assert_msg(__builtin_popcount(src->txr.height) == 1 - && src->txr.height <= 1024, "Invalid texture V size"); + && src->txr.height <= 1024, "Invalid texture V size"); mode2 |= FIELD_PREP(PVR_TA_PM2_TXRALPHA, src->txr.alpha) | FIELD_PREP(PVR_TA_PM2_UVFLIP, src->txr.uv_flip) @@ -304,9 +304,9 @@ void pvr_sprite_compile(pvr_sprite_hdr_t *dst, const pvr_sprite_cxt_t *src) { } else { assert_msg(__builtin_popcount(src->txr.width) == 1 - && src->txr.width <= 1024, "Invalid texture U size"); + && src->txr.width <= 1024, "Invalid texture U size"); assert_msg(__builtin_popcount(src->txr.height) == 1 - && src->txr.height <= 1024, "Invalid texture V size"); + && src->txr.height <= 1024, "Invalid texture V size"); mode2 |= FIELD_PREP(PVR_TA_PM2_TXRALPHA, src->txr.alpha) | FIELD_PREP(PVR_TA_PM2_UVFLIP, src->txr.uv_flip) @@ -393,9 +393,9 @@ void pvr_poly_mod_compile(pvr_poly_mod_hdr_t *dst, const pvr_poly_cxt_t *src) { } else { assert_msg(__builtin_popcount(src->txr.width) == 1 - && src->txr.width <= 1024, "Invalid texture U size"); + && src->txr.width <= 1024, "Invalid texture U size"); assert_msg(__builtin_popcount(src->txr.height) == 1 - && src->txr.height <= 1024, "Invalid texture V size"); + && src->txr.height <= 1024, "Invalid texture V size"); mode2 |= FIELD_PREP(PVR_TA_PM2_TXRALPHA, src->txr.alpha) | FIELD_PREP(PVR_TA_PM2_UVFLIP, src->txr.uv_flip) @@ -432,9 +432,9 @@ void pvr_poly_mod_compile(pvr_poly_mod_hdr_t *dst, const pvr_poly_cxt_t *src) { } else { assert_msg(__builtin_popcount(src->txr2.width) == 1 - && src->txr2.width <= 1024, "Invalid texture U size"); + && src->txr2.width <= 1024, "Invalid texture U size"); assert_msg(__builtin_popcount(src->txr2.height) == 1 - && src->txr2.height <= 1024, "Invalid texture V size"); + && src->txr2.height <= 1024, "Invalid texture V size"); mode2 |= FIELD_PREP(PVR_TA_PM2_TXRALPHA, src->txr2.alpha) | FIELD_PREP(PVR_TA_PM2_UVFLIP, src->txr2.uv_flip) diff --git a/kernel/arch/dreamcast/hardware/sci.c b/kernel/arch/dreamcast/hardware/sci.c index 40f6898f..82322412 100644 --- a/kernel/arch/dreamcast/hardware/sci.c +++ b/kernel/arch/dreamcast/hardware/sci.c @@ -443,7 +443,7 @@ void sci_configure_spi(sci_spi_cs_mode_t cs, size_t buffer_size) { sci_shutdown_spi_cs(); /* Allocate a single aligned buffer for both TX and RX DMA operations */ - if (buffer_size > 0) { + if(buffer_size > 0) { if(spi_dma_buffer != NULL && spi_buffer_size != buffer_size) { free(spi_dma_buffer); spi_dma_buffer = NULL; @@ -451,7 +451,7 @@ void sci_configure_spi(sci_spi_cs_mode_t cs, size_t buffer_size) { if(spi_dma_buffer == NULL) { spi_dma_buffer = aligned_alloc(32, buffer_size); - if (spi_dma_buffer == NULL) { + if(spi_dma_buffer == NULL) { dbglog(DBG_ERROR, "SCI: Failed to allocate DMA buffer\n"); ...<truncated>... hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: kosmirror <kos...@us...> - 2025-08-05 18:13:02
|
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 f7ee03a8533adbba8dd6f03cc458a28b69802a89 (commit) via 85c46b357012ae25be83f811bf826d05b43397b8 (commit) via e8887270d1f896f2888791d905c620babd5fafab (commit) from c5243a942b2389d5231a32a5fffe0f0ce67e6592 (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 f7ee03a8533adbba8dd6f03cc458a28b69802a89 Author: Falco Girgis <gyr...@gm...> Date: Tue Aug 5 13:05:31 2025 -0500 Addressed review feedback. commit 85c46b357012ae25be83f811bf826d05b43397b8 Author: Falco Girgis <gyr...@gm...> Date: Tue Aug 5 09:19:07 2025 -0500 Addressed review feedback. commit e8887270d1f896f2888791d905c620babd5fafab Author: Falco Girgis <gyr...@gm...> Date: Sun Jun 8 22:30:52 2025 -0500 Faster IRQ enable/disable/restore + SR fetch. Despite being tiny little routines that clobber either just one register or nothing at all, the following routines were being implemented in pure out-of-line ASM, which meant the compiler could never inline them even with LTO: a. irq_get_sr() b. irq_restore() c. irq_disable() d. irq_enable() This PR moves them into inline functions as inline ASM where the compiler should definitely be inlining them at even low optimization levels for pretty high perf gainz, since these are very hot throughout the codebase. 1) Removed all out-of-line implementations of theses routines from entry.s. 2) Rewrote them as inlined functions in inline ASM within irq.h 3) Had to tweak the following ASM routines to no longer call into the removed routines, since ASM cannot call inline C functions: a. irq_save_regs() [entry.s] b. thd_block_now() [thdswitch.s] ----------------------------------------------------------------------- Summary of changes: kernel/arch/dreamcast/include/arch/irq.h | 47 ++++++++++++------- kernel/arch/dreamcast/kernel/entry.s | 77 +++++++------------------------- kernel/arch/dreamcast/kernel/thdswitch.s | 22 +++++---- 3 files changed, 59 insertions(+), 87 deletions(-) diff --git a/kernel/arch/dreamcast/include/arch/irq.h b/kernel/arch/dreamcast/include/arch/irq.h index f0a50bf9..a6167499 100644 --- a/kernel/arch/dreamcast/include/arch/irq.h +++ b/kernel/arch/dreamcast/include/arch/irq.h @@ -1,9 +1,9 @@ /* KallistiOS ##version## arch/dreamcast/include/arch/irq.h - Copyright (C) 2000-2001 Megan Potter + Copyright (C) 2000, 2001 Megan Potter Copyright (C) 2024 Paul Cercueil - Copyright (C) 2024 Falco Girgis + Copyright (C) 2024, 2025 Falco Girgis */ @@ -308,7 +308,25 @@ typedef uint32_t irq_mask_t; \retval Status register word \sa irq_disable() */ -irq_mask_t irq_get_sr(void); +static inline irq_mask_t irq_get_sr(void) { + irq_mask_t value; + __asm__ volatile("stc sr, %0" : "=r" (value)); + return value; +} + +/** Restore IRQ state. + + This function will restore the interrupt state to the value specified. This + should correspond to a value returned by irq_disable(). + + \param v The IRQ state to restore. This should be a value + returned by irq_disable(). + + \sa irq_disable() +*/ +static inline void irq_restore(irq_mask_t old) { + __asm__ volatile("ldc %0, sr" : : "r" (old)); +} /** Disable interrupts. @@ -321,7 +339,11 @@ irq_mask_t irq_get_sr(void); \sa irq_restore(), irq_enable() */ -irq_mask_t irq_disable(void); +static inline irq_mask_t irq_disable(void) { + uint32_t mask = (uint32_t)irq_get_sr(); + irq_restore((mask & 0xefffff0f) | 0x000000f0); + return mask; +} /** Enable all interrupts. @@ -329,19 +351,10 @@ irq_mask_t irq_disable(void); \sa irq_disable() */ -void irq_enable(void); - -/** Restore IRQ state. - - This function will restore the interrupt state to the value specified. This - should correspond to a value returned by irq_disable(). - - \param v The IRQ state to restore. This should be a value - returned by irq_disable(). - - \sa irq_disable() -*/ -void irq_restore(irq_mask_t v); +static inline void irq_enable(void) { + uint32_t mask = ((uint32_t)irq_get_sr() & 0xefffff0f); + irq_restore(mask); +} /** \brief Disable interrupts with scope management. diff --git a/kernel/arch/dreamcast/kernel/entry.s b/kernel/arch/dreamcast/kernel/entry.s index 4f01bae7..1ee06592 100644 --- a/kernel/arch/dreamcast/kernel/entry.s +++ b/kernel/arch/dreamcast/kernel/entry.s @@ -1,8 +1,9 @@ ! KallistiOS ##version## ! ! arch/dreamcast/kernel/entry.s -! (c)2000-2001 Megan Potter +! Copyright (C) 2000, 2001 Megan Potter ! Copyright (C) 2023 Paul Cercueil <pa...@cr...> +! Copyright (C) 2025 Falco Girgis ! ! Assembler code for entry and exit to/from the kernel via exceptions ! @@ -111,8 +112,12 @@ _irq_save_regs: ! Before we enter the main C code again, re-enable exceptions ! (but not interrupts) so we can still debug inside handlers. - bsr _irq_disable - nop + mov.l irqd_and,r1 + mov.l irqd_or,r2 + stc sr,r0 + and r0,r1 + or r2,r1 + ldc r1,sr ! R4 still contains the exception code mov.l hdl_except,r2 ! Call handle_exception @@ -121,6 +126,12 @@ _irq_save_regs: bra _save_regs_finish nop + .align 2 +irqd_and: + .long 0xefffff0f +irqd_or: + .long 0x000000f0 + ! irq_force_return() jumps here; make sure we're in register ! bank 1 (as opposed to 0) _irq_force_return: @@ -331,62 +342,4 @@ _vma_table_400: ! TLB miss exceptions (MMU) _vma_table_600: ! IRQs nop bra _irq_save_regs - mov #3,r4 ! Set exception code - - -! Disable interrupts, but leave exceptions enabled. Returns the old -! interrupt status. -! -! Calling this inside an exception/interrupt handler will generally not have -! any effect. -! - .globl _irq_disable -_irq_disable: - mov.l _irqd_and,r1 - mov.l _irqd_or,r2 - stc sr,r0 - and r0,r1 - or r2,r1 - ldc r1,sr - rts - nop - - .align 2 -_irqd_and: - .long 0xefffff0f -_irqd_or: - .long 0x000000f0 - - -! Enable interrupts and exceptions. Returns the old interrupt status. -! -! Call this inside an exception/interrupt handler only with GREAT CARE. -! - .globl _irq_enable -_irq_enable: - mov.l _irqe_and,r1 - stc sr,r0 - and r0,r1 - ldc r1,sr - rts - nop - - .align 2 -_irqe_and: - .long 0xefffff0f - - -! Restore interrupts to the state returned by irq_disable() -! or irq_enable(). - .globl _irq_restore -_irq_restore: - ldc r4,sr - rts - nop - - -! Retrieve SR - .globl _irq_get_sr -_irq_get_sr: - rts - stc sr,r0 + mov #3,r4 ! Set exception code \ No newline at end of file diff --git a/kernel/arch/dreamcast/kernel/thdswitch.s b/kernel/arch/dreamcast/kernel/thdswitch.s index 26be2830..bf19c959 100644 --- a/kernel/arch/dreamcast/kernel/thdswitch.s +++ b/kernel/arch/dreamcast/kernel/thdswitch.s @@ -1,8 +1,9 @@ ! KallistiOS ##version## ! ! arch/dreamcast/kernel/thdswitch.s -! Copyright (c)2003 Megan Potter +! Copyright (C) 2003 Megan Potter ! Copyright (C) 2023 Paul Cercueil <pa...@cr...> +! Copyright (C) 2025 Falco Girgis ! ! Assembler code for swapping out running threads ! @@ -33,12 +34,13 @@ _thd_block_now: ! and start at R8. ! Save SR and disable interrupts - sts.l pr,@-r15 - mov.l idaddr,r0 - jsr @r0 - nop + mov.l irqd_and,r1 + mov.l irqd_or,r2 + stc sr,r0 + and r0,r1 + or r2,r1 + ldc r1,sr - lds.l @r15+,pr add #0x72,r4 mov r0,r1 @@ -122,9 +124,13 @@ _thd_block_now: jmp @r1 mov r0,r4 + .align 2 +irqd_and: + .long 0xefffff0f +irqd_or: + .long 0x000000f0 + .balign 4 -idaddr: - .long _irq_disable ifraddr: .long _irq_force_return tcnaddr: hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: kosmirror <kos...@us...> - 2025-08-05 17:39:56
|
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 c5243a942b2389d5231a32a5fffe0f0ce67e6592 (commit) from 584c550e134979fc69b86e0efb63546764146d4e (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 c5243a942b2389d5231a32a5fffe0f0ce67e6592 Author: darc <da...@pr...> Date: Tue Aug 5 12:28:15 2025 -0500 dc-chain: Add gdb_ver in profiles in which it's missing ----------------------------------------------------------------------- Summary of changes: utils/dc-chain/profiles/aica/stable.mk | 1 + utils/dc-chain/profiles/dreamcast/15.0.0-lra.mk | 1 + 2 files changed, 2 insertions(+) diff --git a/utils/dc-chain/profiles/aica/stable.mk b/utils/dc-chain/profiles/aica/stable.mk index 096dc347..3a28606e 100644 --- a/utils/dc-chain/profiles/aica/stable.mk +++ b/utils/dc-chain/profiles/aica/stable.mk @@ -9,6 +9,7 @@ cpu_configure_args=--with-arch=armv4 --with-mode=arm --disable-multilib binutils_ver=2.44 gcc_ver=8.5.0 newlib_ver=4.5.0.20241231 +gdb_ver=16.3 # GCC custom dependencies # Specify here if you want to use custom GMP, MPFR and MPC libraries when diff --git a/utils/dc-chain/profiles/dreamcast/15.0.0-lra.mk b/utils/dc-chain/profiles/dreamcast/15.0.0-lra.mk index d53bc2b8..693c564b 100644 --- a/utils/dc-chain/profiles/dreamcast/15.0.0-lra.mk +++ b/utils/dc-chain/profiles/dreamcast/15.0.0-lra.mk @@ -16,6 +16,7 @@ cpu_configure_args=--with-multilib-list=$(precision_modes) --with-endian=little binutils_ver=2.44 gcc_ver=15.0.0 newlib_ver=4.5.0.20241231 +gdb_ver=16.3 # Overide SH toolchain download type gcc_download_type=git hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: kosmirror <kos...@us...> - 2025-08-05 16:49: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 584c550e134979fc69b86e0efb63546764146d4e (commit) via 0899526b0a9e358228149f933f3f06c03ea2074e (commit) from c71cc6e505324e35235208c574c04b3a872c2fba (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 584c550e134979fc69b86e0efb63546764146d4e Author: Falco Girgis <gyr...@gm...> Date: Tue Aug 5 11:21:31 2025 -0500 Fixed building "library" example with LTO. ...by disabling LTO within its specific Makefiles to still work with globally enabled LTO using fat objects. commit 0899526b0a9e358228149f933f3f06c03ea2074e Author: Falco Girgis <gyr...@gm...> Date: Tue Aug 5 11:18:26 2025 -0500 Updated environ.sh.sample. 1) New defaults for using builtins and no position-independent code. 2) New option for LTO, which automatically uses fat objects for compatibility. 3) New optional flags for various optimizations such as -fipa-pta. ----------------------------------------------------------------------- Summary of changes: doc/environ.sh.sample | 49 +++++++++++++++------- .../dreamcast/library/loadable-dependence/Makefile | 2 +- .../dreamcast/library/loadable-dependent/Makefile | 2 +- 3 files changed, 36 insertions(+), 17 deletions(-) diff --git a/doc/environ.sh.sample b/doc/environ.sh.sample index e23238c7..e9cf952d 100644 --- a/doc/environ.sh.sample +++ b/doc/environ.sh.sample @@ -138,23 +138,42 @@ export DC_ARM_LDFLAGS="" # Controls the baseline optimization level to use when building. # Typically this is -Og (debugging), -O0, -O1, -O2, or -O3. # NOTE: For our target, -O4 is a valid optimization level that has -# been seen to have some performance impact as well. +# been seen to have some performance impact as well. # export KOS_CFLAGS="${KOS_CFLAGS} -O2" +# Link-Time Optimization +# +# Uncomment this to enable LTO, which can substantially improve performance +# of the generated code by enabling the linker to perform inlining, at the +# cost of longer build times and fatter object files. +# NOTE: Certain ports and examples require fat LTO objects to work with LTO, +# and LTO itself is known to cause issues in code with undefined behavior. +# +#export KOS_CFLAGS="${KOS_CFLAGS} -flto=auto -ffat-lto-objects" + # Additional Optimizations # -# Uncomment this to enable what has been found empirically to be -# the optimal set of additional flags for release build performance -# on the current stable toolchain. NOTE: Certain KOS-ports and examples -# do not work properly with "-flto=auto"! +# Uncomment these to enable what have been found empirically to be a decent +# set of additional flags for optimal release build performance with the +# current stable toolchain. +# +#export KOS_CFLAGS="${KOS_CFLAGS} -freorder-blocks-algorithm=simple" +#export KOS_CFLAGS="${KOS_CFLAGS} -fipa-pta" + +# Position-Independent Code +# +# Comment this line out to enable position-dependent 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. # -#export KOS_CFLAGS="${KOS_CFLAGS} -freorder-blocks-algorithm=simple -flto=auto" +export KOS_CFLAGS="${KOS_CFLAGS} -fno-PIC -fno-PIE" # Frame Pointers # -# Controls whether frame pointers are emitted or not. Disabled by -# default. Enable them if you plan to use GDB for debugging. +# Controls whether frame pointers are emitted or not. Disabled by default, as +# they use an extra register. Enable them if you plan to use GDB for debugging +# or need additional stack trace # export KOS_CFLAGS="${KOS_CFLAGS} -fomit-frame-pointer" #export KOS_CFLAGS="${KOS_CFLAGS} -fno-omit-frame-pointer -DFRAME_POINTERS" @@ -172,13 +191,12 @@ export KOS_CFLAGS="${KOS_CFLAGS} -fomit-frame-pointer" # GCC Builtin Functions # -# Comment out this line to enable GCC to use its own builtin implementations of -# certain standard library functions. Under certain conditions, this can allow -# compiler-optimized implementations to replace standard function invocations. -# The downside of this is that it COULD interfere with Newlib or KOS implementations -# of these functions, and it has not been tested thoroughly to ensure compatibility. +# Uncomment this line to prevent GCC from using its own builtin implementations of +# certain standard library functions. Under certain conditions, using builtins +# allows for compiler-optimized routines to replace function calls to the C standard +# library which are backed by Newlib or KOS. # -export KOS_CFLAGS="${KOS_CFLAGS} -fno-builtin" +#export KOS_CFLAGS="${KOS_CFLAGS} -fno-builtin" # Fast Math Instructions # @@ -186,7 +204,8 @@ export KOS_CFLAGS="${KOS_CFLAGS} -fno-builtin" # FSCA, and FSQRT) for calculating sin/cos, inverse square root, and square roots. # These can result in substantial performance gains for these kinds of operations; # however, they do so at the price of accuracy and are not IEEE compliant. -# NOTE: Enabling this option will also override -fno-builtin! +# NOTE: If these cause issues when enabled globally, it's advised to try to enable +# them on individual files in the critical path to still gain performance. # #export KOS_CFLAGS="${KOS_CFLAGS} -fbuiltin -ffast-math -ffp-contract=fast" diff --git a/examples/dreamcast/library/loadable-dependence/Makefile b/examples/dreamcast/library/loadable-dependence/Makefile index 4037085e..73a52088 100644 --- a/examples/dreamcast/library/loadable-dependence/Makefile +++ b/examples/dreamcast/library/loadable-dependence/Makefile @@ -10,7 +10,7 @@ TARGET_LIB = lib$(TARGET_NAME).a OBJS = $(TARGET_NAME).o # For exporting kos_md5 -LIBS = -lkosutils +LIBS = -lkosutils -fno-lto # library-test exported stub for link test DBG_LIBS = -llibrary-test diff --git a/examples/dreamcast/library/loadable-dependent/Makefile b/examples/dreamcast/library/loadable-dependent/Makefile index 772a00a4..a11990e1 100644 --- a/examples/dreamcast/library/loadable-dependent/Makefile +++ b/examples/dreamcast/library/loadable-dependent/Makefile @@ -13,6 +13,6 @@ DBG_LIBS = -llibrary-dependence -llibrary-test KOS_LIB_PATHS += -L../loadable-dependence -L../ # Dependence include -KOS_CFLAGS += -I../loadable-dependence +KOS_CFLAGS += -fno-lto -I../loadable-dependence include $(KOS_BASE)/loadable/Makefile.prefab hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: kosmirror <kos...@us...> - 2025-08-05 13:34:45
|
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 c71cc6e505324e35235208c574c04b3a872c2fba (commit) via 3c96383b3b06c4448bdac3bd6702a4c3eff2a638 (commit) from 892ca798ed79edfc507e447755c630e0ea2f9930 (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 c71cc6e505324e35235208c574c04b3a872c2fba Author: Falco Girgis <gyr...@gm...> Date: Tue Aug 5 00:51:51 2025 -0500 Forgot to remove manual NULL terminator. commit 3c96383b3b06c4448bdac3bd6702a4c3eff2a638 Author: Falco Girgis <gyr...@gm...> Date: Tue Aug 5 00:50:37 2025 -0500 Fixed string-related warnings. The following functions: 1) realpath() 2) fs_normalize_path() had annoying warnings about strncpy() calls which don't copy enough from the source buffer to include its NULL terminator... which... it's not actually a problem, since the lines right after had us manually terminating the strings, but... this appeases GCC, so whatever. ----------------------------------------------------------------------- Summary of changes: kernel/fs/fs_utils.c | 3 +-- kernel/libc/koslib/realpath.c | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/kernel/fs/fs_utils.c b/kernel/fs/fs_utils.c index 41190f43..b65c285e 100644 --- a/kernel/fs/fs_utils.c +++ b/kernel/fs/fs_utils.c @@ -203,8 +203,7 @@ char *fs_normalize_path(const char *__restrict path, char *__restrict resolved) /* Handle absolute path. */ if(path[0] == '/') { - strncpy(temp_path, path, len); - temp_path[len] = '\0'; + strcpy(temp_path, path); } else { /* Handle relative path: prepend current working directory. */ diff --git a/kernel/libc/koslib/realpath.c b/kernel/libc/koslib/realpath.c index 8db7516b..ab4892c8 100644 --- a/kernel/libc/koslib/realpath.c +++ b/kernel/libc/koslib/realpath.c @@ -42,8 +42,7 @@ char *realpath(const char *__restrict path, char *__restrict resolved) { /* Handle absolute path. */ if(path[0] == '/') { - strncpy(temp_path, path, len); - temp_path[len] = '\0'; + strcpy(temp_path, path); } else { /* Handle relative path: prepend current working directory. */ hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: kosmirror <kos...@us...> - 2025-08-05 05:28: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 892ca798ed79edfc507e447755c630e0ea2f9930 (commit) from b4d54adf23275f7682359ab32c7df3349cda0393 (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 892ca798ed79edfc507e447755c630e0ea2f9930 Author: QuzarDC <qu...@co...> Date: Tue Aug 5 01:20:45 2025 -0400 thread: Correct missing commas from init/reaper attrs. Additionally provide disable_tls for default to avoid warning. ----------------------------------------------------------------------- Summary of changes: kernel/thread/thread.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/kernel/thread/thread.c b/kernel/thread/thread.c index 1a4b20f0..36e57aa1 100644 --- a/kernel/thread/thread.c +++ b/kernel/thread/thread.c @@ -482,7 +482,7 @@ kthread_t *thd_create_ex(const kthread_attr_t *restrict attr, } kthread_t *thd_create(bool detach, void *(*routine)(void *), void *param) { - kthread_attr_t attrs = { detach, 0, NULL, 0, NULL }; + kthread_attr_t attrs = { detach, 0, NULL, 0, NULL, false }; return thd_create_ex(&attrs, routine, param); } @@ -1010,7 +1010,7 @@ int thd_init(void) { .stack_size = sizeof(thd_reaper_stack), .stack_ptr = thd_reaper_stack, .prio = 1, - .label = "[reaper]" + .label = "[reaper]", .disable_tls = true }; @@ -1018,7 +1018,7 @@ int thd_init(void) { .stack_size = sizeof(thd_idle_stack), .stack_ptr = thd_idle_stack, .prio = PRIO_MAX, - .label = "[idle]" + .label = "[idle]", .disable_tls = true }; hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: kosmirror <kos...@us...> - 2025-08-05 05:23: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 b4d54adf23275f7682359ab32c7df3349cda0393 (commit) via db307a62b687d6a1f4cf9ce4f89a25eb5f99ec91 (commit) via 6e74c3487262e469d2a6a6980c3e282c9b83a7fd (commit) from f26ec6edfd6df6508242b53122b8a9d51557a849 (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 b4d54adf23275f7682359ab32c7df3349cda0393 Author: QuzarDC <qu...@co...> Date: Sat May 10 14:13:53 2025 -0400 fmath mark functions __pure. commit db307a62b687d6a1f4cf9ce4f89a25eb5f99ec91 Author: QuzarDC <qu...@co...> Date: Sat May 10 14:08:35 2025 -0400 Mark functions __pure. Additionally clean up some white space in `net.h` commit 6e74c3487262e469d2a6a6980c3e282c9b83a7fd Author: QuzarDC <qu...@co...> Date: Sat May 10 14:02:46 2025 -0400 Remove KOS redefinition of `__pure`. I believe this may have been correct in the past, but now gcc offers an actual 'pure' attribute which differs from const. Unlike const, pure allows data pointed to by pointer arguments to change. Now, not only does `__pure` not have to fall back to `const` but newlib offers it in their cdefs so we shouldn't need to redefine it. ----------------------------------------------------------------------- Summary of changes: include/kos/cdefs.h | 11 --- include/kos/net.h | 102 ++++++++++----------- kernel/arch/dreamcast/fs/vmufs.c | 2 +- kernel/arch/dreamcast/hardware/maple/controller.c | 4 +- kernel/arch/dreamcast/hardware/ubc.c | 6 +- kernel/arch/dreamcast/include/arch/arch.h | 6 +- kernel/arch/dreamcast/include/dc/fmath.h | 23 +++-- .../arch/dreamcast/include/dc/maple/controller.h | 4 +- kernel/arch/dreamcast/kernel/banner.c | 7 +- kernel/arch/dreamcast/kernel/gdb_stub.c | 8 +- kernel/arch/dreamcast/math/fmath.c | 22 ++--- kernel/arch/dreamcast/util/vmu_fb.c | 2 +- kernel/arch/dreamcast/util/vmu_pkg.c | 6 +- kernel/net/net_crc.c | 6 +- kernel/net/net_dhcp.c | 6 +- kernel/net/net_ipv4.c | 10 +- kernel/net/net_ipv4.h | 4 +- kernel/net/net_ipv4_frag.c | 2 +- kernel/net/net_ipv6.c | 2 +- kernel/thread/mutex.c | 2 +- 20 files changed, 112 insertions(+), 123 deletions(-) diff --git a/include/kos/cdefs.h b/include/kos/cdefs.h index dcb1f192..87ddcaa2 100644 --- a/include/kos/cdefs.h +++ b/include/kos/cdefs.h @@ -47,12 +47,6 @@ #define __noreturn __attribute__((__noreturn__)) #endif -#ifndef __pure -/** \brief Identify a function that has no side effects other than its return, - and only uses its arguments for any work. */ -#define __pure __attribute__((__const__)) -#endif - #ifndef __unused /** \brief Identify a function or variable that may be unused. */ #define __unused __attribute__((__unused__)) @@ -78,11 +72,6 @@ #define __dead2 __noreturn /* BSD compat */ #endif -#ifndef __pure2 -/** \brief Alias for \ref __pure. For BSD compatibility. */ -#define __pure2 __pure /* ditto */ -#endif - #ifndef __likely /** \brief Directive to inform the compiler the condition is in the likely path. diff --git a/include/kos/net.h b/include/kos/net.h index a23929af..786cac7b 100644 --- a/include/kos/net.h +++ b/include/kos/net.h @@ -299,7 +299,7 @@ void net_arp_shutdown(void); \param timestamp The entry's timestamp. Set to 0 for a permanent entry, otherwise set to the current number of milliseconds since boot (i.e, timer_ms_gettime64()). - + \retval 0 On success. \retval -1 Error allocating memory. */ @@ -320,7 +320,7 @@ int net_arp_insert(netif_t *nif, const uint8_t mac[6], const uint8_t ip[4], response comes in (if not found immediately). \param data Packet data to go with the header. \param data_size The size of data. - + \retval 0 On success. \retval -1 A query is outstanding for that address. \retval -2 Address not found, query generated. @@ -338,7 +338,7 @@ int net_arp_lookup(netif_t *nif, const uint8_t ip_in[4], uint8_t mac_out[6], \param nif The network device in use. \param ip_out Storage for the IPv4 address. \param mac_in The MAC address to look up. - + \retval 0 On success. \retval -1 On failure. */ @@ -350,7 +350,7 @@ int net_arp_revlookup(netif_t *nif, uint8_t ip_out[4], const uint8_t mac_in[6]); \param nif The network device in use. \param pkt The packet received. \param len The length of the packet. - + \retval 0 On success (no error conditions defined). */ int net_arp_input(netif_t *nif, const uint8_t *pkt, int len); @@ -360,7 +360,7 @@ int net_arp_input(netif_t *nif, const uint8_t *pkt, int len); \param nif The network device to use. \param ip The IP to query. - + \retval 0 On success (no error conditions defined). */ int net_arp_query(netif_t *nif, const uint8_t ip[4]); @@ -374,12 +374,12 @@ int net_arp_query(netif_t *nif, const uint8_t ip[4]); \param nif The network device in use. \param pkt The packet received. \param len The length of the packet, in bytes. - + \return 0 on success, <0 on failure. */ typedef int (*net_input_func)(netif_t *nif, const uint8_t *pkt, int len); -/** \brief Where will input packets be routed? +/** \brief Where will input packets be routed? \ingroup networking_drivers */ extern net_input_func net_input_target; @@ -394,7 +394,7 @@ extern net_input_func net_input_target; \param device The network device submitting packets. \param data The packet to submit. \param len The length of the packet, in bytes. - + \return 0 on success, <0 on failure. */ int net_input(netif_t *device, const uint8_t *data, int len); @@ -403,7 +403,7 @@ int net_input(netif_t *device, const uint8_t *data, int len); \ingroup networking_drivers \param t The new target callback. - + \return The old target. */ net_input_func net_input_set_target(net_input_func t); @@ -448,13 +448,13 @@ extern net_echo_cb net_icmp_echo_cb; \param seq A packet sequence number. \param data Data to send with the packet. \param size The size of the data to send. - + \return 0 on success, <0 on failure. */ int net_icmp_send_echo(netif_t *net, const uint8_t ipaddr[4], uint16_t ident, uint16_t seq, const uint8_t *data, size_t size); -/** \defgroup networking_icmp_unreach Unreachable Values +/** \defgroup networking_icmp_unreach Unreachable Values \brief Valid values for net_icmp_send_dest_unreach(). \ingroup networking_icmpv4 @{ @@ -470,7 +470,7 @@ int net_icmp_send_echo(netif_t *net, const uint8_t ipaddr[4], uint16_t ident, \param net The network device to use. \param code The type of message this is. \param msg The message that caused this error. - + \return 0 on success, <0 on failure. */ int net_icmp_send_dest_unreach(netif_t *net, uint8_t code, const uint8_t *msg); @@ -483,11 +483,11 @@ int net_icmp_send_dest_unreach(netif_t *net, uint8_t code, const uint8_t *msg); /** \brief Send an ICMP Time Exceeded packet in reply to the given message. \ingroup networking_icmp - + \param net The network device to use. \param code The type of message this is. \param msg The message that caused this error. - + \return 0 on success, <0 on failure. */ int net_icmp_send_time_exceeded(netif_t *net, uint8_t code, const uint8_t *msg); @@ -523,15 +523,15 @@ net_ipv4_stats_t net_ipv4_get_stats(void); \ingroup networking_ipv4 \param addr Array of IP address octets. - + \return The address, in host byte order. */ -uint32_t net_ipv4_address(const uint8_t addr[4]); +uint32_t __pure net_ipv4_address(const uint8_t addr[4]); /** \brief Parse an IP address that is packet into a uint32 into an array of the individual bytes. \ingroup networking_ipv4 - + \param addr The full address, in host byte order. \param out The output buffer. */ @@ -547,7 +547,7 @@ void net_ipv4_parse_address(uint32_t addr, uint8_t out[4]); /** \brief ICMPv6 echo reply callback type. \ingroup networking_icmpv6 - + \param ip The IPv6 address the reply is from. \param seq The sequence number of the packet. \param delta_us The time difference, in microseconds. @@ -566,14 +566,14 @@ extern net6_echo_cb net_icmp6_echo_cb; /** \brief Send an ICMPv6 Echo (PING6) packet to the specified device. \ingroup networking_icmpv6 - + \param net The network device to use. \param dst The address to send to. \param ident A packet identifier. \param seq A packet sequence number. \param data Data to send with the packet. \param size Length of the data, in bytes. - + \return 0 on success, <0 on failure. */ int net_icmp6_send_echo(netif_t *net, const struct in6_addr *dst, uint16_t ident, @@ -581,12 +581,12 @@ int net_icmp6_send_echo(netif_t *net, const struct in6_addr *dst, uint16_t ident /** \brief Send a Neighbor Solicitation packet on the specified device. \ingroup networking_icmpv6 - + \param net The network device to use. \param dst The destination address. \param target The target address. \param dupdet 1 if this is for duplicate detection. - + \return 0 on success, <0 on failure. */ int net_icmp6_send_nsol(netif_t *net, const struct in6_addr *dst, @@ -594,12 +594,12 @@ int net_icmp6_send_nsol(netif_t *net, const struct in6_addr *dst, /** \brief Send a Neighbor Advertisement packet on the specified device. \ingroup networking_icmpv6 - + \param net The network device to use. \param dst The destination address. \param target The target address. \param sol 1 if solicited, 0 otherwise. - + \return 0 on success, <0 on failure. */ int net_icmp6_send_nadv(netif_t *net, const struct in6_addr *dst, @@ -607,9 +607,9 @@ int net_icmp6_send_nadv(netif_t *net, const struct in6_addr *dst, /** \brief Send a Router Solicitation request on the specified interface. \ingroup networking_icmpv6 - + \param net The network device to use. - + \return 0 on success, <0 on failure. */ int net_icmp6_send_rsol(netif_t *net); @@ -638,7 +638,7 @@ int net_icmp6_send_rsol(netif_t *net); \param code The type of message this is. \param ppkt The message that caused this error. \param psz Size of the original message. - + \return 0 on success, <0 on failure. */ int net_icmp6_send_dest_unreach(netif_t *net, uint8_t code, const uint8_t *ppkt, @@ -648,7 +648,7 @@ int net_icmp6_send_dest_unreach(netif_t *net, uint8_t code, const uint8_t *ppkt, \brief Time exceeded codes for ICMPv6 \ingroup networking_icmpv6 - Only fragment reassembly time exceeded makes sense + Only fragment reassembly time exceeded makes sense @{ */ @@ -658,12 +658,12 @@ int net_icmp6_send_dest_unreach(netif_t *net, uint8_t code, const uint8_t *ppkt, /** \brief Send a time exceeded message on the specified interface. \ingroup networking_icmpv6 - + \param net The network device to use. \param code The error code. \param ppkt The message that caused this error. \param psz Size of the original packet. - + \return 0 on success, <0 on failure. */ int net_icmp6_send_time_exceeded(netif_t *net, uint8_t code, const uint8_t *ppkt, @@ -681,13 +681,13 @@ int net_icmp6_send_time_exceeded(netif_t *net, uint8_t code, const uint8_t *ppkt /** \brief Send an ICMPv6 Parameter Problem about the given packet. \ingroup networking_icmpv6 - + \param net The network device to use. \param code The error code. \param ptr Where in the packet is the error? \param ppkt The message that caused the error. \param psz Size of the original packet. - + \return 0 on success, <0 on failure. */ int net_icmp6_send_param_prob(netif_t *net, uint8_t code, uint32_t ptr, @@ -795,13 +795,13 @@ typedef struct net_udp_stats { } net_udp_stats_t; /** \brief Retrieve statistics from the UDP layer. - + \return The global UDP stats struct. */ net_udp_stats_t net_udp_get_stats(void); /** \brief Init UDP. - + \retval 0 On success (no error conditions defined). */ int net_udp_init(void); @@ -838,25 +838,25 @@ void net_tcp_shutdown(void); */ /** \brief Calculate a "little-endian" CRC-32 over a block of data. - + \param data The data to calculate over. \param size The size of the data, in bytes. - + \return The calculated CRC-32. */ -uint32_t net_crc32le(const uint8_t *data, int size); +uint32_t __pure net_crc32le(const uint8_t *data, int size); /** \brief Calculate a "big-endian" CRC-32 over a block of data. - + \param data The data to calculate over. \param size The size of the data, in bytes. - + \return The calculated CRC-32. */ -uint32_t net_crc32be(const uint8_t *data, int size); +uint32_t __pure net_crc32be(const uint8_t *data, int size); /** \brief Calculate a CRC16-CCITT over a block of data. - + \note Based on code found online at http://www.ccsinfo.com/forum/viewtopic.php?t=24977 @@ -866,10 +866,10 @@ uint32_t net_crc32be(const uint8_t *data, int size); return value from this function (if continuing a previous calculation) or some initial seed value (typically 0xFFFF or 0x0000). - + \return The calculated CRC16-CCITT. */ -uint16_t net_crc16ccitt(const uint8_t *data, int size, uint16_t start); +uint16_t __pure net_crc16ccitt(const uint8_t *data, int size, uint16_t start); /** @} */ @@ -921,14 +921,14 @@ void net_multicast_shutdown(void); /***** net_core.c *********************************************************/ -/** \brief Interface list; note: do not manipulate directly! +/** \brief Interface list; note: do not manipulate directly! \ingroup networking_drivers */ extern struct netif_list net_if_list; /** \brief Function to retrieve the interface list. \ingroup networking_drivers - + \warning Do not manipulate what this returns to you! @@ -936,8 +936,8 @@ extern struct netif_list net_if_list; */ struct netif_list * net_get_if_list(void); -/** \brief The default network device, used with sockets (read-only). - \ingroup networking_drivers +/** \brief The default network device, used with sockets (read-only). + \ingroup networking_drivers */ extern netif_t *net_default_dev; @@ -945,7 +945,7 @@ extern netif_t *net_default_dev; \ingroup networking_drivers \param n The device to set as default. - + \return The old default device. */ netif_t *net_set_default(netif_t *n); @@ -963,14 +963,14 @@ int net_reg_device(netif_t *device); \ingroup networking_drivers \param device The device to unregister. - + \return 0 on success, <0 on failure. */ int net_unreg_device(netif_t *device); /** \brief Init network support. \ingroup networking_drivers - + \note To auto-detect the IP address to assign to the default device (i.e, over DHCP or from the flashrom on the Dreamcast), pass 0 as the IP parameter. @@ -982,7 +982,7 @@ int net_unreg_device(netif_t *device); */ int net_init(uint32_t ip); -/** \brief Shutdown network support. +/** \brief Shutdown network support. \ingroup networking_drivers */ void net_shutdown(void); diff --git a/kernel/arch/dreamcast/fs/vmufs.c b/kernel/arch/dreamcast/fs/vmufs.c index 726c223f..f80b8613 100644 --- a/kernel/arch/dreamcast/fs/vmufs.c +++ b/kernel/arch/dreamcast/fs/vmufs.c @@ -49,7 +49,7 @@ Function comments located in vmufs.h. static mutex_t mutex; /* Convert a decimal number to BCD; max of two digits */ -static uint8 dec_to_bcd(int dec) { +static uint8 __pure dec_to_bcd(int dec) { uint8 rv = 0; rv = dec % 10; diff --git a/kernel/arch/dreamcast/hardware/maple/controller.c b/kernel/arch/dreamcast/hardware/maple/controller.c index eb60f696..e20f21fe 100644 --- a/kernel/arch/dreamcast/hardware/maple/controller.c +++ b/kernel/arch/dreamcast/hardware/maple/controller.c @@ -51,13 +51,13 @@ static TAILQ_HEAD(cont_btn_callback_list, cont_callback_params) btn_cbs; static mutex_t btn_cbs_mtx = MUTEX_INITIALIZER; /* Check whether the controller has EXACTLY the given capabilities. */ -int cont_is_type(const maple_device_t *cont, uint32_t type) { +int __pure cont_is_type(const maple_device_t *cont, uint32_t type) { return cont ? cont->info.function_data[CONT_FUNCTION_DATA_INDEX] == type : -1; } /* Check whether the controller has at LEAST the given capabilities. */ -int cont_has_capabilities(const maple_device_t *cont, uint32_t capabilities) { +int __pure cont_has_capabilities(const maple_device_t *cont, uint32_t capabilities) { return cont ? ((cont->info.function_data[CONT_FUNCTION_DATA_INDEX] & capabilities) == capabilities) : -1; } diff --git a/kernel/arch/dreamcast/hardware/ubc.c b/kernel/arch/dreamcast/hardware/ubc.c index ba59bc9e..4e96c666 100755 --- a/kernel/arch/dreamcast/hardware/ubc.c +++ b/kernel/arch/dreamcast/hardware/ubc.c @@ -76,7 +76,7 @@ static struct ubc_channel_state { } channel_state[ubc_channel_count] = { 0 }; /* Translates ubc_access_t to BBR.ID field format. */ -inline static uint8_t get_access_mask(ubc_access_t access) { +inline static uint8_t __pure get_access_mask(ubc_access_t access) { switch(access) { case ubc_access_either: return 0x3; @@ -86,7 +86,7 @@ inline static uint8_t get_access_mask(ubc_access_t access) { } /* Translates ubc_rw_t to BBR.RW field format. */ -inline static uint8_t get_rw_mask(ubc_rw_t rw) { +inline static uint8_t __pure get_rw_mask(ubc_rw_t rw) { switch(rw) { case ubc_rw_either: return 0x3; @@ -96,7 +96,7 @@ inline static uint8_t get_rw_mask(ubc_rw_t rw) { } /* Translates ubc_address_mask_t to BASR.BAM field format. */ -inline static uint8_t get_address_mask(ubc_address_mask_t addr_mask) { +inline static uint8_t __pure get_address_mask(ubc_address_mask_t addr_mask) { switch(addr_mask) { case ubc_address_mask_all: return 3; diff --git a/kernel/arch/dreamcast/include/arch/arch.h b/kernel/arch/dreamcast/include/arch/arch.h index cbc731cc..972bbd6a 100644 --- a/kernel/arch/dreamcast/include/arch/arch.h +++ b/kernel/arch/dreamcast/include/arch/arch.h @@ -340,7 +340,7 @@ int hardware_sys_mode(int *region); \return A pointer to the banner string. */ -const char *kos_get_banner(void); +const char * __pure kos_get_banner(void); /** \brief Retrieve the license information for the compiled copy of KOS. \ingroup attribution @@ -351,7 +351,7 @@ const char *kos_get_banner(void); ...<truncated>... hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: kosmirror <kos...@us...> - 2025-08-05 05:05: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 f26ec6edfd6df6508242b53122b8a9d51557a849 (commit) via 38ab23e4824f6ddc8f4359f039b5749c54b61714 (commit) from 7744fa682cf1ead22f6242439dfac52c45ec16ec (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 f26ec6edfd6df6508242b53122b8a9d51557a849 Author: darc <da...@pr...> Date: Mon Aug 4 16:28:10 2025 -0500 Make sysconf() arch agnostic and provide L2 cache specs commit 38ab23e4824f6ddc8f4359f039b5749c54b61714 Author: darc <da...@pr...> Date: Mon Aug 4 16:26:03 2025 -0500 Replace CPU_CACHE_BLOCK_SIZE with more detailed CPU cache specifications atomics.c and cdrom.c are also updated to reflect the new definitions. ----------------------------------------------------------------------- Summary of changes: kernel/arch/dreamcast/hardware/cdrom.c | 4 +-- kernel/arch/dreamcast/include/arch/cache.h | 55 ++++++++++++++++++++++++++++-- kernel/libc/c11/atomics.c | 2 +- kernel/libc/posix/sysconf.c | 22 ++++++++---- 4 files changed, 71 insertions(+), 12 deletions(-) diff --git a/kernel/arch/dreamcast/hardware/cdrom.c b/kernel/arch/dreamcast/hardware/cdrom.c index 8d7d3497..9d6c0922 100644 --- a/kernel/arch/dreamcast/hardware/cdrom.c +++ b/kernel/arch/dreamcast/hardware/cdrom.c @@ -812,8 +812,8 @@ static void unlock_dma_memory(void) { } } if(patched) { - flush_size = (patch_addr[1] - patch_addr[0]) + CPU_CACHE_BLOCK_SIZE; - flush_size &= ~(CPU_CACHE_BLOCK_SIZE - 1); + flush_size = (patch_addr[1] - patch_addr[0]) + CACHE_L1_ICACHE_LINESIZE; + flush_size &= ~(CACHE_L1_ICACHE_LINESIZE - 1); icache_flush_range(patch_addr[0] | MEM_AREA_P1_BASE, flush_size); } *prot_reg = G1_ATA_DMA_UNLOCK_ALLMEM; diff --git a/kernel/arch/dreamcast/include/arch/cache.h b/kernel/arch/dreamcast/include/arch/cache.h index dd29b659..28a89e19 100644 --- a/kernel/arch/dreamcast/include/arch/cache.h +++ b/kernel/arch/dreamcast/include/arch/cache.h @@ -4,6 +4,7 @@ Copyright (C) 2001 Megan Potter Copyright (C) 2014, 2016, 2023 Ruslan Rostovtsev Copyright (C) 2023 Andy Barajas + Copyright (C) 2025 Eric Fradella */ /** \file arch/cache.h @@ -34,11 +35,59 @@ __BEGIN_DECLS @{ */ -/** \brief SH4 cache block size. +/** \brief Level 1 instruction cache size. - The size of a cache block. + The capacity of the L1 instruction cache in bytes. */ -#define CPU_CACHE_BLOCK_SIZE 32 +#define CACHE_L1_ICACHE_SIZE 8 * 1024 + +/** \brief Level 1 instruction cache associativity. + + Number of ways in the L1 instruction cache. +*/ +#define CACHE_L1_ICACHE_ASSOC 1 + +/** \brief L1 instruction cache line size. + + The size of each cache line in the L1 instruction cache. +*/ +#define CACHE_L1_ICACHE_LINESIZE 32 + +/** \brief Level 1 data cache size. + + The capacity of the L1 data cache in bytes. +*/ +#define CACHE_L1_DCACHE_SIZE 16 * 1024 + +/** \brief Level 1 data cache associativity. + + Number of ways in the L1 data cache. +*/ +#define CACHE_L1_DCACHE_ASSOC 1 + +/** \brief L1 data cache line size. + + The size of each cache line in the L1 data cache. +*/ +#define CACHE_L1_DCACHE_LINESIZE 32 + +/** \brief Level 2 cache size. + + The capacity of the L2 cache in bytes. +*/ +#define CACHE_L2_CACHE_SIZE 0 + +/** \brief Level 2 cache associativity. + + Number of ways in the L2 cache. +*/ +#define CACHE_L2_CACHE_ASSOC 0 + +/** \brief Level 2 cache line size. + + The size of each cache line in the L2 cache. +*/ +#define CACHE_L2_CACHE_LINESIZE 0 /** \brief Flush the instruction cache. diff --git a/kernel/libc/c11/atomics.c b/kernel/libc/c11/atomics.c index 763d3c7d..e8effd85 100644 --- a/kernel/libc/c11/atomics.c +++ b/kernel/libc/c11/atomics.c @@ -110,7 +110,7 @@ ATOMIC_FETCH_NAND_N_(unsigned long long, 8) around memcpy() calls. */ /* Size of each memory region covered by an individual lock. */ -#define GENERIC_LOCK_BLOCK_SIZE (CPU_CACHE_BLOCK_SIZE * 4) +#define GENERIC_LOCK_BLOCK_SIZE (CACHE_L1_DCACHE_LINESIZE * 4) /* Locks have to be shared for each page with the MMU enabled, otherwise we can fail when aliasing an address range to multiple diff --git a/kernel/libc/posix/sysconf.c b/kernel/libc/posix/sysconf.c index 9192f134..0ba83708 100644 --- a/kernel/libc/posix/sysconf.c +++ b/kernel/libc/posix/sysconf.c @@ -2,6 +2,7 @@ sysconf.c Copyright (C) 2023, 2024, 2025 Falco Girgis + Copyright (C) 2025 Eric Fradella */ #include <arch/arch.h> @@ -51,22 +52,31 @@ long sysconf(int name) { return PAGESIZE; case _SC_LEVEL1_ICACHE_SIZE: - return 8 * 1024; + return CACHE_L1_ICACHE_SIZE; case _SC_LEVEL1_ICACHE_ASSOC: - return 1; + return CACHE_L1_ICACHE_ASSOC; case _SC_LEVEL1_ICACHE_LINESIZE: - return CPU_CACHE_BLOCK_SIZE; + return CACHE_L1_ICACHE_LINESIZE; case _SC_LEVEL1_DCACHE_SIZE: - return 16 * 1024; + return CACHE_L1_DCACHE_SIZE; case _SC_LEVEL1_DCACHE_ASSOC: - return 1; + return CACHE_L1_DCACHE_ASSOC; case _SC_LEVEL1_DCACHE_LINESIZE: - return CPU_CACHE_BLOCK_SIZE; + return CACHE_L1_DCACHE_LINESIZE; + + case _SC_LEVEL2_CACHE_SIZE: + return CACHE_L2_CACHE_SIZE; + + case _SC_LEVEL2_CACHE_ASSOC: + return CACHE_L2_CACHE_ASSOC; + + case _SC_LEVEL2_CACHE_LINESIZE: + return CACHE_L2_CACHE_LINESIZE; case _SC_SEM_NSEMS_MAX: return UINT32_MAX; hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: kosmirror <kos...@us...> - 2025-08-05 05:02: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 7744fa682cf1ead22f6242439dfac52c45ec16ec (commit) via 59e1b7706c53f22fcd3787bd304b33695da20824 (commit) via 844f8babb0a7fe714c15bdc4e63c4dff36e5f2d0 (commit) via da3174025025025e2667dc383ae0e1e27c79014b (commit) via 0965ee1e3e47afd6a4a05c2a30d18fb40d2c3246 (commit) from 3df833497711472b1b0d8546dfcdf5031d3c6fe7 (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 7744fa682cf1ead22f6242439dfac52c45ec16ec Author: QuzarDC <qu...@co...> Date: Fri May 30 03:14:17 2025 -0400 Change mutex type to unsigned int. This allows for simplified invalid type checks. commit 59e1b7706c53f22fcd3787bd304b33695da20824 Author: QuzarDC <qu...@co...> Date: Thu May 29 22:55:11 2025 -0400 Constify params. Where appropriate mark that the passed pointer will not be used to change its data. This is mostly seen in accessors but also with genwait's sleep `obj`. commit 844f8babb0a7fe714c15bdc4e63c4dff36e5f2d0 Author: QuzarDC <qu...@co...> Date: Thu May 22 21:42:58 2025 -0400 Mark function params as non-null for safety and optimization. In each of these there are no tests being done to verify that the input is non-null, and it has already been up to the caller to ensure that before using. commit da3174025025025e2667dc383ae0e1e27c79014b Author: QuzarDC <qu...@co...> Date: Fri May 23 10:16:17 2025 -0400 Remove deprecated dynamic sync primitive creations. These were all deprecated in 2012. Finally being removed. Recursive locks were additionally replaced entirely by recursive type mutexes. commit 0965ee1e3e47afd6a4a05c2a30d18fb40d2c3246 Author: QuzarDC <qu...@co...> Date: Fri May 23 09:10:04 2025 -0400 Correct param name mismatch in sem.c/h For some reason the .h had all params as `sem` while the .c had all but one as `sm`. Shifted them all to `sm` to match the majority within the .c. ----------------------------------------------------------------------- Summary of changes: addons/libpthread/pthread_mutex_init.c | 3 +- include/kos/cond.h | 42 +++----- include/kos/genwait.h | 16 +-- include/kos/mutex.h | 45 +++----- include/kos/recursive_lock.h | 141 -------------------------- include/kos/rwsem.h | 58 ++++------- include/kos/sem.h | 48 +++------ include/kos/thread.h | 1 - kernel/arch/dreamcast/include/arch/spinlock.h | 6 +- kernel/exports.txt | 3 - kernel/thread/Makefile | 2 +- kernel/thread/cond.c | 25 +---- kernel/thread/genwait.c | 30 +++--- kernel/thread/mutex.c | 41 ++------ kernel/thread/recursive_lock.c | 58 ----------- kernel/thread/rwsem.c | 28 +---- kernel/thread/sem.c | 56 +++------- 17 files changed, 112 insertions(+), 491 deletions(-) delete mode 100644 include/kos/recursive_lock.h delete mode 100644 kernel/thread/recursive_lock.c diff --git a/addons/libpthread/pthread_mutex_init.c b/addons/libpthread/pthread_mutex_init.c index fbfa038c..572d3d5b 100644 --- a/addons/libpthread/pthread_mutex_init.c +++ b/addons/libpthread/pthread_mutex_init.c @@ -12,7 +12,8 @@ int pthread_mutex_init(pthread_mutex_t *__RESTRICT mutex, const pthread_mutexattr_t *__RESTRICT attr) { - int type = MUTEX_TYPE_NORMAL, old, rv = 0; + unsigned int type = MUTEX_TYPE_NORMAL; + int old, rv = 0; if(attr) { switch(attr->mtype) { diff --git a/include/kos/cond.h b/include/kos/cond.h index 6cc9cf95..8b954007 100644 --- a/include/kos/cond.h +++ b/include/kos/cond.h @@ -60,48 +60,30 @@ __BEGIN_DECLS */ typedef struct condvar { int dummy; - int dynamic; } condvar_t; /** \brief Initializer for a transient condvar. */ -#define COND_INITIALIZER { 0, 0 } - -/** \brief Allocate a new condition variable. - - This function allocates and initializes a new condition variable for use. - - \deprecated - This function is formally deprecated and should not be used in new code. - Instead you should use either the static initializer or the cond_init() - function. - - \return The created condvar on success. NULL is returned on - failure and errno is set as appropriate. - - \par Error Conditions: - \em ENOMEM - out of memory -*/ -condvar_t *cond_create(void) __depr("Use cond_init or COND_INITIALIZER."); +#define COND_INITIALIZER { 0 } /** \brief Initialize a condition variable. This function initializes a new condition variable for use. \param cv The condition variable to initialize - \retval 0 On success - \retval -1 On error, sets errno as appropriate + \retval 0 On success (no error conditions currently defined) */ -int cond_init(condvar_t *cv); +int cond_init(condvar_t *cv) __nonnull_all; /** \brief Free a condition variable. - This function frees a condition variable, releasing all memory associated - with it (but not with the mutex that is associated with it). This will also - wake all threads waiting on the condition. + This function destroys a condition variable (but not the mutex + that is associated with it). This will also wake all threads waiting + on the condition. + \param cv The condition variable to destroy \retval 0 On success (no error conditions currently defined) */ -int cond_destroy(condvar_t *cv); +int cond_destroy(condvar_t *cv) __nonnull_all; /** \brief Wait on a condition variable. @@ -124,7 +106,7 @@ int cond_destroy(condvar_t *cv); \em EINVAL - the mutex is not initialized or not locked \n \em ENOTRECOVERABLE - the condvar was destroyed while waiting */ -int cond_wait(condvar_t *cv, mutex_t * m); +int cond_wait(condvar_t *cv, mutex_t * m) __nonnull_all; /** \brief Wait on a condition variable with a timeout. @@ -150,7 +132,7 @@ int cond_wait(condvar_t *cv, mutex_t * m); \em EINVAL - the mutex is not initialized or not locked \n \em ENOTRECOVERABLE - the condvar was destroyed while waiting */ -int cond_wait_timed(condvar_t *cv, mutex_t * m, int timeout); +int cond_wait_timed(condvar_t *cv, mutex_t * m, int timeout) __nonnull_all; /** \brief Signal a single thread waiting on the condition variable. @@ -165,7 +147,7 @@ int cond_wait_timed(condvar_t *cv, mutex_t * m, int timeout); \par Error Conditions: \em EINVAL - the condvar was not initialized */ -int cond_signal(condvar_t *cv); +int cond_signal(condvar_t *cv) __nonnull_all; /** \brief Signal all threads waiting on the condition variable. @@ -180,7 +162,7 @@ int cond_signal(condvar_t *cv); \par Error Conditions: \em EINVAL - the condvar was not initialized */ -int cond_broadcast(condvar_t *cv); +int cond_broadcast(condvar_t *cv) __nonnull_all; __END_DECLS diff --git a/include/kos/genwait.h b/include/kos/genwait.h index d2927f6a..0f480a73 100644 --- a/include/kos/genwait.h +++ b/include/kos/genwait.h @@ -47,7 +47,7 @@ __BEGIN_DECLS \par Error Conditions: \em EAGAIN - on timeout */ -int genwait_wait(void * obj, const char * mesg, int timeout, void (*callback)(void *)); +int genwait_wait(void *obj, const char *mesg, int timeout, void (*callback)(void *)); /* Wake up N threads waiting on the given object. If cnt is <=0, then we wake all threads. Returns the number of threads actually woken. */ @@ -67,7 +67,7 @@ int genwait_wait(void * obj, const char * mesg, int timeout, void (*callback)(vo threads. \return The number of threads woken */ -int genwait_wake_cnt(void * obj, int cnt, int err); +int genwait_wake_cnt(const void *obj, int cnt, int err); /** \brief Wake up all threads sleeping on an object. @@ -76,7 +76,7 @@ int genwait_wake_cnt(void * obj, int cnt, int err); \param obj The object to wake threads that are sleeping on it \see genwait_wake_cnt() */ -void genwait_wake_all(void * obj); +void genwait_wake_all(const void *obj); /** \brief Wake up one thread sleeping on an object. @@ -85,7 +85,7 @@ void genwait_wake_all(void * obj); \param obj The object to wake threads that are sleeping on it \see genwait_wake_cnt() */ -void genwait_wake_one(void * obj); +void genwait_wake_one(const void *obj); /** \brief Wake up all threads sleeping on an object, with an error. @@ -95,7 +95,7 @@ void genwait_wake_one(void * obj); \param err The value to set in the threads' errno values \see genwait_wake_cnt() */ -void genwait_wake_all_err(void *obj, int err); +void genwait_wake_all_err(const void *obj, int err); /** \brief Wake up one thread sleeping on an object, with an error. @@ -105,7 +105,7 @@ void genwait_wake_all_err(void *obj, int err); \param err The value to set in the threads' errno values \see genwait_wake_cnt() */ -void genwait_wake_one_err(void *obj, int err); +void genwait_wake_one_err(const void *obj, int err); /** \brief Wake up a specific thread that is sleeping on an object. @@ -113,7 +113,7 @@ void genwait_wake_one_err(void *obj, int err); specified object. \param obj The object to wake the thread from - \param thd The specific thread to wake + \param thd The specific thread to wake (non-null). \param err The errno code to set as the errno value on the woken thread. If this is 0 (EOK), then the thread's errno will not be changed, and the thread will get a @@ -124,7 +124,7 @@ void genwait_wake_one_err(void *obj, int err); \return The number of threads woken, which should be 1 on success. */ -int genwait_wake_thd(void *obj, kthread_t *thd, int err); +int genwait_wake_thd(const void *obj, kthread_t *thd, int err) __nonnull((2)); /** \brief Look for timed out genwait_wait() calls. diff --git a/include/kos/mutex.h b/include/kos/mutex.h index 243b5cc6..3fb273c6 100644 --- a/include/kos/mutex.h +++ b/include/kos/mutex.h @@ -66,8 +66,7 @@ __BEGIN_DECLS \headerfile kos/mutex.h */ typedef struct kos_mutex { - int type; - int dynamic; + unsigned int type; kthread_t *holder; int count; } mutex_t; @@ -84,34 +83,20 @@ typedef struct kos_mutex { #define MUTEX_TYPE_OLDNORMAL 1 /**< \brief Alias for MUTEX_TYPE_NORMAL */ #define MUTEX_TYPE_ERRORCHECK 2 /**< \brief Error-checking mutex type */ #define MUTEX_TYPE_RECURSIVE 3 /**< \brief Recursive mutex type */ +#define MUTEX_TYPE_DESTROYED 4 /**< \brief Mutex that has been destroyed */ /** \brief Default mutex type */ #define MUTEX_TYPE_DEFAULT MUTEX_TYPE_NORMAL /** @} */ /** \brief Initializer for a transient mutex. */ -#define MUTEX_INITIALIZER { MUTEX_TYPE_NORMAL, 0, NULL, 0 } +#define MUTEX_INITIALIZER { MUTEX_TYPE_NORMAL, NULL, 0 } /** \brief Initializer for a transient error-checking mutex. */ -#define ERRORCHECK_MUTEX_INITIALIZER { MUTEX_TYPE_ERRORCHECK, 0, NULL, 0 } +#define ERRORCHECK_MUTEX_INITIALIZER { MUTEX_TYPE_ERRORCHECK, NULL, 0 } /** \brief Initializer for a transient recursive mutex. */ -#define RECURSIVE_MUTEX_INITIALIZER { MUTEX_TYPE_RECURSIVE, 0, NULL, 0 } - -/** \brief Allocate a new mutex. - - \deprecated - This function allocates and initializes a new mutex for use. This function - will always create mutexes of the type MUTEX_TYPE_NORMAL. - - \return The newly created mutex on success, or NULL on - failure (errno will be set as appropriate). - - \note This function is formally deprecated. It should not - be used in any future code, and may be removed in - the future. You should instead use mutex_init(). -*/ -mutex_t *mutex_create(void) __depr("Use mutex_init or an initializer."); +#define RECURSIVE_MUTEX_INITIALIZER { MUTEX_TYPE_RECURSIVE, NULL, 0 } /** \brief Initialize a new mutex. @@ -128,7 +113,7 @@ mutex_t *mutex_create(void) __depr("Use mutex_init or an initializer."); \sa mutex_types */ -int mutex_init(mutex_t *m, int mtype); +int mutex_init(mutex_t *m, unsigned int mtype) __nonnull_all; /** \brief Destroy a mutex. @@ -139,13 +124,15 @@ int mutex_init(mutex_t *m, int mtype); This function can be called on statically initialized as well as dynamically initialized mutexes. + \param m The mutex to destroy + \retval 0 On success \retval -1 On error, errno will be set as appropriate \par Error Conditions: \em EBUSY - the mutex is currently locked */ -int mutex_destroy(mutex_t *m); +int mutex_destroy(mutex_t *m) __nonnull_all; /** \brief Lock a mutex. @@ -165,7 +152,7 @@ int mutex_destroy(mutex_t *m); \em EAGAIN - lock has been acquired too many times (recursive) \n \em EDEADLK - would deadlock (error-checking) */ -int mutex_lock(mutex_t *m); +int mutex_lock(mutex_t *m) __nonnull_all; /** \brief Lock a mutex. @@ -188,7 +175,7 @@ int mutex_lock(mutex_t *m); already locked \n \em EDEADLK - would deadlock (error-checking) */ -int mutex_lock_irqsafe(mutex_t *m); +int mutex_lock_irqsafe(mutex_t *m) __nonnull_all; /** \brief Lock a mutex (with a timeout). @@ -211,7 +198,7 @@ int mutex_lock_irqsafe(mutex_t *m); \em EAGAIN - lock has been acquired too many times (recursive) \n \em EDEADLK - would deadlock (error-checking) */ -int mutex_lock_timed(mutex_t *m, int timeout); +int mutex_lock_timed(mutex_t *m, int timeout) __nonnull_all; /** \brief Check if a mutex is locked. @@ -224,7 +211,7 @@ int mutex_lock_timed(mutex_t *m, int timeout); \retval 0 If the mutex is not currently locked \retval 1 If the mutex is currently locked */ -int mutex_is_locked(mutex_t *m); +int mutex_is_locked(const mutex_t *m) __nonnull_all; /** \brief Attempt to lock a mutex. @@ -244,7 +231,7 @@ int mutex_is_locked(mutex_t *m); \em EAGAIN - lock has been acquired too many times (recursive) \n \em EDEADLK - would deadlock (error-checking) */ -int mutex_trylock(mutex_t *m); +int mutex_trylock(mutex_t *m) __nonnull_all; /** \brief Unlock a mutex. @@ -259,7 +246,7 @@ int mutex_trylock(mutex_t *m); \em EPERM - the current thread does not own the mutex (error-checking or recursive) */ -int mutex_unlock(mutex_t *m); +int mutex_unlock(mutex_t *m) __nonnull_all; /** \brief Unlock a mutex under another thread's authority. @@ -276,7 +263,7 @@ int mutex_unlock(mutex_t *m); \em EPERM - the specified thread does not own the mutex \n \em EACCES - called outside an IRQ handler */ -int mutex_unlock_as_thread(mutex_t *m, kthread_t *thd); +int mutex_unlock_as_thread(mutex_t *m, kthread_t *thd) __nonnull_all; /** \cond */ static inline void __mutex_scoped_cleanup(mutex_t **m) { diff --git a/include/kos/recursive_lock.h b/include/kos/recursive_lock.h deleted file mode 100644 index 83ae7588..00000000 --- a/include/kos/recursive_lock.h +++ /dev/null @@ -1,141 +0,0 @@ -/* KallistiOS ##version## - - include/kos/recursive_lock.h - Copyright (C) 2008, 2010, 2012 Lawrence Sebald - -*/ - -/** \file kos/recursive_lock.h - \brief Definitions for a recursive mutex. - \ingroup kthreads - - This file defines a recursive lock mechanism, similar to a mutex, but that a - single thread can obtain as many times as it wants. A single thread is still - limited to holding the lock at a time, but it can hold it an "unlimited" - number of times (actually limited to INT_MAX, but who's counting). - - \deprecated - These are now just wrappers around the MUTEX_TYPE_RECURSIVE that is now - provided and will be removed at some point in the future. Please update your - code to use that type instead. - - \author Lawrence Sebald -*/ - -#ifndef __KOS_RECURSIVE_LOCK_H -#define __KOS_RECURSIVE_LOCK_H - -#include <kos/cdefs.h> - -__BEGIN_DECLS - -#include <kos/mutex.h> - -/** \brief Recursive lock structure. - - Recursive locks are just a simple wrapper around mutexes at this point. You - should not use this type in any new code. - - \headerfile kos/recursive_lock.h -*/ -typedef mutex_t recursive_lock_t; - -/** \brief Allocate a new recursive lock. - - \deprecated - This function allocates a new recursive lock that is initially not locked. - - \return The created lock, or NULL on failure (errno will be set to ENOMEM to - indicate that the system appears to be out of memory). -*/ -recursive_lock_t *rlock_create(void) __depr("Use mutexes instead."); - -/** \brief Destroy a recursive lock. - - \deprecated - This function cleans up a recursive lock. It is an error to attempt to - destroy a locked recursive lock. - - \param l The recursive lock to destroy. It must be unlocked. -*/ -void rlock_destroy(recursive_lock_t *l) __depr("Use mutexes instead."); - -/** \brief Lock a recursive lock. - - \deprecated - This function attempts to lock the requested lock, and if it cannot it will - block until that is possible. - - \param l The recursive lock to lock. - \retval -1 On error, errno will be set to EPERM if this function is - called inside an interrupt, or EINTR if it is interrupted. - \retval 0 On success. - \sa rlock_trylock - \sa rlock_lock_timed -*/ -int rlock_lock(recursive_lock_t *l) __depr("Use mutexes instead."); - -/** \brief Lock a recursive lock (with a timeout). - - \deprecated - This function attempts to lock the requested lock, and if it cannot it will - block until either it is possible to acquire the lock or timeout - milliseconds have elapsed. - - \param l The recursive lock to lock. - \param timeout The maximum number of milliseconds to wait. 0 is an - unlimited timeout (equivalent to rlock_lock). - \retval -1 On error, errno will be set to EPERM if this function is - called inside an interrupt, EINTR if the function is - interrupted, or EAGAIN if the timeout expires. - \retval 0 On success. - \sa rlock_trylock - \sa rlock_lock_timed -*/ -int rlock_lock_timed(recursive_lock_t *l, int timeout) - __depr("Use mutexes instead."); - -/** \brief Unlock a recursive lock. - - \deprecated - This function releases the lock one time from the current thread. - - \param l The recursive lock to unlock. - \retval -1 On error, errno will be set to EPERM if the lock is not held - by the calling thread. - \retval 0 On success. -*/ -int rlock_unlock(recursive_lock_t *l) __depr("Use mutexes instead."); - -/** \brief Attempt to lock a recursive lock without blocking. - - \deprecated - This function attempts to lock a recursive lock without blocking. This - function, unlike rlock_lock and rlock_lock_timed is safe to call inside an - interrupt. - - \param l The recursive lock to lock. - \retval -1 On error, errno will be set to EWOULDBLOCK if the lock is - currently held by another thread. - \retval 0 On success. - \sa rlock_lock - \sa rlock_lock_timed -*/ -int rlock_trylock(recursive_lock_t *l) __depr("Use mutexes instead."); - -/** \brief Check if a recursive lock is currently held by any thread. - - \deprecated - This function checks whether or not a lock is currently held by any thread, - including the calling thread. Note that this is <b>NOT</b> a safe way to - check if a lock <em>will</em> be held by the time you get around to locking - it. - - \retval TRUE If the lock is held by any thread. - \retval FALSE If the lock is not currently held by any thread. -*/ -int rlock_is_locked(recursive_lock_t *l) __depr("Use mutexes instead."); - -__END_DECLS - -#endif /* !__KOS_RECURSIVE_LOCK_H */ diff --git a/include/kos/rwsem.h b/include/kos/rwsem.h index ad2a05d2..d7612a63 100644 --- a/include/kos/rwsem.h +++ b/include/kos/rwsem.h @@ -41,9 +41,6 @@ __BEGIN_DECLS \headerfile kos/rwsem.h */ typedef struct rw_semaphore { - /** \brief Was this structure created with rwsem_create()? */ - int dynamic; - /** \brief The number of readers that are currently holding the lock. */ int read_count; @@ -55,24 +52,7 @@ typedef struct rw_semaphore { ...<truncated>... hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: kosmirror <kos...@us...> - 2025-08-05 03:05: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 3df833497711472b1b0d8546dfcdf5031d3c6fe7 (commit) from 5a91091e37421e9b15678dc086d111386f80fbbb (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 3df833497711472b1b0d8546dfcdf5031d3c6fe7 Author: Falco Girgis <gyr...@gm...> Date: Mon Aug 4 22:04:49 2025 -0500 Added flag for disabling TLS for individual threads. (#1045) I thought of a potential optimization the other day for how we handle TLS that could lead to some RAM savings... Say that we KNOW a thread is just some little simple task that is never accessing any TLS variables. If we were able to tell the kernel this is the case, we could avoid allocating a TLS segment that will never be used for that particular thread. ...and we already have two very good use-cases immediately within the kernel: the reaper and idle threads are not going to be accessing any TLS variables, yet they're getting their own copies of them allocated upon their creation. 1) Added THD_DISABLE_TLS to kthread_flags_t for signaling to the kernel that we're not using TLS for a particular thread. 2) Added kthread_attr_t::disable_tls flag for telling the kernel we don't want TLS when spawning a thread and passing its attributes. - notice it's the last member of the struct, so I don't break backwards compat, also it's the NEGATIVE so a 0 default value keeps the old functionality 3) Added checks to thread.c when creating and destroying threads to see whether THD_DISABLE_TLS is used, and if so, skip TLS segment processing. 4) Made the [reaper] and [idle] threads, by default, disable TLS. I validated these changes by rerunning my TLS test located in: examples/dreamcast/basic/threading/compiler_tls. Everything looks good! ----------------------------------------------------------------------- Summary of changes: include/kos/thread.h | 18 ++++++++++-------- kernel/thread/thread.c | 33 +++++++++++++++++++-------------- 2 files changed, 29 insertions(+), 22 deletions(-) diff --git a/include/kos/thread.h b/include/kos/thread.h index 98457f43..581dc1af 100644 --- a/include/kos/thread.h +++ b/include/kos/thread.h @@ -4,7 +4,7 @@ Copyright (C) 2000, 2001, 2002, 2003 Megan Potter Copyright (C) 2009, 2010, 2016, 2023 Lawrence Sebald Copyright (C) 2023 Colton Pawielski - Copyright (C) 2023, 2024 Falco Girgis + Copyright (C) 2023, 2024, 2025 Falco Girgis */ @@ -128,11 +128,12 @@ LIST_HEAD(ktlist, kthread); @{ */ -#define THD_DEFAULTS 0 /**< \brief Defaults: no flags */ -#define THD_USER 1 /**< \brief Thread runs in user mode */ -#define THD_QUEUED 2 /**< \brief Thread is in the run queue */ -#define THD_DETACHED 4 /**< \brief Thread is detached */ -#define THD_OWNS_STACK 8 /**< \brief Thread manages stack lifetime */ +#define THD_DEFAULTS 0x0 /**< \brief Defaults: no flags */ +#define THD_USER 0x1 /**< \brief Thread runs in user mode */ +#define THD_QUEUED 0x2 /**< \brief Thread is in the run queue */ +#define THD_DETACHED 0x4 /**< \brief Thread is detached */ +#define THD_OWNS_STACK 0x8 /**< \brief Thread manages stack lifetime */ +#define THD_DISABLE_TLS 0x10 /**< \brief Thread does not use TLS variables */ /** @} */ /** \brief Kernel thread flags type */ @@ -150,8 +151,6 @@ typedef enum kthread_state { STATE_FINISHED = 0x0004 /**< \brief Finished execution */ } kthread_state_t; - - /** \brief Structure describing one running thread. Each thread has one of these structures assigned to it, which holds all the @@ -289,6 +288,9 @@ typedef struct kthread_attr { /** \brief Thread label. */ const char *label; + + /** \brief 1 if the thread doesn't use thread_local variables. */ + bool disable_tls; } kthread_attr_t; /** \brief kthread mode values diff --git a/kernel/thread/thread.c b/kernel/thread/thread.c index 374235a2..1a4b20f0 100644 --- a/kernel/thread/thread.c +++ b/kernel/thread/thread.c @@ -4,7 +4,7 @@ Copyright (C) 2000, 2001, 2002, 2003 Megan Potter Copyright (C) 2010, 2016, 2023 Lawrence Sebald Copyright (C) 2023 Colton Pawielski - Copyright (C) 2023, 2024 Falco Girgis + Copyright (C) 2023, 2024, 2025 Falco Girgis */ #include <assert.h> @@ -368,7 +368,7 @@ kthread_t *thd_create_ex(const kthread_attr_t *restrict attr, kthread_t *nt = NULL; tid_t tid; uint32_t params[4]; - kthread_attr_t real_attr = { false, THD_STACK_SIZE, NULL, PRIO_DEFAULT, NULL }; + kthread_attr_t real_attr = { false, THD_STACK_SIZE, NULL, PRIO_DEFAULT, NULL, false }; if(attr) real_attr = *attr; @@ -430,8 +430,10 @@ kthread_t *thd_create_ex(const kthread_attr_t *restrict attr, ((uint32_t)nt->stack) + nt->stack_size, (uint32_t)thd_birth, params, 0); - /* Create static TLS data */ - if(!arch_tls_setup_data(nt)) { + /* Create static TLS data if the thread hasn't disabled it. */ + if(real_attr.disable_tls) { + nt->flags |= THD_DISABLE_TLS; + } else if(!arch_tls_setup_data(nt)) { if(nt->flags & THD_OWNS_STACK) free(nt->stack); free(nt); @@ -526,8 +528,9 @@ int thd_destroy(kthread_t *thd) { if(thd->flags & THD_OWNS_STACK) free(thd->stack); - /* Free static TLS segment */ - arch_tls_destroy_data(thd); + /* Free static TLS segment (if it hasn't been disabled for the thread). */ + if(!(thd->flags & THD_DISABLE_TLS)) + arch_tls_destroy_data(thd); /* Free the thread */ free(thd); @@ -1004,17 +1007,19 @@ int thd_init(void) { }; const kthread_attr_t reaper_attr = { - .stack_size = sizeof(thd_reaper_stack), - .stack_ptr = thd_reaper_stack, - .prio = 1, - .label = "[reaper]" + .stack_size = sizeof(thd_reaper_stack), + .stack_ptr = thd_reaper_stack, + .prio = 1, + .label = "[reaper]" + .disable_tls = true }; const kthread_attr_t idle_attr = { - .stack_size = sizeof(thd_idle_stack), - .stack_ptr = thd_idle_stack, - .prio = PRIO_MAX, - .label = "[idle]" + .stack_size = sizeof(thd_idle_stack), + .stack_ptr = thd_idle_stack, + .prio = PRIO_MAX, + .label = "[idle]" + .disable_tls = true }; kthread_t *kern; hooks/post-receive -- A pseudo Operating System for the Dreamcast. |