From: kosmirror <kos...@us...> - 2025-09-25 15:45:15
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via 91e03e8fbb7b217647faf38fedf4a5ae7499674a (commit) via 8767beb0305dedc3727e88bba9ff2fa9d92a2aa3 (commit) via d21f3323a31a8b31002f9a5b521362b6943fff23 (commit) via e392dbac1bbb0dd358bf25885b70b5b85fb83de8 (commit) via 12083926c41f7d8b40bcc9fdff5c21af2ef0d96a (commit) from 7d8cba2c46866dd4b757557826fe2967844fb520 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 91e03e8fbb7b217647faf38fedf4a5ae7499674a Author: QuzarDC <qu...@co...> Date: Tue Sep 23 21:59:03 2025 -0400 newlib: Remove patching of `<sys/sched.h>` This may have been needed when it was originally added, but the file is effectively identical to what is provided by newlib and there doesn't seem to be any need for it anymore. commit 8767beb0305dedc3727e88bba9ff2fa9d92a2aa3 Author: QuzarDC <qu...@co...> Date: Tue Sep 23 21:41:40 2025 -0400 newlib: Stop including `<arch/types.h>` in `<sys/_types.h>` This prevents the types from unavoidably leaking out into standard headers, which has been a cause of a number of issues for users especially with 3rd party libs. A number of internal files were relying on this though, and had to be modified to either get those types through explicit use of `<arch/types.h>` or to stop using those types (in the cases where it was a minimal change). In kos-ports this was still being relied on by libimageload, which has also been updated to match. commit d21f3323a31a8b31002f9a5b521362b6943fff23 Author: QuzarDC <qu...@co...> Date: Tue Sep 23 20:40:45 2025 -0400 newlib: Move kos time implementation to correct path. We were forcing this time implementation info to be included in most of the same places it should be by tacking it onto `<sys/_types.h>`. Instead, place it in `<machine/time.h>` which is where newlib is set up to pick up this info by including that in `<time.h>`. commit e392dbac1bbb0dd358bf25885b70b5b85fb83de8 Author: QuzarDC <qu...@co...> Date: Tue Sep 23 20:11:40 2025 -0400 newlib: Remove endian defines already provided by newlib. These should be accesible easily from various `sys` headers' include chains (so nobody should have needed it from _types). I added the narrowest include to byteorder.h to have it access them and removed from our sys/_types. commit 12083926c41f7d8b40bcc9fdff5c21af2ef0d96a Author: QuzarDC <qu...@co...> Date: Tue Sep 23 02:38:17 2025 -0400 newlib: Remove patching of `AT_` fcntl defines. These are now corectly provided by versions of newlib that KOS supports, but require `__BSD_VISIBLE || __POSIX_VISIBLE >= 200809` so the language standard for `libkosext2fs` had to be updated to have gnu extensions in order to levereage them. ----------------------------------------------------------------------- Summary of changes: addons/libkosext2fs/Makefile | 2 +- include/{kos => machine}/time.h | 6 ++-- include/sys/_types.h | 42 ---------------------- include/sys/sched.h | 29 --------------- kernel/arch/dreamcast/hardware/ubc.c | 14 ++++---- kernel/arch/dreamcast/hardware/vblank.c | 3 +- kernel/arch/dreamcast/include/arch/byteorder.h | 3 ++ kernel/arch/dreamcast/include/dc/fb_console.h | 1 + kernel/arch/dreamcast/include/dc/modem/modem.h | 2 ++ .../dreamcast/include/dc/net/broadband_adapter.h | 2 ++ utils/dc-chain/scripts/newlib.mk | 1 - 11 files changed, 21 insertions(+), 84 deletions(-) rename include/{kos => machine}/time.h (97%) delete mode 100644 include/sys/sched.h diff --git a/addons/libkosext2fs/Makefile b/addons/libkosext2fs/Makefile index 0a4f9a79..108d7d21 100644 --- a/addons/libkosext2fs/Makefile +++ b/addons/libkosext2fs/Makefile @@ -6,6 +6,6 @@ OBJS = ext2fs.o bitops.o block.o inode.o superblock.o fs_ext2.o symlink.o \ directory.o # Make sure everything compiles nice and cleanly (or not at all). -KOS_CFLAGS += -W -pedantic -Werror -std=c99 +KOS_CFLAGS += -W -pedantic -Werror -std=gnu99 include $(KOS_BASE)/addons/Makefile.prefab diff --git a/include/kos/time.h b/include/machine/time.h similarity index 97% rename from include/kos/time.h rename to include/machine/time.h index 5fa1f7ba..c47a5c9f 100644 --- a/include/kos/time.h +++ b/include/machine/time.h @@ -1,11 +1,11 @@ /* KallistiOS ##version## - kos/time.h + machine/time.h Copyright (C) 2023 Lawrence Sebald Copyright (C) 2024 Falco Girgis */ -/** \file kos/time.h +/** \file machine/time.h \brief KOS-implementation of select C11 and POSIX extensions Add select POSIX extensions, C11, and C23 functionality to time.h which are not @@ -40,7 +40,7 @@ __BEGIN_DECLS #define __STDC_VERSION_TIME_H__ 202311L /* Microsecond resolution for clock(), per POSIX standard.. */ -#define CLOCKS_PER_SEC 1000000 +#define _CLOCKS_PER_SEC_ 1000000 /* =============== Enable the following for >=c11, >=c++17 =================== */ #if (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L)) || \ diff --git a/include/sys/_types.h b/include/sys/_types.h index 3110877d..cb8d653b 100644 --- a/include/sys/_types.h +++ b/include/sys/_types.h @@ -155,48 +155,11 @@ typedef _TIMER_T_ __timer_t; typedef _CLOCK_T_ __clock_t; -/* The architecture should define the macro BYTE_ORDER in <arch/types.h> to - equal one of these macros for code that looks for these BSD-style macros. */ -/** \brief Little Endian test macro */ -#define LITTLE_ENDIAN 1234 - -/** \brief Big Endian test macro */ -#define BIG_ENDIAN 4321 - -/** \brief PDP Endian test macro */ -#define PDP_ENDIAN 3412 - -/* Sigh... for some reason, Newlib only bothers defining these on Cygwin... - We're only actually concerned with AT_SYMLINK_NOFOLLOW currently. These - should all be defined in <fcntl.h>, by the way. */ -#ifndef AT_EACCESS -/** \brief Check access using effective user and group ID */ -#define AT_EACCESS 1 -#endif - -#ifndef AT_SYMLINK_NOFOLLOW -/** \brief Do not follow symlinks */ -#define AT_SYMLINK_NOFOLLOW 2 -#endif - -#ifndef AT_SYMLINK_FOLLOW -/** \brief Follow symbolic links */ -#define AT_SYMLINK_FOLLOW 4 -#endif - -#ifndef AT_REMOVEDIR -/** \brief Remove directory instead of file */ -#define AT_REMOVEDIR 8 -#endif - #ifndef IOV_MAX /** \brief Maximum length of an iovec, in elements. */ #define IOV_MAX 1024 #endif -/* This is for old KOS source compatibility. */ -#include <arch/types.h> - #if __GNUC_MINOR__ > 95 || __GNUC__ >= 3 typedef __builtin_va_list __va_list; #else @@ -209,11 +172,6 @@ __END_DECLS #endif /* _SYS__TYPES_H */ -/* Grab our C11 time stuff if we got here from <time.h>. */ -#ifdef _TIME_H_ -#include <kos/time.h> -#endif - #ifdef _STDLIB_H_ #include <kos/stdlib.h> #endif diff --git a/include/sys/sched.h b/include/sys/sched.h deleted file mode 100644 index 2e040f62..00000000 --- a/include/sys/sched.h +++ /dev/null @@ -1,29 +0,0 @@ -/** \file sys/sched.h - \brief Basic sys/sched.h file for newlib. - - This file specifies a few things to make sure pthreads stuff compiles. -*/ - -#ifndef __SYS_SCHED_H -#define __SYS_SCHED_H - -#include <sys/cdefs.h> -__BEGIN_DECLS - -// These are copied from Newlib to make stuff compile as expected. - -#define SCHED_OTHER 0 /**< \brief Other scheduling */ -#define SCHED_FIFO 1 /**< \brief FIFO scheduling */ -#define SCHED_RR 2 /**< \brief Round-robin scheduling */ - -/** \brief Scheduling Parameters, P1003.1b-1993, p. 249. - \note Fields whose name begins with "ss_" added by P1003.4b/D8, p. 33. - \headerfile sys/sched.h -*/ -struct sched_param { - int sched_priority; /**< \brief Process execution scheduling priority */ -}; - -__END_DECLS - -#endif /* __SYS_SCHED_H */ diff --git a/kernel/arch/dreamcast/hardware/ubc.c b/kernel/arch/dreamcast/hardware/ubc.c index 4e96c666..75d685f6 100755 --- a/kernel/arch/dreamcast/hardware/ubc.c +++ b/kernel/arch/dreamcast/hardware/ubc.c @@ -15,10 +15,10 @@ #include <assert.h> /* Macros for accessing SFRs common to both channels by index */ -#define BAR(o) (*((vuint32 *)(uintptr_t)(SH4_REG_UBC_BARA + (unsigned)(o) * 0xc))) /* Address */ -#define BASR(o) (*((vuint8 *)(uintptr_t)(SH4_REG_UBC_BASRA + (unsigned)(o) * 0x4))) /* ASID */ -#define BAMR(o) (*((vuint8 *)(uintptr_t)(SH4_REG_UBC_BAMRA + (unsigned)(o) * 0xc))) /* Address Mask */ -#define BBR(o) (*((vuint16 *)(uintptr_t)(SH4_REG_UBC_BBRA + (unsigned)(o) * 0xc))) /* Bus Cycle */ +#define BAR(o) (*((volatile uint32_t *)(uintptr_t)(SH4_REG_UBC_BARA + (unsigned)(o) * 0xc))) /* Address */ +#define BASR(o) (*((volatile uint8_t *)(uintptr_t)(SH4_REG_UBC_BASRA + (unsigned)(o) * 0x4))) /* ASID */ +#define BAMR(o) (*((volatile uint8_t *)(uintptr_t)(SH4_REG_UBC_BAMRA + (unsigned)(o) * 0xc))) /* Address Mask */ +#define BBR(o) (*((volatile uint16_t *)(uintptr_t)(SH4_REG_UBC_BBRA + (unsigned)(o) * 0xc))) /* Bus Cycle */ /* Macros for accessing individual, channel-specific SFRs */ #define BARA (BAR(ubc_channel_a)) /**< Break Address A */ @@ -29,9 +29,9 @@ #define BASRB (BASR(ubc_channel_b)) /**< Break ASID B */ #define BAMRB (BAMR(ubc_channel_b)) /**< Break Address Mask B */ #define BBRB (BBR(ubc_channel_b)) /**< Break Bus Cycle B */ -#define BDRB (*((vuint32 *)SH4_REG_UBC_BDRB)) /**< Break Data B */ -#define BDMRB (*((vuint32 *)SH4_REG_UBC_BDMRB)) /**< Break Data Mask B */ -#define BRCR (*((vuint16 *)SH4_REG_UBC_BRCR)) /**< Break Control */ +#define BDRB (*((volatile uint32_t *)SH4_REG_UBC_BDRB)) /**< Break Data B */ +#define BDMRB (*((volatile uint32_t *)SH4_REG_UBC_BDMRB)) /**< Break Data Mask B */ +#define BRCR (*((volatile uint16_t *)SH4_REG_UBC_BRCR)) /**< Break Control */ /* BASR Fields */ #define BASM (1 << 2) /* No ASID (1), use ASID (0) */ diff --git a/kernel/arch/dreamcast/hardware/vblank.c b/kernel/arch/dreamcast/hardware/vblank.c index abf93c88..175c84fa 100644 --- a/kernel/arch/dreamcast/hardware/vblank.c +++ b/kernel/arch/dreamcast/hardware/vblank.c @@ -4,6 +4,7 @@ Copyright (C)2003 Megan Potter */ +#include <stdint.h> #include <stdlib.h> #include <errno.h> #include <sys/queue.h> @@ -28,7 +29,7 @@ static TAILQ_HEAD(vhlist, vblhnd) vblhnds; static int vblid_high; /* Our internal IRQ handler */ -static void vblank_handler(uint32 src, void *data) { +static void vblank_handler(uint32_t src, void *data) { struct vblhnd * t; (void)data; diff --git a/kernel/arch/dreamcast/include/arch/byteorder.h b/kernel/arch/dreamcast/include/arch/byteorder.h index 2d352621..0bb1f2fc 100644 --- a/kernel/arch/dreamcast/include/arch/byteorder.h +++ b/kernel/arch/dreamcast/include/arch/byteorder.h @@ -25,6 +25,9 @@ #include <kos/cdefs.h> __BEGIN_DECLS +/* Included to get the `LITTLE_ENDIAN` define */ +#include <machine/endian.h> + #ifdef BYTE_ORDER /* If we've included <arch/types.h>, this might already be defined... */ #undef BYTE_ORDER diff --git a/kernel/arch/dreamcast/include/dc/fb_console.h b/kernel/arch/dreamcast/include/dc/fb_console.h index 31dde8ee..8a718707 100644 --- a/kernel/arch/dreamcast/include/dc/fb_console.h +++ b/kernel/arch/dreamcast/include/dc/fb_console.h @@ -27,6 +27,7 @@ #include <kos/cdefs.h> __BEGIN_DECLS +#include <arch/types.h> #include <kos/dbgio.h> /* \cond */ diff --git a/kernel/arch/dreamcast/include/dc/modem/modem.h b/kernel/arch/dreamcast/include/dc/modem/modem.h index 1362c92d..81df223f 100644 --- a/kernel/arch/dreamcast/include/dc/modem/modem.h +++ b/kernel/arch/dreamcast/include/dc/modem/modem.h @@ -20,6 +20,8 @@ #ifndef __DC_MODEM_MODEM_H #define __DC_MODEM_MODEM_H +#include <arch/types.h> + #include "mconst.h" /** \defgroup modem Modem diff --git a/kernel/arch/dreamcast/include/dc/net/broadband_adapter.h b/kernel/arch/dreamcast/include/dc/net/broadband_adapter.h index 7d6548b0..969ce44f 100644 --- a/kernel/arch/dreamcast/include/dc/net/broadband_adapter.h +++ b/kernel/arch/dreamcast/include/dc/net/broadband_adapter.h @@ -22,6 +22,8 @@ #include <kos/cdefs.h> __BEGIN_DECLS +#include <arch/types.h> + /** \defgroup bba Broadband Adapter \brief Driver for the Dreamcast's BBA (RTL8139C). \ingroup networking_drivers diff --git a/utils/dc-chain/scripts/newlib.mk b/utils/dc-chain/scripts/newlib.mk index 48e833f3..0e665b03 100644 --- a/utils/dc-chain/scripts/newlib.mk +++ b/utils/dc-chain/scripts/newlib.mk @@ -44,7 +44,6 @@ fixup-newlib-apply: fixup-newlib-init cp $(kos_base)/include/pthread.h $(newlib_inc) cp $(kos_base)/include/sys/_pthreadtypes.h $(newlib_inc)/sys cp $(kos_base)/include/sys/_pthread.h $(newlib_inc)/sys - cp $(kos_base)/include/sys/sched.h $(newlib_inc)/sys ifndef MINGW32 ln -nsf $(kos_base)/include/kos $(newlib_inc) ln -nsf $(kos_base)/kernel/arch/$(platform)/include/arch $(newlib_inc) hooks/post-receive -- A pseudo Operating System for the Dreamcast. |