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
(20) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: kosmirror <kos...@us...> - 2025-05-16 17:06: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 d531a815865eae2c1d7794a0d2d09be10836d80d (commit) from b330b2ff5affef7ff4b632947ecbf0c623dc7b1d (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 d531a815865eae2c1d7794a0d2d09be10836d80d Author: Donald Haase <qu...@ya...> Date: Fri May 16 01:07:50 2025 -0400 Restrict SourceForge sync to main repo Without this restriction, forks will take the same action and attempt to sync to sourceforge as well. I am unfortunately though unaware of how to test these changes prior to merging them. ----------------------------------------------------------------------- Summary of changes: .github/workflows/sourceforge.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/sourceforge.yml b/.github/workflows/sourceforge.yml index 47d6d61e..ce13b524 100644 --- a/.github/workflows/sourceforge.yml +++ b/.github/workflows/sourceforge.yml @@ -7,6 +7,7 @@ on: jobs: deploy: + if: github.repository == 'KallistiOS/KallistiOS' runs-on: ubuntu-latest steps: hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: kosmirror <kos...@us...> - 2025-05-16 04:31: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 b330b2ff5affef7ff4b632947ecbf0c623dc7b1d (commit) via 81e507fdbd5f31b5feb5b30c29c604027d736f6c (commit) from 51a8350bf00e3172b9a713487fe6763d0200a81b (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 b330b2ff5affef7ff4b632947ecbf0c623dc7b1d Author: DC-SWAT <sw...@21...> Date: Fri May 16 08:55:48 2025 +0700 init: Fix fs_pty shutdown order to prevent bugs during filesystem shutdown. commit 81e507fdbd5f31b5feb5b30c29c604027d736f6c Author: DC-SWAT <sw...@21...> Date: Thu May 15 11:17:58 2025 +0700 exec: Fixed pointer to values ââin arch_exec_at() ----------------------------------------------------------------------- Summary of changes: kernel/arch/dreamcast/kernel/exec.c | 2 +- kernel/arch/dreamcast/kernel/init.c | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/kernel/arch/dreamcast/kernel/exec.c b/kernel/arch/dreamcast/kernel/exec.c index 15fb9155..a788b686 100644 --- a/kernel/arch/dreamcast/kernel/exec.c +++ b/kernel/arch/dreamcast/kernel/exec.c @@ -33,7 +33,7 @@ void arch_exec_at(const void *image, uint32_t length, uint32_t address) { tvals = (uintptr_t)_arch_exec_template_values; size_t tcount = (tend - tstart) / 4; uint32_t buffer[tcount]; - uint32_t *values = buffer + (_arch_exec_template_values - _arch_exec_template); + uint32_t *values = &buffer[(tvals - tstart) / 4]; size_t i; assert((tend - tstart) % 4 == 0); diff --git a/kernel/arch/dreamcast/kernel/init.c b/kernel/arch/dreamcast/kernel/init.c index 00313378..c9f6ccfc 100644 --- a/kernel/arch/dreamcast/kernel/init.c +++ b/kernel/arch/dreamcast/kernel/init.c @@ -260,13 +260,16 @@ void __weak arch_auto_shutdown(void) { KOS_INIT_FLAG_CALL(fs_ramdisk_shutdown); KOS_INIT_FLAG_CALL(fs_romdisk_shutdown); - KOS_INIT_FLAG_CALL(fs_pty_shutdown); KOS_INIT_FLAG_CALL(fs_null_shutdown); KOS_INIT_FLAG_CALL(fs_dev_shutdown); + /* As a workaround, shut down the base FS before fs_pty + to avoid triggering bugs. */ if(__kos_init_flags & INIT_FS_ALL) fs_shutdown(); + KOS_INIT_FLAG_CALL(fs_pty_shutdown); + thd_shutdown(); rtc_shutdown(); } hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: kosmirror <kos...@us...> - 2025-05-16 00:53: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 51a8350bf00e3172b9a713487fe6763d0200a81b (commit) from e9ebbecdfa4b08f07ab0e2026c0dd0f5b130c4b3 (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 51a8350bf00e3172b9a713487fe6763d0200a81b Author: darc <da...@pr...> Date: Thu May 15 19:45:33 2025 -0500 Fix type errors in dc/fifo.h and dc/g2bus.h ----------------------------------------------------------------------- Summary of changes: kernel/arch/dreamcast/include/dc/fifo.h | 2 +- kernel/arch/dreamcast/include/dc/g2bus.h | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/kernel/arch/dreamcast/include/dc/fifo.h b/kernel/arch/dreamcast/include/dc/fifo.h index c04b4e95..682e9b58 100644 --- a/kernel/arch/dreamcast/include/dc/fifo.h +++ b/kernel/arch/dreamcast/include/dc/fifo.h @@ -32,7 +32,7 @@ __BEGIN_DECLS Accessing this value provides the current status of all FIFOs. */ -#define FIFO_STATUS (*(vuint32 const *)0xa05f688c) +#define FIFO_STATUS (*(volatile uint32_t const *)0xa05f688c) /** \name FIFO Status Indicators diff --git a/kernel/arch/dreamcast/include/dc/g2bus.h b/kernel/arch/dreamcast/include/dc/g2bus.h index d543fd27..8b449aab 100644 --- a/kernel/arch/dreamcast/include/dc/g2bus.h +++ b/kernel/arch/dreamcast/include/dc/g2bus.h @@ -146,9 +146,9 @@ typedef struct { /* Internal constants to access suspend registers for G2 DMA. They are not meant for user-code use. */ /** \cond */ -#define G2_DMA_SUSPEND_SPU (*((vuint32 *)0xa05f781C)) -#define G2_DMA_SUSPEND_BBA (*((vuint32 *)0xa05f783C)) -#define G2_DMA_SUSPEND_CH2 (*((vuint32 *)0xa05f785C)) +#define G2_DMA_SUSPEND_SPU (*((volatile uint32_t *)0xa05f781C)) +#define G2_DMA_SUSPEND_BBA (*((volatile uint32_t *)0xa05f783C)) +#define G2_DMA_SUSPEND_CH2 (*((volatile uint32_t *)0xa05f785C)) /** \endcond */ /** \brief Disable IRQs and G2 DMA @@ -223,7 +223,7 @@ void g2_write_8(uintptr_t address, uint8_t value); \param address The address in memory to read. \return The word read from the address specified. */ -uint16 g2_read_16(uintptr_t address); +uint16_t g2_read_16(uintptr_t address); /** \brief Write a 16-bit word to G2. hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: kosmirror <kos...@us...> - 2025-05-15 16:17:01
|
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 e9ebbecdfa4b08f07ab0e2026c0dd0f5b130c4b3 (commit) from 0d2c2328792f470d9b71c7fc35808c0aaea14371 (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 e9ebbecdfa4b08f07ab0e2026c0dd0f5b130c4b3 Author: darc <da...@pr...> Date: Thu May 15 10:27:04 2025 -0500 Include arch/types.h in thread.h to fix toolchain building ----------------------------------------------------------------------- Summary of changes: include/kos/thread.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/kos/thread.h b/include/kos/thread.h index 0c450f74..7b1ab1e5 100644 --- a/include/kos/thread.h +++ b/include/kos/thread.h @@ -42,6 +42,7 @@ __BEGIN_DECLS #include <kos/cdefs.h> #include <kos/tls.h> #include <arch/irq.h> +#include <arch/types.h> #include <sys/queue.h> #include <sys/reent.h> hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: kosmirror <kos...@us...> - 2025-05-15 05:07:10
|
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 0d2c2328792f470d9b71c7fc35808c0aaea14371 (commit) via 8d6ef3f3bf1bb214a7eb4df6725447607d18cfc8 (commit) via 485e858478566403c3c3c1ca9667ad730c4355b2 (commit) via 2c5b13437d11088f791687fa254510f894f6a63b (commit) via 09dd6ec621b939cbca75ec1303b946f8147f151a (commit) via bc4d0b083373d386991c0ab98bddda7fa45156d2 (commit) via 1ea69409c29cbcf6f57eb15135322c93bbffd0a5 (commit) via 2982fbecf1a419c9c6784e6663ff9e50b6051400 (commit) via 7f38a674b0b7eb61bbf98a7f02c48f1b481bbb6b (commit) via d0a08cf946acf82a7483a60eb0ee9cd7eff776b8 (commit) via de6feb24c33b81a2669c89ab1030b0e70c7924a0 (commit) via bfc841833c17f99435664dccdb4401e39ad3c92a (commit) via 2da06361c09320c300189834b5fb5d5353243bd4 (commit) via 3ad38674588efa1d3b82bd8a2b40204b44b2df4c (commit) via b21e0bf3af04ea175531d0b02d7459e116c7ffc0 (commit) via 07404a2e9b2e2bef79eed461e9ea379aafe72824 (commit) via 768ac05cdc8a78b7aebeb31be361cee8dc893405 (commit) via 23cecd496352490b3d699e4f2ea8e81b357867ac (commit) via ec9d1ceaebcfc659ae3129082837b613955e7554 (commit) via ff0789129478fe584f42874a722cf152555981e6 (commit) via 2746498dc54fc5961318b6ddca30535a1a9f9cdc (commit) via 980b8e58373bdffebe2473e15e8bb41d30cd1ccb (commit) via 779af3a2febd5804ad22b9be3c6fae6b746d1c55 (commit) via 70e50124d1903ddd68611c1630ddb1a3669b9fa0 (commit) via 4963607accbeee5b1e5adb6a9428717046a3b1ef (commit) via 32b849fff162b74cfbd8723fd45a29649688b6ca (commit) via 3a7bce6d929e2d4a97be3a6c482aeeb3e9fcefd2 (commit) via a31208545e2976dc946b40e585a4c89e84ae4eec (commit) via 72be9462b31f5da5d4a6161ef5198c553dfa5bca (commit) via 003fbe64373c818286fdf1ec4b8cb4b0fbc97bfc (commit) via d42da44b54512a7d403ec85b8a27bdf797b4ae8c (commit) via a3563806abdda790d3cf79129ab513e6bc951a46 (commit) via 9e7557a5e06a6d693cd02208aac9a8e2521990e8 (commit) via 88f2b95fb94a399d3b5d44af1ffc4be8019d261d (commit) via fdf71759599551990e70f0018039785fe72394bd (commit) via 9e9fd275d6f6d8cf3a0a671f0e972d8a26141ccd (commit) via 121aec023822073812f3b009a0d2c6cf650f1bcc (commit) via 97d2c432224e701da929f110b2d536adfc5e3126 (commit) via 42728924c571cb6be9f318ca6a7d8667c4033914 (commit) via 023db79ebecc9451e1181f7545e8fa5ea52429aa (commit) via 2daf1dad93c56c3dbc72d0d61a67c68bd9abd8cd (commit) via 828872948aa165a6ddc3646e6683f827acba60eb (commit) via bce53fc101c3315cb8ab47de5dbb1d60359820db (commit) via f6c5261203c79fc3066e079ed95c270b99cbe723 (commit) via 1aa34a837ad3bae70b6902198dd4c6d987ed8a42 (commit) via 60421d6ecf96d335dd77d3e3deaaa1cedc66535b (commit) via eadd691dd033e6a219582cb16f3bb60e5d2cb34f (commit) via b359ae2677dd9eedc0aaa3bbb85ebd54e2e3d1d2 (commit) via 6186b354cf9fed7390436f728f467b58d558a93e (commit) via 58f94644d5fe509168c621bd9069d2e793b34259 (commit) via 5c3250c3d6898741219f4d8806af548476fa2c40 (commit) via bbffcb927c8a266eda6617f7be64e34aee9dac62 (commit) via e2ffec70a5578ba10a65f8b45e686058e571b275 (commit) via d886185c6035c9a552b5062ff0c9cdd02bc24dcd (commit) via ae290a7896364d7014d5e05135a64fd9742b7f94 (commit) via 934fbcfb4371defff3baa2c46a9b7377806ba66d (commit) via 5f5ebb62f8771e01b94808149c31a52279e6e6b3 (commit) via ed6b7c1c0de06e0197dfc9da8a166130665ca580 (commit) via 9d1d93750d208cf01595a24b41e39ef83c0d38ed (commit) via 64e937d69c9f087503ce84759ece6d8c5204fbee (commit) via e931da9cda3d70d6a61b729c710bf064a8ba8ecb (commit) via af9b2f600f80bd9e2c12f25324fbcf10b04a27bd (commit) via c24867189bc311aa4029cac78037b6862ba0ebfa (commit) via 87289bdc1d56b48d96ac0215c5ff6843efc4ac3c (commit) via 0002c120d02be35cf4112fd2f882f520028f73a9 (commit) via 2c78971926c0cccacb770f9735a62874440ccaf7 (commit) via b261906e9b032cbc7a4cc887b611c84ab961c207 (commit) via 81a9bc609bcadf3f0c6c69b76e409665ec9821bb (commit) via c6f1342b544c047682ac5bbe1cce9168d4768898 (commit) via 60eb61f025446557a41723559e5000130fefc678 (commit) via d30d41bbb3275b584733d0d5d906b1802a7b1f07 (commit) via 3439f217fcb1e814604df3b9dbe0b1d1e4479049 (commit) via 93ffa86838022817d586de25eaba129eff509ca1 (commit) via d65978a8d90eba676946e966f5cd09510b2746df (commit) via 2fd07131a428445d21170b92fc024c2c256e97ca (commit) via 8d5662e4918bfc859ab509a369f3ec4ac108402f (commit) via d6211e47cde27eac3bbeb7f057cccd37b085a746 (commit) via 4fbdd1ce38ca82ab322438e75c6aab6dbc36396b (commit) via 980772a00645c3c42e00679612ea0fd3009f06c2 (commit) via 65286eb0023170b51309917cc993b2fa6162e2d9 (commit) via 86bcf15ad7c4a8158517bbb8e619ada2ff14ce0c (commit) via adc3958020006187adeb57166a25de9b199fafcf (commit) via 1ee18d89a686add380da5a019174700a259681cc (commit) via ab88f7661d1f9e9fbb4d6b29b9775d1db4b46058 (commit) via 1e6f8eb37ae92aca4d9c73c46eb7359b97eee0d2 (commit) via 21b5df1e9c3557f1b8c8f323c32f83b9e532eef3 (commit) from 1aaa930bf1050ef8116bf23527eba95a16da6efb (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 0d2c2328792f470d9b71c7fc35808c0aaea14371 Author: QuzarDC <qu...@co...> Date: Sun May 11 21:01:34 2025 -0400 Remove unnecessary <arch/types.h> includes. To help address #840 and generally clean up. It seems many of the files have been transitioned over to stdint, but the includes weren't removed. In cond.h also added a missing void for cond_init. commit 8d6ef3f3bf1bb214a7eb4df6725447607d18cfc8 Author: QuzarDC <qu...@co...> Date: Sun May 11 20:57:24 2025 -0400 Add missing includes. These are needed for __unlikely in perfctr, and old-style types in ramdisk/pty (but dosn't need to be shared in their headers). commit 485e858478566403c3c3c1ca9667ad730c4355b2 Author: QuzarDC <qu...@co...> Date: Sun May 11 20:14:18 2025 -0400 nmmgr Use stdint types. commit 2c5b13437d11088f791687fa254510f894f6a63b Author: QuzarDC <qu...@co...> Date: Sun May 11 19:58:10 2025 -0400 malloc Remove include of <arch/types.h> commit 09dd6ec621b939cbca75ec1303b946f8147f151a Merge: 1ea69409 bc4d0b08 Author: Lawrence Sebald <ljs...@us...> Date: Thu May 15 00:58:15 2025 -0400 Merge pull request #1001 from pcercuei/sync-sourceforge CI: Automatically sync to SourceForge commit bc4d0b083373d386991c0ab98bddda7fa45156d2 Author: Lawrence Sebald <ljs...@us...> Date: Thu May 15 00:57:34 2025 -0400 Apply suggestions from code review commit 1ea69409c29cbcf6f57eb15135322c93bbffd0a5 Author: QuzarDC <qu...@co...> Date: Mon May 12 11:08:49 2025 -0400 Fix printf format types for pvr_stats members in GL examples. These were changed in #471 and the examples hadn't been updated to reflect the new sizes. commit 2982fbecf1a419c9c6784e6663ff9e50b6051400 Author: QuzarDC <qu...@co...> Date: Tue May 13 14:21:33 2025 -0400 Roll back bad pointer math update for arch_exec_at. From #923 commit 7f38a674b0b7eb61bbf98a7f02c48f1b481bbb6b Author: QuzarDC <qu...@co...> Date: Sun May 11 21:43:02 2025 -0400 Fix mismatched types for ubc callback. `ubc.h` is using the irq_context type but for some reason wasn't using the typedef'd name for it, and wasn't including `irq.h` either. This fixes the use of it in gcc14+ ----------------------------------------------------------------------- Summary of changes: .github/workflows/sourceforge.yml | 26 + AUTHORS | 24 +- README.md | 2 +- addons/libkosext2fs/inode.c | 1 + addons/libkosutils/netcfg.c | 2 + addons/libpthread/Makefile | 71 ++ .../{libkosext2fs => libpthread}/kos/dreamcast.cnf | 0 addons/libpthread/pthread-internal.h | 84 ++ addons/libpthread/pthread_atfork.c | 18 + addons/libpthread/pthread_attr_destroy.c | 19 + addons/libpthread/pthread_attr_getdetachstate.c | 20 + addons/libpthread/pthread_attr_getguardsize.c | 21 + addons/libpthread/pthread_attr_getname_np.c | 33 + addons/libpthread/pthread_attr_getschedparam.c | 22 + addons/libpthread/pthread_attr_getscope.c | 21 + addons/libpthread/pthread_attr_getstack.c | 24 + addons/libpthread/pthread_attr_getstacksize.c | 21 + addons/libpthread/pthread_attr_init.c | 26 + addons/libpthread/pthread_attr_setdetachstate.c | 21 + addons/libpthread/pthread_attr_setguardsize.c | 19 + addons/libpthread/pthread_attr_setname_np.c | 35 + addons/libpthread/pthread_attr_setschedparam.c | 26 + addons/libpthread/pthread_attr_setscope.c | 19 + addons/libpthread/pthread_attr_setstack.c | 30 + addons/libpthread/pthread_attr_setstacksize.c | 21 + addons/libpthread/pthread_barrier_destroy.c | 16 + addons/libpthread/pthread_barrier_init.c | 18 + addons/libpthread/pthread_barrier_wait.c | 16 + addons/libpthread/pthread_barrierattr_destroy.c | 19 + addons/libpthread/pthread_barrierattr_init.c | 19 + addons/libpthread/pthread_cancel.c | 15 + addons/libpthread/pthread_cond_broadcast.c | 22 + addons/libpthread/pthread_cond_destroy.c | 22 + addons/libpthread/pthread_cond_init.c | 32 + addons/libpthread/pthread_cond_signal.c | 22 + addons/libpthread/pthread_cond_timedwait.c | 45 + addons/libpthread/pthread_cond_wait.c | 23 + addons/libpthread/pthread_condattr_destroy.c | 19 + addons/libpthread/pthread_condattr_getclock.c | 20 + addons/libpthread/pthread_condattr_init.c | 22 + addons/libpthread/pthread_condattr_setclock.c | 29 + addons/libpthread/pthread_create.c | 29 + addons/libpthread/pthread_detach.c | 21 + addons/libpthread/pthread_equal.c | 12 + addons/libpthread/pthread_exit.c | 13 + addons/libpthread/pthread_getname_np.c | 38 + addons/libpthread/pthread_getprio.c | 19 + addons/libpthread/pthread_getsetconcurrency.c | 29 + addons/libpthread/pthread_getspecific.c | 13 + addons/libpthread/pthread_join.c | 26 + addons/libpthread/pthread_key_create.c | 13 + addons/libpthread/pthread_key_delete.c | 13 + addons/libpthread/pthread_mutex_consistent.c | 19 + addons/libpthread/pthread_mutex_destroy.c | 22 + addons/libpthread/pthread_mutex_init.c | 42 + addons/libpthread/pthread_mutex_lock.c | 22 + addons/libpthread/pthread_mutex_timedlock.c | 50 + addons/libpthread/pthread_mutex_trylock.c | 22 + addons/libpthread/pthread_mutex_unlock.c | 22 + addons/libpthread/pthread_mutexattr_destroy.c | 19 + addons/libpthread/pthread_mutexattr_getrobust.c | 22 + addons/libpthread/pthread_mutexattr_gettype.c | 22 + addons/libpthread/pthread_mutexattr_init.c | 19 + addons/libpthread/pthread_mutexattr_setrobust.c | 22 + addons/libpthread/pthread_mutexattr_settype.c | 26 + addons/libpthread/pthread_once.c | 13 + addons/libpthread/pthread_rwlock_destroy.c | 27 + addons/libpthread/pthread_rwlock_init.c | 30 + addons/libpthread/pthread_rwlock_rdlock.c | 27 + addons/libpthread/pthread_rwlock_timedrdlock.c | 50 + addons/libpthread/pthread_rwlock_timedwrlock.c | 50 + addons/libpthread/pthread_rwlock_tryrdlock.c | 27 + addons/libpthread/pthread_rwlock_trywrlock.c | 27 + addons/libpthread/pthread_rwlock_unlock.c | 27 + addons/libpthread/pthread_rwlock_wrlock.c | 27 + addons/libpthread/pthread_rwlockattr_destroy.c | 19 + addons/libpthread/pthread_rwlockattr_init.c | 19 + addons/libpthread/pthread_self.c | 13 + addons/libpthread/pthread_setcancelstate.c | 16 + addons/libpthread/pthread_setcanceltype.c | 16 + addons/libpthread/pthread_setname_np.c | 31 + addons/libpthread/pthread_setprio.c | 25 + addons/libpthread/pthread_setspecific.c | 13 + addons/libpthread/pthread_spin_destroy.c | 18 + addons/libpthread/pthread_spin_init.c | 20 + addons/libpthread/pthread_spin_lock.c | 14 + addons/libpthread/pthread_spin_trylock.c | 19 + addons/libpthread/pthread_spin_unlock.c | 14 + addons/libpthread/pthread_testcancel.c | 11 + addons/libpthread/pthread_yield.c | 14 + doc/CHANGELOG.md | 4 + doc/RELNOTES.md | 8 + doc/license/LICENSE.KOS | 4 +- examples/dreamcast/basic/breaking/breaking.c | 3 + .../threading/{spinlock_test => barrier}/Makefile | 6 +- .../dreamcast/basic/threading/barrier/barrier.c | 196 ++++ examples/dreamcast/gldc/basic/gl/gltest.c | 2 +- .../dreamcast/gldc/benchmarks/quadmark/quadmark.c | 2 +- .../dreamcast/gldc/benchmarks/trimark/trimark.c | 2 +- .../gldc/benchmarks/tristripmark/tristripmark.c | 2 +- examples/dreamcast/libdream/vmu/vmu.c | 2 + examples/dreamcast/network/dns-client/dns-client.c | 1 + examples/dreamcast/network/httpd/httpd.c | 3 + examples/dreamcast/network/ntp/ntp.c | 2 + .../dreamcast/network/speedtest/handle_request.c | 3 + examples/dreamcast/network/speedtest/server.c | 1 + examples/dreamcast/network/udpecho6/echo.c | 1 + examples/dreamcast/pthread/Makefile | 14 + .../threading/once => pthread/general}/Makefile | 11 +- .../pthread/general/general_pthread_test.c | 230 ++++ examples/dreamcast/rumble/rumble.c | 1 + examples/dreamcast/sound/hello-opus/opustest.c | 1 + include/kos.h | 1 + include/kos/barrier.h | 143 +++ include/kos/cond.h | 3 +- include/kos/dbglog.h | 4 - include/kos/fs_dev.h | 4 +- include/kos/fs_null.h | 4 +- include/kos/fs_pty.h | 5 +- include/kos/fs_ramdisk.h | 5 +- include/kos/fs_random.h | 4 +- include/kos/init.h | 54 +- include/kos/library.h | 2 +- include/kos/nmmgr.h | 10 +- include/kos/thread.h | 40 +- include/malloc.h | 2 - include/pthread.h | 492 ++++---- include/sys/_pthread.h | 12 +- include/sys/_pthreadtypes.h | 103 ++ include/sys/_types.h | 4 +- include/sys/sched.h | 51 +- kernel/arch/dreamcast/exports-naomi.txt | 24 +- kernel/arch/dreamcast/exports-pristine.txt | 33 +- kernel/arch/dreamcast/hardware/Makefile | 2 +- kernel/arch/dreamcast/hardware/biosfont.c | 1 + kernel/arch/dreamcast/hardware/cdrom.c | 368 ++++-- kernel/arch/dreamcast/hardware/dmac.c | 12 +- kernel/arch/dreamcast/hardware/g1ata.c | 44 +- .../arch/dreamcast/hardware/maple/maple_driver.c | 57 +- kernel/arch/dreamcast/hardware/sci.c | 1178 ++++++++++++++++++++ kernel/arch/dreamcast/hardware/ubc.c | 1 - kernel/arch/dreamcast/include/arch/cache.h | 1 - kernel/arch/dreamcast/include/arch/init_flags.h | 22 +- kernel/arch/dreamcast/include/arch/irq.h | 8 +- kernel/arch/dreamcast/include/arch/mmu.h | 1 - kernel/arch/dreamcast/include/arch/stack.h | 2 +- kernel/arch/dreamcast/include/arch/trap.h | 6 +- kernel/arch/dreamcast/include/dc/biosfont.h | 2 - kernel/arch/dreamcast/include/dc/cdrom.h | 19 +- kernel/arch/dreamcast/include/dc/fmath.h | 14 +- kernel/arch/dreamcast/include/dc/fs_iso9660.h | 1 - kernel/arch/dreamcast/include/dc/g2bus.h | 1 - kernel/arch/dreamcast/include/dc/maple.h | 22 + .../arch/dreamcast/include/dc/maple/controller.h | 1 - kernel/arch/dreamcast/include/dc/maple/keyboard.h | 1 - kernel/arch/dreamcast/include/dc/maple/vmu.h | 1 - kernel/arch/dreamcast/include/dc/math.h | 12 +- kernel/arch/dreamcast/include/dc/pvr.h | 197 +--- kernel/arch/dreamcast/include/dc/pvr/pvr_header.h | 363 ++++++ kernel/arch/dreamcast/include/dc/sci.h | 276 +++++ kernel/arch/dreamcast/include/dc/sound/sfxmgr.h | 1 - kernel/arch/dreamcast/include/dc/spu.h | 1 - kernel/arch/dreamcast/include/dc/sq.h | 1 - kernel/arch/dreamcast/include/dc/ubc.h | 7 +- kernel/arch/dreamcast/kernel/exec.c | 2 +- kernel/arch/dreamcast/kernel/init.c | 60 +- kernel/arch/dreamcast/kernel/perfctr.c | 1 + .../arch/dreamcast/kernel/{startup.s => startup.S} | 2 + kernel/arch/dreamcast/math/math.s | 40 +- kernel/arch/dreamcast/util/vmu_pkg.c | 1 + kernel/exports/library.c | 4 +- kernel/fs/fs_dev.c | 8 +- kernel/fs/fs_null.c | 9 +- kernel/fs/fs_pty.c | 20 +- kernel/fs/fs_ramdisk.c | 20 +- kernel/fs/fs_random.c | 9 +- kernel/fs/fs_utils.c | 1 + kernel/libc/Makefile | 4 +- kernel/libc/koslib/dbglog.c | 1 + kernel/libc/koslib/getaddrinfo.c | 1 + kernel/libc/koslib/realpath.c | 2 + kernel/libc/pthreads/Makefile | 13 - kernel/libc/pthreads/pthread_cond.c | 93 -- kernel/libc/pthreads/pthread_mutex.c | 113 -- kernel/libc/pthreads/pthread_thd.c | 78 -- kernel/libc/pthreads/pthread_thd_attr.c | 172 --- kernel/libc/pthreads/pthread_tls.c | 34 - kernel/net/net_dhcp.c | 1 + kernel/net/net_tcp.c | 1 + kernel/thread/Makefile | 4 +- kernel/thread/barrier.c | 201 ++++ kernel/thread/thread.c | 32 +- utils/dc-chain/Makefile.default.cfg | 6 +- utils/dc-chain/scripts/newlib.mk | 1 + utils/dc-chain/scripts/patch.mk | 2 +- 195 files changed, 5816 insertions(+), 1329 deletions(-) create mode 100644 .github/workflows/sourceforge.yml create mode 100644 addons/libpthread/Makefile copy addons/{libkosext2fs => libpthread}/kos/dreamcast.cnf (100%) create mode 100644 addons/libpthread/pthread-internal.h create mode 100644 addons/libpthread/pthread_atfork.c create mode 100644 addons/libpthread/pthread_attr_destroy.c create mode 100644 addons/libpthread/pthread_attr_getdetachstate.c create mode 100644 addons/libpthread/pthread_attr_getguardsize.c create mode 100644 addons/libpthread/pthread_attr_getname_np.c create mode 100644 addons/libpthread/pthread_attr_getschedparam.c create mode 100644 addons/libpthread/pthread_attr_getscope.c create mode 100644 addons/libpthread/pthread_attr_getstack.c create mode 100644 addons/libpthread/pthread_attr_getstacksize.c create mode 100644 addons/libpthread/pthread_attr_init.c create mode 100644 addons/libpthread/pthread_attr_setdetachstate.c create mode 100644 addons/libpthread/pthread_attr_setguardsize.c create mode 100644 addons/libpthread/pthread_attr_setname_np.c create mode 100644 addons/libpthread/pthread_attr_setschedparam.c create mode 100644 addons/libpthread/pthread_attr_setscope.c create mode 100644 addons/libpthread/pthread_attr_setstack.c create mode 100644 addons/libpthread/pthread_attr_setstacksize.c create mode 100644 addons/libpthread/pthread_barrier_destroy.c create mode 100644 addons/libpthread/pthread_barrier_init.c create mode 100644 addons/libpthread/pthread_barrier_wait.c create mode 100644 addons/libpthread/pthread_barrierattr_destroy.c create mode 100644 addons/libpthread/pthread_barrierattr_init.c create mode 100644 addons/libpthread/pthread_cancel.c create mode 100644 addons/libpthread/pthread_cond_broadcast.c create mode 100644 addons/libpthread/pthread_cond_destroy.c create mode 100644 addons/libpthread/pthread_cond_init.c create mode 100644 addons/libpthread/pthread_cond_signal.c create mode 100644 addons/libpthread/pthread_cond_timedwait.c create mode 100644 addons/libpthread/pthread_cond_wait.c create mode 100644 addons/libpthread/pthread_condattr_destroy.c create mode 100644 addons/libpthread/pthread_condattr_getclock.c create mode 100644 addons/libpthread/pthread_condattr_init.c create mode 100644 addons/libpthread/pthread_condattr_setclock.c create mode 100644 addons/libpthread/pthread_create.c create mode 100644 addons/libpthread/pthread_detach.c create mode 100644 addons/libpthread/pthread_equal.c create mode 100644 addons/libpthread/pthread_exit.c create mode 100644 addons/libpthread/pthread_getname_np.c create mode 100644 addons/libpthread/pthread_getprio.c create mode 100644 addons/libpthread/pthread_getsetconcurrency.c create mode 100644 addons/libpthread/pthread_getspecific.c create mode 100644 addons/libpthread/pthread_join.c create mode 100644 addons/libpthread/pthread_key_create.c create mode 100644 addons/libpthread/pthread_key_delete.c create mode 100644 addons/libpthread/pthread_mutex_consistent.c create mode 100644 addons/libpthread/pthread_mutex_destroy.c create mode 100644 addons/libpthread/pthread_mutex_init.c create mode 100644 addons/libpthread/pthread_mutex_lock.c create mode 100644 addons/libpthread/pthread_mutex_timedlock.c create mode 100644 addons/libpthread/pthread_mutex_trylock.c create mode 100644 addons/libpthread/pthread_mutex_unlock.c create mode 100644 addons/libpthread/pthread_mutexattr_destroy.c create mode 100644 addons/libpthread/pthread_mutexattr_getrobust.c create mode 100644 addons/libpthread/pthread_mutexattr_gettype.c create mode 100644 addons/libpthread/pthread_mutexattr_init.c create mode 100644 addons/libpthread/pthread_mutexattr_setrobust.c create mode 100644 addons/libpthread/pthread_mutexattr_settype.c create mode 100644 addons/libpthread/pthread_once.c create mode 100644 addons/libpthread/pthread_rwlock_destroy.c create mode 100644 addons/libpthread/pthread_rwlock_init.c create mode 100644 addons/libpthread/pthread_rwlock_rdlock.c create mode 100644 addons/libpthread/pthread_rwlock_timedrdlock.c create mode 100644 addons/libpthread/pthread_rwlock_timedwrlock.c create mode 100644 addons/libpthread/pthread_rwlock_tryrdlock.c create mode 100644 addons/libpthread/pthread_rwlock_trywrlock.c create mode 100644 addons/libpthread/pthread_rwlock_unlock.c create mode 100644 addons/libpthread/pthread_rwlock_wrlock.c create mode 100644 addons/libpthread/pthread_rwlockattr_destroy.c create mode 100644 addons/libpthread/pthread_rwlockattr_init.c create mode 100644 addons/libpthread/pthread_self.c create mode 100644 addons/libpthread/pthread_setcancelstate.c create mode 100644 addons/libpthread/pthread_setcanceltype.c create mode 100644 addons/libpthread/pthread_setname_np.c create mode 100644 addons/libpthread/pthread_setprio.c create mode 100644 addons/libpthread/pthread_setspecific.c create mode 100644 addons/libpthread/pthread_spin_destroy.c create mode 100644 addons/libpthread/pthread_spin_init.c create mode 100644 addons/libpthread/pthread_spin_lock.c create mode 100644 addons/libpthread/pthread_spin_trylock.c create mode 100644 addons/libpthread/pthread_spin_unlock.c create mode 100644 addons/libpthread/pthread_testcancel.c create mode 100644 addons/libpthread/pthread_yield.c copy examples/dreamcast/basic/threading/{spinlock_test => barrier}/Makefile (78%) create mode 100644 examples/dreamcast/basic/threading/barrier/barrier.c create mode 100644 examples/dreamcast/pthread/Makefile copy examples/dreamcast/{basic/threading/once => pthread/general}/Makefile (61%) create mode 100644 examples/dreamcast/pthread/general/general_pthread_test.c create mode 100644 include/kos/barrier.h create mode 100644 include/sys/_pthreadtypes.h create mode 100644 kernel/arch/dreamcast/hardware/sci.c create mode 100644 kernel/arch/dreamcast/include/dc/pvr/pvr_header.h create mode 100644 kernel/arch/dreamcast/include/dc/sci.h rename kernel/arch/dreamcast/kernel/{startup.s => startup.S} (99%) delete mode 100644 kernel/libc/pthreads/Makefile delete mode 100644 kernel/libc/pthreads/pthread_cond.c delete mode 100644 kernel/libc/pthreads/pthread_mutex.c delete mode 100644 kernel/libc/pthreads/pthread_thd.c delete mode 100644 kernel/libc/pthreads/pthread_thd_attr.c delete mode 100644 kernel/libc/pthreads/pthread_tls.c create mode 100644 kernel/thread/barrier.c diff --git a/.github/workflows/sourceforge.yml b/.github/workflows/sourceforge.yml new file mode 100644 index 00000000..47d6d61e --- /dev/null +++ b/.github/workflows/sourceforge.yml @@ -0,0 +1,26 @@ +name: Sourceforge sync + +on: + push: + branches: + - master + +jobs: + deploy: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: setup-ssh + run: | + install -m 600 -D /dev/null ~/.ssh/id_ed25519 + echo "${{ secrets.SF_MIRROR_KEY }}" > ~/.ssh/id_ed25519 + ssh-keyscan -H git.code.sf.net > ~/.ssh/known_hosts + + - name: sourceforge-sync + run: | + git remote add sourceforge ssh://kos...@gi.../p/cadcdev/kallistios + git push sourceforge master diff --git a/AUTHORS b/AUTHORS index 333e288c..82715c88 100644 --- a/AUTHORS +++ b/AUTHORS @@ -22,7 +22,7 @@ please see the README.KOS file in the doc directory. Contributors list (under the normal KOS license): ------------------------------------------------- Megan Potter: 1997, 2000, 2001, 2002, 2003, 2004 -Lawrence Sebald: 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023 +Lawrence Sebald: 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023, 2024 Sam Steele: 2004 Gil Megidish: 2002 Florian Schulze: 2002 @@ -44,33 +44,13 @@ Stefan Galowicz: 2016, 2017 Luke Benstead: 2020, 2021, 2022, 2023 Eric Fradella: 2023, 2024, 2025 Falco Girgis: 2023, 2024, 2025 -Ruslan Rostovtsev: 2014, 2016, 2023, 2024 +Ruslan Rostovtsev: 2014, 2016, 2023, 2024, 2025 Colton Pawielski: 2023 Andy Barajas: 2023, 2024 Paul Cercueil: 2023, 2024, 2025 Files with Specific licenses: ----------------------------- -include/pthread.h: -/* pthread.h - * - * Written by Joel Sherrill <jo...@OA...>. - * - * COPYRIGHT (c) 1989-2000. - * On-Line Applications Research Corporation (OAR). - * - * Permission to use, copy, modify, and distribute this software for any - * purpose without fee is hereby granted, provided that this entire notice - * is included in all copies of any software which is or includes a copy - * or modification of this software. - * - * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED - * WARRANTY. IN PARTICULAR, THE AUTHOR MAKES NO REPRESENTATION - * OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY OF THIS - * SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE. - * - */ - kernel/arch/dreamcast/kernel/gdb_stub.c: /* This is originally based on an m68k software stub written by Glenn Engel at HP, but has changed quite a bit. diff --git a/README.md b/README.md index 10618ec6..2099def8 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ KallistiOS also features a package manager called [**_kos-ports_**](https://gith * Optical Disc Drive * Low-level 3D PowerVR Graphics * SH4 ASM-Optimized Math Routines -* SH4 SCIF Serial I/O +* SH4 SCI and SCIF Serial I/O * DMA Controller * FlashROM Filesystem * AICA SPU Sound Processor Driver diff --git a/addons/libkosext2fs/inode.c b/addons/libkosext2fs/inode.c index 6056e32c..a8cb184f 100644 --- a/addons/libkosext2fs/inode.c +++ b/addons/libkosext2fs/inode.c @@ -11,6 +11,7 @@ #include <stddef.h> #include <errno.h> #include <limits.h> +#include <kos/limits.h> #include <assert.h> #include <sys/queue.h> #include <inttypes.h> diff --git a/addons/libkosutils/netcfg.c b/addons/libkosutils/netcfg.c index 6ed801e5..39a78613 100644 --- a/addons/libkosutils/netcfg.c +++ b/addons/libkosutils/netcfg.c @@ -8,7 +8,9 @@ #include <stdio.h> #include <string.h> #include <stdlib.h> +#include <unistd.h> #include <assert.h> +#include <kos/fs.h> #include <kos/netcfg.h> #include <dc/flashrom.h> #include <dc/vmu_pkg.h> diff --git a/addons/libpthread/Makefile b/addons/libpthread/Makefile new file mode 100644 index 00000000..54f2879a --- /dev/null +++ b/addons/libpthread/Makefile @@ -0,0 +1,71 @@ +# KallistiOS ##version## +# +# addons/libpthread/Makefile +# Copyright (C) 2023, 2024 Lawrence Sebald +# + +TARGET = libpthread.a +SUBDIRS = + +# Threads +OBJS = pthread_create.o pthread_self.o pthread_detach.o pthread_join.o \ + pthread_exit.o pthread_equal.o pthread_getname_np.o \ + pthread_setname_np.o + +# Thread Attributes +OBJS += pthread_attr_init.o pthread_attr_destroy.o \ + pthread_attr_setdetachstate.o pthread_attr_getdetachstate.o \ + pthread_attr_setstack.o pthread_attr_getstack.o \ + pthread_attr_setstacksize.o pthread_attr_getstacksize.o \ + pthread_attr_setschedparam.o pthread_attr_getschedparam.o \ + pthread_attr_setguardsize.o pthread_attr_getguardsize.o \ + pthread_attr_setscope.o pthread_attr_getscope.o \ + pthread_attr_setname_np.o pthread_attr_getname_np.o + +# Thread Cancellation +OBJS += pthread_cancel.o pthread_testcancel.o pthread_setcancelstate.o \ + pthread_setcanceltype.o + +# Dynamic package initialization +OBJS += pthread_once.o + +# Thread-specific data key creation/deletion and data management +OBJS += pthread_key_create.o pthread_key_delete.o pthread_getspecific.o \ + pthread_setspecific.o + +# Mutexes +OBJS += pthread_mutex_init.o pthread_mutex_destroy.o pthread_mutex_lock.o \ + pthread_mutex_trylock.o pthread_mutex_timedlock.o \ + pthread_mutex_unlock.o pthread_mutex_consistent.o \ + pthread_mutexattr_init.o pthread_mutexattr_destroy.o \ + pthread_mutexattr_settype.o pthread_mutexattr_gettype.o \ + pthread_mutexattr_setrobust.o pthread_mutexattr_getrobust.o + +# Condition Variables +OBJS += pthread_cond_init.o pthread_cond_destroy.o pthread_cond_wait.o \ + pthread_cond_timedwait.o pthread_cond_signal.o \ + pthread_cond_broadcast.o \ + pthread_condattr_init.o pthread_condattr_destroy.o \ + pthread_condattr_setclock.o pthread_condattr_getclock.o + +# Reader/Writer Locks +OBJS += pthread_rwlockattr_init.o pthread_rwlockattr_destroy.o \ + pthread_rwlock_init.o pthread_rwlock_destroy.o pthread_rwlock_rdlock.o \ + pthread_rwlock_wrlock.o pthread_rwlock_unlock.o \ + pthread_rwlock_tryrdlock.o pthread_rwlock_trywrlock.o \ + pthread_rwlock_timedrdlock.o pthread_rwlock_timedwrlock.o + +# Spin Locks +OBJS += pthread_spin_init.o pthread_spin_destroy.o pthread_spin_lock.o \ + pthread_spin_trylock.o pthread_spin_unlock.o + +# Barriers +OBJS += pthread_barrierattr_init.o pthread_barrierattr_destroy.o \ + pthread_barrier_init.o pthread_barrier_destroy.o \ + pthread_barrier_wait.o + +# Misc. +OBJS += pthread_atfork.o pthread_getsetconcurrency.o pthread_yield.o \ + pthread_setprio.o pthread_getprio.o + +include $(KOS_BASE)/addons/Makefile.prefab diff --git a/addons/libkosext2fs/kos/dreamcast.cnf b/addons/libpthread/kos/dreamcast.cnf similarity index 100% copy from addons/libkosext2fs/kos/dreamcast.cnf copy to addons/libpthread/kos/dreamcast.cnf diff --git a/addons/libpthread/pthread-internal.h b/addons/libpthread/pthread-internal.h new file mode 100644 index 00000000..9a3b3b2e --- /dev/null +++ b/addons/libpthread/pthread-internal.h @@ -0,0 +1,84 @@ +/* KallistiOS ##version## + + pthread-internal.h + Copyright (C) 2023, 2024 Lawrence Sebald +*/ ...<truncated>... hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: awayla <aw...@us...> - 2025-05-12 14:14:13
|
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, sync-sourceforge has been created at 50ab2689824349006734a69aeccf354f075804b8 (commit) - Log ----------------------------------------------------------------- commit 50ab2689824349006734a69aeccf354f075804b8 Author: Paul Cercueil <pa...@cr...> Date: Mon May 12 16:10:41 2025 +0200 SF test commit d0a08cf946acf82a7483a60eb0ee9cd7eff776b8 Author: Paul Cercueil <pa...@cr...> Date: Mon May 12 16:09:17 2025 +0200 CI: Automatically sync to SourceForge Add a Github action which triggers every time the master branch is bumped, that will sync the old SourceForge repo. Signed-off-by: Paul Cercueil <pa...@cr...> commit de6feb24c33b81a2669c89ab1030b0e70c7924a0 Author: darc <da...@pr...> Date: Sun May 11 21:03:29 2025 -0500 Add dummy char in pthread_barrierattr_t and pthread_rwlockattr_t An empty struct is undefined in C, and causes a mismatch in sizes with C++ code. We add a dummy char here to define the struct (not to mention suppress warnings). commit bfc841833c17f99435664dccdb4401e39ad3c92a Author: QuzarDC <qu...@co...> Date: Sun May 11 19:02:12 2025 -0400 Remove extraneous includes from <kos/dbglog.h> The preceeding commits fix the places within the codebase that were getting this includes from dbglog. Noticed when trying to set a `#warning` and seeing it pop up in unexpected places. commit 2da06361c09320c300189834b5fb5d5353243bd4 Author: QuzarDC <qu...@co...> Date: Sun May 11 19:01:10 2025 -0400 net_tcp add missing includes. They were being provided accidentally by <kos/dbglog.h>. commit 3ad38674588efa1d3b82bd8a2b40204b44b2df4c Author: QuzarDC <qu...@co...> Date: Sun May 11 19:00:56 2025 -0400 net_dhcp add missing includes. They were being provided accidentally by <kos/dbglog.h>. commit b21e0bf3af04ea175531d0b02d7459e116c7ffc0 Author: QuzarDC <qu...@co...> Date: Sun May 11 19:00:38 2025 -0400 realpath add missing includes. They were being provided accidentally by <kos/dbglog.h>. commit 07404a2e9b2e2bef79eed461e9ea379aafe72824 Author: QuzarDC <qu...@co...> Date: Sun May 11 19:00:17 2025 -0400 getaddrinfo add missing includes. They were being provided accidentally by <kos/dbglog.h>. commit 768ac05cdc8a78b7aebeb31be361cee8dc893405 Author: QuzarDC <qu...@co...> Date: Sun May 11 18:59:57 2025 -0400 dbglog add missing includes. They were being provided accidentally by <kos/dbglog.h>. commit 23cecd496352490b3d699e4f2ea8e81b357867ac Author: QuzarDC <qu...@co...> Date: Sun May 11 18:58:50 2025 -0400 fs_utils add missing includes. They were being provided accidentally by <kos/dbglog.h>. commit ec9d1ceaebcfc659ae3129082837b613955e7554 Author: QuzarDC <qu...@co...> Date: Sun May 11 18:58:16 2025 -0400 fs_pty add missing includes. They were being provided accidentally by <kos/dbglog.h>. commit ff0789129478fe584f42874a722cf152555981e6 Author: QuzarDC <qu...@co...> Date: Sun May 11 18:57:53 2025 -0400 vmu_pkg add missing includes. They were being provided accidentally by <kos/dbglog.h>. commit 2746498dc54fc5961318b6ddca30535a1a9f9cdc Author: QuzarDC <qu...@co...> Date: Sun May 11 18:56:21 2025 -0400 arch/stack add missing includes. They were being provided accidentally by <kos/dbglog.h>. commit 980b8e58373bdffebe2473e15e8bb41d30cd1ccb Author: QuzarDC <qu...@co...> Date: Sun May 11 18:55:06 2025 -0400 rumble add missing includes. They were being provided accidentally by <kos/dbglog.h>. commit 779af3a2febd5804ad22b9be3c6fae6b746d1c55 Author: QuzarDC <qu...@co...> Date: Sun May 11 18:54:45 2025 -0400 udpecho6 add missing includes. They were being provided accidentally by <kos/dbglog.h>. commit 70e50124d1903ddd68611c1630ddb1a3669b9fa0 Author: QuzarDC <qu...@co...> Date: Sun May 11 18:53:46 2025 -0400 net/speedtest add missing includes. They were being provided accidentally by <kos/dbglog.h>. commit 4963607accbeee5b1e5adb6a9428717046a3b1ef Author: QuzarDC <qu...@co...> Date: Sun May 11 18:49:17 2025 -0400 ntp add missing includes. unistd being provided accidentally by <kos/dbglog.h>, and <kos/thread.h> was needed after the libpthread changes. commit 32b849fff162b74cfbd8723fd45a29649688b6ca Author: QuzarDC <qu...@co...> Date: Sun May 11 18:47:48 2025 -0400 httpd add missing includes. They were being provided accidentally by <kos/dbglog.h>. commit 3a7bce6d929e2d4a97be3a6c482aeeb3e9fcefd2 Author: QuzarDC <qu...@co...> Date: Sun May 11 18:46:12 2025 -0400 libdream/vmu add missing includes. This was missing after the updates from libpthread. commit a31208545e2976dc946b40e585a4c89e84ae4eec Author: QuzarDC <qu...@co...> Date: Sun May 11 18:44:29 2025 -0400 libkosutils add missing includes. They were being provided accidentally by <kos/dbglog.h>. commit 72be9462b31f5da5d4a6161ef5198c553dfa5bca Author: QuzarDC <qu...@co...> Date: Sun May 11 18:43:27 2025 -0400 libkosext2fs add missing includes. They were being provided accidentally by <kos/dbglog.h>. commit 003fbe64373c818286fdf1ec4b8cb4b0fbc97bfc Author: DC-SWAT <sw...@21...> Date: Sun May 11 23:04:45 2025 +0700 cdrom: Introduced ability to abort a command. Also fix exports, remove useless comment and init check. commit d42da44b54512a7d403ec85b8a27bdf797b4ae8c Author: DC-SWAT <sw...@21...> Date: Fri Apr 18 20:18:24 2025 +0700 cdrom: Introduced IRQ handling for DMA and command polling. commit a3563806abdda790d3cf79129ab513e6bc951a46 Author: DC-SWAT <sw...@21...> Date: Thu Apr 17 14:53:44 2025 +0700 g1ata: Sharing IRQ DMA with cdrom. commit 9e7557a5e06a6d693cd02208aac9a8e2521990e8 Author: QuzarDC <qu...@co...> Date: Sun May 11 12:50:29 2025 -0400 Add missing include in sci The new pthreads implementation that was merged directly before the sci work changed some dependencies so it's needed to explicitly include thread.h now. Otherwise it's a warning in gcc13 and an error in newer. commit 88f2b95fb94a399d3b5d44af1ffc4be8019d261d Author: DC-SWAT <sw...@21...> Date: Sat May 10 12:56:35 2025 +0700 sci: Move reverse_bits() to math as bit_reverse8() Also update AUTHORS and README. commit fdf71759599551990e70f0018039785fe72394bd Author: DC-SWAT <sw...@21...> Date: Tue May 6 22:36:07 2025 +0700 sci: Fix DMA callbacks and codestyle commit 9e9fd275d6f6d8cf3a0a671f0e972d8a26141ccd Author: DC-SWAT <sw...@21...> Date: Tue May 6 22:35:38 2025 +0700 dmac: Always use genwait in dma_wait_complete() commit 121aec023822073812f3b009a0d2c6cf650f1bcc Author: DC-SWAT <sw...@21...> Date: Sun May 4 23:10:22 2025 +0700 sci: Refactor register definitions to use regfields commit 97d2c432224e701da929f110b2d536adfc5e3126 Author: DC-SWAT <sw...@21...> Date: Sun May 4 22:51:02 2025 +0700 sci: Added DMA support for both SPI and UART modes. commit 42728924c571cb6be9f318ca6a7d8667c4033914 Author: DC-SWAT <sw...@21...> Date: Thu May 1 16:09:35 2025 +0700 Implemented driver for SCI interface. Both UART and SPI modes are supported at all possible speeds and formats. No DMA or IRQ yet. commit 023db79ebecc9451e1181f7545e8fa5ea52429aa Author: darc <da...@pr...> Date: Fri May 9 07:03:22 2025 -0500 Fix string handling error in pthread_attr_getname_np() - Fixed erroneous comparison of buflen and thread label sizes - Added check if buflen is 0 to avoid memory corruption issues commit 2daf1dad93c56c3dbc72d0d61a67c68bd9abd8cd Author: darc <da...@pr...> Date: Thu May 8 21:35:24 2025 -0500 Small fixes for libpthread branch This is a rollup commit containing the fixes that were added in the original libpthread branch's merge commits. commit 828872948aa165a6ddc3646e6683f827acba60eb Author: Falco Girgis <gyr...@gm...> Date: Tue Jun 4 22:30:46 2024 -0500 Added support for pthread_condattr_setclock() (#513) * Helping out with Doxygen docs for Barrier API * Initial support for pthread_condattr clock_id - Only implemented storage within the pthread API - Lower levels need to be modified to support this behavior (genwait) * Implemented pthread_cond_timedwait(). - Added public and private unions for pthread_condattr_t. - Added attribute pointer to pthread_cond_t - Initialized pthread_condattr_t::clock_id to CLOCK_REALTIME by default - Implemented pthread_condattr_setclock() with support for CLOCK_MONOTONIC and CLOCK_REALTIME - Warezed darc's timing fixes for pthread_cond_timedwait() - Made pthread_cond_timedwait() respect the requested clock ID * Finished adding darc's pthread_x_timedlock() fixes - Fixed pthread_mutex_timedlock() time calculation - Fixed pthread_rwlock_timedrdlock() time calculation - Fixed pthraed_rwlock_timedwrlock() time calculation - Updated CHANGEOG with previous work for pthread_condattr_setclock() * Address review feedback - No longer storing a pointer to a pthread_condattr_t within a pthread_cond_t, copying over its values upon init instead. - Bumped pthread_condattr_t's default size up to 16 so that it has room to grow. * Fix PTHREAD_CONDATTR_SIZE in _pthreadtypes.h commit bce53fc101c3315cb8ab47de5dbb1d60359820db Author: Lawrence Sebald <ljs...@us...> Date: Mon Jan 1 02:24:56 2024 -0500 Update copyrights. commit f6c5261203c79fc3066e079ed95c270b99cbe723 Author: Lawrence Sebald <ljs...@us...> Date: Mon Jan 1 02:23:24 2024 -0500 Add barriers to libpthread. commit 1aa34a837ad3bae70b6902198dd4c6d987ed8a42 Author: Lawrence Sebald <ljs...@us...> Date: Sat Dec 30 11:32:05 2023 -0500 Add doxygen comments to kos/barrier.h commit 60421d6ecf96d335dd77d3e3deaaa1cedc66535b Author: Lawrence Sebald <ljs...@us...> Date: Fri Dec 29 23:18:15 2023 -0500 Add description of barriers. Thanks @andressbarajas. commit eadd691dd033e6a219582cb16f3bb60e5d2cb34f Author: Lawrence Sebald <ljs...@us...> Date: Fri Dec 29 23:10:10 2023 -0500 Update a few comments about thread functions. commit b359ae2677dd9eedc0aaa3bbb85ebd54e2e3d1d2 Author: Lawrence Sebald <ljs...@us...> Date: Thu Dec 28 21:44:59 2023 -0500 Add const to the attr parameter for thd_barrier_init(). commit 6186b354cf9fed7390436f728f467b58d558a93e Author: Falco Girgis <gyr...@gm...> Date: Thu Dec 28 16:07:02 2023 -0600 kthread Barrier Example/Test (#430) * Added example/test for kthread barriers - Created examples/basic/threading/barrier directory which contains an example that's also a test for kernel thread barriers. - Everything actually works and returns success EXCEPT it hangs on destroying the barriers. - Had to fix an extra semicolon in the SERIAL macro in the barrier header. * Added comments to kthread barrier test. * Added better output messages - Threads are now printed by their index rather than their internal ID, which I guess looked confusing when you only spawned 3 threads then saw a "Thread[5]" reference. - Changed the defaults back to something epic for the test. commit 58f94644d5fe509168c621bd9069d2e793b34259 Author: Lawrence Sebald <ljs...@us...> Date: Fri Dec 22 23:13:00 2023 -0500 Fix deadlock in barrier cleanup due to refcnt never being decremented. commit 5c3250c3d6898741219f4d8806af548476fa2c40 Author: Falco Girgis <gyr...@gm...> Date: Thu Dec 21 21:17:18 2023 -0600 Removed semicolon from THD_BARRIER_SINGLE_THREAD - or else it didn't act like a regular integer literal commit bbffcb927c8a266eda6617f7be64e34aee9dac62 Author: Lawrence Sebald <ljs...@us...> Date: Thu Dec 21 21:30:03 2023 -0500 Add thd_get_prio and thd_get_id functions. Also, make the accessor/mutators for thread attributes default to the current thread if the passed thread is NULL. commit e2ffec70a5578ba10a65f8b45e686058e571b275 Author: Lawrence Sebald <ljs...@us...> Date: Sun Nov 19 20:23:44 2023 -0500 Update changelog for barriers. commit d886185c6035c9a552b5062ff0c9cdd02bc24dcd Author: Lawrence Sebald <ljs...@us...> Date: Sun Nov 19 19:45:26 2023 -0500 Add initial implementation of thread barriers. commit ae290a7896364d7014d5e05135a64fd9742b7f94 Author: Lawrence Sebald <ljs...@us...> Date: Wed Nov 15 22:13:08 2023 -0500 Fix name of pthread_mutex_trylock function commit 934fbcfb4371defff3baa2c46a9b7377806ba66d Author: Lawrence Sebald <ljs...@us...> Date: Fri Sep 1 22:38:54 2023 -0400 It helps if you actually restrict all the pointers, not just one. commit 5f5ebb62f8771e01b94808149c31a52279e6e6b3 Author: Lawrence Sebald <ljs...@us...> Date: Fri Sep 1 21:52:54 2023 -0400 Add a few useful GNU/BSD extensions to pthreads and add pthread_setschedprio. Namely: - pthread_yield - pthread_getprio - pthread_setprio commit ed6b7c1c0de06e0197dfc9da8a166130665ca580 Author: Lawrence Sebald <ljs...@us...> Date: Fri Sep 1 21:19:22 2023 -0400 Remove pointless 'extern's on declarations. commit 9d1d93750d208cf01595a24b41e39ef83c0d38ed Author: Lawrence Sebald <ljs...@us...> Date: Fri Sep 1 16:18:23 2023 -0400 Update _pthread.h for older newlib versions and ensure it gets copied over too. commit 64e937d69c9f087503ce84759ece6d8c5204fbee Author: Lawrence Sebald <ljs...@us...> Date: Thu Aug 31 22:06:53 2023 -0400 Update newlib include fixup for _pthreadtypes.h instead of _pthread.h. commit e931da9cda3d70d6a61b729c710bf064a8ba8ecb Author: Lawrence Sebald <ljs...@us...> Date: Thu Aug 31 22:05:56 2023 -0400 Use <sys/cdefs.h> in <sys/sched.h>, not <kos/cdefs.h>. commit af9b2f600f80bd9e2c12f25324fbcf10b04a27bd Author: Lawrence Sebald <ljs...@us...> Date: Thu Aug 31 22:04:26 2023 -0400 Remove include of <sys/_pthread.h> commit c24867189bc311aa4029cac78037b6862ba0ebfa Author: Lawrence Sebald <ljs...@us...> Date: Thu Aug 31 22:02:31 2023 -0400 Move pthread.h to main include directory and rename _pthread_types.h to _pthreadtypes.h. commit 87289bdc1d56b48d96ac0215c5ff6843efc4ac3c Author: Lawrence Sebald <ljs...@us...> Date: Wed Aug 30 00:21:39 2023 -0400 Add in call to pthread_attr_destroy that should be there... commit 0002c120d02be35cf4112fd2f882f520028f73a9 Author: Lawrence Sebald <ljs...@us...> Date: Wed Aug 30 00:18:43 2023 -0400 Add detached thread to fill left half of screen to pthread example. commit 2c78971926c0cccacb770f9735a62874440ccaf7 Author: Lawrence Sebald <ljs...@us...> Date: Tue Aug 29 21:54:30 2023 -0400 Add basic mutex test and rwlock test commit b261906e9b032cbc7a4cc887b611c84ab961c207 Author: darc <da...@pr...> Date: Tue Aug 29 17:41:58 2023 -0500 Fix dns-client and hello-opus needing kos/threads header to build commit 81a9bc609bcadf3f0c6c69b76e409665ec9821bb Author: Lawrence Sebald <ljs...@us...> Date: Tue Aug 29 18:17:49 2023 -0400 Add start of a simple test program for pthreads. commit c6f1342b544c047682ac5bbe1cce9168d4768898 Author: Lawrence Sebald <ljs...@us...> Date: Tue Aug 29 18:13:40 2023 -0400 Add missing pthread_mutex_unlock function. commit 60eb61f025446557a41723559e5000130fefc678 Author: Lawrence Sebald <ljs...@us...> Date: Mon Aug 28 23:42:52 2023 -0400 Update RELNOTES to include information about libpthread and remove pthread.h stuff from AUTHORS. commit d30d41bbb3275b584733d0d5d906b1802a7b1f07 Author: Lawrence Sebald <ljs...@us...> Date: Mon Aug 28 23:29:34 2023 -0400 Initial commit of new libpthread. Also, remove all of the old pthreads implementation. commit 3439f217fcb1e814604df3b9dbe0b1d1e4479049 Merge: 93ffa868 4fbdd1ce Author: Lawrence Sebald <ljs...@us...> Date: Thu May 8 21:14:35 2025 -0400 Merge pull request #541 from KallistiOS/nofpu Allow the patched toolchain to support -m4-nofpu commit 93ffa86838022817d586de25eaba129eff509ca1 Merge: d65978a8 65286eb0 Author: Lawrence Sebald <ljs...@us...> Date: Thu May 8 21:13:11 2025 -0400 Merge pull request #680 from KallistiOS/moar_modularity Another round of KOS_INIT_FLAG() modularization. commit d65978a8d90eba676946e966f5cd09510b2746df Merge: 2fd07131 980772a0 Author: Lawrence Sebald <ljs...@us...> Date: Thu May 8 20:26:44 2025 -0400 Merge pull request #971 from pcercuei/maple-hotplug maple: Support multiple hotplug callbacks commit 2fd07131a428445d21170b92fc024c2c256e97ca Merge: 1aaa930b 8d5662e4 Author: Lawrence Sebald <ljs...@us...> Date: Thu May 8 20:23:33 2025 -0400 Merge pull request #981 from pcercuei/pvr-new-header pvr: Move + improve PVR poly headers and types into their own file commit 8d5662e4918bfc859ab509a369f3ec4ac108402f Author: Paul Cercueil <pa...@cr...> Date: Fri May 2 12:19:42 2025 +0200 pvr: Improve documentation of texture shading modes The previous documentation was not wrong, but was pretty cryptic. Signed-off-by: Paul Cercueil <pa...@cr...> commit d6211e47cde27eac3bbeb7f057cccd37b085a746 Author: Paul Cercueil <pa...@cr...> Date: Fri Mar 28 22:24:51 2025 +0100 pvr: Move + improve PVR poly headers and types into their own file Create enums and types for the various macros relative to the PVR headers and polygon contexts. Note the change with PVR_FILTER_* values - which does not break API since the register field was moved as well. Create types for the cmd, mode1, mode2, mode3 fields of a PVR header. Redefine pvr_poly_hdr_t to use these new types, in a fully backwards-compatible manner. This allows applications to create poly headers directly, without having to go through creating a poly context that is later "compiled". It also greatly improves documentation, if only because of the type system. Signed-off-by: Paul Cercueil <pa...@cr...> commit 4fbdd1ce38ca82ab322438e75c6aab6dbc36396b Author: QuzarDC <qu...@co...> Date: Wed Jan 29 13:05:35 2025 -0500 Allow patched toolchain to support -m4-nofpu This still will not build language support for objc/cpp but does for c/cpp and can successfully build dcload with a patch there. This does not support building KOS but as startup.s is provided to the toolchain, it needed adjustment. This should be helpful for those who had been investigating using KallistiOS org stuff on alternative SH machines. commit 980772a00645c3c42e00679612ea0fd3009f06c2 Author: Paul Cercueil <pa...@cr...> Date: Wed Apr 16 18:53:25 2025 +0200 maple: Support multiple hotplug callbacks Previously, maple_attach_callback() would register a callback function to be called when a device featuring one or more of the specified functions was plugged. The problem is that there could only be a single callback function registered at any given time; it was therefore impossible to register a callback e.g. for a controller and a different one for a VMU. Address this issue by adding callback pointers inside the maple_driver structure itself, and update maple_attach_callback and maple_detach_callback to update the fields of the drivers that match the specified functions. With this new setup, there can be one attach / detach callback couple registered for each single function, or any combination of them, that KallistiOS supports. Signed-off-by: Paul Cercueil <pa...@cr...> commit 65286eb0023170b51309917cc993b2fa6162e2d9 Author: Falco Girgis <gyr...@gm...> Date: Wed Dec 11 01:15:24 2024 -0600 Addressed review feedback. commit 86bcf15ad7c4a8158517bbb8e619ada2ff14ce0c Author: Falco Girgis <gyr...@gm...> Date: Mon Dec 9 00:09:26 2024 -0600 Addressed review feedback. commit adc3958020006187adeb57166a25de9b199fafcf Merge: ab88f766 1ee18d89 Author: Falco Girgis <gyr...@gm...> Date: Sun Dec 8 08:52:24 2024 -0600 Merge branch 'moar_modularity' of github.com:KallistiOS/KallistiOS into moar_modularity commit 1ee18d89a686add380da5a019174700a259681cc Merge: 1e6f8eb3 bae7adbd Author: Falco Girgis <gyr...@gm...> Date: Sun Dec 8 08:42:05 2024 -0600 Merge branch 'master' into moar_modularity commit ab88f7661d1f9e9fbb4d6b29b9775d1db4b46058 Merge: 1e6f8eb3 bae7adbd Author: Falco Girgis <gyr...@gm...> Date: Sun Dec 8 07:51:55 2024 -0600 Merge branch 'master' into moar_modularity commit 1e6f8eb37ae92aca4d9c73c46eb7359b97eee0d2 Author: Falco Girgis <gyr...@gm...> Date: Fri Aug 9 21:17:36 2024 -0500 Fixed missing KOS_INIT_FLAG() declarations. commit 21b5df1e9c3557f1b8c8f323c32f83b9e532eef3 Author: Falco Girgis <gyr...@gm...> Date: Tue Jul 16 20:09:51 2024 -0500 Another round of KOS_INIT_FLAG() modularization. The following new KOS_INIT_FLAG() values have been added; however, none of the defaults have changed, so they are all already enabled as part of INIT_DEFAULT. 1) INIT_FS_DEV - enable /dev/ VFS 2) INIT_FS_NULL - enable /dev/null VFS 3) INIT_FS_PTY - enable /pty 4) INIT_FS_RAMDISK - enable /ram 5) INIT_FS_RND - enable /dev/urandom 6) INIT_LIBRARY - enable dynamic library loading ----------------------------------------------------------------------- hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: quzar <qu...@us...> - 2025-05-12 04:23:57
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The KallistiOS port of PLIB.". The branch, master has been updated via 3c0e12af53679bdbae667758aef3ef679cc6ef5e (commit) from 90fa6bf24baa61a0c3022a3d4d72d1ab6217ff76 (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 3c0e12af53679bdbae667758aef3ef679cc6ef5e Author: QuzarDC <qu...@co...> Date: Mon May 12 00:02:19 2025 -0400 Fix missing stdargs include. Was getting stdargs from kos/dbglog.h until KallistiOS#995 ----------------------------------------------------------------------- Summary of changes: ulError.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ulError.cc b/ulError.cc index 1a25f30..6dfffdd 100644 --- a/ulError.cc +++ b/ulError.cc @@ -22,6 +22,8 @@ #include <stdio.h> #include <stdlib.h> +#include <stdarg.h> + #include "ul.h" static char _ulErrorBuffer [ 1024 ] = { '\0' } ; hooks/post-receive -- The KallistiOS port of PLIB. |
From: quzar <qu...@us...> - 2025-05-07 12:55:39
|
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 1aaa930bf1050ef8116bf23527eba95a16da6efb (commit) via 5607a3e0e0da992d0780e6ab8920788970faaed7 (commit) from 0d7f67c472aa4b8eef910aba339f247fde3b2134 (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 1aaa930bf1050ef8116bf23527eba95a16da6efb Author: DC-SWAT <sw...@21...> Date: Wed May 7 11:06:10 2025 +0700 sd: Optimized reading and writing sectors on SCIF-SPI. About ~10% increase for reading. commit 5607a3e0e0da992d0780e6ab8920788970faaed7 Author: SiZiOUS <si...@gm...> Date: Tue Apr 29 21:59:12 2025 +0200 `dc-chain`: adding GCC 9.5.0 patches for MinGW-w64/MSYS2 Adding for both MinGW-w64 32-bit (`i686-w64-mingw32`, aka `mingw32`) and for MinGW-w64 64-bit (`x86_64-w64-mingw32` aka `mingw64`). ----------------------------------------------------------------------- Summary of changes: kernel/arch/dreamcast/hardware/sd.c | 18 +- .../patches/i686-w64-mingw32/gcc-9.5.0.diff | 2810 ++++++++++++++++++++ .../patches/x86_64-w64-mingw32/gcc-9.5.0.diff | 2810 ++++++++++++++++++++ 3 files changed, 5627 insertions(+), 11 deletions(-) create mode 100644 utils/dc-chain/patches/i686-w64-mingw32/gcc-9.5.0.diff create mode 100644 utils/dc-chain/patches/x86_64-w64-mingw32/gcc-9.5.0.diff diff --git a/kernel/arch/dreamcast/hardware/sd.c b/kernel/arch/dreamcast/hardware/sd.c index ca6b8af8..c687f9a2 100644 --- a/kernel/arch/dreamcast/hardware/sd.c +++ b/kernel/arch/dreamcast/hardware/sd.c @@ -305,8 +305,6 @@ int sd_shutdown(void) { } static int read_data(size_t bytes, uint8 *buf) { - uint8 *ptr = buf; - size_t cnt = bytes; uint8 byte; uint16 crc; int i = 0; @@ -321,12 +319,10 @@ static int read_data(size_t bytes, uint8 *buf) { return -1; /* Read in the data */ - while(cnt--) { - *ptr++ = scif_spi_rw_byte(0xFF); - } + scif_spi_read_data(buf, bytes); /* Read in the trailing CRC */ - crc = (scif_spi_rw_byte(0xFF) << 8) | scif_spi_rw_byte(0xFF); + crc = (scif_spi_read_byte() << 8) | scif_spi_read_byte(); /* Return success if the CRC matches */ return crc != net_crc16ccitt(buf, bytes, 0); @@ -406,20 +402,20 @@ static int write_data(uint8 tag, size_t bytes, const uint8 *buf) { if(rv != 0xFF) return -1; - scif_spi_rw_byte(tag); + scif_spi_write_byte(tag); /* Send the data. */ crc = net_crc16ccitt(buf, bytes, 0); while(bytes--) { - scif_spi_rw_byte(*ptr++); + scif_spi_write_byte(*ptr++); } /* Write out the block's crc */ - scif_spi_rw_byte((uint8)(crc >> 8)); - scif_spi_rw_byte((uint8)crc); + scif_spi_write_byte((uint8)(crc >> 8)); + scif_spi_write_byte((uint8)crc); /* Make sure the card accepted the block */ - rv = scif_spi_rw_byte(0xFF); + rv = scif_spi_read_byte(); if((rv & 0x1F) != 0x05) return -1; diff --git a/utils/dc-chain/patches/i686-w64-mingw32/gcc-9.5.0.diff b/utils/dc-chain/patches/i686-w64-mingw32/gcc-9.5.0.diff new file mode 100644 index 00000000..1fe0980b --- /dev/null +++ b/utils/dc-chain/patches/i686-w64-mingw32/gcc-9.5.0.diff @@ -0,0 +1,2810 @@ +diff -ruN gcc-9.5.0/gcc/ada/adaint.c gcc-9.5.0-patched/gcc/ada/adaint.c +--- gcc-9.5.0/gcc/ada/adaint.c 2022-05-27 09:21:10.583377700 +0200 ++++ gcc-9.5.0-patched/gcc/ada/adaint.c 2025-04-28 14:41:55.127009100 +0200 +@@ -192,6 +192,7 @@ + + #elif defined (_WIN32) + ++#define WIN32_LEAN_AND_MEAN + #include <windows.h> + #include <accctrl.h> + #include <aclapi.h> +diff -ruN gcc-9.5.0/gcc/ada/cio.c gcc-9.5.0-patched/gcc/ada/cio.c +--- gcc-9.5.0/gcc/ada/cio.c 2022-05-27 09:21:10.595377700 +0200 ++++ gcc-9.5.0-patched/gcc/ada/cio.c 2025-04-28 14:41:55.131917000 +0200 +@@ -68,6 +68,7 @@ + #endif + + #ifdef RTX ++#define WIN32_LEAN_AND_MEAN + #include <windows.h> + #include <Rtapi.h> + #endif +diff -ruN gcc-9.5.0/gcc/ada/ctrl_c.c gcc-9.5.0-patched/gcc/ada/ctrl_c.c +--- gcc-9.5.0/gcc/ada/ctrl_c.c 2022-05-27 09:21:10.595377700 +0200 ++++ gcc-9.5.0-patched/gcc/ada/ctrl_c.c 2025-04-28 14:41:55.136067500 +0200 +@@ -131,6 +131,7 @@ + #elif defined (__MINGW32__) + + #include "mingw32.h" ++#define WIN32_LEAN_AND_MEAN + #include <windows.h> + + void (*sigint_intercepted) (void) = NULL; +diff -ruN gcc-9.5.0/gcc/ada/expect.c gcc-9.5.0-patched/gcc/ada/expect.c +--- gcc-9.5.0/gcc/ada/expect.c 2022-05-27 09:21:10.651378000 +0200 ++++ gcc-9.5.0-patched/gcc/ada/expect.c 2025-04-28 14:41:55.140700100 +0200 +@@ -77,6 +77,7 @@ + + #ifdef _WIN32 + ++#define WIN32_LEAN_AND_MEAN + #include <windows.h> + #include <process.h> + #include <signal.h> +diff -ruN gcc-9.5.0/gcc/ada/gsocket.h gcc-9.5.0-patched/gcc/ada/gsocket.h +--- gcc-9.5.0/gcc/ada/gsocket.h 2022-05-27 09:21:10.683378200 +0200 ++++ gcc-9.5.0-patched/gcc/ada/gsocket.h 2025-04-28 14:41:55.145733600 +0200 +@@ -166,6 +166,7 @@ + + #endif + ++#define WIN32_LEAN_AND_MEAN + #include <windows.h> + + #elif defined(VMS) +diff -ruN gcc-9.5.0/gcc/ada/mingw32.h gcc-9.5.0-patched/gcc/ada/mingw32.h +--- gcc-9.5.0/gcc/ada/mingw32.h 2022-05-27 09:21:10.759378500 +0200 ++++ gcc-9.5.0-patched/gcc/ada/mingw32.h 2025-04-28 14:41:55.148804700 +0200 +@@ -58,6 +58,7 @@ + #define _X86INTRIN_H_INCLUDED + #define _EMMINTRIN_H_INCLUDED + #endif ++#define WIN32_LEAN_AND_MEAN + #include <windows.h> + + /* After including this file it is possible to use the character t as prefix +diff -ruN gcc-9.5.0/gcc/ada/mkdir.c gcc-9.5.0-patched/gcc/ada/mkdir.c +--- gcc-9.5.0/gcc/ada/mkdir.c 2022-05-27 09:21:10.759378500 +0200 ++++ gcc-9.5.0-patched/gcc/ada/mkdir.c 2025-04-28 14:41:55.153885500 +0200 +@@ -45,6 +45,7 @@ + + #ifdef __MINGW32__ + #include "mingw32.h" ++#define WIN32_LEAN_AND_MEAN + #include <windows.h> + #ifdef MAXPATHLEN + #define GNAT_MAX_PATH_LEN MAXPATHLEN +diff -ruN gcc-9.5.0/gcc/ada/rtfinal.c gcc-9.5.0-patched/gcc/ada/rtfinal.c +--- gcc-9.5.0/gcc/ada/rtfinal.c 2022-05-27 09:21:10.771378600 +0200 ++++ gcc-9.5.0-patched/gcc/ada/rtfinal.c 2025-04-28 14:41:55.166223600 +0200 +@@ -47,6 +47,7 @@ + + #if defined (__MINGW32__) + #include "mingw32.h" ++#define WIN32_LEAN_AND_MEAN + #include <windows.h> + + extern CRITICAL_SECTION ProcListCS; +diff -ruN gcc-9.5.0/gcc/ada/rtinit.c gcc-9.5.0-patched/gcc/ada/rtinit.c +--- gcc-9.5.0/gcc/ada/rtinit.c 2022-05-27 09:21:10.771378600 +0200 ++++ gcc-9.5.0-patched/gcc/ada/rtinit.c 2025-04-28 14:41:55.172726400 +0200 +@@ -73,6 +73,7 @@ + + #if defined (__MINGW32__) + #include "mingw32.h" ++#define WIN32_LEAN_AND_MEAN + #include <windows.h> + + extern void __gnat_init_float (void); +diff -ruN gcc-9.5.0/gcc/ada/seh_init.c gcc-9.5.0-patched/gcc/ada/seh_init.c +--- gcc-9.5.0/gcc/ada/seh_init.c 2022-05-27 09:21:10.775378600 +0200 ++++ gcc-9.5.0-patched/gcc/ada/seh_init.c 2025-04-28 14:41:55.177886600 +0200 +@@ -34,6 +34,7 @@ + + #if defined (_WIN32) || (defined (__CYGWIN__) && defined (__SEH__)) + /* Include system headers, before system.h poisons malloc. */ ++#define WIN32_LEAN_AND_MEAN + #include <windows.h> + #include <excpt.h> + #endif +diff -ruN gcc-9.5.0/gcc/ada/sysdep.c gcc-9.5.0-patched/gcc/ada/sysdep.c +--- gcc-9.5.0/gcc/ada/sysdep.c 2022-05-27 09:21:10.843378900 +0200 ++++ gcc-9.5.0-patched/gcc/ada/sysdep.c 2025-04-28 14:41:55.183945700 +0200 +@@ -215,6 +215,7 @@ + #endif /* __CYGWIN__ */ + + #if defined (__CYGWIN__) || defined (__MINGW32__) ++#define WIN32_LEAN_AND_MEAN + #include <windows.h> + + int __gnat_is_windows_xp (void); +@@ -591,6 +592,7 @@ + Ada programs. */ + + #ifdef WINNT ++#define WIN32_LEAN_AND_MEAN + #include <windows.h> + + /* Provide functions to echo the values passed to WinMain (windows bindings +diff -ruN gcc-9.5.0/gcc/ada/terminals.c gcc-9.5.0-patched/gcc/ada/terminals.c +--- gcc-9.5.0/gcc/ada/terminals.c 2022-05-27 09:21:10.843378900 +0200 ++++ gcc-9.5.0-patched/gcc/ada/terminals.c 2025-04-28 14:41:55.191540000 +0200 +@@ -151,6 +151,7 @@ + #include <stdio.h> + #include <stdlib.h> + ++#define WIN32_LEAN_AND_MEAN + #include <windows.h> + + #define MAXPATHLEN 1024 +diff -ruN gcc-9.5.0/gcc/ada/tracebak.c gcc-9.5.0-patched/gcc/ada/tracebak.c +--- gcc-9.5.0/gcc/ada/tracebak.c 2022-05-27 09:21:10.843378900 +0200 ++++ gcc-9.5.0-patched/gcc/ada/tracebak.c 2025-04-28 14:41:55.197690500 +0200 +@@ -97,6 +97,7 @@ + + #if defined (_WIN64) && defined (__SEH__) + ++#define WIN32_LEAN_AND_MEAN + #include <windows.h> + + #define IS_BAD_PTR(ptr) (IsBadCodePtr((FARPROC)ptr)) +@@ -444,6 +445,7 @@ + #elif defined (__i386__) || defined (__x86_64__) + + #if defined (__WIN32) ++#define WIN32_LEAN_AND_MEAN + #include <windows.h> + #define IS_BAD_PTR(ptr) (IsBadCodePtr((FARPROC)ptr)) + #elif defined (__sun__) +diff -ruN gcc-9.5.0/gcc/d/dmd/root/file.c gcc-9.5.0-patched/gcc/d/dmd/root/file.c +--- gcc-9.5.0/gcc/d/dmd/root/file.c 2022-05-27 09:21:11.147380400 +0200 ++++ gcc-9.5.0-patched/gcc/d/dmd/root/file.c 2025-04-28 14:41:55.254807300 +0200 +@@ -10,6 +10,7 @@ + #include "file.h" + + #if _WIN32 ++#define WIN32_LEAN_AND_MEAN + #include <windows.h> + #endif + +diff -ruN gcc-9.5.0/gcc/d/dmd/root/filename.c gcc-9.5.0-patched/gcc/d/dmd/root/filename.c +--- gcc-9.5.0/gcc/d/dmd/root/filename.c 2022-05-27 09:21:11.147380400 +0200 ++++ gcc-9.5.0-patched/gcc/d/dmd/root/filename.c 2025-04-28 14:41:55.261719800 +0200 +@@ -15,6 +15,7 @@ + #include "rmem.h" + + #if _WIN32 ++#define WIN32_LEAN_AND_MEAN + #include <windows.h> + #endif + +diff -ruN gcc-9.5.0/gcc/diagnostic-color.c gcc-9.5.0-patched/gcc/diagnostic-color.c +--- gcc-9.5.0/gcc/diagnostic-color.c 2022-05-27 09:21:11.155380500 +0200 ++++ gcc-9.5.0-patched/gcc/diagnostic-color.c 2025-04-28 14:41:55.268542100 +0200 +@@ -21,6 +21,7 @@ + #include "diagnostic-color.h" + + #ifdef __MINGW32__ ++# define WIN32_LEAN_AND_MEAN + # include <windows.h> + #endif + +diff -ruN gcc-9.5.0/gcc/prefix.c gcc-9.5.0-patched/gcc/prefix.c +--- gcc-9.5.0/gcc/prefix.c 2022-05-27 09:21:11.703383200 +0200 ++++ gcc-9.5.0-patched/gcc/prefix.c 2025-04-28 14:41:55.290110200 +0200 +@@ -67,6 +67,7 @@ + #include "system.h" + #include "coretypes.h" + #if defined(_WIN32) && defined(ENABLE_WIN32_REGISTRY) ++#define WIN32_LEAN_AND_MEAN + #include <windows.h> + #endif + #include "prefix.h" +diff -ruN gcc-9.5.0/gcc/testsuite/g++.dg/asan/sanitizer_test_utils.h gcc-9.5.0-patched/gcc/testsuite/g++.dg/asan/sanitizer_test_utils.h +--- gcc-9.5.0/gcc/testsuite/g++.dg/asan/sanitizer_test_utils.h 2022-05-27 09:21:11.851383900 +0200 ++++ gcc-9.5.0-patched/gcc/testsuite/g++.dg/asan/sanitizer_test_utils.h 2025-04-28 14:41:55.307048000 +0200 +@@ -15,6 +15,7 @@ + + #if defined(_WIN32) + // <windows.h> should always be the first include on Windows. ++# define WIN32_LEAN_AND_MEAN + # include <windows.h> + // MSVS headers define max/min as macros, so std::max/min gets crazy. + # undef max +diff -ruN gcc-9.5.0/gcc/testsuite/gcc.dg/di-sync-multithread.c gcc-9.5.0-patched/gcc/testsuite/gcc.dg/di-sync-multithread.c +--- gcc-9.5.0/gcc/testsuite/gcc.dg/di-sync-multithread.c 2022-05-27 09:21:12.151385400 +0200 ++++ gcc-9.5.0-patched/gcc/testsuite/gcc.dg/di-sync-multithread.c 2025-04-28 14:41:55.313904000 +0200 +@@ -11,6 +11,7 @@ + #include <pthread.h> + #include <unistd.h> + #ifdef _WIN32 ++#define WIN32_LEAN_AND_MEAN + #include <windows.h> + #endif + +diff -ruN gcc-9.5.0/gcc/testsuite/gcc.dg/format/ms-format3.c gcc-9.5.0-patched/gcc/testsuite/gcc.dg/format/ms-format3.c +--- gcc-9.5.0/gcc/testsuite/gcc.dg/format/ms-format3.c 2022-05-27 09:21:12.155385400 +0200 ++++ gcc-9.5.0-patched/gcc/testsuite/gcc.dg/format/ms-format3.c 2025-04-28 14:41:55.321098100 +0200 +@@ -8,6 +8,7 @@ + #define USE_SYSTEM_FORMATS + #define WIN32_LEAN_AND_MEAN + #include "format.h" ++#define WIN32_LEAN_AND_MEAN + #include <windows.h> + + void foo (LONG_PTR l, ULONG_PTR u, DWORD_PTR d, UINT_PTR p, SIZE_T s) +diff -ruN gcc-9.5.0/gcc/testsuite/objc-obj-c++-shared/GNUStep/GNUstepBase/GSConfig.h gcc-9.5.0-patched/gcc/testsuite/objc-obj-c++-shared/GNUStep/GNUstepBase/GSConfig.h +--- gcc-9.5.0/gcc/testsuite/objc-obj-c++-shared/GNUStep/GNUstepBase/GSConfig.h 2022-05-27 09:21:12.711388100 +0200 ++++ gcc-9.5.0-patched/gcc/testsuite/objc-obj-c++-shared/GNUStep/GNUstepBase/GSConfig.h 2025-04-28 21:56:15.339515200 +0200 +@@ -307,6 +307,7 @@ + #define WINVER Windows2000 + #endif + ++#define WIN32_LEAN_AND_MEAN + #if defined(__WIN64__) + #include <winsock2.h> + #include <windows.h> +diff -ruN gcc-9.5.0/libatomic/config/mingw/lock.c gcc-9.5.0-patched/libatomic/config/mingw/lock.c +--- gcc-9.5.0/libatomic/config/mingw/lock.c 2022-05-27 09:21:12.803388500 +0200 ++++ gcc-9.5.0-patched/libatomic/config/mingw/lock.c 2025-04-28 14:41:55.353547500 +0200 +@@ -23,6 +23,7 @@ + <http://www.gnu.org/licenses/>. */ + + #define UWORD __shadow_UWORD ++#define WIN32_LEAN_AND_MEAN + #include <windows.h> + #undef UWORD + #include "libatomic_i.h" +diff -ruN gcc-9.5.0/libcpp/system.h gcc-9.5.0-patched/libcpp/system.h +--- gcc-9.5.0/libcpp/system.h 2022-05-27 09:21:12.835388700 +0200 ++++ gcc-9.5.0-patched/libcpp/system.h 2025-04-28 21:58:28.654156400 +0200 +@@ -272,7 +272,9 @@ + #endif + + #ifndef HAVE_SETLOCALE +-# define setlocale(category, locale) (locale) ++# ifndef ENABLE_NLS ++# define setlocale(category, locale) (locale) ++# endif + #endif + + #ifdef ENABLE_NLS +diff -ruN gcc-9.5.0/libffi/src/x86/darwin_c.c gcc-9.5.0-patched/libffi/src/x86/darwin_c.c +--- gcc-9.5.0/libffi/src/x86/darwin_c.c 2022-05-27 09:21:12.851388800 +0200 ++++ gcc-9.5.0-patched/libffi/src/x86/darwin_c.c 2025-04-28 14:41:55.366580200 +0200 +@@ -31,6 +31,7 @@ + #if !defined(__x86_64__) || defined(_WIN64) || defined(__CYGWIN__) + + #ifdef _WIN64 ++#define WIN32_LEAN_AND_MEAN + #include <windows.h> + #endif + +diff -ruN gcc-9.5.0/libgcc/config/i386/enable-execute-stack-mingw32.c gcc-9.5.0-patched/libgcc/config/i386/enable-execute-stack-mingw32.c +--- gcc-9.5.0/libgcc/config/i386/enable-execute-stack-mingw32.c 2022-05-27 09:21:12.867388900 +0200 ++++ gcc-9.5.0-patched/libgcc/config/i386/enable-execute-stack-mingw32.c 2025-04-28 14:41:55.380079700 +0200 +@@ -22,6 +22,7 @@ + see the files COPYING3 and COPYING.RUNTIME respectively. If not, see + <http://www.gnu.org/licenses/>. */ + ++#define WIN32_LEAN_AND_MEAN + #include <windows.h> + + extern void __enable_execute_stack (void *); +diff -ruN gcc-9.5.0/libgcc/config/i386/gthr-win32.c gcc-9.5.0-patched/libgcc/config/i386/gthr-win32.c +--- gcc-9.5.0/libgcc/config/i386/gthr-win32.c 2022-05-27 09:21:12.867388900 +0200 ++++ gcc-9.5.0-patched/libgcc/config/i386/gthr-win32.c 2025-04-28 14:41:55.384272800 +0200 +@@ -27,6 +27,7 @@ + see the files COPYING3 and COPYING.RUNTIME respectively. If not, see + <http://www.gnu.org/licenses/>. */ + ++#define WIN32_LEAN_AND_MEAN + #include <windows.h> + #ifndef __GTHREAD_HIDE_WIN32API + # define __GTHREAD_HIDE_WIN32API 1 +diff -ruN gcc-9.5.0/libgcc/config/i386/gthr-win32.h gcc-9.5.0-patched/libgcc/config/i386/gthr-win32.h +--- gcc-9.5.0/libgcc/config/i386/gthr-win32.h 2022-05-27 09:21:12.867388900 +0200 ++++ gcc-9.5.0-patched/libgcc/config/i386/gthr-win32.h 2025-04-28 14:41:55.390564800 +0200 +@@ -82,6 +82,7 @@ + #ifndef __OBJC__ + #define __OBJC__ + #endif ++#define WIN32_LEAN_AND_MEAN + #include <windows.h> + /* Now undef the windows BOOL. */ + #undef BOOL +@@ -546,6 +547,7 @@ + #else /* ! __GTHREAD_HIDE_WIN32API */ + + #define NOGDI ++#define WIN32_LEAN_AND_MEAN + #include <windows.h> + #include <errno.h> + +diff -ruN gcc-9.5.0/libgcc/config/sh/crt1.S gcc-9.5.0-patched/libgcc/config/sh/crt1.S +--- gcc-9.5.0/libgcc/config/sh/crt1.S 2022-05-27 09:21:12.907389100 +0200 ++++ gcc-9.5.0-patched/libgcc/config/sh/crt1.S 2025-04-28 22:00:31.971574600 +0200 +@@ -1,724 +1,724 @@ +-/* Copyright (C) 2000-2019 Free Software Foundation, Inc. +- This file was pretty much copied from newlib. +- +-This file is part of GCC. +- +-GCC is free software; you can redistribute it and/or modify it +-under the terms of the GNU General Public License as published by the +-Free Software Foundation; either version 3, or (at your option) any +-later version. +- +-GCC is distributed in the hope that it will be useful, +-but WITHOUT ANY WARRANTY; without even the implied warranty of +-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +-General Public License for more details. +- +-Under Section 7 of GPL version 3, you are granted additional +-permissions described in the GCC Runtime Library Exception, version +-3.1, as published by the Free Software Foundation. +- +-You should have received a copy of the GNU General Public License and +-a copy of the GCC Runtime Library Exception along with this program; +-see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +-<http://www.gnu.org/licenses/>. */ +- +-#include "crt.h" +- +-#ifdef MMU_SUPPORT +- /* Section used for exception/timer interrupt stack area */ +- .section .data.vbr.stack,"aw" +- .align 4 +- .global __ST_VBR +-__ST_VBR: +- .zero 1024 * 2 /* ; 2k for VBR handlers */ +-/* Label at the highest stack address where the stack grows from */ +-__timer_stack: +-#endif /* MMU_SUPPORT */ +- +- /* ;---------------------------------------- +- Normal newlib crt1.S */ +- +- ! make a place to keep any previous value of the vbr register +- ! this will only have a value if it has been set by redboot (for example) +- .section .bss +-old_vbr: +- .long 0 +-#ifdef PROFILE +-profiling_enabled: +- .long 0 +-#endif +- +- +- .section .text +- .global start +- .import ___rtos_profiler_start_timer +- .weak ___rtos_profiler_start_timer +-start: +- mov.l stack_k,r15 +- +-#if defined (__SH3__) || (defined (__SH_FPU_ANY__) && ! defined (__SH2E__) && ! defined (__SH2A__)) || defined (__SH4_NOFPU__) +-#define VBR_SETUP +- ! before zeroing the bss ... +- ! if the vbr is already set to vbr_start then the program has been restarted +- ! (i.e. it is not the first time the program has been run since reset) +- ! reset the vbr to its old value before old_vbr (in bss) is wiped +- ! this ensures that the later code does not create a circular vbr chain +- stc vbr, r1 +- mov.l vbr_start_k, r2 +- cmp/eq r1, r2 +- bf 0f +- ! reset the old vbr value +- mov.l old_vbr_k, r1 +- mov.l @r1, r2 +- ldc r2, vbr +-0: +-#endif /* VBR_SETUP */ +- +- ! zero out bss +- mov.l edata_k,r0 +- mov.l end_k,r1 +- mov #0,r2 +-start_l: +- mov.l r2,@r0 +- add #4,r0 +- cmp/ge r0,r1 +- bt start_l +- +-#if defined (__SH_FPU_ANY__) +- mov.l set_fpscr_k, r1 +- mov #4,r4 +- jsr @r1 +- shll16 r4 ! Set DN bit (flush denormal inputs to zero) +- lds r3,fpscr ! Switch to default precision +-#endif /* defined (__SH_FPU_ANY__) */ +- +-#ifdef VBR_SETUP +- ! save the existing contents of the vbr +- ! there will only be a prior value when using something like redboot +- ! otherwise it will be zero +- stc vbr, r1 +- mov.l old_vbr_k, r2 +- mov.l r1, @r2 +- ! setup vbr +- mov.l vbr_start_k, r1 +- ldc r1,vbr +-#endif /* VBR_SETUP */ +- +- ! if an rtos is exporting a timer start fn, +- ! then pick up an SR which does not enable ints +- ! (the rtos will take care of this) +- mov.l rtos_start_fn, r0 +- mov.l sr_initial_bare, r1 +- tst r0, r0 +- bt set_sr +- +- mov.l sr_initial_rtos, r1 +- +-set_sr: ...<truncated>... hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: quzar <qu...@us...> - 2025-05-05 04:00:44
|
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 0d7f67c472aa4b8eef910aba339f247fde3b2134 (commit) via 3ab157c5d80b0500039d4d6ecbfcb54b19469e40 (commit) via a5d88d7b0a816302b0a9f1f6ed52ae36dfd38f23 (commit) via fb4de26ba11483edcaf7c41cdc1decfe9e36b1f5 (commit) via 351d498a39ca41b66e7c1f8aaf280076e2d1d151 (commit) from 2762ceff10c06ff491290630faeee1584b7c96a3 (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 0d7f67c472aa4b8eef910aba339f247fde3b2134 Author: QuzarDC <qu...@co...> Date: Sun May 4 13:26:01 2025 -0400 Update gitignore to ignore intermediate bin2c file. With #977 the ARM firmware is now using bin2c so an intermediary .c file is created that should be ignored by git. commit 3ab157c5d80b0500039d4d6ecbfcb54b19469e40 Author: Paul Cercueil <pa...@cr...> Date: Mon May 5 00:10:44 2025 +0200 ldscript: Drop SEARCH_DIR It has been pointing to the wrong path for years, without causing any issues; which means we don't really need it and it can safely be dropped. Signed-off-by: Paul Cercueil <pa...@cr...> commit a5d88d7b0a816302b0a9f1f6ed52ae36dfd38f23 Author: Paul Cercueil <pa...@cr...> Date: Fri Apr 25 16:00:35 2025 +0200 ldscript: Add icache-aligned subsections These subsections can be used to enforce specific functions to be sitting close together in the binary, to make sure that they won't flush one another outside the icache. These can be used like this, for instance: __attribute__((section(".sub0"))) int my_function(void) { ... } These subsections only take the space of the functions they contain. If they are not used, they don't take any space. Signed-off-by: Paul Cercueil <pa...@cr...> commit fb4de26ba11483edcaf7c41cdc1decfe9e36b1f5 Author: Paul Cercueil <pa...@cr...> Date: Fri Apr 25 15:59:46 2025 +0200 ldscripts: Drop old Naomi linker script It is not used anymore. Signed-off-by: Paul Cercueil <pa...@cr...> commit 351d498a39ca41b66e7c1f8aaf280076e2d1d151 Author: Paul Cercueil <pa...@cr...> Date: Fri Apr 25 15:57:13 2025 +0200 ldscripts: Use one linker script for all subarchs Using one linker script per subarch is the best way to involuntarily introduce bugs. For instance, the shlelf-naomi.xc was missing the .monitors section. Since the only difference between the two (apart from the missing .monitors section) was the load address, set the default at 0x8c010000 and allow the environment to override the load address. Signed-off-by: Paul Cercueil <pa...@cr...> ----------------------------------------------------------------------- Summary of changes: .gitignore | 1 + environ_dreamcast.sh | 7 +- utils/ldscripts/shlelf-naomi.xc | 254 ---------------------------------------- utils/ldscripts/shlelf.xc | 38 +++++- 4 files changed, 40 insertions(+), 260 deletions(-) delete mode 100644 utils/ldscripts/shlelf-naomi.xc diff --git a/.gitignore b/.gitignore index 7552e5e2..cb2657a4 100644 --- a/.gitignore +++ b/.gitignore @@ -17,6 +17,7 @@ kernel/stubs/*.c kernel/exports/kernel_exports.c kernel/arch/dreamcast/kernel/arch_exports.c kernel/arch/dreamcast/kernel/banner.h +kernel/arch/dreamcast/sound/snd_stream_drv.c kernel/arch/dreamcast/sound/arm/stream.drv utils/bincnv/bincnv utils/genromfs/genromfs diff --git a/environ_dreamcast.sh b/environ_dreamcast.sh index f5adfe5a..ced09d2f 100644 --- a/environ_dreamcast.sh +++ b/environ_dreamcast.sh @@ -24,15 +24,14 @@ fi export KOS_CFLAGS="${KOS_CFLAGS} ${KOS_SH4_PRECISION} -ml -mfsrra -mfsca -ffunction-sections -fdata-sections -matomic-model=soft-imask -ftls-model=local-exec" export KOS_AFLAGS="${KOS_AFLAGS} -little" +export KOS_LDFLAGS="${KOS_LDFLAGS} ${KOS_SH4_PRECISION} -ml -Wl,--gc-sections" +export KOS_LD_SCRIPT="-T${KOS_BASE}/utils/ldscripts/shlelf.xc" if [ x${KOS_SUBARCH} = xnaomi ]; then export KOS_CFLAGS="${KOS_CFLAGS} -D__NAOMI__" - export KOS_LDFLAGS="${KOS_LDFLAGS} ${KOS_SH4_PRECISION} -ml -Wl,-Ttext=0x8c020000 -Wl,--gc-sections" - export KOS_LD_SCRIPT="-T${KOS_BASE}/utils/ldscripts/shlelf-naomi.xc" + export KOS_LDFLAGS="${KOS_LDFLAGS} -Wl,--defsym=LOAD_OFFSET=0x8c020000" else export KOS_CFLAGS="${KOS_CFLAGS} -D__DREAMCAST__" - export KOS_LDFLAGS="${KOS_LDFLAGS} ${KOS_SH4_PRECISION} -ml -Wl,-Ttext=0x8c010000 -Wl,--gc-sections" - export KOS_LD_SCRIPT="-T${KOS_BASE}/utils/ldscripts/shlelf.xc" fi # If we're building for DC, we need the ARM compiler paths as well. diff --git a/utils/ldscripts/shlelf-naomi.xc b/utils/ldscripts/shlelf-naomi.xc deleted file mode 100644 index bc63d035..00000000 --- a/utils/ldscripts/shlelf-naomi.xc +++ /dev/null @@ -1,254 +0,0 @@ -/* Script for -z combreloc: combine and sort reloc sections */ -OUTPUT_FORMAT("elf32-shl", "elf32-shl", - "elf32-shl") -OUTPUT_ARCH(sh) -ENTRY(start) -SEARCH_DIR("/opt/toolchains/dc/sh-elf/sh-elf/lib"); -SECTIONS -{ - /* Read-only sections, merged into text segment: */ - PROVIDE (__executable_start = 0x8c020000); . = 0x8c020000; - .text : - { - *(.text .stub .text.* .gnu.linkonce.t.*) - /* .gnu.warning sections are handled specially by elf32.em. */ - *(.gnu.warning) - } =0 - .init : - { - KEEP (*(.init)) - } =0 - .fini : - { - KEEP (*(.fini)) - } =0 - .interp : { *(.interp) } - .note.gnu.build-id : { *(.note.gnu.build-id) } - .hash : { *(.hash) } - .gnu.hash : { *(.gnu.hash) } - .dynsym : { *(.dynsym) } - .dynstr : { *(.dynstr) } - .gnu.version : { *(.gnu.version) } - .gnu.version_d : { *(.gnu.version_d) } - .gnu.version_r : { *(.gnu.version_r) } - .rel.dyn : - { - *(.rel.init) - *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*) - *(.rel.fini) - *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*) - *(.rel.data.rel.ro* .rel.gnu.linkonce.d.rel.ro.*) - *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*) - *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*) - *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*) - *(.rel.ctors) - *(.rel.dtors) - *(.rel.got) - *(.rel.sdata .rel.sdata.* .rel.gnu.linkonce.s.*) - *(.rel.sbss .rel.sbss.* .rel.gnu.linkonce.sb.*) - *(.rel.sdata2 .rel.sdata2.* .rel.gnu.linkonce.s2.*) - *(.rel.sbss2 .rel.sbss2.* .rel.gnu.linkonce.sb2.*) - *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*) - } - .rela.dyn : - { - *(.rela.init) - *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) - *(.rela.fini) - *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) - *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) - *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*) - *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*) - *(.rela.ctors) - *(.rela.dtors) - *(.rela.got) - *(.rela.sdata .rela.sdata.* .rela.gnu.linkonce.s.*) - *(.rela.sbss .rela.sbss.* .rela.gnu.linkonce.sb.*) - *(.rela.sdata2 .rela.sdata2.* .rela.gnu.linkonce.s2.*) - *(.rela.sbss2 .rela.sbss2.* .rela.gnu.linkonce.sb2.*) - *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) - } - .rel.plt : { *(.rel.plt) } - .rela.plt : { *(.rela.plt) } - .plt : { *(.plt) } - PROVIDE (__etext = .); - PROVIDE (_etext = .); - PROVIDE (etext = .); - .rodata : - { - *(.rodata .rodata.* .gnu.linkonce.r.*) - . = ALIGN(4); - __tdata_align = .; - LONG (ALIGNOF(.tdata)); - . = ALIGN(4); - __tbss_align = .; - LONG (ALIGNOF(.tbss)); - . = ALIGN(4); - } - .rodata1 : { *(.rodata1) } - .sdata2 : - { - *(.sdata2 .sdata2.* .gnu.linkonce.s2.*) - } - .sbss2 : { *(.sbss2 .sbss2.* .gnu.linkonce.sb2.*) } - .eh_frame_hdr : { *(.eh_frame_hdr) } - .eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) } - .gcc_except_table : ONLY_IF_RO { *(.gcc_except_table .gcc_except_table.*) } - /* Adjust the address for the data segment. We want to adjust up to - the same address within the page on the next page up. */ - . = ALIGN(128) + (. & (128 - 1)); - /* Exception handling */ - .eh_frame : ONLY_IF_RW { KEEP (*(.eh_frame)) } - .gcc_except_table : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) } - /* Thread Local Storage sections */ - .tdata : - { - __tdata_start = .; - *(.tdata .tdata.* .gnu.linkonce.td.*) - } - __tdata_size = SIZEOF(.tdata); - .tbss (NOLOAD) : - { - *(.tbss .tbss.* .gnu.linkonce.tb.*) - *(.tcommon) - } - __tbss_size = SIZEOF(.tbss); - .preinit_array : - { - PROVIDE_HIDDEN (__preinit_array_start = .); - KEEP (*(.preinit_array)) - PROVIDE_HIDDEN (__preinit_array_end = .); - } - .init_array : - { - PROVIDE_HIDDEN (__init_array_start = .); - KEEP (*(SORT(.init_array.*))) - KEEP (*(.init_array)) - PROVIDE_HIDDEN (__init_array_end = .); - } - .fini_array : - { - PROVIDE_HIDDEN (__fini_array_start = .); - KEEP (*(.fini_array)) - KEEP (*(SORT(.fini_array.*))) - PROVIDE_HIDDEN (__fini_array_end = .); - } - .ctors : - { - ___ctors = .; - /* gcc uses crtbegin.o to find the start of - the constructors, so we make sure it is - first. Because this is a wildcard, it - doesn't matter if the user does not - actually link against crtbegin.o; the - linker won't look for a file to match a - wildcard. The wildcard also means that it - doesn't matter which directory crtbegin.o - is in. */ - KEEP (*crtbegin.o(.ctors)) - KEEP (*crtbegin?.o(.ctors)) - /* We don't want to include the .ctor section from - the crtend.o file until after the sorted ctors. - The .ctor section from the crtend file contains the - end of ctors marker and it must be last */ - KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors)) - KEEP (*(SORT(.ctors.*))) - KEEP (*(.ctors)) - ___ctors_end = .; - } - .dtors : - { - ___dtors = .; - KEEP (*crtbegin.o(.dtors)) - KEEP (*crtbegin?.o(.dtors)) - KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors)) - KEEP (*(SORT(.dtors.*))) - KEEP (*(.dtors)) - ___dtors_end = .; - } - .jcr : { KEEP (*(.jcr)) } - .data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro* .gnu.linkonce.d.rel.ro.*) } - .dynamic : { *(.dynamic) } - .data : - { - *(.data .data.* .gnu.linkonce.d.*) - SORT(CONSTRUCTORS) - } - .data1 : { *(.data1) } - .got : { *(.got.plt) *(.got) } - /* We want the small data sections together, so single-instruction offsets - can access them all, and initialized data all before uninitialized, so - we can shorten the on-disk segment size. */ - .sdata : - { - *(.sdata .sdata.* .gnu.linkonce.s.*) - } - _edata = .; PROVIDE (edata = .); - __bss_start = .; - .sbss : - { - *(.dynsbss) - *(.sbss .sbss.* .gnu.linkonce.sb.*) - *(.scommon) - } - .bss : - { - *(.dynbss) - *(.bss .bss.* .gnu.linkonce.b.*) - *(COMMON) - /* Align here to ensure that the .bss section occupies space up to - _end. Align after .bss to ensure correct alignment even if the - .bss section disappears because there are no input sections. - FIXME: Why do we need it? When there is no .bss section, we don't - pad the .data section. */ - . = ALIGN(. != 0 ? 32 / 8 : 1); - } - . = ALIGN(32 / 8); - . = ALIGN(32 / 8); - _end = .; PROVIDE (end = .); - .ocram 0x7c001000 (NOLOAD) : - { - *(.ocram) - /* We have 8kb of operand cache RAM. The next line lets ld throw - an error if we exceed that size. */ - . = . > 0x2000 ? 0x2000 : .; - } - /* Stabs debugging sections. */ - .stab 0 : { *(.stab) } - .stabstr 0 : { *(.stabstr) } - .stab.excl 0 : { *(.stab.excl) } - .stab.exclstr 0 : { *(.stab.exclstr) } - .stab.index 0 : { *(.stab.index) } - .stab.indexstr 0 : { *(.stab.indexstr) } - .comment 0 : { *(.comment) } - /* DWARF debug sections. - Symbols in the DWARF debugging sections are relative to the beginning - of the section so we begin them at 0. */ - /* DWARF 1 */ - .debug 0 : { *(.debug) } - .line 0 : { *(.line) } - /* GNU DWARF 1 extensions */ - .debug_srcinfo 0 : { *(.debug_srcinfo) } - .debug_sfnames 0 : { *(.debug_sfnames) } - /* DWARF 1.1 and DWARF 2 */ - .debug_aranges 0 : { *(.debug_aranges) } - .debug_pubnames 0 : { *(.debug_pubnames) } - /* DWARF 2 */ - .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) } - .debug_abbrev 0 : { *(.debug_abbrev) } - .debug_line 0 : { *(.debug_line) } - .debug_frame 0 : { *(.debug_frame) } - .debug_str 0 : { *(.debug_str) } - .debug_loc 0 : { *(.debug_loc) } - .debug_macinfo 0 : { *(.debug_macinfo) } - /* SGI/MIPS DWARF 2 extensions */ - .debug_weaknames 0 : { *(.debug_weaknames) } - .debug_funcnames 0 : { *(.debug_funcnames) } - .debug_typenames 0 : { *(.debug_typenames) } - .debug_varnames 0 : { *(.debug_varnames) } - /* DWARF 3 */ - .debug_pubtypes 0 : { *(.debug_pubtypes) } - .debug_ranges 0 : { *(.debug_ranges) } - .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) } - /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) } -} diff --git a/utils/ldscripts/shlelf.xc b/utils/ldscripts/shlelf.xc index 10358882..9da8df75 100644 --- a/utils/ldscripts/shlelf.xc +++ b/utils/ldscripts/shlelf.xc @@ -3,17 +3,51 @@ OUTPUT_FORMAT("elf32-shl", "elf32-shl", "elf32-shl") OUTPUT_ARCH(sh) ENTRY(start) -SEARCH_DIR("/usr/local/dc-new/sh-elf/sh-elf/lib"); +LOAD_OFFSET = DEFINED(LOAD_OFFSET) ? LOAD_OFFSET : 0x8c010000 ; + SECTIONS { /* Read-only sections, merged into text segment: */ - PROVIDE (__executable_start = 0x8c010000); . = 0x8c010000; + PROVIDE (__executable_start = LOAD_OFFSET); . = LOAD_OFFSET; .text : { *(.text .stub .text.* .gnu.linkonce.t.*) /* .gnu.warning sections are handled specially by elf32.em. */ *(.gnu.warning) } =0 + + /* Custom sections, aligned to the icache size */ + .sub0 : ALIGN(8192) { + *(.sub0*) + } + .sub1 : ALIGN(8192) { + *(.sub1*) + } + .sub2 : ALIGN(8192) { + *(.sub2*) + } + .sub3 : ALIGN(8192) { + *(.sub3*) + } + .sub4 : ALIGN(8192) { + *(.sub4*) + } + .sub5 : ALIGN(8192) { + *(.sub5*) + } + .sub6 : ALIGN(8192) { + *(.sub6*) + } + .sub7 : ALIGN(8192) { + *(.sub7*) + } + .sub8 : ALIGN(8192) { + *(.sub8*) + } + .sub9 : ALIGN(8192) { + *(.sub9*) + } + .init : { KEEP (*(.init)) hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: quzar <qu...@us...> - 2025-05-04 06:59:27
|
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 2762ceff10c06ff491290630faeee1584b7c96a3 (commit) via 386b3ab28592b499fbfdb7edfed1e0f375ebc5f8 (commit) via ef6fe371ba87e9312674b9596937932ee3433f85 (commit) from 22ce1e63c2ae8f7a27dcea1d7d379ac6e6c5726c (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 2762ceff10c06ff491290630faeee1584b7c96a3 Author: Paul Cercueil <pa...@cr...> Date: Thu May 1 11:53:07 2025 +0200 maple: Fix maple_enum_type() In C, the binary AND takes precedence over the logical AND. Signed-off-by: Paul Cercueil <pa...@cr...> commit 386b3ab28592b499fbfdb7edfed1e0f375ebc5f8 Author: Paul Cercueil <pa...@cr...> Date: Fri Apr 25 17:31:07 2025 +0200 sound: Fix loading of ARM firmware The offending commit 1d507167d ("Use proper typing for pointer math.") had the following change: -extern uint8_t snd_stream_drv[]; -extern uint8_t snd_stream_drv_end[]; +extern uintptr_t snd_stream_drv; +extern uintptr_t snd_stream_drv_end; and was later computing the size of the firmware by doing the difference (snd_stream_drv_end - snd_stream_drv). However, the behaviour was changed; before, it computed the difference between two addresses, and now computed the difference between the two uintptr_t values located at these addresses. Therefore the difference should have been changed to (&snd_stream_drv_end - &snd_stream_drv). Instead of just reverting the commit, update the code to use a blob generated by bin2c instead of bin2o, since we already moved to bin2c for romdisks. The source blob generated by bin2c can be included directly, which means that the symbols can be used directly without having to use "extern". Signed-off-by: Paul Cercueil <pa...@cr...> commit ef6fe371ba87e9312674b9596937932ee3433f85 Author: darc <da...@pr...> Date: Thu Apr 17 17:21:07 2025 -0500 Add 15.1.0 release profile and 15.1.1/16.0.0 dev profiles. All dev profiles upgraded to Binutils 2.44 and GDB 16.2 ----------------------------------------------------------------------- Summary of changes: kernel/arch/dreamcast/hardware/maple/maple_enum.c | 2 +- kernel/arch/dreamcast/sound/Makefile | 9 +++- kernel/arch/dreamcast/sound/snd_iface.c | 13 +++--- utils/dc-chain/Makefile.default.cfg | 4 +- utils/dc-chain/README.md | 10 +++-- utils/dc-chain/doc/CHANGELOG.md | 1 + utils/dc-chain/patches/gcc-14.2.1-kos.diff | 34 +++++++-------- .../{gcc-15.0.1-kos.diff => gcc-15.1.0-kos.diff} | 50 +++++++++++----------- .../{gcc-15.0.1-kos.diff => gcc-15.1.1-kos.diff} | 50 +++++++++++----------- .../{gcc-15.0.1-kos.diff => gcc-16.0.0-kos.diff} | 50 +++++++++++----------- utils/dc-chain/profiles/profile.13.3.1-dev.mk | 8 ++-- utils/dc-chain/profiles/profile.14.2.1-dev.mk | 8 ++-- .../{profile.13.3.0.mk => profile.15.1.0.mk} | 8 ++-- ...profile.15.0.1-dev.mk => profile.15.1.1-dev.mk} | 12 +++--- ...profile.15.0.1-dev.mk => profile.16.0.0-dev.mk} | 10 ++--- 15 files changed, 139 insertions(+), 130 deletions(-) copy utils/dc-chain/patches/{gcc-15.0.1-kos.diff => gcc-15.1.0-kos.diff} (73%) copy utils/dc-chain/patches/{gcc-15.0.1-kos.diff => gcc-15.1.1-kos.diff} (73%) rename utils/dc-chain/patches/{gcc-15.0.1-kos.diff => gcc-16.0.0-kos.diff} (73%) copy utils/dc-chain/profiles/{profile.13.3.0.mk => profile.15.1.0.mk} (93%) copy utils/dc-chain/profiles/{profile.15.0.1-dev.mk => profile.15.1.1-dev.mk} (89%) rename utils/dc-chain/profiles/{profile.15.0.1-dev.mk => profile.16.0.0-dev.mk} (91%) diff --git a/kernel/arch/dreamcast/hardware/maple/maple_enum.c b/kernel/arch/dreamcast/hardware/maple/maple_enum.c index 2e7fe4d6..57565101 100644 --- a/kernel/arch/dreamcast/hardware/maple/maple_enum.c +++ b/kernel/arch/dreamcast/hardware/maple/maple_enum.c @@ -38,7 +38,7 @@ maple_device_t * maple_enum_type(int n, uint32 func) { for(u = 0; u < MAPLE_UNIT_COUNT; u++) { dev = maple_enum_dev(p, u); - if(dev != NULL && dev->info.functions & func) { + if(dev != NULL && (dev->info.functions & func)) { if(!n) return dev; n--; diff --git a/kernel/arch/dreamcast/sound/Makefile b/kernel/arch/dreamcast/sound/Makefile index 6c061cd1..c6e8dbd7 100644 --- a/kernel/arch/dreamcast/sound/Makefile +++ b/kernel/arch/dreamcast/sound/Makefile @@ -20,5 +20,10 @@ include $(KOS_BASE)/Makefile.prefab arm/stream.drv: subdirs -snd_stream_drv.o: arm/stream.drv - $(KOS_BASE)/utils/bin2o/bin2o arm/stream.drv snd_stream_drv snd_stream_drv.o +snd_iface.c: snd_stream_drv.c + +snd_stream_drv.c: arm/stream.drv $(KOS_BASE)/utils/bin2c/bin2c + $(KOS_BASE)/utils/bin2c/bin2c $< $@ snd_stream_drv + +clean: + -rm -f snd_stream_drv.c diff --git a/kernel/arch/dreamcast/sound/snd_iface.c b/kernel/arch/dreamcast/sound/snd_iface.c index 47443892..ba57e0f8 100644 --- a/kernel/arch/dreamcast/sound/snd_iface.c +++ b/kernel/arch/dreamcast/sound/snd_iface.c @@ -20,13 +20,12 @@ #include "arm/aica_cmd_iface.h" +/* Include the default firmware blob */ +#include "snd_stream_drv.c" + /* Are we initted? */ static int initted = 0; -/* This will come from a separately linked object file */ -extern uintptr_t snd_stream_drv; -extern uintptr_t snd_stream_drv_end; - /* The queue processing mutex for snd_sh4_to_aica_start and snd_sh4_to_aica_stop. There are some cases like stereo stream control + stereo sfx control at the same time in separate threads. */ @@ -41,13 +40,13 @@ int snd_init(void) { if(!initted) { spu_disable(); spu_memset_sq(0, 0, AICA_RAM_START); - amt = snd_stream_drv_end - snd_stream_drv; + amt = snd_stream_drv_size; if(amt % 4) amt = (amt + 4) & ~3; - dbglog(DBG_DEBUG, "snd_init(): loading %u bytes into SPU RAM\n", amt); - spu_memload_sq(0, (void* )snd_stream_drv, amt); + dbglog(DBG_DEBUG, "snd_init(): loading %zu bytes into SPU RAM\n", amt); + spu_memload_sq(0, (void *)snd_stream_drv_data, amt); /* Enable the AICA and give it a few ms to start up */ spu_enable(); diff --git a/utils/dc-chain/Makefile.default.cfg b/utils/dc-chain/Makefile.default.cfg index 8838a514..73cb0a19 100644 --- a/utils/dc-chain/Makefile.default.cfg +++ b/utils/dc-chain/Makefile.default.cfg @@ -11,10 +11,12 @@ # - stable: Stable: Well-tested; based on GCC 13.2.0, released 2023-07-27. # - 13.3.0: Testing: Latest release in the GCC 13 series, released 2024-05-21. # - 14.2.0: Testing: Latest release in the GCC 14 series, released 2024-08-01. +# - 15.1.0: Testing: Latest release in the GCC 15 series, released 2025-04-25. # Development toolchains: # - 13.3.1-dev Bleeding edge GCC 13 series from git. # - 14.2.1-dev Bleeding edge GCC 14 series from git. -# - 15.0.1-dev Bleeding edge GCC 15 series from git. +# - 15.1.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/README.md b/utils/dc-chain/README.md index 8a6663c5..8156425b 100644 --- a/utils/dc-chain/README.md +++ b/utils/dc-chain/README.md @@ -102,9 +102,11 @@ The following toolchain profiles are available for users to select in | **stable** | **13.2.0** | **4.3.0** | **2.43** | **8.5.0** | **2.43** | **Tested stable; based on GCC 13.2.0, released 2023-07-27** | | 13.3.0 | 13.3.0 | 4.5.0 | 2.43.1 | 8.5.0 | 2.43.1 | Latest release in the GCC 13 series, released 2024-05-21 | | 14.2.0 | 14.2.0 | 4.5.0 | 2.43.1 | 8.5.0 | 2.43.1 | Latest release in the GCC 14 series, released 2024-08-01 | -| 13.3.1-dev | 13.3.1 (git) | 4.5.0 | 2.43.1 | 8.5.0 | 2.43.1 | Bleeding edge GCC 13 series from git | -| 14.2.1-dev | 14.2.1 (git) | 4.5.0 | 2.43.1 | 8.5.0 | 2.43.1 | Bleeding edge GCC 14 series from git | -| 15.0.1-dev | 15.0.1 (git) | 4.5.0 | 2.43.1 | 8.5.0 | 2.43.1 | Bleeding edge GCC 15 series from git | +| 15.1.0 | 15.1.0 | 4.5.0 | 2.44 | 8.5.0 | 2.44 | Latest release in the GCC 15 series, released 2025-04-25 | +| 13.3.1-dev | 13.3.1 (git) | 4.5.0 | 2.44 | 8.5.0 | 2.44 | Bleeding edge GCC 13 series from git | +| 14.2.1-dev | 14.2.1 (git) | 4.5.0 | 2.44 | 8.5.0 | 2.44 | Bleeding edge GCC 14 series from git | +| 15.1.1-dev | 15.1.1 (git) | 4.5.0 | 2.44 | 8.5.0 | 2.44 | Bleeding edge GCC 15 series from git | +| 16.0.0-dev | 16.0.0 (git) | 4.5.0 | 2.44 | 8.5.0 | 2.44 | Bleeding edge GCC 16 series from git | The **stable** profile is the primary, widely tested target for KallistiOS, and is the most recent toolchain profile known to work with all example programs. @@ -113,7 +115,7 @@ useful in compiling older software. The alternative and development profiles are maintained at a lower priority and are not guaranteed to build, but feel free to open a bug report if issues are encountered building one of these profiles. -As of 2024, the use of any versions of GCC prior to 9.3.0 is deprecated for the +As of 2025, the use of any versions of GCC prior to 9.5.0 is deprecated for the SH4 toolchain, and only GCC 8 series is supported for use with the ARM toolchain. diff --git a/utils/dc-chain/doc/CHANGELOG.md b/utils/dc-chain/doc/CHANGELOG.md index fb2fa151..86534f89 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-04-18 | Eric Fradella | Add 15.1.0 release profile and 15.1.1/16.0.0 dev profiles. All dev profiles upgraded to Binutils 2.44 and GDB 16.2 | | 2025-02-19 | Eric Fradella | Remove profiles and patches for older toolchains (9.3.0, 10.5.0, 11.5.0, 12.4.0) and Rust dev toolchains. Support for Newlib versions prior to 4.x now deprecated. | | 2025-01-26 | Mickaël Cardoso | Update documentations. | | 2025-01-05 | Eric Fradella | Add support and update toolchain profiles for Newlib 4.5.0, Binutils 2.43.1, and GDB 15.2. | diff --git a/utils/dc-chain/patches/gcc-14.2.1-kos.diff b/utils/dc-chain/patches/gcc-14.2.1-kos.diff index a9033017..a3f559bb 100644 --- a/utils/dc-chain/patches/gcc-14.2.1-kos.diff +++ b/utils/dc-chain/patches/gcc-14.2.1-kos.diff @@ -1,6 +1,6 @@ diff -ruN gcc-14.2.1/gcc/config/sh/sh-c.cc gcc-14.2.1-kos/gcc/config/sh/sh-c.cc ---- gcc-14.2.1/gcc/config/sh/sh-c.cc 2024-01-04 16:01:33.790051712 -0600 -+++ gcc-14.2.1-kos/gcc/config/sh/sh-c.cc 2024-01-04 16:01:42.910094466 -0600 +--- gcc-14.2.1/gcc/config/sh/sh-c.cc 2025-04-18 16:01:33.790051712 -0600 ++++ gcc-14.2.1-kos/gcc/config/sh/sh-c.cc 2025-04-18 16:01:42.910094466 -0600 @@ -141,4 +141,11 @@ cpp_define_formatted (pfile, "__SH_ATOMIC_MODEL_%s__", @@ -14,8 +14,8 @@ diff -ruN gcc-14.2.1/gcc/config/sh/sh-c.cc gcc-14.2.1-kos/gcc/config/sh/sh-c.cc + builtin_define ("__KOS_GCC_32MB__"); } diff -ruN gcc-14.2.1/gcc/configure gcc-14.2.1-kos/gcc/configure ---- gcc-14.2.1/gcc/configure 2024-01-04 16:01:33.801051764 -0600 -+++ gcc-14.2.1-kos/gcc/configure 2024-01-04 16:01:42.913094480 -0600 +--- gcc-14.2.1/gcc/configure 2025-04-18 16:01:33.801051764 -0600 ++++ gcc-14.2.1-kos/gcc/configure 2025-04-18 16:01:42.913094480 -0600 @@ -13220,7 +13220,7 @@ target_thread_file='single' ;; @@ -26,8 +26,8 @@ diff -ruN gcc-14.2.1/gcc/configure gcc-14.2.1-kos/gcc/configure ;; *) diff -ruN gcc-14.2.1/libgcc/config/sh/t-sh gcc-14.2.1-kos/libgcc/config/sh/t-sh ---- gcc-14.2.1/libgcc/config/sh/t-sh 2024-01-04 16:01:37.134067388 -0600 -+++ gcc-14.2.1-kos/libgcc/config/sh/t-sh 2024-01-04 16:01:42.914094485 -0600 +--- gcc-14.2.1/libgcc/config/sh/t-sh 2025-04-18 16:01:37.134067388 -0600 ++++ gcc-14.2.1-kos/libgcc/config/sh/t-sh 2025-04-18 16:01:42.914094485 -0600 @@ -23,6 +23,8 @@ $(LIB1ASMFUNCS_CACHE) LIB1ASMFUNCS_CACHE = _ic_invalidate _ic_invalidate_array @@ -38,9 +38,9 @@ diff -ruN gcc-14.2.1/libgcc/config/sh/t-sh gcc-14.2.1-kos/libgcc/config/sh/t-sh $(gcc_compile) -c $< diff -ruN gcc-14.2.1/libgcc/configure gcc-14.2.1-kos/libgcc/configure ---- gcc-14.2.1/libgcc/configure 2024-01-04 16:01:37.139067412 -0600 -+++ gcc-14.2.1-kos/libgcc/configure 2024-01-04 16:01:42.914094485 -0600 -@@ -5763,6 +5763,7 @@ +--- gcc-14.2.1/libgcc/configure 2025-04-18 16:01:37.139067412 -0600 ++++ gcc-14.2.1-kos/libgcc/configure 2025-04-18 16:01:42.914094485 -0600 +@@ -5764,6 +5764,7 @@ tpf) thread_header=config/s390/gthr-tpf.h ;; vxworks) thread_header=config/gthr-vxworks.h ;; win32) thread_header=config/i386/gthr-win32.h ;; @@ -49,8 +49,8 @@ diff -ruN gcc-14.2.1/libgcc/configure gcc-14.2.1-kos/libgcc/configure esac diff -ruN gcc-14.2.1/libobjc/configure gcc-14.2.1-kos/libobjc/configure ---- gcc-14.2.1/libobjc/configure 2024-01-04 16:01:37.499069099 -0600 -+++ gcc-14.2.1-kos/libobjc/configure 2024-01-04 16:01:42.915094489 -0600 +--- gcc-14.2.1/libobjc/configure 2025-04-18 16:01:37.499069099 -0600 ++++ gcc-14.2.1-kos/libobjc/configure 2025-04-18 16:01:42.915094489 -0600 @@ -2924,11 +2924,9 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -64,8 +64,8 @@ diff -ruN gcc-14.2.1/libobjc/configure gcc-14.2.1-kos/libobjc/configure return 0; } diff -ruN gcc-14.2.1/libobjc/Makefile.in gcc-14.2.1-kos/libobjc/Makefile.in ---- gcc-14.2.1/libobjc/Makefile.in 2024-01-04 16:01:37.499069099 -0600 -+++ gcc-14.2.1-kos/libobjc/Makefile.in 2024-01-04 16:01:42.915094489 -0600 +--- gcc-14.2.1/libobjc/Makefile.in 2025-04-18 16:01:37.499069099 -0600 ++++ gcc-14.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) @@ -97,8 +97,8 @@ diff -ruN gcc-14.2.1/libobjc/Makefile.in gcc-14.2.1-kos/libobjc/Makefile.in mostlyclean: -$(LIBTOOL_CLEAN) rm -f libobjc$(libsuffix).la libobjc_gc$(libsuffix).la *.lo diff -ruN gcc-14.2.1/libstdc++-v3/config/cpu/sh/atomicity.h gcc-14.2.1-kos/libstdc++-v3/config/cpu/sh/atomicity.h ---- gcc-14.2.1/libstdc++-v3/config/cpu/sh/atomicity.h 2024-01-04 16:01:37.608069611 -0600 -+++ gcc-14.2.1-kos/libstdc++-v3/config/cpu/sh/atomicity.h 2024-01-04 16:01:42.916094494 -0600 +--- gcc-14.2.1/libstdc++-v3/config/cpu/sh/atomicity.h 2025-04-18 16:01:37.608069611 -0600 ++++ gcc-14.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/>. @@ -150,8 +150,8 @@ diff -ruN gcc-14.2.1/libstdc++-v3/config/cpu/sh/atomicity.h gcc-14.2.1-kos/libst +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace diff -ruN gcc-14.2.1/libstdc++-v3/configure gcc-14.2.1-kos/libstdc++-v3/configure ---- gcc-14.2.1/libstdc++-v3/configure 2024-01-04 16:01:37.616069648 -0600 -+++ gcc-14.2.1-kos/libstdc++-v3/configure 2024-01-04 16:01:42.919094508 -0600 +--- gcc-14.2.1/libstdc++-v3/configure 2025-04-18 16:01:37.616069648 -0600 ++++ gcc-14.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/patches/gcc-15.0.1-kos.diff b/utils/dc-chain/patches/gcc-15.1.0-kos.diff similarity index 73% copy from utils/dc-chain/patches/gcc-15.0.1-kos.diff copy to utils/dc-chain/patches/gcc-15.1.0-kos.diff index d1ccd1fe..05b68919 100644 --- a/utils/dc-chain/patches/gcc-15.0.1-kos.diff +++ b/utils/dc-chain/patches/gcc-15.1.0-kos.diff @@ -1,6 +1,6 @@ -diff -ruN gcc-15.0.1/gcc/config/sh/sh-c.cc gcc-15.0.1-kos/gcc/config/sh/sh-c.cc ---- gcc-15.0.1/gcc/config/sh/sh-c.cc 2024-01-04 16:01:33.790051712 -0600 -+++ gcc-15.0.1-kos/gcc/config/sh/sh-c.cc 2024-01-04 16:01:42.910094466 -0600 +diff -ruN gcc-15.1.0/gcc/config/sh/sh-c.cc gcc-15.1.0-kos/gcc/config/sh/sh-c.cc +--- gcc-15.1.0/gcc/config/sh/sh-c.cc 2025-04-18 16:01:33.790051712 -0600 ++++ gcc-15.1.0-kos/gcc/config/sh/sh-c.cc 2025-04-18 16:01:42.910094466 -0600 @@ -141,4 +141,11 @@ cpp_define_formatted (pfile, "__SH_ATOMIC_MODEL_%s__", @@ -13,10 +13,10 @@ diff -ruN gcc-15.0.1/gcc/config/sh/sh-c.cc gcc-15.0.1-kos/gcc/config/sh/sh-c.cc + /* Toolchain supports setting up stack for 32MB */ + builtin_define ("__KOS_GCC_32MB__"); } -diff -ruN gcc-15.0.1/gcc/configure gcc-15.0.1-kos/gcc/configure ---- gcc-15.0.1/gcc/configure 2024-01-04 16:01:33.801051764 -0600 -+++ gcc-15.0.1-kos/gcc/configure 2024-01-04 16:01:42.913094480 -0600 -@@ -13122,7 +13122,7 @@ +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 +@@ -13165,7 +13165,7 @@ target_thread_file='single' ;; aix | dce | lynx | mipssde | posix | rtems | \ @@ -25,9 +25,9 @@ diff -ruN gcc-15.0.1/gcc/configure gcc-15.0.1-kos/gcc/configure target_thread_file=${enable_threads} ;; *) -diff -ruN gcc-15.0.1/libgcc/config/sh/t-sh gcc-15.0.1-kos/libgcc/config/sh/t-sh ---- gcc-15.0.1/libgcc/config/sh/t-sh 2024-01-04 16:01:37.134067388 -0600 -+++ gcc-15.0.1-kos/libgcc/config/sh/t-sh 2024-01-04 16:01:42.914094485 -0600 +diff -ruN gcc-15.1.0/libgcc/config/sh/t-sh gcc-15.1.0-kos/libgcc/config/sh/t-sh +--- gcc-15.1.0/libgcc/config/sh/t-sh 2025-04-18 16:01:37.134067388 -0600 ++++ gcc-15.1.0-kos/libgcc/config/sh/t-sh 2025-04-18 16:01:42.914094485 -0600 @@ -23,6 +23,8 @@ $(LIB1ASMFUNCS_CACHE) LIB1ASMFUNCS_CACHE = _ic_invalidate _ic_invalidate_array @@ -37,9 +37,9 @@ diff -ruN gcc-15.0.1/libgcc/config/sh/t-sh gcc-15.0.1-kos/libgcc/config/sh/t-sh crt1.o: $(srcdir)/config/sh/crt1.S $(gcc_compile) -c $< -diff -ruN gcc-15.0.1/libgcc/configure gcc-15.0.1-kos/libgcc/configure ---- gcc-15.0.1/libgcc/configure 2024-01-04 16:01:37.139067412 -0600 -+++ gcc-15.0.1-kos/libgcc/configure 2024-01-04 16:01:42.914094485 -0600 +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 @@ -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.0.1/libgcc/configure gcc-15.0.1-kos/libgcc/configure mcf) thread_header=config/i386/gthr-mcf.h ;; esac -diff -ruN gcc-15.0.1/libobjc/configure gcc-15.0.1-kos/libobjc/configure ---- gcc-15.0.1/libobjc/configure 2024-01-04 16:01:37.499069099 -0600 -+++ gcc-15.0.1-kos/libobjc/configure 2024-01-04 16:01:42.915094489 -0600 +diff -ruN gcc-15.1.0/libobjc/configure gcc-15.1.0-kos/libobjc/configure +--- gcc-15.1.0/libobjc/configure 2025-04-18 16:01:37.499069099 -0600 ++++ gcc-15.1.0-kos/libobjc/configure 2025-04-18 16:01:42.915094489 -0600 @@ -2924,11 +2924,9 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -63,9 +63,9 @@ diff -ruN gcc-15.0.1/libobjc/configure gcc-15.0.1-kos/libobjc/configure ; return 0; } -diff -ruN gcc-15.0.1/libobjc/Makefile.in gcc-15.0.1-kos/libobjc/Makefile.in ---- gcc-15.0.1/libobjc/Makefile.in 2024-01-04 16:01:37.499069099 -0600 -+++ gcc-15.0.1-kos/libobjc/Makefile.in 2024-01-04 16:01:42.915094489 -0600 +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 @@ -308,14 +308,16 @@ $(srcdir)/aclocal.m4: @MAINT@ $(aclocal_deps) cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) @@ -96,9 +96,9 @@ diff -ruN gcc-15.0.1/libobjc/Makefile.in gcc-15.0.1-kos/libobjc/Makefile.in mostlyclean: -$(LIBTOOL_CLEAN) rm -f libobjc$(libsuffix).la libobjc_gc$(libsuffix).la *.lo -diff -ruN gcc-15.0.1/libstdc++-v3/config/cpu/sh/atomicity.h gcc-15.0.1-kos/libstdc++-v3/config/cpu/sh/atomicity.h ---- gcc-15.0.1/libstdc++-v3/config/cpu/sh/atomicity.h 2024-01-04 16:01:37.608069611 -0600 -+++ gcc-15.0.1-kos/libstdc++-v3/config/cpu/sh/atomicity.h 2024-01-04 16:01:42.916094494 -0600 +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 @@ -22,14 +22,40 @@ // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. @@ -149,9 +149,9 @@ diff -ruN gcc-15.0.1/libstdc++-v3/config/cpu/sh/atomicity.h gcc-15.0.1-kos/libst + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace -diff -ruN gcc-15.0.1/libstdc++-v3/configure gcc-15.0.1-kos/libstdc++-v3/configure ---- gcc-15.0.1/libstdc++-v3/configure 2024-01-04 16:01:37.616069648 -0600 -+++ gcc-15.0.1-kos/libstdc++-v3/configure 2024-01-04 16:01:42.919094508 -0600 +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 @@ -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/gcc-15.0.1-kos.diff b/utils/dc-chain/patches/gcc-15.1.1-kos.diff similarity index 73% copy from utils/dc-chain/patches/gcc-15.0.1-kos.diff copy to utils/dc-chain/patches/gcc-15.1.1-kos.diff index d1ccd1fe..adb10945 100644 --- a/utils/dc-chain/patches/gcc-15.0.1-kos.diff +++ b/utils/dc-chain/patches/gcc-15.1.1-kos.diff @@ -1,6 +1,6 @@ -diff -ruN gcc-15.0.1/gcc/config/sh/sh-c.cc gcc-15.0.1-kos/gcc/config/sh/sh-c.cc ---- gcc-15.0.1/gcc/config/sh/sh-c.cc 2024-01-04 16:01:33.790051712 -0600 -+++ gcc-15.0.1-kos/gcc/config/sh/sh-c.cc 2024-01-04 16:01:42.910094466 -0600 +diff -ruN gcc-15.1.1/gcc/config/sh/sh-c.cc gcc-15.1.1-kos/gcc/config/sh/sh-c.cc +--- gcc-15.1.1/gcc/config/sh/sh-c.cc 2025-04-18 16:01:33.790051712 -0600 ++++ gcc-15.1.1-kos/gcc/config/sh/sh-c.cc 2025-04-18 16:01:42.910094466 -0600 @@ -141,4 +141,11 @@ cpp_define_formatted (pfile, "__SH_ATOMIC_MODEL_%s__", @@ -13,10 +13,10 @@ diff -ruN gcc-15.0.1/gcc/config/sh/sh-c.cc gcc-15.0.1-kos/gcc/config/sh/sh-c.cc + /* Toolchain supports setting up stack for 32MB */ + builtin_define ("__KOS_GCC_32MB__"); } -diff -ruN gcc-15.0.1/gcc/configure gcc-15.0.1-kos/gcc/configure ---- gcc-15.0.1/gcc/configure 2024-01-04 16:01:33.801051764 -0600 -+++ gcc-15.0.1-kos/gcc/configure 2024-01-04 16:01:42.913094480 -0600 -@@ -13122,7 +13122,7 @@ +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 +@@ -13165,7 +13165,7 @@ target_thread_file='single' ;; aix | dce | lynx | mipssde | posix | rtems | \ @@ -25,9 +25,9 @@ diff -ruN gcc-15.0.1/gcc/configure gcc-15.0.1-kos/gcc/configure target_thread_file=${enable_threads} ;; *) -diff -ruN gcc-15.0.1/libgcc/config/sh/t-sh gcc-15.0.1-kos/libgcc/config/sh/t-sh ---- gcc-15.0.1/libgcc/config/sh/t-sh 2024-01-04 16:01:37.134067388 -0600 -+++ gcc-15.0.1-kos/libgcc/config/sh/t-sh 2024-01-04 16:01:42.914094485 -0600 +diff -ruN gcc-15.1.1/libgcc/config/sh/t-sh gcc-15.1.1-kos/libgcc/config/sh/t-sh +--- gcc-15.1.1/libgcc/config/sh/t-sh 2025-04-18 16:01:37.134067388 -0600 ++++ gcc-15.1.1-kos/libgcc/config/sh/t-sh 2025-04-18 16:01:42.914094485 -0600 @@ -23,6 +23,8 @@ $(LIB1ASMFUNCS_CACHE) LIB1ASMFUNCS_CACHE = _ic_invalidate _ic_invalidate_array @@ -37,9 +37,9 @@ diff -ruN gcc-15.0.1/libgcc/config/sh/t-sh gcc-15.0.1-kos/libgcc/config/sh/t-sh crt1.o: $(srcdir)/config/sh/crt1.S $(gcc_compile) -c $< -diff -ruN gcc-15.0.1/libgcc/configure gcc-15.0.1-kos/libgcc/configure ---- gcc-15.0.1/libgcc/configure 2024-01-04 16:01:37.139067412 -0600 -+++ gcc-15.0.1-kos/libgcc/configure 2024-01-04 16:01:42.914094485 -0600 +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 @@ -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.0.1/libgcc/configure gcc-15.0.1-kos/libgcc/configure mcf) thread_header=config/i386/gthr-mcf.h ;; esac -diff -ruN gcc-15.0.1/libobjc/configure gcc-15.0.1-kos/libobjc/configure ---- gcc-15.0.1/libobjc/configure 2024-01-04 16:01:37.499069099 -0600 -+++ gcc-15.0.1-kos/libobjc/configure 2024-01-04 16:01:42.915094489 -0600 +diff -ruN gcc-15.1.1/libobjc/configure gcc-15.1.1-kos/libobjc/configure +--- gcc-15.1.1/libobjc/configure 2025-04-18 16:01:37.499069099 -0600 ++++ gcc-15.1.1-kos/libobjc/configure 2025-04-18 16:01:42.915094489 -0600 @@ -2924,11 +2924,9 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -63,9 +63,9 @@ diff -ruN gcc-15.0.1/libobjc/configure gcc-15.0.1-kos/libobjc/configure ; return 0; } -diff -ruN gcc-15.0.1/libobjc/Makefile.in gcc-15.0.1-kos/libobjc/Makefile.in ---- gcc-15.0.1/libobjc/Makefile.in 2024-01-04 16:01:37.499069099 -0600 -+++ gcc-15.0.1-kos/libobjc/Makefile.in 2024-01-04 16:01:42.915094489 -0600 +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 @@ -308,14 +308,16 @@ $(srcdir)/aclocal.m4: @MAINT@ $(aclocal_deps) cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) @@ -96,9 +96,9 @@ diff -ruN gcc-15.0.1/libobjc/Makefile.in gcc-15.0.1-kos/libobjc/Makefile.in mostlyclean: -$(LIBTOOL_CLEAN) rm -f libobjc$(libsuffix).la libobjc_gc$(libsuffix).la *.lo -diff -ruN gcc-15.0.1/libstdc++-v3/config/cpu/sh/atomicity.h gcc-15.0.1-kos/libstdc++-v3/config/cpu/sh/atomicity.h ---- gcc-15.0.1/libstdc++-v3/config/cpu/sh/atomicity.h 2024-01-04 16:01:37.608069611 -0600 -+++ gcc-15.0.1-kos/libstdc++-v3/config/cpu/sh/atomicity.h 2024-01-04 16:01:42.916094494 -0600 +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 @@ -22,14 +22,40 @@ // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. @@ -149,9 +149,9 @@ diff -ruN gcc-15.0.1/libstdc++-v3/config/cpu/sh/atomicity.h gcc-15.0.1-kos/libst + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace -diff -ruN gcc-15.0.1/libstdc++-v3/configure gcc-15.0.1-kos/libstdc++-v3/configure ---- gcc-15.0.1/libstdc++-v3/configure 2024-01-04 16:01:37.616069648 -0600 -+++ gcc-15.0.1-kos/libstdc++-v3/configure 2024-01-04 16:01:42.919094508 -0600 +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 @@ -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/gcc-15.0.1-kos.diff b/utils/dc-chain/patches/gcc-16.0.0-kos.diff similarity index 73% rename from utils/dc-chain/patches/gcc-15.0.1-kos.diff rename to utils/dc-chain/patches/gcc-16.0.0-kos.diff index d1ccd1fe..8837af93 100644 --- a/utils/dc-chain/patches/gcc-15.0.1-kos.diff +++ b/utils/dc-chain/patches/gcc-16.0.0-kos.diff @@ -1,6 +1,6 @@ -diff -ruN gcc-15.0.1/gcc/config/sh/sh-c.cc gcc-15.0.1-kos/gcc/config/sh/sh-c.cc ---- gcc-15.0.1/gcc/config/sh/sh-c.cc 2024-01-04 16:01:33.790051712 -0600 -+++ gcc-15.0.1-kos/gcc/config/sh/sh-c.cc 2024-01-04 16:01:42.910094466 -0600 +diff -ruN gcc-16.0.0/gcc/config/sh/sh-c.cc gcc-16.0.0-kos/gcc/config/sh/sh-c.cc +--- gcc-16.0.0/gcc/config/sh/sh-c.cc 2025-04-17 16:01:33.790051712 -0600 ++++ gcc-16.0.0-kos/gcc/config/sh/sh-c.cc 2025-04-17 16:01:42.910094466 -0600 @@ -141,4 +141,11 @@ cpp_define_formatted (pfile, "__SH_ATOMIC_MODEL_%s__", @@ -13,10 +13,10 @@ diff -ruN gcc-15.0.1/gcc/config/sh/sh-c.cc gcc-15.0.1-kos/gcc/config/sh/sh-c.cc + /* Toolchain supports setting up stack for 32MB */ + builtin_define ("__KOS_GCC_32MB__"); } -diff -ruN gcc-15.0.1/gcc/configure gcc-15.0.1-kos/gcc/configure ---- gcc-15.0.1/gcc/configure 2024-01-04 16:01:33.801051764 -0600 -+++ gcc-15.0.1-kos/gcc/configure 2024-01-04 16:01:42.913094480 -0600 -@@ -13122,7 +13122,7 @@ +diff -ruN gcc-16.0.0/gcc/configure gcc-16.0.0-kos/gcc/configure +--- gcc-16.0.0/gcc/configure 2025-04-17 16:01:33.801051764 -0600 ++++ gcc-16.0.0-kos/gcc/configure 2025-04-17 16:01:42.913094480 -0600 +@@ -13165,7 +13165,7 @@ target_thread_file='single' ;; aix | dce | lynx | mipssde | posix | rtems | \ @@ -25,9 +25,9 @@ diff -ruN gcc-15.0.1/gcc/configure gcc-15.0.1-kos/gcc/configure target_thread_file=${enable_threads} ;; *) -diff -ruN gcc-15.0.1/libgcc/config/sh/t-sh gcc-15.0.1-kos/libgcc/config/sh/t-sh ---- gcc-15.0.1/libgcc/config/sh/t-sh 2024-01-04 16:01:37.134067388 -0600 -+++ gcc-15.0.1-kos/libgcc/config/sh/t-sh 2024-01-04 16:01:42.914094485 -0600 +diff -ruN gcc-16.0.0/libgcc/config/sh/t-sh gcc-16.0.0-kos/libgcc/config/sh/t-sh +--- gcc-16.0.0/libgcc/config/sh/t-sh 2025-04-17 16:01:37.134067388 -0600 ++++ gcc-16.0.0-kos/libgcc/config/sh/t-sh 2025-04-17 16:01:42.914094485 -0600 @@ -23,6 +23,8 @@ $(LIB1ASMFUNCS_CACHE) LIB1ASMFUNCS_CACHE = _ic_invalidate _ic_invalidate_array @@ -37,9 +37,9 @@ diff -ruN gcc-15.0.1/libgcc/config/sh/t-sh gcc-15.0.1-kos/libgcc/config/sh/t-sh crt1.o: $(srcdir)/config/sh/crt1.S $(gcc_compile) -c $< -diff -ruN gcc-15.0.1/libgcc/configure gcc-15.0.1-kos/libgcc/configure ---- gcc-15.0.1/libgcc/configure 2024-01-04 16:01:37.139067412 -0600 ...<truncated>... hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: quzar <qu...@us...> - 2025-04-24 14:28:13
|
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 22ce1e63c2ae8f7a27dcea1d7d379ac6e6c5726c (commit) via 0c52a075d6d933c262d0a70a0d964548f2592184 (commit) via cb9e1e602d37b733f378cfc04d7739acdb7e30dc (commit) via e3558c7d1264a6812030583d3b0d756bee493f90 (commit) via 3d7c25eba2bbcac7debece234826f4096c644156 (commit) via 070bb6d6afdd4798eaec7f9361c17e6d00b9ec71 (commit) via 1d507167db1758c3b5d14f424c0baf6cb73c8663 (commit) from 35931a498b667b91024dd826b7141a1ad05cb4fa (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 22ce1e63c2ae8f7a27dcea1d7d379ac6e6c5726c Author: Paul Cercueil <pa...@cr...> Date: Thu Apr 17 11:40:42 2025 +0200 fs_iso9660: Get rid of global FD table Instead of using one big FD table with a fixed size, and using an index into that table as the token passed among the backend functions, use a pointer to the file handle structure as the token itself. The FD table can then be removed, and replaced by a double-linked list of the file handle structs, so that we can still keep track of what's opened in case we need to invalidate all the handles at once. This change removes the arbitrary limitation on the number of files that can be opened with the iso9660 filesystem. Signed-off-by: Paul Cercueil <pa...@cr...> commit 0c52a075d6d933c262d0a70a0d964548f2592184 Author: QuzarDC <qu...@co...> Date: Sun Feb 9 14:38:33 2025 -0500 Properly use uintptr types for pointer math. Additionally clean up the file generally to use stdint types, have the func typedef take `void`, and memory region define. commit cb9e1e602d37b733f378cfc04d7739acdb7e30dc Author: QuzarDC <qu...@co...> Date: Sat Feb 8 23:30:03 2025 -0500 Use proper typing for pointer math. commit e3558c7d1264a6812030583d3b0d756bee493f90 Author: QuzarDC <qu...@co...> Date: Sun Jan 26 04:32:43 2025 -0500 Prevent possible null derefs in scandir. Four changes were made here: 1) Move the check of namelist to before it's deref'd. 2) In out_of_memory check *list before possible deref. 3) Remove clearing of size and capacity as they're internal. 4) Swap list/list_tmp to reduce assigns needed. commit 3d7c25eba2bbcac7debece234826f4096c644156 Author: QuzarDC <qu...@co...> Date: Sun Jan 26 03:36:48 2025 -0500 Handle OOM in fs_dcload. commit 070bb6d6afdd4798eaec7f9361c17e6d00b9ec71 Author: QuzarDC <qu...@co...> Date: Sun Jan 26 03:32:05 2025 -0500 Correct malloc without free with invalid video mode. I don't say 'memory leak' because, it's kind of not. If we are in an invalid vid_mode where width or height == 0 then we could end up doing a `malloc(0)` which is not guaranteed to be NULL, and leak it out when we return 0 as buffer_size. Perhaps too thin of a case ... commit 1d507167db1758c3b5d14f424c0baf6cb73c8663 Author: QuzarDC <qu...@co...> Date: Sat Jan 25 18:49:40 2025 -0500 Use proper typing for pointer math. ----------------------------------------------------------------------- Summary of changes: kernel/arch/dreamcast/fs/fs_dcload.c | 6 + kernel/arch/dreamcast/fs/fs_iso9660.c | 191 ++++++++++++++---------------- kernel/arch/dreamcast/include/arch/exec.h | 4 +- kernel/arch/dreamcast/kernel/exec.c | 57 ++++----- kernel/arch/dreamcast/kernel/init.c | 5 +- kernel/arch/dreamcast/sound/snd_iface.c | 10 +- kernel/arch/dreamcast/util/screenshot.c | 5 + kernel/libc/koslib/scandir.c | 25 ++-- 8 files changed, 149 insertions(+), 154 deletions(-) diff --git a/kernel/arch/dreamcast/fs/fs_dcload.c b/kernel/arch/dreamcast/fs/fs_dcload.c index cfedfede..ed5263c5 100644 --- a/kernel/arch/dreamcast/fs/fs_dcload.c +++ b/kernel/arch/dreamcast/fs/fs_dcload.c @@ -288,6 +288,12 @@ static dirent_t *dcload_readdir(void * h) { rv->attr = 0; /* what the hell is attr supposed to be anyways? */ fn = malloc(strlen(entry->path) + strlen(dcld->d_name) + 1); + + if(!fn) { + errno = ENOMEM; + return NULL; + } + strcpy(fn, entry->path); strcat(fn, dcld->d_name); diff --git a/kernel/arch/dreamcast/fs/fs_iso9660.c b/kernel/arch/dreamcast/fs/fs_iso9660.c index 96858ce3..0246c77f 100644 --- a/kernel/arch/dreamcast/fs/fs_iso9660.c +++ b/kernel/arch/dreamcast/fs/fs_iso9660.c @@ -42,6 +42,7 @@ ISO9660 systems, as these were used as references as well. #include <ctype.h> #include <string.h> #include <strings.h> +#include <sys/queue.h> #include <errno.h> static int init_percd(void); @@ -570,16 +571,19 @@ static iso_dirent_t *find_object_path(const char *fn, int dir, iso_dirent_t *sta /* File handles.. I could probably do this with a linked list, but I'm just too lazy right now. =) */ -static struct { +typedef struct iso_fd { uint32 first_extent; /* First sector */ bool dir; /* True if a directory */ uint32 ptr; /* Current read position in bytes */ uint32 size; /* Length of file in bytes */ dirent_t dirent; /* A static dirent to pass back to clients */ bool broken; /* True if the CD has been swapped out since open */ -} fh[FS_CD_MAX_FILES]; + TAILQ_ENTRY(iso_fd) next; /* Next handle in the linked list */ +} iso_fd_t; -/* Mutex for file handles */ +static TAILQ_HEAD(iso_fd_queue, iso_fd) iso_fd_queue; + +/* Mutex for protecting access to the iso_fd_queue */ static mutex_t fh_mutex; /* Break all of our open file descriptor. This is necessary when the disc @@ -587,20 +591,19 @@ static mutex_t fh_mutex; with the old info. As files are closed and re-opened, the broken flag will be cleared. */ static void iso_break_all(void) { - int i; + iso_fd_t *fd; - mutex_lock(&fh_mutex); + mutex_lock_scoped(&fh_mutex); - for(i = 0; i < FS_CD_MAX_FILES; i++) - fh[i].broken = true; - - mutex_unlock(&fh_mutex); + TAILQ_FOREACH(fd, &iso_fd_queue, next) { + fd->broken = true; + } } /* Open a file or directory */ static void * iso_open(vfs_handler_t * vfs, const char *fn, int mode) { - file_t fd; iso_dirent_t *de; + iso_fd_t *fd; (void)vfs; @@ -626,41 +629,35 @@ static void * iso_open(vfs_handler_t * vfs, const char *fn, int mode) { return 0; } - /* Find a free file handle */ - mutex_lock(&fh_mutex); - - for(fd = 0; fd < FS_CD_MAX_FILES; fd++) - if(fh[fd].first_extent == 0) { - fh[fd].first_extent = -1; - break; - } - - mutex_unlock(&fh_mutex); - - if(fd >= FS_CD_MAX_FILES) { - errno = ENFILE; + fd = malloc(sizeof(*fd)); + if(!fd) { + errno = ENOMEM; return 0; } /* Fill in the file handle and return the fd */ - fh[fd].first_extent = iso_733(de->extent); - fh[fd].dir = ((mode & O_DIR) != 0); - fh[fd].ptr = 0; - fh[fd].size = iso_733(de->size); - fh[fd].broken = false; + *fd = (iso_fd_t){ + .first_extent = iso_733(de->extent), + .dir = (mode & O_DIR) != 0, + .size = iso_733(de->size), + }; + + mutex_lock_scoped(&fh_mutex); - return (void *)fd; + TAILQ_INSERT_TAIL(&iso_fd_queue, fd, next); + + return fd; } /* Close a file or directory */ static int iso_close(void * h) { - file_t fd = (file_t)h; + iso_fd_t *fd = (iso_fd_t *)h; + + mutex_lock_scoped(&fh_mutex); + + TAILQ_REMOVE(&iso_fd_queue, fd, next); + free(fd); - /* Check that the fd is valid */ - if(fd < FS_CD_MAX_FILES) { - /* No need to lock the mutex: this is an atomic op */ - fh[fd].first_extent = 0; - } return 0; } @@ -668,10 +665,10 @@ static int iso_close(void * h) { static ssize_t iso_read(void * h, void *buf, size_t bytes) { int rv, toread, thissect, c; uint8 * outbuf; - file_t fd = (file_t)h; + iso_fd_t *fd = (iso_fd_t *)h; /* Check that the fd is valid */ - if(fd >= FS_CD_MAX_FILES || fh[fd].first_extent == 0 || fh[fd].broken) { + if(fd->first_extent == 0 || fd->broken) { errno = EBADF; return -1; } @@ -682,13 +679,12 @@ static ssize_t iso_read(void * h, void *buf, size_t bytes) { /* Read zero or more sectors into the buffer from the current pos */ while(bytes > 0) { /* Figure out how much we still need to read */ - toread = (bytes > (fh[fd].size - fh[fd].ptr)) ? - fh[fd].size - fh[fd].ptr : bytes; + toread = (bytes > (fd->size - fd->ptr)) ? fd->size - fd->ptr : bytes; if(toread == 0) break; /* How much more can we read in the current sector? */ - thissect = 2048 - (fh[fd].ptr % 2048); + thissect = 2048 - (fd->ptr % 2048); /* If we're on a sector boundary and we have more than one full sector to read, then short-circuit the cache here @@ -700,7 +696,7 @@ static ssize_t iso_read(void * h, void *buf, size_t bytes) { /* Do the read */ c = cdrom_read_sectors_ex(outbuf, - fh[fd].first_extent + (fh[fd].ptr / 2048) + 150, + fd->first_extent + (fd->ptr / 2048) + 150, thissect, CDROM_READ_DMA); @@ -712,19 +708,19 @@ static ssize_t iso_read(void * h, void *buf, size_t bytes) { toread = (toread > thissect) ? thissect : toread; /* Do the read */ - c = bdread(fh[fd].first_extent + fh[fd].ptr / 2048); + c = bdread(fd->first_extent + fd->ptr / 2048); if(c < 0) { errno = EIO; return -1; } - memcpy(outbuf, dcache[c]->data + (fh[fd].ptr % 2048), toread); + memcpy(outbuf, dcache[c]->data + (fd->ptr % 2048), toread); } /* Adjust pointers */ outbuf += toread; - fh[fd].ptr += toread; + fd->ptr += toread; bytes -= toread; rv += toread; } @@ -734,10 +730,10 @@ static ssize_t iso_read(void * h, void *buf, size_t bytes) { /* Seek elsewhere in a file */ static off_t iso_seek(void * h, off_t offset, int whence) { - file_t fd = (file_t)h; + iso_fd_t *fd = (iso_fd_t *)h; /* Check that the fd is valid */ - if(fd >= FS_CD_MAX_FILES || fh[fd].first_extent == 0 || fh[fd].broken) { + if(fd->first_extent == 0 || fd->broken) { errno = EBADF; return -1; } @@ -750,25 +746,25 @@ static off_t iso_seek(void * h, off_t offset, int whence) { return -1; } - fh[fd].ptr = offset; + fd->ptr = offset; break; case SEEK_CUR: - if(offset < 0 && ((uint32)-offset) > fh[fd].ptr) { + if(offset < 0 && ((uint32)-offset) > fd->ptr) { errno = EINVAL; return -1; } - fh[fd].ptr += offset; + fd->ptr += offset; break; case SEEK_END: - if(offset < 0 && ((uint32)-offset) > fh[fd].size) { + if(offset < 0 && ((uint32)-offset) > fd->size) { errno = EINVAL; return -1; } - fh[fd].ptr = fh[fd].size + offset; + fd->ptr = fd->size + offset; break; default: @@ -777,33 +773,33 @@ static off_t iso_seek(void * h, off_t offset, int whence) { } /* Check bounds */ - if(fh[fd].ptr > fh[fd].size) fh[fd].ptr = fh[fd].size; + if(fd->ptr > fd->size) fd->ptr = fd->size; - return fh[fd].ptr; + return fd->ptr; } /* Tell where in the file we are */ static off_t iso_tell(void * h) { - file_t fd = (file_t)h; + iso_fd_t *fd = (iso_fd_t *)h; - if(fd >= FS_CD_MAX_FILES || fh[fd].first_extent == 0 || fh[fd].broken) { + if(fd->first_extent == 0 || fd->broken) { errno = EBADF; return -1; } - return fh[fd].ptr; + return fd->ptr; } /* Tell how big the file is */ static size_t iso_total(void * h) { - file_t fd = (file_t)h; + iso_fd_t *fd = (iso_fd_t *)h; - if(fd >= FS_CD_MAX_FILES || fh[fd].first_extent == 0 || fh[fd].broken) { + if(fd->first_extent == 0 || fd->broken) { errno = EBADF; return -1; } - return fh[fd].size; + return fd->size; } /* Helper function for readdir: post-processes an ISO filename to make @@ -833,10 +829,9 @@ static dirent_t *iso_readdir(void * h) { int len; uint8 *pnt; - file_t fd = (file_t)h; + iso_fd_t *fd = (iso_fd_t *)h; - if(fd >= FS_CD_MAX_FILES || fh[fd].first_extent == 0 || !fh[fd].dir || - fh[fd].broken) { + if(fd->first_extent == 0 || !fd->dir || fd->broken) { errno = EBADF; return NULL; } @@ -846,40 +841,40 @@ static dirent_t *iso_readdir(void * h) { c = -1; de = NULL; - while(fh[fd].ptr < fh[fd].size) { + while(fd->ptr < fd->size) { /* Get the current dirent block */ - c = biread(fh[fd].first_extent + fh[fd].ptr / 2048); + c = biread(fd->first_extent + fd->ptr / 2048); if(c < 0) return NULL; - de = (iso_dirent_t *)(icache[c]->data + (fh[fd].ptr % 2048)); + de = (iso_dirent_t *)(icache[c]->data + (fd->ptr % 2048)); if(de->length) break; /* Skip to the next sector */ - fh[fd].ptr += 2048 - (fh[fd].ptr % 2048); + fd->ptr += 2048 - (fd->ptr % 2048); } - if(fh[fd].ptr >= fh[fd].size) return NULL; + if(fd->ptr >= fd->size) return NULL; /* If we're at the first, skip the two blank entries */ if(!de->name[0] && de->name_len == 1) { - fh[fd].ptr += de->length; - de = (iso_dirent_t *)(icache[c]->data + (fh[fd].ptr % 2048)); - fh[fd].ptr += de->length; - de = (iso_dirent_t *)(icache[c]->data + (fh[fd].ptr % 2048)); + fd->ptr += de->length; + de = (iso_dirent_t *)(icache[c]->data + (fd->ptr % 2048)); + fd->ptr += de->length; + de = (iso_dirent_t *)(icache[c]->data + (fd->ptr % 2048)); if(!de->length) return NULL; } if(joliet) { - ucs2utfn((uint8 *)fh[fd].dirent.name, (uint8 *)de->name, de->name_len); + ucs2utfn((uint8 *)fd->dirent.name, (uint8 *)de->name, de->name_len); } else { /* Fill out the VFS dirent */ - strncpy(fh[fd].dirent.name, de->name, de->name_len); - fh[fd].dirent.name[de->name_len] = 0; - fn_postprocess(fh[fd].dirent.name); + strncpy(fd->dirent.name, de->name, de->name_len); + fd->dirent.name[de->name_len] = 0; + fn_postprocess(fd->dirent.name); /* Check for Rock Ridge NM extension */ len = de->length - sizeof(iso_dirent_t) + sizeof(de->name) - de->name_len; @@ -892,8 +887,8 @@ static dirent_t *iso_readdir(void * h) { while((len >= 4) && ((pnt[3] == 1) || (pnt[3] == 2))) { if(strncmp((char *)pnt, "NM", 2) == 0) { - strncpy(fh[fd].dirent.name, (char *)(pnt + 5), pnt[2] - 5); - fh[fd].dirent.name[pnt[2] - 5] = 0; + strncpy(fd->dirent.name, (char *)(pnt + 5), pnt[2] - 5); + fd->dirent.name[pnt[2] - 5] = 0; } len -= pnt[2]; @@ -902,30 +897,29 @@ static dirent_t *iso_readdir(void * h) { } if(de->flags & 2) { - fh[fd].dirent.size = -1; - fh[fd].dirent.attr = O_DIR; + fd->dirent.size = -1; + fd->dirent.attr = O_DIR; } else { - fh[fd].dirent.size = iso_733(de->size); - fh[fd].dirent.attr = 0; + fd->dirent.size = iso_733(de->size); + fd->dirent.attr = 0; } - fh[fd].ptr += de->length; + fd->ptr += de->length; - return &fh[fd].dirent; + return &fd->dirent; } static int iso_rewinddir(void * h) { - file_t fd = (file_t)h; + iso_fd_t *fd = (iso_fd_t *)h; - if(fd >= FS_CD_MAX_FILES || fh[fd].first_extent == 0 || !fh[fd].dir || - fh[fd].broken) { + if(fd->first_extent == 0 || !fd->dir || fd->broken) { errno = EBADF; return -1; } /* Rewind to the beginning of the directory. */ - fh[fd].ptr = 0; + fd->ptr = 0; return 0; } @@ -1009,12 +1003,12 @@ static int iso_stat(vfs_handler_t *vfs, const char *path, struct stat *st, } static int iso_fcntl(void *h, int cmd, va_list ap) { - file_t fd = (file_t)h; + iso_fd_t *fd = (iso_fd_t *)h; int rv = -1; (void)ap; - if(fd >= FS_CD_MAX_FILES || !fh[fd].first_extent || fh[fd].broken) { + if(!fd->first_extent || fd->broken) { errno = EBADF; return -1; } @@ -1023,7 +1017,7 @@ static int iso_fcntl(void *h, int cmd, va_list ap) { case F_GETFL: rv = O_RDONLY; - if(fh[fd].dir) + if(fd->dir) rv |= O_DIR; break; @@ -1042,9 +1036,9 @@ static int iso_fcntl(void *h, int cmd, va_list ap) { } static int iso_fstat(void *h, struct stat *st) { - file_t fd = (file_t)h; + iso_fd_t *fd = (iso_fd_t *)h; - if(fd >= FS_CD_MAX_FILES || !fh[fd].first_extent || fh[fd].broken) { + if(!fd->first_extent || fd->broken) { errno = EBADF; return -1; } @@ -1052,9 +1046,9 @@ static int iso_fstat(void *h, struct stat *st) { memset(st, 0, sizeof(struct stat)); st->st_dev = 'c' | ('d' << 8); st->st_mode = S_IRUSR | S_IRGRP | S_IROTH | S_IXUSR | S_IXGRP | S_IXOTH; - st->st_mode |= fh[fd].dir ? S_IFDIR : S_IFREG; - st->st_size = fh[fd].dir ? -1 : (int)fh[fd].size; - st->st_nlink = fh[fd].dir ? 2 : 1; + st->st_mode |= fd->dir ? S_IFDIR : S_IFREG; + st->st_size = fd->dir ? -1 : (int)fd->size; + st->st_nlink = fd->dir ? 2 : 1; st->st_blksize = 512; return 0; @@ -1106,11 +1100,8 @@ static vfs_handler_t vh = { void fs_iso9660_init(void) { int i; - /* Reset fd's */ - memset(fh, 0, sizeof(fh)); - - /* Mark the first as active so we can have an error FD of zero */ - fh[0].first_extent = -1; + /* Init the linked list */ + TAILQ_INIT(&iso_fd_queue); /* Init thread mutexes */ mutex_init(&cache_mutex, MUTEX_TYPE_NORMAL); diff --git a/kernel/arch/dreamcast/include/arch/exec.h b/kernel/arch/dreamcast/include/arch/exec.h index 852a240c..16144c63 100644 --- a/kernel/arch/dreamcast/include/arch/exec.h +++ b/kernel/arch/dreamcast/include/arch/exec.h @@ -39,7 +39,7 @@ __BEGIN_DECLS \param length The length of the binary. \param address The address of the binary's starting point. */ -void arch_exec_at(const void *image, uint32 length, uint32 address) __noreturn; +void arch_exec_at(const void *image, uint32_t length, uint32_t address) __noreturn; /** \brief Replace the currently running binary at the default address. @@ -50,7 +50,7 @@ void arch_exec_at(const void *image, uint32 length, uint32 address) __noreturn; \param image The binary to run (already loaded into RAM). \param length The length of the binary. */ -void arch_exec(const void *image, uint32 length) __noreturn; +void arch_exec(const void *image, uint32_t length) __noreturn; /** @} */ diff --git a/kernel/arch/dreamcast/kernel/exec.c b/kernel/arch/dreamcast/kernel/exec.c index 15e741ae..8e959fab 100644 --- a/kernel/arch/dreamcast/kernel/exec.c +++ b/kernel/arch/dreamcast/kernel/exec.c @@ -4,36 +4,37 @@ Copyright (C) 2002 Megan Potter */ +#include <assert.h> + #include <arch/arch.h> +#include <arch/cache.h> ...<truncated>... hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: ljsebald <ljs...@us...> - 2025-04-24 02:27:38
|
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 35931a498b667b91024dd826b7141a1ad05cb4fa (commit) via c9ecb53a4a48a4cb0bc4b65d4364b206af14c861 (commit) via b47567c783166c31d0ddaeb1add4ef76600a6406 (commit) via 1ef5090fbe0b1693faf7cd3e63bbd8bb1235c0d6 (commit) via 9509e5c055aaaaee87041e868f3217a8d4070c12 (commit) via d71b4fba22234d2322f77930307f99cd746f0eb7 (commit) via 274d7ae48835cf72c3aa43d7f31fb417a67bd688 (commit) from f6485596cf4bfe263ddea4f975f9041bd78095ff (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 35931a498b667b91024dd826b7141a1ad05cb4fa Merge: b47567c7 c9ecb53a Author: Lawrence Sebald <ljs...@us...> Date: Thu Apr 17 01:18:07 2025 -0400 Merge pull request #970 from DC-SWAT/g1ata_fix_prot_cleanup g1ata: Fixed DMA protection and cleanup. commit c9ecb53a4a48a4cb0bc4b65d4364b206af14c861 Author: DC-SWAT <sw...@21...> Date: Thu Apr 17 08:21:50 2025 +0700 g1ata: Fixed DMA protection and cleanup. - Fixed DMA protection register memory area. - Introduced constants for maximum sector counts (LBA28 and LBA48). - Refactored sector count handling in various functions to use these constants. - Improved DMA chaining logic and error handling in the DMA IRQ handler. - Updated type usage for sector counts to size_t for better compatibility. - Using macros instead of hardcoded values. commit b47567c783166c31d0ddaeb1add4ef76600a6406 Merge: 9509e5c0 1ef5090f Author: Lawrence Sebald <ljs...@us...> Date: Wed Apr 16 15:21:53 2025 -0400 Merge pull request #969 from pcercuei/libc-fix-thrd-join Fix potential NULL pointer dereference in thrd_join(). commit 1ef5090fbe0b1693faf7cd3e63bbd8bb1235c0d6 Author: Paul Cercueil <pa...@cr...> Date: Tue Apr 15 13:10:09 2025 +0200 libc: Fix thrd_join() thrd_join() did not handle the case where the second parameter passed is NULL, which is permitted by the standard. Signed-off-by: Paul Cercueil <pa...@cr...> commit 9509e5c055aaaaee87041e868f3217a8d4070c12 Author: QuzarDC <qu...@co...> Date: Sat Apr 12 18:22:37 2025 -0400 Use new __array_size macro. Replace instances of build-time array size counting with the new macro. Cleaned up one to use more appropriate types. commit d71b4fba22234d2322f77930307f99cd746f0eb7 Author: QuzarDC <qu...@co...> Date: Sat Apr 12 15:38:26 2025 -0400 Add build_assert and array_size macros. The `__array_size` macro is already being hand-rolled multiple times in the codebase. This should provide a more robust version of it. `__build_assert` should also be quite useful and backs param checking in `__array_size`. commit 274d7ae48835cf72c3aa43d7f31fb417a67bd688 Author: QuzarDC <qu...@co...> Date: Sat Apr 12 15:09:26 2025 -0400 Clean up doxygen for cdefs.h Split out the doxygen group for the defines that are for compiler attributes vs language defines. ----------------------------------------------------------------------- Summary of changes: include/kos/cdefs.h | 113 ++++++++++++++++++--- include/kos/dbgio.h | 2 +- kernel/arch/dreamcast/hardware/g1ata.c | 99 ++++++++++-------- kernel/arch/dreamcast/hardware/maple/keyboard.c | 2 +- kernel/arch/dreamcast/hardware/maple/maple_utils.c | 6 +- kernel/arch/dreamcast/kernel/init.c | 2 +- kernel/debug/dbgio.c | 4 +- kernel/libc/c11/thrd_join.c | 4 +- 8 files changed, 169 insertions(+), 63 deletions(-) diff --git a/include/kos/cdefs.h b/include/kos/cdefs.h index f042b524..22ff1e16 100644 --- a/include/kos/cdefs.h +++ b/include/kos/cdefs.h @@ -9,12 +9,12 @@ */ /** \file kos/cdefs.h - \brief Definitions for builtin attributes and compiler directives - \ingroup system_macros + \brief Various common macros used throughout the codebase + \ingroup system - This file contains definitions of various __attribute__ directives in - shorter forms for use in programs. These typically aid in optimizations - or provide the compiler with extra information about a symbol. + This file contains various convenience macros. Mostly compiler + __attribute__ directives, as well as other language defines, and + useful language extensions. \author Megan Potter \author Lawrence Sebald @@ -26,19 +26,21 @@ #include <sys/cdefs.h> -/** \defgroup system_macros Macros - \brief Various common macros used throughout the codebase - \ingroup system - - @{ -*/ - /* Check GCC version */ #if __GNUC__ <= 3 # warning Your GCC is too old. This will probably not work right. #endif -/* Special function/variable attributes */ +/** \defgroup system_attributes + \brief Definitions for builtin attributes and compiler directives + \ingroup system + + This group contains definitions of various __attribute__ directives in + shorter forms for use in programs. These typically aid in optimizations + or provide the compiler with extra information about a symbol. + + @{ +*/ #ifndef __noreturn /** \brief Identify a function that will never return. */ @@ -169,6 +171,18 @@ #define __no_inline __attribute__((__noinline__)) #endif +/** @} */ + +/** \defgroup system_compat + \brief Definitions for language features + \ingroup system + + This group contains definitions to help retain some older language + backwards compatibility for external software linking into KOS. + + @{ +*/ + /* GCC macros for special cases */ /* #if __GNUC__ == */ @@ -192,4 +206,77 @@ /** @} */ +/** \defgroup system_helpers + \brief General useful language macros + \ingroup system + + This group contains definitions to help give robust solutions + to common code patterns. + + @{ +*/ + +/** \brief Assert a build-time dependency. + + Your compiler will fail if the condition isn't true, or can't be evaluated + by the compiler. This can only be used within a function. + + Example: + #include <stddef.h> + ... + static char *foo_to_char(struct foo *foo) + { + // This code needs string to be at start of foo. + __build_assert(offsetof(struct foo, string) == 0); + return (char *)foo; + } + + \param cond The compile-time condition which must be true. + + \sa __build_assert_or_zero + */ +#define __build_assert(cond) \ + do { (void) sizeof(char [1 - 2*!(cond)]); } while(0) + +/** \brief Assert a build-time dependency. + + Your compiler will fail if the condition isn't true, or can't be evaluated + by the compiler. This can be used in an expression: its value is "0". + + Example: + #define foo_to_char(foo) \ + ((char *)(foo) \ + + __build_assert_or_zero(offsetof(struct foo, string) == 0)) + + \param cond The compile-time condition which must be true. + + \sa __build_assert + */ +#define __build_assert_or_zero(cond) \ + (sizeof(char [1 - 2*!(cond)]) - 1) + +/** \brief Get the number of elements in a visible array. + + This does not work on pointers, or arrays declared as [], or + function parameters. With correct compiler support, such usage + will cause a build error (\see __build_assert). + + \param arr The array whose size you want. + + */ +#define __array_size(arr) (sizeof(arr) / sizeof((arr)[0]) + _array_size_chk(arr)) + +/* Helper for __array_size's type check */ +#if HAVE_BUILTIN_TYPES_COMPATIBLE_P && HAVE_TYPEOF +/* Two gcc extensions. + * &a[0] degrades to a pointer: a different type from an array */ +#define _array_size_chk(arr) \ + __build_assert_or_zero(!__builtin_types_compatible_p(typeof(arr), \ + typeof(&(arr)[0]))) +#else +#define _array_size_chk(arr) 0 +#endif + +/** @} */ + #endif /* __KOS_CDEFS_H */ diff --git a/include/kos/dbgio.h b/include/kos/dbgio.h index ffdcb5f0..4210f2e4 100644 --- a/include/kos/dbgio.h +++ b/include/kos/dbgio.h @@ -107,7 +107,7 @@ typedef struct dbgio_handler { /** \cond */ /* These two should be initialized in arch. */ extern dbgio_handler_t * dbgio_handlers[]; -extern int dbgio_handler_cnt; +extern const size_t dbgio_handler_cnt; /* This is defined by the shared code, in case there's no valid handler. */ extern dbgio_handler_t dbgio_null; diff --git a/kernel/arch/dreamcast/hardware/g1ata.c b/kernel/arch/dreamcast/hardware/g1ata.c index 83b72b7f..54894c5d 100644 --- a/kernel/arch/dreamcast/hardware/g1ata.c +++ b/kernel/arch/dreamcast/hardware/g1ata.c @@ -150,6 +150,9 @@ typedef struct ata_devdata { #define ATA_TRANSFER_WDMA(x) 0x20 | ((x) & 0x07) #define ATA_TRANSFER_UDMA(x) 0x40 | ((x) & 0x07) +#define ATA_MAX_SECTORS_LBA28 256 +#define ATA_MAX_SECTORS_LBA48 65536 + /* Access timing data. */ #define G1_ACCESS_WDMA_MODE2 0x00001001 #define G1_ACCESS_PIO_DEFAULT 0x00000222 @@ -194,7 +197,7 @@ extern mutex_t _g1_ata_mutex; do {} while(!(IN8(G1_ATA_ALTSTATUS) & G1_ATA_SR_DRDY)) static inline int use_lba28(uint64_t sector, size_t count) { - return ((sector + count) < 0x0FFFFFFF) && (count <= 256); + return ((sector + count) < 0x0FFFFFFF) && (count <= ATA_MAX_SECTORS_LBA28); } #define CAN_USE_LBA48() ((device.command_sets & (1 << 26))) @@ -218,7 +221,7 @@ inline int g1_ata_mutex_unlock(void) { return mutex_unlock(&_g1_ata_mutex); } -static void g1_ata_set_sector_and_count(uint64_t sector, uint32_t count, int lba28) { +static void g1_ata_set_sector_and_count(uint64_t sector, size_t count, int lba28) { if(!lba28) { OUT8(G1_ATA_SECTOR_COUNT, (uint8_t)(count >> 8)); OUT8(G1_ATA_LBA_LOW, (uint8_t)((sector >> 24) & 0xFF)); @@ -235,24 +238,50 @@ static void g1_ata_set_sector_and_count(uint64_t sector, uint32_t count, int lba OUT8(G1_ATA_LBA_HIGH, (uint8_t)((sector >> 16) & 0xFF)); } +static void g1_dma_done(void) { + /* Signal the calling thread to continue, if it is blocking. */ + if(dma_blocking) { + sem_signal(&dma_done); + thd_schedule(1, 0); + dma_blocking = 0; + } + + dma_in_progress = 0; + + /* Make sure to select the GD-ROM drive back. */ + g1_ata_select_device(G1_ATA_MASTER); + mutex_unlock_as_thread(&_g1_ata_mutex, dma_thd); +} + static void g1_dma_irq_hnd(uint32 code, void *data) { int can_lba48 = CAN_USE_LBA48(); - unsigned int nb_sectors; + size_t nb_sectors; + uint8_t status; /* XXXX: Probably should look at the code to make sure it isn't an error. */ (void)code; (void)data; - if(dma_in_progress && !can_lba48 && dma_nb_sectors > 256) { - dma_sector += 256; - dma_nb_sectors -= 256; - nb_sectors = dma_nb_sectors <= 256 ? dma_nb_sectors : 256; + if(dma_in_progress && !can_lba48 && dma_nb_sectors > ATA_MAX_SECTORS_LBA28) { + dma_sector += ATA_MAX_SECTORS_LBA28; + dma_nb_sectors -= ATA_MAX_SECTORS_LBA28; + nb_sectors = dma_nb_sectors <= ATA_MAX_SECTORS_LBA28 ? dma_nb_sectors : ATA_MAX_SECTORS_LBA28; + + /* Make sure to acknowledge the IRQ before continuing */ + status = IN8(G1_ATA_STATUS_REG); + + /* If there is an error, stop the DMA chain. */ + if(status & (G1_ATA_SR_ERR | G1_ATA_SR_DF)) { + dbglog(DBG_ERROR, "g1_dma_irq_hnd: Error detected in DMA chain, aborting\n"); + g1_dma_done(); + return; + } /* Set the DMA parameters for the next transfer. */ g1_ata_select_device(G1_ATA_SLAVE | G1_ATA_LBA_MODE | ((dma_sector >> 24) & 0x0F)); g1_ata_set_sector_and_count(dma_sector, nb_sectors, 1); - OUT32(G1_ATA_DMA_ADDRESS, IN32(G1_ATA_DMA_ADDRESS) + 256 * 512); + OUT32(G1_ATA_DMA_ADDRESS, IN32(G1_ATA_DMA_ADDRESS) + ATA_MAX_SECTORS_LBA28 * 512); OUT32(G1_ATA_DMA_LENGTH, nb_sectors * 512); if(dma_cmd == ATA_CMD_WRITE_DMA) @@ -267,18 +296,7 @@ static void g1_dma_irq_hnd(uint32 code, void *data) { OUT32(G1_ATA_DMA_STATUS, 1); } else if(dma_in_progress) { - /* Signal the calling thread to continue, if it is blocking. */ - if(dma_blocking) { - sem_signal(&dma_done); - thd_schedule(1, 0); - dma_blocking = 0; - } - - dma_in_progress = 0; - - /* Make sure to select the GD-ROM drive back. */ - g1_ata_select_device(G1_ATA_MASTER); - mutex_unlock_as_thread(&_g1_ata_mutex, dma_thd); + g1_dma_done(); } } @@ -382,7 +400,7 @@ int g1_ata_read_chs(uint16_t c, uint8_t h, uint8_t s, size_t count, void *buf) { int rv = 0; unsigned int i, j; - uint16_t nsects; + size_t nsects; uint16_t word; uint8_t *ptr = (uint8_t *)buf; @@ -400,14 +418,14 @@ int g1_ata_read_chs(uint16_t c, uint8_t h, uint8_t s, size_t count, g1_ata_wait_bsydrq(); while(count) { - nsects = count > 256 ? 256 : (uint16_t)count; + nsects = count > ATA_MAX_SECTORS_LBA28 ? ATA_MAX_SECTORS_LBA28 : count; count -= nsects; g1_ata_select_device(G1_ATA_SLAVE | (h & 0x0F)); /* Write out the number of sectors we want as well as the cylinder and sector. */ - OUT8(G1_ATA_SECTOR_COUNT, nsects); + OUT8(G1_ATA_SECTOR_COUNT, (uint8_t)nsects); OUT8(G1_ATA_CHS_SECTOR, s); OUT8(G1_ATA_CHS_CYL_LOW, (uint8_t)((c >> 0) & 0xFF)); OUT8(G1_ATA_CHS_CYL_HIGH, (uint8_t)((c >> 8) & 0xFF)); @@ -463,7 +481,7 @@ int g1_ata_write_chs(uint16_t c, uint8_t h, uint8_t s, size_t count, const void *buf) { int rv = 0; unsigned int i, j; - uint16_t nsects; + size_t nsects; uint16_t word; uint8_t *ptr = (uint8_t *)buf; @@ -481,14 +499,14 @@ int g1_ata_write_chs(uint16_t c, uint8_t h, uint8_t s, size_t count, g1_ata_wait_bsydrq(); while(count) { - nsects = count > 256 ? 256 : (uint16_t)count; + nsects = count > ATA_MAX_SECTORS_LBA28 ? ATA_MAX_SECTORS_LBA28 : count; count -= nsects; g1_ata_select_device(G1_ATA_SLAVE | (h & 0x0F)); /* Write out the number of sectors we want as well as the cylinder and sector. */ - OUT8(G1_ATA_SECTOR_COUNT, nsects); + OUT8(G1_ATA_SECTOR_COUNT, (uint8_t)nsects); OUT8(G1_ATA_CHS_SECTOR, s); OUT8(G1_ATA_CHS_CYL_LOW, (uint8_t)((c >> 0) & 0xFF)); OUT8(G1_ATA_CHS_CYL_HIGH, (uint8_t)((c >> 8) & 0xFF)); @@ -538,10 +556,11 @@ int g1_ata_write_chs(uint16_t c, uint8_t h, uint8_t s, size_t count, int g1_ata_read_lba(uint64_t sector, size_t count, void *buf) { int rv = 0; unsigned int i, j; - uint16_t nsects; + size_t nsects; uint16_t word; uint8_t *ptr = (uint8_t *)buf; int lba28, cmd; + const size_t max_sectors = CAN_USE_LBA48() ? ATA_MAX_SECTORS_LBA48 : ATA_MAX_SECTORS_LBA28; /* Make sure that we've been initialized and there's a disk attached. */ if(!devices) { @@ -569,11 +588,11 @@ int g1_ata_read_lba(uint64_t sector, size_t count, void *buf) { g1_ata_wait_bsydrq(); while(count) { - nsects = count > 256 ? 256 : (uint16_t)count; + nsects = count > max_sectors ? max_sectors : count; count -= nsects; /* Which mode are we using: LBA28 or LBA48? */ - lba28 = (sector + nsects) <= 0x0FFFFFFF; + lba28 = use_lba28(sector, nsects); if(lba28) { g1_ata_select_device(G1_ATA_SLAVE | G1_ATA_LBA_MODE | ((sector >> 24) & 0x0F)); @@ -656,7 +675,7 @@ int g1_ata_read_lba_dma(uint64_t sector, size_t count, void *buf, } /* Chaining isn't done yet, so make sure we don't need to. */ - if(count > 65536) { + if(count > ATA_MAX_SECTORS_LBA48) { errno = EOVERFLOW; return -1; } @@ -712,8 +731,8 @@ int g1_ata_read_lba_dma(uint64_t sector, size_t count, void *buf, dma_sector = sector; irq_restore(old); - if(!can_lba48 && count > 256) - count = 256; + if(!can_lba48 && count > ATA_MAX_SECTORS_LBA28) + count = ATA_MAX_SECTORS_LBA28; /* Wait for the device to signal it is ready. */ g1_ata_wait_bsydrq(); @@ -739,11 +758,11 @@ int g1_ata_read_lba_dma(uint64_t sector, size_t count, void *buf, int g1_ata_write_lba(uint64_t sector, size_t count, const void *buf) { unsigned int i, j; - uint32_t nsects; + size_t nsects; uint16_t word; uint8_t *ptr = (uint8_t *)buf; int cmd, lba28; - const size_t max_sectors = CAN_USE_LBA48() ? 65536 : 256; + const size_t max_sectors = CAN_USE_LBA48() ? ATA_MAX_SECTORS_LBA48 : ATA_MAX_SECTORS_LBA28; /* Make sure that we've been initialized and there's a disk attached. */ if(!devices) { @@ -775,7 +794,7 @@ int g1_ata_write_lba(uint64_t sector, size_t count, const void *buf) { count -= nsects; /* Which mode are we using: LBA28 or LBA48? */ - lba28 = (sector + nsects) <= 0x0FFFFFFF; + lba28 = use_lba28(sector, nsects); if(lba28) { g1_ata_select_device(G1_ATA_SLAVE | G1_ATA_LBA_MODE | ((sector >> 24) & 0x0F)); @@ -847,7 +866,7 @@ int g1_ata_write_lba_dma(uint64_t sector, size_t count, const void *buf, } /* Make sure we don't exceed maximum sector count */ - if(count > 65536) { + if(count > ATA_MAX_SECTORS_LBA48) { errno = EOVERFLOW; return -1; } @@ -912,8 +931,8 @@ int g1_ata_write_lba_dma(uint64_t sector, size_t count, const void *buf, g1_ata_select_device(G1_ATA_SLAVE | G1_ATA_LBA_MODE | ((sector >> 24) & 0x0F)); cmd = ATA_CMD_WRITE_DMA; - if(count > 256) { - count = 256; + if(count > ATA_MAX_SECTORS_LBA28) { + count = ATA_MAX_SECTORS_LBA28; } } else { @@ -944,7 +963,7 @@ int g1_ata_flush(void) { timer_spin_sleep(1); /* Flush the disk's write cache to make sure everything gets written out. */ - if(device.max_lba > 0x0FFFFFFF) + if(CAN_USE_LBA48()) OUT8(G1_ATA_COMMAND_REG, ATA_CMD_FLUSH_CACHE_EXT); else OUT8(G1_ATA_COMMAND_REG, ATA_CMD_FLUSH_CACHE); @@ -1092,7 +1111,7 @@ static int g1_ata_scan(void) { if(!g1_ata_set_transfer_mode(ATA_TRANSFER_WDMA(2))) { OUT32(G1_ATA_DMA_RACCESS_WAIT, G1_ACCESS_WDMA_MODE2); OUT32(G1_ATA_DMA_WACCESS_WAIT, G1_ACCESS_WDMA_MODE2); - OUT32(G1_ATA_DMA_PROTECTION, G1_DMA_UNLOCK_ALLMEM); + OUT32(G1_ATA_DMA_PROTECTION | MEM_AREA_P2_BASE, G1_DMA_UNLOCK_ALLMEM); } else { device.wdma_modes = 0; diff --git a/kernel/arch/dreamcast/hardware/maple/keyboard.c b/kernel/arch/dreamcast/hardware/maple/keyboard.c index c4dc8663..9fd1b22c 100644 --- a/kernel/arch/dreamcast/hardware/maple/keyboard.c +++ b/kernel/arch/dreamcast/hardware/maple/keyboard.c @@ -80,7 +80,7 @@ typedef struct kbd_keymap { } kbd_keymap_internal_t; /* Built-in keymaps. */ -#define KBD_NUM_KEYMAPS (sizeof(keymaps) / sizeof(keymaps[0])) +#define KBD_NUM_KEYMAPS __array_size(keymaps) static const kbd_keymap_internal_t keymaps[] = { { /* Japanese keyboard */ diff --git a/kernel/arch/dreamcast/hardware/maple/maple_utils.c b/kernel/arch/dreamcast/hardware/maple/maple_utils.c index 5b455e12..c12db5c6 100644 --- a/kernel/arch/dreamcast/hardware/maple/maple_utils.c +++ b/kernel/arch/dreamcast/hardware/maple/maple_utils.c @@ -93,7 +93,6 @@ static const char *maple_cap_names[] = { "Mouse", "JumpPack" }; -#define maple_cap_name_cnt (sizeof(maple_cap_names)/sizeof(char *)) /* Print the capabilities of a given driver to dbglog; NOT THREAD SAFE */ static char caps_buffer[64]; @@ -102,7 +101,7 @@ const char * maple_pcaps(uint32 functions) { for(o = 0, i = 0; i < 32; i++) { if(functions & (0x80000000 >> i)) { - if(i > maple_cap_name_cnt || maple_cap_names[i] == NULL) { + if(i > __array_size(maple_cap_names) || maple_cap_names[i] == NULL) { sprintf(caps_buffer + o, "UNKNOWN(%08x), ", (0x80000000 >> i)); o += strlen(caps_buffer + o); } @@ -133,13 +132,12 @@ static const char *maple_resp_names[] = { "OK", "DATATRF" }; -#define maple_resp_name_cnt ((int)(sizeof(maple_resp_names)/sizeof(char *))) /* Return a string representing the maple response code */ const char * maple_perror(int response) { response += 5; - if(response < 0 || response >= maple_resp_name_cnt) + if(response < 0 || (size_t)response >= __array_size(maple_resp_names)) return "UNKNOWN"; else return maple_resp_names[response]; diff --git a/kernel/arch/dreamcast/kernel/init.c b/kernel/arch/dreamcast/kernel/init.c index dae62a55..01841aec 100644 --- a/kernel/arch/dreamcast/kernel/init.c +++ b/kernel/arch/dreamcast/kernel/init.c @@ -53,7 +53,7 @@ dbgio_handler_t * dbgio_handlers[] = { &dbgio_null, &dbgio_fb }; -int dbgio_handler_cnt = sizeof(dbgio_handlers) / sizeof(dbgio_handler_t *); +const size_t dbgio_handler_cnt = __array_size(dbgio_handlers); void arch_init_net_dcload_ip(void) { union { diff --git a/kernel/debug/dbgio.c b/kernel/debug/dbgio.c index a7ecb9f8..1c79034c 100644 --- a/kernel/debug/dbgio.c +++ b/kernel/debug/dbgio.c @@ -25,7 +25,7 @@ static dbgio_handler_t * dbgio = NULL; int dbgio_dev_select(const char * name) { - int i; ...<truncated>... hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: quzar <qu...@us...> - 2025-04-14 06:02: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 f6485596cf4bfe263ddea4f975f9041bd78095ff (commit) via a157c03444b2836c390775d0f2d09764e7fd264a (commit) from e120412ac981ce36e51c941d03e0db2608651992 (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 f6485596cf4bfe263ddea4f975f9041bd78095ff Author: DC-SWAT <sw...@21...> Date: Fri Apr 11 19:41:35 2025 +0700 g1ata: Fix and improve LBA28 DMA chaining. - Fixed setting up LBA28 high bits. - Added chaining support for writing. commit a157c03444b2836c390775d0f2d09764e7fd264a Author: DC-SWAT <sw...@21...> Date: Fri Apr 11 13:21:13 2025 +0700 g1ata: Fixed max sector count. ----------------------------------------------------------------------- Summary of changes: kernel/arch/dreamcast/hardware/g1ata.c | 36 ++++++++++++++++++++++------------ 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/kernel/arch/dreamcast/hardware/g1ata.c b/kernel/arch/dreamcast/hardware/g1ata.c index 35dad2db..83b72b7f 100644 --- a/kernel/arch/dreamcast/hardware/g1ata.c +++ b/kernel/arch/dreamcast/hardware/g1ata.c @@ -2,7 +2,7 @@ hardware/g1ata.c Copyright (C) 2013, 2014, 2015 Lawrence Sebald - Copyright (C) 2015, 2023, 2024 Ruslan Rostovtsev + Copyright (C) 2015, 2023, 2024, 2025 Ruslan Rostovtsev */ #include <errno.h> @@ -108,7 +108,6 @@ typedef struct ata_devdata { #define G1_ATA_DMA_DIRECTION 0xA05F740C /* Read/Write */ #define G1_ATA_DMA_ENABLE 0xA05F7414 /* Read/Write */ #define G1_ATA_DMA_STATUS 0xA05F7418 /* Read/Write */ -#define G1_ATA_DMA_PROTECTION 0xA05F74B8 /* Write-only */ /* Protection register code. */ #define G1_DMA_UNLOCK_CODE 0x8843 @@ -229,7 +228,7 @@ static void g1_ata_set_sector_and_count(uint64_t sector, uint32_t count, int lba /* Write out the number of sectors we want and the lower 24-bits of the LBA we're looking for. Note that putting 0 into the sector count - register returns 256 sectors. */ + register returns max count of sectors. */ OUT8(G1_ATA_SECTOR_COUNT, (uint8_t)count); OUT8(G1_ATA_LBA_LOW, (uint8_t)((sector >> 0) & 0xFF)); OUT8(G1_ATA_LBA_MID, (uint8_t)((sector >> 8) & 0xFF)); @@ -250,10 +249,17 @@ static void g1_dma_irq_hnd(uint32 code, void *data) { nb_sectors = dma_nb_sectors <= 256 ? dma_nb_sectors : 256; /* Set the DMA parameters for the next transfer. */ + g1_ata_select_device(G1_ATA_SLAVE | G1_ATA_LBA_MODE | + ((dma_sector >> 24) & 0x0F)); g1_ata_set_sector_and_count(dma_sector, nb_sectors, 1); OUT32(G1_ATA_DMA_ADDRESS, IN32(G1_ATA_DMA_ADDRESS) + 256 * 512); OUT32(G1_ATA_DMA_LENGTH, nb_sectors * 512); + if(dma_cmd == ATA_CMD_WRITE_DMA) + OUT8(G1_ATA_DMA_DIRECTION, G1_DMA_TO_DEVICE); + else + OUT8(G1_ATA_DMA_DIRECTION, G1_DMA_TO_MEMORY); + /* Write out the command to the device. */ OUT8(G1_ATA_COMMAND_REG, dma_cmd); @@ -376,7 +382,7 @@ int g1_ata_read_chs(uint16_t c, uint8_t h, uint8_t s, size_t count, void *buf) { int rv = 0; unsigned int i, j; - uint8_t nsects = (uint8_t)count; + uint16_t nsects; uint16_t word; uint8_t *ptr = (uint8_t *)buf; @@ -394,7 +400,7 @@ int g1_ata_read_chs(uint16_t c, uint8_t h, uint8_t s, size_t count, g1_ata_wait_bsydrq(); while(count) { - nsects = count > 255 ? 255 : (uint8_t)count; + nsects = count > 256 ? 256 : (uint16_t)count; count -= nsects; g1_ata_select_device(G1_ATA_SLAVE | (h & 0x0F)); @@ -457,7 +463,7 @@ int g1_ata_write_chs(uint16_t c, uint8_t h, uint8_t s, size_t count, const void *buf) { int rv = 0; unsigned int i, j; - uint8_t nsects = (uint8_t)count; + uint16_t nsects; uint16_t word; uint8_t *ptr = (uint8_t *)buf; @@ -475,7 +481,7 @@ int g1_ata_write_chs(uint16_t c, uint8_t h, uint8_t s, size_t count, g1_ata_wait_bsydrq(); while(count) { - nsects = count > 255 ? 255 : (uint8_t)count; + nsects = count > 256 ? 256 : (uint16_t)count; count -= nsects; g1_ata_select_device(G1_ATA_SLAVE | (h & 0x0F)); @@ -532,7 +538,7 @@ int g1_ata_write_chs(uint16_t c, uint8_t h, uint8_t s, size_t count, int g1_ata_read_lba(uint64_t sector, size_t count, void *buf) { int rv = 0; unsigned int i, j; - uint8_t nsects = (uint8_t)count; + uint16_t nsects; uint16_t word; uint8_t *ptr = (uint8_t *)buf; int lba28, cmd; @@ -563,7 +569,7 @@ int g1_ata_read_lba(uint64_t sector, size_t count, void *buf) { g1_ata_wait_bsydrq(); while(count) { - nsects = count > 255 ? 255 : (uint8_t)count; + nsects = count > 256 ? 256 : (uint16_t)count; count -= nsects; /* Which mode are we using: LBA28 or LBA48? */ @@ -733,10 +739,11 @@ int g1_ata_read_lba_dma(uint64_t sector, size_t count, void *buf, int g1_ata_write_lba(uint64_t sector, size_t count, const void *buf) { unsigned int i, j; - uint8_t nsects = (uint8_t)count; + uint32_t nsects; uint16_t word; uint8_t *ptr = (uint8_t *)buf; int cmd, lba28; + const size_t max_sectors = CAN_USE_LBA48() ? 65536 : 256; /* Make sure that we've been initialized and there's a disk attached. */ if(!devices) { @@ -764,7 +771,7 @@ int g1_ata_write_lba(uint64_t sector, size_t count, const void *buf) { g1_ata_wait_bsydrq(); while(count) { - nsects = count > 255 ? 255 : (uint8_t)count; + nsects = count > max_sectors ? max_sectors : count; count -= nsects; /* Which mode are we using: LBA28 or LBA48? */ @@ -839,8 +846,8 @@ int g1_ata_write_lba_dma(uint64_t sector, size_t count, const void *buf, return -1; } - /* Chaining isn't done yet, so make sure we don't need to. */ - if(count > 65536 || (!can_lba48 && count > 256)) { + /* Make sure we don't exceed maximum sector count */ + if(count > 65536) { errno = EOVERFLOW; return -1; } @@ -905,6 +912,9 @@ int g1_ata_write_lba_dma(uint64_t sector, size_t count, const void *buf, g1_ata_select_device(G1_ATA_SLAVE | G1_ATA_LBA_MODE | ((sector >> 24) & 0x0F)); cmd = ATA_CMD_WRITE_DMA; + if(count > 256) { + count = 256; + } } else { g1_ata_select_device(G1_ATA_SLAVE | G1_ATA_LBA_MODE); hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: quzar <qu...@us...> - 2025-04-10 20:03: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 e120412ac981ce36e51c941d03e0db2608651992 (commit) via 6822d9db85a739b1b19146b0373e81677cb11338 (commit) via d9e4ac836288aeaf6a514bc5177243db8e71b133 (commit) via 95f8f2d48c95bf8ac970191ce9d3a1d3a30ff377 (commit) via 6b54707a5f3045c357b337942349530a3eb50265 (commit) via 08385c8de32bbb2af6dcb48ce427581061f3ed68 (commit) via ee5d32fff3411afd6385423b640b87ca7714a199 (commit) via 91e60459f01b4838c8c7af718e280d1b7ab03b01 (commit) via 205aaeb6922032afa6ba9361e7278ab14bfc2320 (commit) via bcc9b7506ad5ab39700793cb38cd2879fdf0c4d3 (commit) via 2802ae7a595f0a9a075bed2efc203bb8732fc3b4 (commit) via e1e2503f1be90216ef5ff577ff68532f6377e2bf (commit) via 1b5429bf39092df76565c9f22aaca45ad56d736b (commit) via 129d18af3a4af0336f74bce374bb5ad163a249c6 (commit) via edf52edd38e99921f644e60ba0a0f1f5e9cda7a8 (commit) via 3e4d1bb12cca8fb90b42f5f9405c199aca8a31e9 (commit) via 5573c8eed2e1ecb2e82c6a984691dd9917227b5d (commit) via 0c4a7d8d41f7d28513cdea12985752f47ee424ef (commit) via 996b01f05386ff12bc4906f08d37dba386f71d33 (commit) via 5d33e5ac74b59804d78305a355532e663164b8f3 (commit) via 0b56ee924d97f9f5e1d6e1ae1b34da95f63faffd (commit) via 33101bdfa56550c68d7d6e055b514d387d06df0c (commit) via b7df027e03cd329bf2341d48cec65d9931287c80 (commit) via 43b0f9a01973c063c513f5efbc7b2ed7f0df4d67 (commit) via ef8308b1e5ecf26f8b24502eb1b2e04cfde321b4 (commit) via aa5bbb791e7b37e0ee1dfaf53e8a16d15f4f6726 (commit) via 3b354a4b4246ae154c3fc1c70846a6b04e1a5de7 (commit) via 80308bc44e30f0c92a05f7e8a4ac82c6e1a072b9 (commit) via d286105ed5403ae0079043956a21e9c8dd643763 (commit) via d665cdae34a4ae6bb2ef5ccd02c450e4077fb5f2 (commit) via 5ac08737d0d026e43254c3028e0d5829e0f14d4a (commit) via dca7f6d86be234b6488bd9d7e05aef0fa10f8d96 (commit) via fcae791265eee3fa3644316b3bbdb70563b4b290 (commit) via 4934bfbae4cfeb45c7ed57a41f5feadf5d2a2c51 (commit) via 78ec0f239d4d1cf7bb5eb6c3d7fde91d9aec05ea (commit) via 5685e822b02e49e80b1d3e46541686c8ce133b49 (commit) via 3a7cff13340b98ceeb153878147a5653fba82cdf (commit) via 20279fc53ad8e17f458fbb05c0c1cdd42fe0ab81 (commit) via 0771070cc741ff513d09ecefb92cf23a9c21e34c (commit) via 08a94a5cead642470d0185b6ec4eefb5a7695514 (commit) via 9da83b9007c3d4e0de1df08cd6d35984d4cababb (commit) via 73b0c14a9f64f1937f4ed207746dd89101897f89 (commit) via 2e18edca61a8357c5c149f14ddfa984b06b2817a (commit) via b1453c5fbd68c68a3e5bb0a3af9dc6b543a47182 (commit) via 58e06b91648b0dca27c6ae603aeffe5b2cb42ce8 (commit) from f94e9a5b4bb8cfc281fa00884bb04e3da510eb96 (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 e120412ac981ce36e51c941d03e0db2608651992 Author: QuzarDC <qu...@co...> Date: Fri Mar 21 21:53:25 2025 -0400 Reduce duplicated thread scheduling code. Slight refactor that deduplicates a sequence that was used 3 times in thread.c . This has the side effect of introducing stack overrun testing during manual thread rescheduling via `thd_schedule_next`. commit 6822d9db85a739b1b19146b0373e81677cb11338 Author: QuzarDC <qu...@co...> Date: Fri Mar 21 21:39:32 2025 -0400 Add arch/tls_static Move arch-dependent static TLS functionality out of kos/thread. Previously the SH-specific implementation details were hardcoded into otherwise platform-independent code. commit d9e4ac836288aeaf6a514bc5177243db8e71b133 Author: QuzarDC <qu...@co...> Date: Thu Mar 20 22:49:06 2025 -0400 Clean up thd_create_tls_data First, adjust it to signal failure for simple memory allocation, as out of memory is normally recoverable. Second, move the setting of the gbr register into the tls data creation. This will facilitate moving the function out of thread.c into an arch-specific file by having all the SH-specific code together. Now, you pass the kthread that you want tls data created for and the function does the rest of the related work. commit 95f8f2d48c95bf8ac970191ce9d3a1d3a30ff377 Author: Paul Cercueil <pa...@cr...> Date: Thu Apr 3 11:19:31 2025 +0200 pvr: Rename 'ta_ready' variable It was looking a bit strange in the pvr_start_ta_rendering() function to have the following: ta_ready = 1; ta_busy = 1; Rename the 'ta_ready' variable to 'ta_checked_ready', since the information it really contains is whether or not we already checked that the TA was ready in the current scene, and not if it is ready at this exact moment. Signed-off-by: Paul Cercueil <pa...@cr...> commit 6b54707a5f3045c357b337942349530a3eb50265 Author: Paul Cercueil <pa...@cr...> Date: Thu Apr 3 02:21:49 2025 +0200 pvr: Fix race between driver and TA The driver was calling pvr_start_ta_rendering() at two different spots: when a non-DMA list was opened, or in the pvr_scene_finish() function before uploading DMA lists. This function would wait for the TA to be ready (if not previously done), then mark it as "busy" again. However, in the specific case where the DMA feature was enabled but no lists were actually configured for DMA transfers, and for a simple enough scene, it was possible for the TA to complete before the second call of pvr_start_ta_rendering(), causing it to reset the "busy" flag once again, which would then never be cleared by the IRQ handler. This caused any following call to pvr_wait_ready() to timeout, dropping the framerate to 5 fps or lower. Fix this race by only setting the "busy" flag once, as we only need to set it in the first call (whichever it is) of pvr_start_ta_rendering(). Signed-off-by: Paul Cercueil <pa...@cr...> commit 08385c8de32bbb2af6dcb48ce427581061f3ed68 Author: QuzarDC <qu...@co...> Date: Mon Apr 7 18:17:11 2025 -0400 Clean up doxygen structure. Remove duplicated insertions of documentation to the top level kbd group. Add a predefined exception for the `__depr` (deprecation with a message) macro. commit ee5d32fff3411afd6385423b640b87ca7714a199 Author: QuzarDC <qu...@co...> Date: Mon Apr 7 16:26:53 2025 -0400 Add new public function kbd_key_to_ascii This makes public the translation functionality from kbd_queue_pop. It required moving the definition of the region type, but no changes to it. commit 91e60459f01b4838c8c7af718e280d1b7ab03b01 Author: QuzarDC <qu...@co...> Date: Mon Apr 7 15:50:42 2025 -0400 Deprecate public kbd_keymap_t Move to a private version. Leaving a deprecated stub as this was never noted as being internal (it just didn't make much sense to use it externally, perhaps as a way to support keyboard layouts we don't). commit 205aaeb6922032afa6ba9361e7278ab14bfc2320 Author: QuzarDC <qu...@co...> Date: Mon Apr 7 12:45:02 2025 -0400 Use new kbd_mods, kbd_leds, and kbd_key types. Shift over internal data structures and functions to use these new types. Introduces new internal type for queued keypresses (`kbd_q_key_t`) that wraps the three new types that used to be just bitpacked into an int. In `kbd_enqueue` no longer pass 'mods' as the same is already available via the keyboard state. Additionally use the defined keycode rather than literal 1 for ERROR, and the compile time static sizeof keymap rather than the hardcoded size of it. In `kbd_queue_pop` access the mods/led data from the `kbd_q_key` type rather than the bitpacking, and use the correct led define for caps lock. The old kbd_state `shift_keys` int is incompatible with these new usages so it has been replaced by a new `last_modifiers` kbd_mods_t. It has been set up to allow friendly deprecation. Changes in `kbd_check_poll` follow the change of `shift keys` as well as the params change of `kbd_enqueue`. commit bcc9b7506ad5ab39700793cb38cd2879fdf0c4d3 Author: QuzarDC <qu...@co...> Date: Mon Apr 7 09:52:03 2025 -0400 Remove extraneous error check. The region parameter is only set during attach, and it is guaranteed to be valid based on that. Thus this error condition can never be triggered. commit 2802ae7a595f0a9a075bed2efc203bb8732fc3b4 Author: QuzarDC <qu...@co...> Date: Mon Apr 7 03:15:29 2025 -0400 Move private data members out of public kbd_state_t. These values had been marked as being internal when first introduced, just due to lack of the mechanism being used here. The private struct size will be the status size in the driver definition. With this new mechanism, it's also possible to simplify the initialization of the private struct data rather than individually setting each to 0. Additionally, some minor whitespace, define, and typing fixes. commit e1e2503f1be90216ef5ff577ff68532f6377e2bf Author: QuzarDC <qu...@co...> Date: Mon Apr 7 02:41:55 2025 -0400 Clean up keyboard example. Add clarifying comments and defines. Use escape characters rather than hex. Update kbd_queue_pop usage. commit 1b5429bf39092df76565c9f22aaca45ad56d736b Author: QuzarDC <qu...@co...> Date: Mon Apr 7 02:14:40 2025 -0400 Update keyboard example to not require controller. Previously if no controller was found, the example would just quit, despite the controller just being for optional exiting via START. commit 129d18af3a4af0336f74bce374bb5ad163a249c6 Author: QuzarDC <qu...@co...> Date: Mon Apr 7 01:59:10 2025 -0400 Change kbd_queue_pop param to bool. Additionally adjust documentation to match and to remove some unclear language. commit edf52edd38e99921f644e60ba0a0f1f5e9cda7a8 Author: QuzarDC <qu...@co...> Date: Tue Apr 8 02:31:51 2025 -0400 Add kbd_set_repeat_timing, clean up repeating internals. The two loose static vars have been updated into a struct, and an accessor added to set the values. Additionally a small change was made so that if the repeat timing is set to 0 the timing is not pulled or tested at all. Previously, each poll would unnecessarily check the timer and store/test times. commit 3e4d1bb12cca8fb90b42f5f9405c199aca8a31e9 Author: QuzarDC <qu...@co...> Date: Mon Apr 7 01:00:02 2025 -0400 Add kbd_mods type, and update documentation for keyboard state. commit 5573c8eed2e1ecb2e82c6a984691dd9917227b5d Author: QuzarDC <qu...@co...> Date: Mon Apr 7 00:29:33 2025 -0400 Create define KBD_QUEUE_END. Replaces magic -1 for marking that there are no keys left in queue for kbd_queue_pop. commit 0c4a7d8d41f7d28513cdea12985752f47ee424ef Author: QuzarDC <qu...@co...> Date: Mon Apr 7 00:11:05 2025 -0400 Move kbd_key defines into enum from list of defines. The enum needs to be 'packed' so that its still just a byte in order to match the hardware data. commit 996b01f05386ff12bc4906f08d37dba386f71d33 Author: QuzarDC <qu...@co...> Date: Sun Apr 6 23:55:08 2025 -0400 Add kbd_input doxygen group. Enumerates and explains the two available methods for accessing keyboard data. commit 5d33e5ac74b59804d78305a355532e663164b8f3 Author: QuzarDC <qu...@co...> Date: Sun Apr 6 21:46:07 2025 -0400 Better handle unknown keyboard regions. Test against region = 0 which is also undefined, add debug output to note it, and clean up some spacing. commit 0b56ee924d97f9f5e1d6e1ae1b34da95f63faffd Author: QuzarDC <qu...@co...> Date: Sun Apr 6 21:16:44 2025 -0400 Add accessor for keyboard state. Useful for safely working with a kbd_state_t, no need to blindly cast from the generic maple state. Additionally add doxygen commentary for the usage of directly polling the kbd state. commit 33101bdfa56550c68d7d6e055b514d387d06df0c Author: QuzarDC <qu...@co...> Date: Sun Apr 6 20:34:38 2025 -0400 Move deprecated functions to end of header. commit b7df027e03cd329bf2341d48cec65d9931287c80 Author: QuzarDC <qu...@co...> Date: Sun Apr 6 14:35:50 2025 -0400 Update to stdint types. commit 43b0f9a01973c063c513f5efbc7b2ed7f0df4d67 Author: QuzarDC <qu...@co...> Date: Sun Apr 6 14:28:28 2025 -0400 Update kbd_leds defines and add a type. Clean up kbd_led defines with dox and macros. Add new type to access the data. Fill in all previously undefined bits. commit ef8308b1e5ecf26f8b24502eb1b2e04cfde321b4 Author: QuzarDC <qu...@co...> Date: Sun Apr 6 10:50:21 2025 -0400 Create enum type for keyboard regions. This transparently replaces the existing defines. commit aa5bbb791e7b37e0ee1dfaf53e8a16d15f4f6726 Author: QuzarDC <qu...@co...> Date: Sun Apr 6 09:54:14 2025 -0400 Rename MAX_KBD_KEYS define to KBD_MAX_KEYS. This is more in-line with our naming conventions to start with the system name. A compatibility const was added to help with updating. commit 3b354a4b4246ae154c3fc1c70846a6b04e1a5de7 Author: Paul Cercueil <pa...@cr...> Date: Sun Apr 6 11:38:00 2025 +0200 fs_vmu: Fix seeking in files with headers My recent change with VMU headers worked as long as applications did not try to use fs_seek(). The problem was then that the beginning of the file was set relative to the actual beginning, before the header, and not after the header. The fix is to consider that the cursor position is always relative to the start of the file, and the start of the file being the address after the file header, if there is one. Signed-off-by: Paul Cercueil <pa...@cr...> commit 80308bc44e30f0c92a05f7e8a4ac82c6e1a072b9 Author: Paul Cercueil <pa...@cr...> Date: Tue Dec 31 20:18:05 2024 +0100 examples: vmu_pkg: Set file header using new function Instead of writing the header to the file itself, use fs_vmu_set_header() to assignate the header to the file. Signed-off-by: Paul Cercueil <pa...@cr...> commit d286105ed5403ae0079043956a21e9c8dd643763 Author: Paul Cercueil <pa...@cr...> Date: Wed Jan 1 14:33:54 2025 +0100 fs_vmu: Allow opening raw file with O_META flag When the O_META flag is passed to fs_open(), the VMU file header will not be kept internally, and will be able to be read as regular data. Signed-off-by: Paul Cercueil <pa...@cr...> commit d665cdae34a4ae6bb2ef5ccd02c450e4077fb5f2 Author: Paul Cercueil <pa...@cr...> Date: Tue Dec 31 20:05:04 2024 +0100 fs_vmu: Improve handling of VMU file headers - Add function fs_vmu_set_header(). This function can be used to set a specific header (which contains the metadata, icons...) to an opened VMU file, replacing the one it previously had (if any). - Add function fs_vmu_set_default_header(). This function will set a default header, that will be used for new files which were not assignated their own header. The header is now skipped when opening a VMU file (that has a header), which is a breaking change from the previous behaviour of KallistiOS. It is however kept internally, which means that a file opened read-write will reuse its header (unless overwritten by fs_vmu_set_header()). The point of this change is to hide the header from the application completely, which can now read/write the VMU files with a proper header as if they were PC files. It is then much easier for PC ports to read/write savestates that look good. Signed-off-by: Paul Cercueil <pa...@cr...> commit 5ac08737d0d026e43254c3028e0d5829e0f14d4a Author: Paul Cercueil <pa...@cr...> Date: Tue Dec 31 19:09:50 2024 +0100 vmu_pkg: Add "data_size" param to vmu_pkg_parse() This allows vmu_pkg_parse() to work (aka. not crash) with buffers that do not contain a VMU header. Signed-off-by: Paul Cercueil <pa...@cr...> commit dca7f6d86be234b6488bd9d7e05aef0fa10f8d96 Author: Paul Cercueil <pa...@cr...> Date: Wed Apr 2 14:08:02 2025 +0200 pvr: Fix render-to-texture Render-to-texture was broken since the recent changes that decoupled the Tile Accelerator with the PVR rendering. This was because the code checked the "render to texture" flag on the back buffer, which made sense back then, but now the back and front buffers can be flipped in the middle of a scene draw. This did not show in KOS' example for RTT (examples/dreamcast/pvr/texture_render/), for the reason that the code there was rendering fast enough to reach 60 fps and be throttled by VSYNC. Address this issue by keeping track of RTT for the next frame (the one for which we're preparing a new scene), and the current frame (being processed by the TA or being rendered by the PVR CORE), without taking the "view target" into account. Signed-off-by: Paul Cercueil <pa...@cr...> commit fcae791265eee3fa3644316b3bbdb70563b4b290 Author: Paul Cercueil <pa...@cr...> Date: Sat Mar 29 19:25:22 2025 +0100 vmufb: Add function vmufb_screen_shot() This function can be used to save a screenshot of a VMU framebuffer into a PBM image. Signed-off-by: Paul Cercueil <pa...@cr...> commit 4934bfbae4cfeb45c7ed57a41f5feadf5d2a2c51 Author: Paul Cercueil <pa...@cr...> Date: Thu Mar 27 18:06:47 2025 +0100 math: Add mat_multiply() This function is similar to mat_apply(), except that it does not write the result matrix back to the internal matrix, but to a destination pointer in memory. Signed-off-by: Paul Cercueil <pa...@cr...> commit 78ec0f239d4d1cf7bb5eb6c3d7fde91d9aec05ea Author: Tchan0 <617...@us...> Date: Sun Mar 23 10:10:06 2025 +0100 pvr_list_prim(): avoid buffer overflow In pvr_list_prim(), the assert to check for buffer overflow is done too late, after a potential memory corruption commit 5685e822b02e49e80b1d3e46541686c8ce133b49 Author: Ross Kilgariff <ros...@gm...> Date: Sun Mar 23 15:51:07 2025 +0000 Remove GDROM reset syscall as it causes an issue with GDEMU clones where the subsequent CMD_INIT is ignored because it's sent while the drive is in the BUSY status commit 3a7cff13340b98ceeb153878147a5653fba82cdf Merge: 20279fc5 73b0c14a Author: Lawrence Sebald <ljs...@us...> Date: Tue Mar 18 00:08:10 2025 -0400 Merge pull request #952 from KallistiOS/arch_perf Remove non-arch perf counter use / fix `thd_pslist` times commit 20279fc53ad8e17f458fbb05c0c1cdd42fe0ab81 Merge: b1453c5f 0771070c Author: Lawrence Sebald <ljs...@us...> Date: Tue Mar 18 00:07:05 2025 -0400 Merge pull request #953 from KallistiOS/arch_include_fixes A set of small changes around better arch separation. commit 0771070cc741ff513d09ecefb92cf23a9c21e34c Author: QuzarDC <qu...@co...> Date: Sat Mar 8 02:08:52 2025 -0500 Add `kos/init_base.h` include to newlib_exit. It needs init_base for the init flag macros. Currently it gets them from <arch/arch.h> but the inclusion of `kos/init.h` there is marked as for compat only so other archs shouldn't need to. Also remove extraneous stdbool. commit 08a94a5cead642470d0185b6ec4eefb5a7695514 Author: QuzarDC <qu...@co...> Date: Sat Mar 8 02:14:51 2025 -0500 Reduce scope of <arch/wdt.h>. As we dont require it in the kernel, moving <arch/wdt.h> to be gated by `dreamcast`. This should likely be moved to be a <dc/wdt.h> driver that the <arch/timer.h> api can tap intom, rather than an arch-level interface requirement. commit 9da83b9007c3d4e0de1df08cd6d35984d4cababb Author: QuzarDC <qu...@co...> Date: Sat Mar 8 02:18:09 2025 -0500 Don't hardcode the arch of the cmake toolchain files. Open up the structure to easily allow other archs to be added. commit 73b0c14a9f64f1937f4ed207746dd89101897f89 Author: QuzarDC <qu...@co...> Date: Thu Mar 6 21:25:11 2025 -0500 Ensure precision and consistency of the thread list printout. A number of changes were made in order to ensure the total timing of the thread list cpu_times would always reach 100%. First, IRQs are disabled before taking the first time measurements. This is important as, without doing so we could context switch away and skew the percentages. This was happening randomly in the general threading test. Second, we get the total time `ns_time` only once at the start of the listing. Otherwise when checking it repeatedly it will naturally skew as it grows duing the process of printing. To match with this, we update the current thread's time just before reading it. The small amount of time between those two operations ends up factoring into the new [system] line item. Third, adding a new line item [system]. This tracks the difference between the total `cpu_time` recorded for each thread and the clock. This not only helps account for the small chunk of time mentioned before but all the time taken between the updating of one thread's time and the new schedule time of the next thread that starts. With basic operation should should mostly track just context switching time, but can be significant when we're doing something like genwaiting on multiple objects as we'll be repeatedly jumping out of the idle thread to update them. With these changes the total percentages should always add up to exactly 100% (permitting possible rounding error) while before they would vary wildly in situations with lots of waits and idle time. commit 2e18edca61a8357c5c149f14ddfa984b06b2817a Author: QuzarDC <qu...@co...> Date: Wed Mar 5 18:06:36 2025 -0500 Remove perfcounter usage from time tracking functions. There were a number of issues with the usage of perf counters here. The biggest was that it violates the arch interface into KOS by directly digging into a dreamcast-specific driver from the outer threading/libc support. The second is that it simply unnecessary. I don't see anything in the descriptions of the usage to indicate that this has merits over the standard ns timer used elsewhere, and the mere usage of a separate timer with different qualities means that it's more likely to have discrepancies with our general ns timer-backed things. The third is that it's not accurate. Due to not counting sleep time the performance counters horribly undercount the amount of time spent in the idle thread, so the total time percentage of a `thd_pslist` would rarely add up to 100%. The last is that doing so allows us to move forward with a better way to streamline a perfcounter based timer into the API. commit b1453c5fbd68c68a3e5bb0a3af9dc6b543a47182 Merge: f94e9a5b 58e06b91 Author: Lawrence Sebald <ljs...@us...> Date: Sun Mar 2 00:43:44 2025 -0500 Merge pull request #949 from darcagn/chainmakefile Update profiles listed in Makefile.default.cfg commit 58e06b91648b0dca27c6ae603aeffe5b2cb42ce8 Author: darc <da...@pr...> Date: Sat Mar 1 19:49:47 2025 -0600 Update profiles listed in Makefile.default.cfg ----------------------------------------------------------------------- Summary of changes: doc/Doxyfile | 3 +- examples/dreamcast/libdream/keyboard/keyboard.c | 65 ++- examples/dreamcast/vmu/vmu_pkg/vmu.c | 5 +- include/kos.h | 2 +- include/kos/cdefs.h | 5 + include/kos/thread.h | 41 +- kernel/arch/dreamcast/fs/fs_vmu.c | 148 ++++- kernel/arch/dreamcast/hardware/cdrom.c | 2 - kernel/arch/dreamcast/hardware/maple/keyboard.c | 217 ++++--- kernel/arch/dreamcast/hardware/pvr/pvr_internal.h | 26 +- kernel/arch/dreamcast/hardware/pvr/pvr_irq.c | 17 +- kernel/arch/dreamcast/hardware/pvr/pvr_misc.c | 10 +- kernel/arch/dreamcast/hardware/pvr/pvr_scene.c | 34 +- kernel/arch/dreamcast/include/arch/tls_static.h | 65 +++ kernel/arch/dreamcast/include/dc/fs_vmu.h | 59 ++ kernel/arch/dreamcast/include/dc/maple/keyboard.h | 664 +++++++++++++++------- kernel/arch/dreamcast/include/dc/matrix.h | 16 + kernel/arch/dreamcast/include/dc/vmu_fb.h | 11 + kernel/arch/dreamcast/include/dc/vmu_pkg.h | 5 +- kernel/arch/dreamcast/kernel/Makefile | 2 +- kernel/arch/dreamcast/kernel/tls_static.c | 131 +++++ kernel/arch/dreamcast/math/matrix.s | 72 +++ kernel/arch/dreamcast/util/vmu_fb.c | 24 + kernel/arch/dreamcast/util/vmu_pkg.c | 7 +- kernel/libc/newlib/newlib_exit.c | 2 +- kernel/libc/newlib/newlib_times.c | 8 +- kernel/libc/posix/clock_gettime.c | 21 +- kernel/thread/thread.c | 211 +++---- utils/build_wrappers/kos-ccmake | 2 +- utils/build_wrappers/kos-cmake | 2 +- utils/dc-chain/Makefile.default.cfg | 19 +- 31 files changed, 1306 insertions(+), 590 deletions(-) create mode 100644 kernel/arch/dreamcast/include/arch/tls_static.h create mode 100644 kernel/arch/dreamcast/kernel/tls_static.c diff --git a/doc/Doxyfile b/doc/Doxyfile index 74abf0bf..a6b8c9c1 100644 --- a/doc/Doxyfile +++ b/doc/Doxyfile @@ -2268,7 +2268,8 @@ PREDEFINED = _arch_$(KOS_ARCH)=1 \ __END_DECLS= \ __extension__= \ __packed__= \ - __attribute__(x)= + __attribute__(x)= \ + __depr # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this # tag can be used to specify a list of macro names that should be expanded. The diff --git a/examples/dreamcast/libdream/keyboard/keyboard.c b/examples/dreamcast/libdream/keyboard/keyboard.c index c020b432..2ff10b44 100644 --- a/examples/dreamcast/libdream/keyboard/keyboard.c +++ b/examples/dreamcast/libdream/keyboard/keyboard.c @@ -1,33 +1,34 @@ #include <kos.h> +#include <stdlib.h> + +/* Display constants */ +#define SCREEN_WIDTH 640 +#define SCREEN_HEIGHT 480 void kb_test(void) { maple_device_t *cont, *kbd; cont_state_t *state; - int k, x = 20, y = 20 + 24; + int k, x = 20, y = 20 + BFONT_HEIGHT; printf("Now doing keyboard test\n"); - while(1) { - cont = maple_enum_type(0, MAPLE_FUNC_CONTROLLER); + while(true) { + /* Query for the first detected controller */ + if((cont = maple_enum_type(0, MAPLE_FUNC_CONTROLLER))) { + /* Fetch controller button state structure. */ + state = maple_dev_status(cont); - if(!cont) continue; + /* Quit if start is pressed on the controller. */ + if(state->start) { + printf("Pressed start!\n"); + return; + } + } kbd = maple_enum_type(0, MAPLE_FUNC_KEYBOARD); if(!kbd) continue; - /* Check for start on the controller */ - state = (cont_state_t *)maple_dev_status(cont); - - if(!state) { - return; - } - - if(state->buttons & CONT_START) { - printf("Pressed start\n"); - return; - } - thd_sleep(10); /* Check for keyboard input */ @@ -36,23 +37,29 @@ void kb_test(void) { return; } */ - /* Get queued keys */ - while((k = kbd_queue_pop(kbd, 1)) != -1) { - if(k == 27) { + /* Keep popping keys while there are more enqueued. */ + while((k = kbd_queue_pop(kbd, true)) != KBD_QUEUE_END) { + /* Quit if ESC key is pressed. */ + if(k == '\e') { printf("ESC pressed\n"); return; } + /* Log when special keys are pressed. */ if(k > 0xff) printf("Special key %04x\n", k); - if(k != 13) { - bfont_draw(vram_s + y * 640 + x, 640, 0, k); - x += 12; + /* Handle every key that isn't the RETURN key. */ + if(k != '\r') { + /* Draw the key we just pressed. */ + bfont_draw(vram_s + y * SCREEN_WIDTH + x, SCREEN_WIDTH, 0, k); + + /* Advance the cursor horizontally. */ + x += BFONT_THIN_WIDTH; } else { x = 20; - y += 24; + y += BFONT_HEIGHT; } } @@ -63,15 +70,15 @@ void kb_test(void) { int main(int argc, char **argv) { int x, y; - for(y = 0; y < 480; y++) - for(x = 0; x < 640; x++) { + for(y = 0; y < SCREEN_HEIGHT; y++) + for(x = 0; x < SCREEN_WIDTH; x++) { int c = (x ^ y) & 255; - vram_s[y * 640 + x] = ((c >> 3) << 12) - | ((c >> 2) << 5) - | ((c >> 3) << 0); + vram_s[y * SCREEN_WIDTH + x] = ((c >> 3) << 12) + | ((c >> 2) << 5) + | ((c >> 3) << 0); } kb_test(); - return 0; + return EXIT_SUCCESS; } diff --git a/examples/dreamcast/vmu/vmu_pkg/vmu.c b/examples/dreamcast/vmu/vmu_pkg/vmu.c index 553ef9aa..2baa7979 100644 --- a/examples/dreamcast/vmu/vmu_pkg/vmu.c +++ b/examples/dreamcast/vmu/vmu_pkg/vmu.c @@ -98,8 +98,6 @@ void write_entry(void) { pkg.icon_data = vmu_icon; pkg.icon_anim_speed = 8; pkg.eyecatch_type = VMUPKG_EC_NONE; - pkg.data_len = 4096; - pkg.data = data; for(i = 0; i < 4096; i++) data[i] = i & 255; @@ -115,7 +113,8 @@ void write_entry(void) { return; } - fs_write(f, pkg_out, pkg_size); + fs_write(f, data, sizeof(data)); + fs_vmu_set_header(f, &pkg); fs_close(f); } diff --git a/include/kos.h b/include/kos.h index f2d48638..fbc7f41f 100644 --- a/include/kos.h +++ b/include/kos.h @@ -66,7 +66,6 @@ __BEGIN_DECLS #include <arch/irq.h> #include <arch/spinlock.h> #include <arch/timer.h> -#include <arch/wdt.h> #include <arch/types.h> #include <arch/exec.h> #include <arch/stack.h> @@ -77,6 +76,7 @@ __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> diff --git a/include/kos/cdefs.h b/include/kos/cdefs.h index 0aa77349..f042b524 100644 --- a/include/kos/cdefs.h +++ b/include/kos/cdefs.h @@ -66,6 +66,11 @@ #define __weak __attribute__((weak)) #endif +#ifndef __packed +/** \brief Force a structure, enum, or other type to be packed as small as possible. */ +#define __packed __attribute__((packed)) +#endif + #ifndef __dead2 /** \brief Alias for \ref __noreturn. For BSD compatibility. */ #define __dead2 __noreturn /* BSD compat */ diff --git a/include/kos/thread.h b/include/kos/thread.h index f78d5b81..bccc836f 100644 --- a/include/kos/thread.h +++ b/include/kos/thread.h @@ -149,16 +149,7 @@ typedef enum kthread_state { STATE_FINISHED = 0x0004 /**< \brief Finished execution */ } kthread_state_t; -/** \brief Thread Control Block Header - Header preceding the static TLS data segments as defined by - the SH-ELF TLS ABI (version 1). This is what the thread pointer - (GBR) points to for compiler access to thread-local data. -*/ -typedef struct tcbhead { - void *dtv; /**< \brief Dynamic TLS vector (unused) */ - uintptr_t pointer_guard; /**< \brief Pointer guard (unused) */ -} tcbhead_t; /** \brief Structure describing one running thread. @@ -260,7 +251,7 @@ typedef __attribute__((aligned(32))) struct kthread { struct kthread_tls_kv_list tls_list; /** \brief Compiler-level thread-local storage. */ - tcbhead_t* tcbhead; + void *tls_hnd; /** \brief Return value of the thread function. @@ -608,26 +599,28 @@ int *thd_get_errno(kthread_t *thd); */ struct _reent *thd_get_reent(kthread_t *thd); - /** \brief Retrieves the thread's elapsed CPU time \relatesalso kthread_t Returns the amount of active CPU time the thread has consumed in nanoseconds. - \warning - The implementation uses perf_cntr_timer_ns() internally when maintaining - this CPU time, so disabling or clearing the nanosecond timer will - interfere with this time keeping. - - \param thd The thead to retrieve the CPU time for + \param thd The thead to retrieve the CPU time for. - \retval Total utilized CPU time in nanoseconds OR - 0 if the nanosecond timer of the performance - counters has been disturbed. + \retval Total utilized CPU time in nanoseconds. */ uint64_t thd_get_cpu_time(kthread_t *thd); +/** \brief Retrieves all thread's elapsed CPU time + \relatesalso kthread_t + + Returns the amount of active CPU time all threads have consumed in + nanoseconds. + + \retval Total utilized CPU time in nanoseconds. +*/ +uint64_t thd_get_total_cpu_time(void); + /** \brief Change threading modes. This function changes the current threading mode of the system. @@ -729,6 +722,14 @@ int thd_each(int (*cb)(kthread_t *thd, void *user_data), void *data); /** \brief Print a list of all threads using the given print function. + Each thread is printed with its address, tid, priority level, flags, + it's wait timeout (if sleeping) the amount of cpu time usage in ns + (this includes time in IRQs), state, and name. + + In addition a '[system]' item is provided that represents time since + initialization not spent in a thread (context switching, updating + wait timeouts, etc). + \param pf The printf-like function to print with. \retval 0 On success. diff --git a/kernel/arch/dreamcast/fs/fs_vmu.c b/kernel/arch/dreamcast/fs/fs_vmu.c index ab45f449..e28eb49b 100644 --- a/kernel/arch/dreamcast/fs/fs_vmu.c +++ b/kernel/arch/dreamcast/fs/fs_vmu.c @@ -18,6 +18,7 @@ #include <dc/vmufs.h> #include <dc/maple.h> #include <dc/maple/vmu.h> +#include <dc/vmu_pkg.h> #include <sys/queue.h> /* @@ -56,10 +57,13 @@ typedef struct vmu_fh_str { int mode; /* mode the file was opened with */ char path[17]; /* full path of the file */ char name[13]; /* name of the file */ - off_t loc; /* current position in the file (bytes) */ + off_t loc; /* current position from the start in the file (bytes) */ + off_t start; /* start of the data in the file (bytes) */ maple_device_t *dev; /* maple address of the vmu to use */ uint32 filesize; /* file length from dirent (in 512-byte blks) */ uint8 *data; /* copy of the whole file */ + vmu_pkg_t *header; /* VMU file header */ + bool raw; /* file opened as raw */ } vmu_fh_t; /* Directory handles */ @@ -81,6 +85,50 @@ TAILQ_HEAD(vmu_fh_list, vmu_fh_str) vmu_fh; /* Thread mutex for vmu_fh access */ static mutex_t fh_mutex; +static vmu_pkg_t *dft_header; + +static vmu_pkg_t * vmu_pkg_dup(const vmu_pkg_t *old_hdr) { + size_t ec_size, icon_size; + vmu_pkg_t *hdr; + + hdr = malloc(sizeof(*hdr)); + if(!hdr) + return NULL; + + memcpy(hdr, old_hdr, sizeof(*hdr)); + + if(old_hdr->eyecatch_type && old_hdr->eyecatch_data) { + ec_size = (72 * 56 / 2) << (3 - old_hdr->eyecatch_type); + + hdr->eyecatch_data = malloc(ec_size); + if(!hdr->eyecatch_data) + goto err_free_hdr; + + memcpy(hdr->eyecatch_data, old_hdr->eyecatch_data, ec_size); + } else { + hdr->eyecatch_data = NULL; + } + + if(old_hdr->icon_cnt) { + icon_size = 512 * old_hdr->icon_cnt; + + hdr->icon_data = malloc(icon_size); + if(!hdr->icon_data) + goto err_free_ec_data; + + memcpy(hdr->icon_data, old_hdr->icon_data, icon_size); + } else { + hdr->icon_data = NULL; + } + + return hdr; + +err_free_ec_data: + free(hdr->eyecatch_data); +err_free_hdr: + free(hdr); + return NULL; +} /* Take a VMUFS path and return the requested address */ static maple_device_t * vmu_path_to_addr(const char *p) { @@ -182,6 +230,7 @@ static vmu_fh_t *vmu_open_file(maple_device_t * dev, const char *path, int mode) int realmode, rv; void * data; int datasize; + vmu_pkg_t vmu_pkg; /* Malloc a new fh struct */ if(!(fd = malloc(sizeof(vmu_fh_t)))) @@ -193,7 +242,10 @@ static vmu_fh_t *vmu_open_file(maple_device_t * dev, const char *path, int mode) strncpy(fd->path, path, 16); strncpy(fd->name, path + 4, 12); fd->loc = 0; + fd->start = 0; fd->dev = dev; + fd->header = NULL; + fd->raw = mode & O_META; /* What mode are we opening in? If we're reading or writing without O_TRUNC then we need to read the old file if there is one. */ @@ -228,6 +280,9 @@ static vmu_fh_t *vmu_open_file(maple_device_t * dev, const char *path, int mode) } datasize = 512; memset(data, 0, 512); + } else if(!fd->raw && !vmu_pkg_parse(data, datasize, &vmu_pkg)) { + fd->header = vmu_pkg_dup(&vmu_pkg); + fd->start = (unsigned int)vmu_pkg.data - (unsigned int)data; } fd->data = (uint8 *)data; @@ -308,10 +363,30 @@ static int vmu_verify_hnd(void * hnd, int type) { /* write a file out before closing it: we aren't perfect on error handling here */ static int vmu_write_close(void * hnd) { - vmu_fh_t *fh; + vmu_fh_t *fh = (vmu_fh_t*)hnd; + uint8_t *data = fh->data + fh->start; + int ret, data_len = fh->filesize * 512; + vmu_pkg_t *hdr = fh->header ?: dft_header; + + if(!fh->raw) { + if(!hdr) { + dbglog(DBG_WARNING, "VMUFS: file written without header\n"); + } else { + hdr->data_len = data_len; + hdr->data = data; + + ret = vmu_pkg_build(hdr, &data, &data_len); + if(ret < 0) + return ret; + } + } + + ret = vmufs_write(fh->dev, fh->name, data, data_len, VMUFS_OVERWRITE); + + if(hdr) + free(data); - fh = (vmu_fh_t*)hnd; - return vmufs_write(fh->dev, fh->name, fh->data, fh->filesize * 512, VMUFS_OVERWRITE); + return ret; } /* close a file */ @@ -349,6 +424,11 @@ static int vmu_close(void * hnd) { } } + if(fh->header) { + free(fh->header->eyecatch_data); + free(fh->header->icon_data); + free(fh->header); + } free(fh->data); break; @@ -386,7 +466,7 @@ static ssize_t vmu_read(void * hnd, void *buffer, size_t cnt) { return 0; /* Copy out the data */ - memcpy(buffer, fh->data + fh->loc, cnt); + memcpy(buffer, fh->data + fh->loc + fh->start, cnt); fh->loc += cnt; return cnt; @@ -409,9 +489,9 @@ static ssize_t vmu_write(void * hnd, const void *buffer, size_t cnt) { return -1; /* Check to make sure we have enough room in data */ - if(fh->loc + cnt > fh->filesize * 512) { + if(fh->loc + fh->start + cnt > fh->filesize * 512) { /* Figure out the new block count */ - n = ((fh->loc + cnt) - (fh->filesize * 512)); + n = ((fh->loc + fh->start + cnt) - (fh->filesize * 512)); if(n & 511) n = (n + 512) & ~511; @@ -441,7 +521,7 @@ static ssize_t vmu_write(void * hnd, const void *buffer, size_t cnt) { dbglog(DBG_KDEBUG, "VMUFS: adding %d bytes of data at loc %d (%d avail)\n", cnt, fh->loc, fh->filesize * 512); #endif - memcpy(fh->data + fh->loc, buffer, cnt); + memcpy(fh->data + fh->loc + fh->start, buffer, cnt); fh->loc += cnt; return cnt; @@ -458,7 +538,7 @@ static void *vmu_mmap(void * hnd) { fh = (vmu_fh_t *)hnd; - return fh->data; + return fh->data + fh->start; } /* Seek elsewhere in a file */ @@ -486,7 +566,8 @@ static off_t vmu_seek(void * hnd, off_t offset, int whence) { } /* Check bounds; allow seek past EOF. */ - if(offset < 0) offset = 0; + if(offset < 0) + offset = 0; fh->loc = offset; @@ -555,6 +636,45 @@ static dirent_t *vmu_readdir(void * fd) { return &dh->dirent; } ...<truncated>... hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: quzar <qu...@us...> - 2025-03-01 17:55:33
|
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 f94e9a5b4bb8cfc281fa00884bb04e3da510eb96 (commit) via c255d3e59d2d46f75b95b3020694c37765c1f531 (commit) via 69b70d414718de41e9241bcee4266d5103a161dc (commit) via 0b82f6d39dbc8941025684586caff6f12d460acf (commit) via d448dd4a093dbef9f9530c13696bf68703786cb0 (commit) via 90279816136a797b3334bb79102da6a810d3aa08 (commit) via a8076a56aa2ee6676e19f1982ca2684cb2dec3ee (commit) via 793cddbb360ce6a0f82ed460b88836663108a082 (commit) via 01de4c6948b09030515dfec77f314ccc8df4ce69 (commit) via 02c99c9a32f8af87a259e48b8bfab9626defd82d (commit) via 16185f57e2ba828df4899bb80f3d0f5036369ccf (commit) via 8bf3d94c8360e5e7cdabd3595860dac56036142f (commit) via 2d95f5e56465420273067d2d920e771d6d18c068 (commit) via 8f4221181e98eb643313c20d180dcdc04c43b82c (commit) via de6da59523e46b89f3ab193668c49de3d45b974c (commit) via f497f5fd8d530624a546ded8bccfedb087876d61 (commit) via 2bad2f3a523c95c5e24c6b88edde8b4d5628236d (commit) via a36ffe35979dd5cc140afe3b8dd51b892635fd1d (commit) via f6f50e2d886fb2b6a309625b30236bbedc29cb81 (commit) via 2c2e3d2606d2e844e936a41e4d780678a9f76504 (commit) via 36d53a3fc479dc6af9e0dcd11fac61aa56b1061d (commit) via 72021525d21e19571cebfcec5b3e46d326283df4 (commit) via 35bd5bc29636897f09eb6afd7dc48d6bf57d0b63 (commit) via c8887c60fec135d238622a25f50d5f46e6f226da (commit) via 19e98d7537d37abb0fe563a360e5564260fb383b (commit) via c34052a24c5fe8ad3ac68298c1f55d8f0be1b46e (commit) via d37fc9df97d7d50dcf559feffd22d4d535cc9c4d (commit) via 6900a5bfd775e9835a56e5c65c18a8c0372a15d0 (commit) via f57ea860c40e508d6d0b8884bf430382c2414b1f (commit) via 974133fd60dc8a90f0c3acb184118bf738d9039b (commit) via ac7e73ab95f72eafeeeae22ab66f246394d91c73 (commit) via b0d20e72c6ae74d3053c187fe2cee594c1f6ba4d (commit) via a7847b3e13449e22f9f60fe0fff2b629cbd417f7 (commit) via f07d0b17598d599a5c04fa7e9afecf8c1b081bd9 (commit) via 8c3148fb5c21ecdfeab02ad80fe10a621a48b84d (commit) via 071bc16df3d086a191fe25e3ee50498ac3dba77b (commit) via 588411cd0032385cf64a681bc3292379ae10e4ce (commit) via a560517a9968edd899c4e98daf8fca4bbb712495 (commit) via 086ef6f917123d93d6db95d61f4e05fb97c6cff7 (commit) from bad425592df5401515f296802a05ddfef1afe8b5 (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 f94e9a5b4bb8cfc281fa00884bb04e3da510eb96 Author: QuzarDC <qu...@co...> Date: Sun Feb 16 23:54:27 2025 -0500 Separate out pvr_misc API. Split from #539. Split out various misc global and stats functions matching `pvr_misc.c` commit c255d3e59d2d46f75b95b3020694c37765c1f531 Author: QuzarDC <qu...@co...> Date: Sun Feb 16 16:22:18 2025 -0500 Separate out pvr_mem API. Split from #539. Split out the pvr_mem API. This one has to be included at top of pvr.h as pvr_ptr_t is used throughout. commit 69b70d414718de41e9241bcee4266d5103a161dc Author: darc <da...@pr...> Date: Wed Feb 19 17:56:20 2025 -0600 Simplify toolchain profiles by deprecating older toolchain components Remove profiles and patches for older toolchains (9.3.0, 10.5.0, 11.5.0, 12.4.0) and Rust dev toolchains. Support for Newlib versions prior to 4.x now deprecated. commit 0b82f6d39dbc8941025684586caff6f12d460acf Author: Tchan0 <617...@us...> Date: Sun Feb 23 17:41:18 2025 +0100 fix Naomi build after PR 552 The Naomi has some different hardware connected to the Maple Bus (ie, the MIE), eg it will respond with a MAPLE_RESPONSE_BADCMD to a MAPLE_COMMAND_DEVINFO to A0. So the 'catch all' else in vbl_autodet_callback() must set scan_ready_mask, otherwise maple_wait_scan() in arch_auto_init() will wait endlessly commit d448dd4a093dbef9f9530c13696bf68703786cb0 Author: Tchan0 <617...@us...> Date: Sun Feb 23 17:39:03 2025 +0100 fix Naomi build after PR 734 PR 734 introduced a call to DC syscalls, not present on Naomi, making the Naomi programs crash commit 90279816136a797b3334bb79102da6a810d3aa08 Author: Daniel Roberts <ade...@gm...> Date: Sun Feb 23 21:16:21 2025 -0600 Fix Alpine dc-chain instructions commit a8076a56aa2ee6676e19f1982ca2684cb2dec3ee Author: DC-SWAT <sw...@21...> Date: Wed Feb 12 22:07:56 2025 +0700 cdrom: Improved work with G1 bus protection system. - Initiating BIOS checking only if needed. - Unlocking all memory on the Root Bus for G1 DMA transfers. commit 793cddbb360ce6a0f82ed460b88836663108a082 Author: DC-SWAT <sw...@21...> Date: Sat Feb 8 11:44:48 2025 +0700 g1ata: Added defines for the protection system on the G1 bus. commit 01de4c6948b09030515dfec77f314ccc8df4ce69 Author: Paul Cercueil <pa...@cr...> Date: Wed Feb 12 14:11:33 2025 +0100 Replace expanded attributes with their cdefs.h macro We have macros for the "noinline" and "deprecated" attributes, use them. Signed-off-by: Paul Cercueil <pa...@cr...> commit 02c99c9a32f8af87a259e48b8bfab9626defd82d Author: Paul Cercueil <pa...@cr...> Date: Wed Feb 12 14:09:15 2025 +0100 Remove pointless "packed" attributes None of these structures actually need to be packed, because none of them have gaps between their fields. This has been verified with static asserts for every single change. Signed-off-by: Paul Cercueil <pa...@cr...> commit 16185f57e2ba828df4899bb80f3d0f5036369ccf Author: QuzarDC <qu...@co...> Date: Sun Feb 16 12:31:52 2025 -0500 Correct erroneous resetting of output buffer in vmu_pkg_build. Regression from #907 commit 8bf3d94c8360e5e7cdabd3595860dac56036142f Author: DC-SWAT <sw...@21...> Date: Thu Feb 6 15:06:07 2025 +0700 isofs: Short-circuit the cache and use multi-sector reads if possible. Also fixed check for cdrom_read_sectors_ex() result. commit 2d95f5e56465420273067d2d920e771d6d18c068 Author: QuzarDC <qu...@co...> Date: Tue Feb 4 20:16:26 2025 -0500 Separate out pvr_txr API. Split from #539. Splits out the textures API. Additionally removed some tabs that snuck in. commit 8f4221181e98eb643313c20d180dcdc04c43b82c Author: QuzarDC <qu...@co...> Date: Tue Feb 4 20:06:38 2025 -0500 Separate out pvr_regs API. Split from #539. Split out the register defines. These had to go first in the list of included headers in pvr.h as pvr_pal.h references some. commit de6da59523e46b89f3ab193668c49de3d45b974c Author: QuzarDC <qu...@co...> Date: Tue Feb 4 19:48:29 2025 -0500 Separate out pvr_pal API. Split from #539. Split out the palette API. Also adjust doxygen for pvr_set_pal_format to properly mark the warning. commit f497f5fd8d530624a546ded8bccfedb087876d61 Author: QuzarDC <qu...@co...> Date: Tue Feb 4 19:29:27 2025 -0500 Separate out pvr_dma API. Split from #539. Split out the dma API from the main pvr.h. Moved the included subsystem headers to the bottom of the file and added a note. Additionally add parens where missing in doxygen for pvr_sq_set32. commit 2bad2f3a523c95c5e24c6b88edde8b4d5628236d Author: QuzarDC <qu...@co...> Date: Tue Feb 4 15:03:27 2025 -0500 Separate out pvr_fog API. Split from #539. Split out the fog API from the main pvr.h. Additionally adjust the formatting of the doxygen comments slightly (add backticks, remove brief tags, add \sa refs, etc). commit a36ffe35979dd5cc140afe3b8dd51b892635fd1d Author: QuzarDC <qu...@co...> Date: Fri Feb 7 20:59:01 2025 -0500 Replace memalign with C11 standard alligned_alloc. commit f6f50e2d886fb2b6a309625b30236bbedc29cb81 Author: QuzarDC <qu...@co...> Date: Fri Feb 7 20:01:55 2025 -0500 Remove inclusions of non-standard malloc.h We've blindly used malloc.h for some time when the appropriate include is just stdlib.h. This switches most uses in the codebase. commit 2c2e3d2606d2e844e936a41e4d780678a9f76504 Author: QuzarDC <qu...@co...> Date: Sat Feb 1 00:21:54 2025 -0500 Validate inputs, OOM, and cleanup in vmu_pkg. commit 36d53a3fc479dc6af9e0dcd11fac61aa56b1061d Author: Paul Cercueil <pa...@cr...> Date: Tue Jan 28 15:14:10 2025 +0100 cache: Fix non-working dcache_{flush,purge}_all() The algorithm of dcache_flush_all() and dcache_purge_all() were sometimes exhibiting problems under unidentified conditions, in which case some cache lines were not written back properly to RAM. This caused all kind of memory corruption problems, when the PVR DMA was used for transfers with a size above the threshold at which the "dcache_flush_all()" function is called. Fix these functions by accessing the cache address array using association. Since the underlying problem is not fully understood, the fix is not fully understood either, but it was reported as fixing the memory corruption in Doom64. Fixes #928. Signed-off-by: Paul Cercueil <pa...@cr...> commit 72021525d21e19571cebfcec5b3e46d326283df4 Author: DC-SWAT <sw...@21...> Date: Sat Feb 8 12:20:09 2025 +0700 asic: Add ability to set a chain of handlers for IRQ's. commit 35bd5bc29636897f09eb6afd7dc48d6bf57d0b63 Merge: c8887c60 c34052a2 Author: Lawrence Sebald <ljs...@us...> Date: Thu Feb 6 22:42:48 2025 -0500 Merge pull request #911 from KallistiOS/ansi_cleanups Ansi cleanups commit c8887c60fec135d238622a25f50d5f46e6f226da Merge: 19e98d75 b0d20e72 Author: Donald Haase <qu...@ya...> Date: Wed Feb 5 18:13:24 2025 -0500 Merge pull request #932 from KallistiOS/shrink_pcaps Right-size the pcaps buffer. commit 19e98d7537d37abb0fe563a360e5564260fb383b Merge: 6900a5bf 974133fd Author: Donald Haase <qu...@ya...> Date: Wed Feb 5 18:13:02 2025 -0500 Merge pull request #804 from KallistiOS/revalidate_maple Persist allocated `maple_device_t`s commit c34052a24c5fe8ad3ac68298c1f55d8f0be1b46e Author: QuzarDC <qu...@co...> Date: Sat Jan 25 16:56:31 2025 -0500 Clean up stray C++ style comments. We use ISO C style almost everywhere else. commit d37fc9df97d7d50dcf559feffd22d4d535cc9c4d Author: QuzarDC <qu...@co...> Date: Sat Jan 25 16:57:36 2025 -0500 Clean up C++ style comments in sys includes. commit 6900a5bfd775e9835a56e5c65c18a8c0372a15d0 Merge: f57ea860 ac7e73ab Author: Lawrence Sebald <ljs...@us...> Date: Tue Feb 4 15:43:42 2025 -0500 Merge pull request #933 from KallistiOS/dump_b_types Remove redefined 'BSD-style' types. commit f57ea860c40e508d6d0b8884bf430382c2414b1f Merge: bad42559 071bc16d Author: Lawrence Sebald <ljs...@us...> Date: Tue Feb 4 15:42:42 2025 -0500 Merge pull request #873 from pcercuei/ico-loader vmu_pkg: Add function to load VMU icons from .ico files commit 974133fd60dc8a90f0c3acb184118bf738d9039b Author: QuzarDC <qu...@co...> Date: Sat Nov 16 03:53:40 2024 -0500 Adjust rumble example to rely again on dev->valid. * Remove workarounds for the removal of dev->valid. * Correct comment as dev->valid is now bool. * Correct bug that would allow null deref commit ac7e73ab95f72eafeeeae22ab66f246394d91c73 Author: QuzarDC <qu...@co...> Date: Mon Feb 3 01:36:31 2025 -0500 Remove redefined 'BSD-style' types. This should help reduce the possible impact of #840 which describes how types defined in this file escape out and can conflict with other codebases. This is in-line with our general move to stdint types and, as far as I can tell, there was only one use of these types in the codebase. commit b0d20e72c6ae74d3053c187fe2cee594c1f6ba4d Author: QuzarDC <qu...@co...> Date: Sun Feb 2 03:07:53 2025 -0500 Right-size the pcaps buffer. There's no reason for it to be 1kb static. The largest we currently ever return is 36. commit a7847b3e13449e22f9f60fe0fff2b629cbd417f7 Author: QuzarDC <qu...@co...> Date: Sat Jan 25 16:54:40 2025 -0500 Clean up comments and 'usleep' in libnavi. Brings it all more inline with the rest of the codebase's style and usages. commit f07d0b17598d599a5c04fa7e9afecf8c1b081bd9 Author: QuzarDC <qu...@co...> Date: Fri Jan 24 10:20:24 2025 -0500 Forward declare strnlen which is missing in strict ansi. To match patching like is seen in gethostbyname.c and others. It might make sense to just relegate these into cdefs or just no longer care about -ansi. commit 8c3148fb5c21ecdfeab02ad80fe10a621a48b84d Author: QuzarDC <qu...@co...> Date: Sat Nov 16 03:39:50 2024 -0500 Persist allocated maple_device_t's (#804) * #552 had the unintended impact of breaking usage that relied on maple_device_ts being static and preallocated. * Adjust the dynamically allocated dev structures to persist in the global table. This prevents use-after-frees that had not been possible with static devices. * Restore the maple_device_t->valid member with the same purpose it previously had of noting if an allocated dev is valid or not. * Adjust autodetection to use the device's frame for allocated devices. commit 071bc16df3d086a191fe25e3ee50498ac3dba77b Author: Paul Cercueil <pa...@cr...> Date: Fri Jan 3 21:59:26 2025 +0100 examples: vmu_pkg: Be a bit more explicit about icon size Signed-off-by: Paul Cercueil <pa...@cr...> commit 588411cd0032385cf64a681bc3292379ae10e4ce Author: Paul Cercueil <pa...@cr...> Date: Fri Jan 3 21:51:58 2025 +0100 Whitespace fixes No functional changes intended. Co-authored-by: Lawrence Sebald <ljs...@us...> Signed-off-by: Paul Cercueil <pa...@cr...> commit a560517a9968edd899c4e98daf8fca4bbb712495 Author: Paul Cercueil <pa...@cr...> Date: Mon Dec 23 14:08:18 2024 +0100 examples: vmu_pkg: Add an icon to the save file Use the function vmu_pkg_load_icon() to add an icon to the save file. The provided icon was drawn by myself. Signed-off-by: Paul Cercueil <pa...@cr...> commit 086ef6f917123d93d6db95d61f4e05fb97c6cff7 Author: Paul Cercueil <pa...@cr...> Date: Sun Dec 22 19:36:12 2024 +0100 vmu_pkg: Add function to load VMU icons from .ico files Add the function vmu_pkg_load_icon(), which can load a VMU save icon from a .ico file. Icon files must be in the ICO file format, be 32x32 in size, contain a bitmap (no PNG or compressed BMP), and use paletted 4bpp. They can contain more than one frame, and they can use up to 16 colors if transparency is not used, or 15 colors otherwise. Finally, all frames must use the same palette. This function assumes that the vmu_pkg_t has been properly initialized; in particular, the .icon_cnt must be set, and the .icon_data must point to a valid buffer (of 512 bytes per frame). If the .ico file contains more frames than requested, only the first ones are loaded. If it contains less frames than requested, the .icon_cnt field will be updated to the new frame count. Signed-off-by: Paul Cercueil <pa...@cr...> ----------------------------------------------------------------------- Summary of changes: addons/libkosutils/img.c | 2 +- addons/libnavi/navi_flash.c | 3 +- addons/libnavi/navi_ide.c | 21 +- examples/dreamcast/conio/wump/wump.c | 2 +- .../dreamcast/kgl/basic/elements/gl-elements.c | 1 - .../dreamcast/kgl/basic/zclip_arrays/gl-arrays.c | 1 - examples/dreamcast/kgl/demos/specular/font.c | 2 +- examples/dreamcast/parallax/serpent_dma/serpent.c | 2 +- examples/dreamcast/pvr/plasma/plasma.c | 2 +- .../dreamcast/pvr/yuv_converter/YUV420/yuv420.c | 8 +- .../dreamcast/pvr/yuv_converter/YUV422/yuv422.c | 8 +- examples/dreamcast/rumble/rumble.c | 14 +- examples/dreamcast/vmu/vmu_pkg/Makefile | 6 +- examples/dreamcast/vmu/vmu_pkg/romdisk/ebook.ico | Bin 0 -> 1526 bytes examples/dreamcast/vmu/vmu_pkg/vmu.c | 13 +- include/kos/net.h | 13 +- include/sys/_pthread.h | 2 +- include/sys/_types.h | 2 +- include/sys/lock.h | 3 +- kernel/arch/dreamcast/fs/fs_dcload.c | 2 +- kernel/arch/dreamcast/fs/fs_dclsocket.c | 8 +- kernel/arch/dreamcast/fs/fs_iso9660.c | 51 +- kernel/arch/dreamcast/fs/fs_vmu.c | 3 +- kernel/arch/dreamcast/fs/vmufs.c | 3 +- kernel/arch/dreamcast/hardware/asic.c | 10 +- kernel/arch/dreamcast/hardware/cdrom.c | 68 +- .../arch/dreamcast/hardware/maple/maple_driver.c | 85 +- kernel/arch/dreamcast/hardware/maple/maple_enum.c | 11 +- .../dreamcast/hardware/maple/maple_init_shutdown.c | 21 +- kernel/arch/dreamcast/hardware/maple/maple_irq.c | 20 +- kernel/arch/dreamcast/hardware/maple/maple_utils.c | 2 +- kernel/arch/dreamcast/hardware/sq.c | 2 +- kernel/arch/dreamcast/hardware/vblank.c | 2 +- kernel/arch/dreamcast/include/arch/types.h | 25 - kernel/arch/dreamcast/include/dc/asic.h | 10 +- kernel/arch/dreamcast/include/dc/g1ata.h | 57 +- kernel/arch/dreamcast/include/dc/maple.h | 5 +- kernel/arch/dreamcast/include/dc/maple/keyboard.h | 4 +- kernel/arch/dreamcast/include/dc/pvr.h | 902 +-------------------- kernel/arch/dreamcast/include/dc/pvr/pvr_dma.h | 260 ++++++ kernel/arch/dreamcast/include/dc/pvr/pvr_fog.h | 133 +++ kernel/arch/dreamcast/include/dc/pvr/pvr_mem.h | 110 +++ kernel/arch/dreamcast/include/dc/pvr/pvr_misc.h | 185 +++++ kernel/arch/dreamcast/include/dc/pvr/pvr_pal.h | 91 +++ kernel/arch/dreamcast/include/dc/pvr/pvr_regs.h | 213 +++++ kernel/arch/dreamcast/include/dc/pvr/pvr_txr.h | 134 +++ kernel/arch/dreamcast/include/dc/scif.h | 2 +- kernel/arch/dreamcast/include/dc/video.h | 24 +- kernel/arch/dreamcast/include/dc/vmu_pkg.h | 72 +- kernel/arch/dreamcast/include/dc/vmufs.h | 11 +- kernel/arch/dreamcast/kernel/cache.s | 2 +- kernel/arch/dreamcast/kernel/init.c | 3 +- kernel/arch/dreamcast/kernel/mmu.c | 2 +- kernel/arch/dreamcast/kernel/panic.c | 1 - kernel/arch/dreamcast/sound/snd_sfxmgr.c | 27 +- kernel/arch/dreamcast/sound/snd_stream.c | 3 +- kernel/arch/dreamcast/util/vmu_pkg.c | 222 ++++- kernel/exports/library.c | 2 +- kernel/exports/nmmgr.c | 3 +- kernel/fs/elf.c | 5 +- kernel/fs/fs.c | 2 +- kernel/fs/fs_dev.c | 2 +- kernel/fs/fs_null.c | 3 +- kernel/fs/fs_pty.c | 2 +- kernel/fs/fs_ramdisk.c | 2 +- kernel/fs/fs_random.c | 3 +- kernel/fs/fs_romdisk.c | 2 +- kernel/fs/fs_socket.c | 3 +- kernel/fs/fs_utils.c | 2 +- kernel/libc/koslib/readdir.c | 7 + kernel/mm/cplusplus.c | 2 +- kernel/net/net_arp.c | 7 +- kernel/net/net_core.c | 3 +- kernel/net/net_dhcp.h | 2 +- kernel/net/net_icmp.c | 4 +- kernel/net/net_icmp.h | 4 +- kernel/net/net_icmp6.h | 34 +- kernel/net/net_ipv4.h | 6 +- kernel/net/net_ipv6.h | 12 +- kernel/net/net_tcp.c | 2 +- kernel/net/net_udp.c | 10 +- kernel/thread/genwait.c | 1 - kernel/thread/sem.c | 2 +- kernel/thread/thread.c | 4 +- utils/dc-chain/Makefile.default.cfg | 11 +- utils/dc-chain/README.md | 6 - utils/dc-chain/doc/CHANGELOG.md | 1 + utils/dc-chain/doc/alpine.md | 4 +- utils/dc-chain/patches/gcc-rs-fix.diff | 25 - utils/dc-chain/patches/gcc-rs-kos.diff | 162 ---- utils/dc-chain/patches/gcc-rustc-kos.diff | 162 ---- .../patches/{ => historical}/gcc-10.5.0-kos.diff | 0 .../patches/{ => historical}/gcc-11.5.0-kos.diff | 0 .../patches/{ => historical}/gcc-12.4.0-kos.diff | 0 .../patches/{ => historical}/gcc-13.1.0-kos.diff | 0 .../patches/{ => historical}/gcc-9.3.0-kos.diff | 0 .../patches/{ => historical}/newlib-3.3.0-kos.diff | 0 utils/dc-chain/profiles/profile.10.5.0.mk | 35 - utils/dc-chain/profiles/profile.11.5.0.mk | 35 - utils/dc-chain/profiles/profile.12.4.0.mk | 35 - utils/dc-chain/profiles/profile.9.3.0-legacy.mk | 35 - utils/dc-chain/profiles/profile.gccrs-dev.mk | 47 -- utils/dc-chain/profiles/profile.rustc-dev.mk | 47 -- 103 files changed, 1796 insertions(+), 1831 deletions(-) create mode 100644 examples/dreamcast/vmu/vmu_pkg/romdisk/ebook.ico create mode 100644 kernel/arch/dreamcast/include/dc/pvr/pvr_dma.h create mode 100644 kernel/arch/dreamcast/include/dc/pvr/pvr_fog.h create mode 100644 kernel/arch/dreamcast/include/dc/pvr/pvr_mem.h create mode 100644 kernel/arch/dreamcast/include/dc/pvr/pvr_misc.h create mode 100644 kernel/arch/dreamcast/include/dc/pvr/pvr_pal.h create mode 100644 kernel/arch/dreamcast/include/dc/pvr/pvr_regs.h create mode 100644 kernel/arch/dreamcast/include/dc/pvr/pvr_txr.h delete mode 100644 utils/dc-chain/patches/gcc-rs-fix.diff delete mode 100644 utils/dc-chain/patches/gcc-rs-kos.diff delete mode 100644 utils/dc-chain/patches/gcc-rustc-kos.diff rename utils/dc-chain/patches/{ => historical}/gcc-10.5.0-kos.diff (100%) rename utils/dc-chain/patches/{ => historical}/gcc-11.5.0-kos.diff (100%) rename utils/dc-chain/patches/{ => historical}/gcc-12.4.0-kos.diff (100%) rename utils/dc-chain/patches/{ => historical}/gcc-13.1.0-kos.diff (100%) rename utils/dc-chain/patches/{ => historical}/gcc-9.3.0-kos.diff (100%) rename utils/dc-chain/patches/{ => historical}/newlib-3.3.0-kos.diff (100%) delete mode 100644 utils/dc-chain/profiles/profile.10.5.0.mk delete mode 100644 utils/dc-chain/profiles/profile.11.5.0.mk delete mode 100644 utils/dc-chain/profiles/profile.12.4.0.mk delete mode 100644 utils/dc-chain/profiles/profile.9.3.0-legacy.mk delete mode 100644 utils/dc-chain/profiles/profile.gccrs-dev.mk delete mode 100644 utils/dc-chain/profiles/profile.rustc-dev.mk diff --git a/addons/libkosutils/img.c b/addons/libkosutils/img.c index 0fc72f52..3e4ad38d 100644 --- a/addons/libkosutils/img.c +++ b/addons/libkosutils/img.c @@ -6,8 +6,8 @@ Platform independent image handling */ -#include <malloc.h> #include <assert.h> +#include <stdlib.h> #include <kos/img.h> /* Free a kos_img_t which was created by an image loader; set struct_also to non-zero diff --git a/addons/libnavi/navi_flash.c b/addons/libnavi/navi_flash.c index 16854ea1..dd00a72c 100644 --- a/addons/libnavi/navi_flash.c +++ b/addons/libnavi/navi_flash.c @@ -9,6 +9,7 @@ #include <assert.h> #include <stdio.h> #include <navi/flash.h> +#include <kos/thread.h> /* @@ -105,7 +106,7 @@ static int nvflash_wait_ready(uint32 addr, int timeout) { while(timeout-- && nvflash_busy(addr)) { if(wait) - usleep(1000); + thd_sleep(1); } if(timeout <= 0) { diff --git a/addons/libnavi/navi_ide.c b/addons/libnavi/navi_ide.c index e540754b..fff802e9 100644 --- a/addons/libnavi/navi_ide.c +++ b/addons/libnavi/navi_ide.c @@ -10,6 +10,7 @@ #include <stdio.h> #include <navi/ide.h> #include <dc/g2bus.h> +#include <kos/thread.h> /* A *very* simple port-level ATA-IDE device driver. This was ported up @@ -36,7 +37,7 @@ static void ide_outp(int port, uint16 value, int size) { return; } - //printf("ide_outp %02x -> %04x(%08x)\n", value, port, addr); + /* printf("ide_outp %02x -> %04x(%08x)\n", value, port, addr); */ g2_write_16(addr, value); } @@ -76,7 +77,7 @@ static void wait_controller(void) { int timeout = 1000; while((inp(0x1f7) & 0x80) && timeout) { - usleep(1 * 1000); + thd_sleep(1); timeout--; } @@ -90,7 +91,7 @@ static void wait_data(void) { int timeout = 1000; while(!(inp(0x1f7) & 0x08) && timeout) { - usleep(1 * 1000); + thd_sleep(1); timeout--; } @@ -112,7 +113,7 @@ static char *get_ascii(uint16 *in_data, uint32 off_start, uint32 off_end) { ret_val [loop1++] = (char)(in_data [loop] % 256); /* Get Low byte */ } - // Now, go back and eliminate the blank spaces + /* Now, go back and eliminate the blank spaces */ for(; (ret_val[loop1] < 'A' || ret_val[loop1] > 'z') && loop1 >= 0 ; loop1--) ret_val[loop1] = '\0'; @@ -124,8 +125,8 @@ static int ide_read_chs(uint32 cyl, uint32 head, uint32 sector, uint32 numsects, int o; uint16 *bufptr16 = (uint16*)bufptr; - //printf("reading C/H/S/Cnt %d/%d/%d/%d\n", - // cyl, head, sector, numsects); + /** printf("reading C/H/S/Cnt %d/%d/%d/%d\n", + cyl, head, sector, numsects); */ wait_controller(); /* wait for controller to be not busy */ @@ -158,8 +159,8 @@ static int ide_write_chs(uint32 cyl, uint32 head, uint32 sector, uint32 numsects int o; uint16 *bufptr16 = (uint16*)bufptr; - //printf("writing C/H/S/Cnt %d/%d/%d/%d\n", - // cyl, head, sector, numsects); + /** printf("writing C/H/S/Cnt %d/%d/%d/%d\n", + cyl, head, sector, numsects); */ wait_controller(); /* wait for controller to be not busy */ @@ -248,9 +249,9 @@ int ide_init(void) { /* Reset */ outp(0x3f6, 0x0e); - usleep(10 * 1000); + thd_sleep(10); outp(0x3f6, 0x0a); - usleep(10 * 1000); + thd_sleep(10); wait_controller(); outp(0x1f6, 0xa0); /* get info on first drive. 0xb0 == 2nd */ diff --git a/examples/dreamcast/conio/wump/wump.c b/examples/dreamcast/conio/wump/wump.c index 9881aa3b..53d26d7e 100644 --- a/examples/dreamcast/conio/wump/wump.c +++ b/examples/dreamcast/conio/wump/wump.c @@ -652,7 +652,7 @@ cave_init() { * make it easier on the intrepid adventurer. */ for(i = 1; i <= room_num; ++i) - qsort(cave[i].tunnel, (u_int)link_num, + qsort(cave[i].tunnel, link_num, sizeof(cave[i].tunnel[0]), int_compare); #ifdef DEBUG diff --git a/examples/dreamcast/kgl/basic/elements/gl-elements.c b/examples/dreamcast/kgl/basic/elements/gl-elements.c index 513358b7..54212b66 100644 --- a/examples/dreamcast/kgl/basic/elements/gl-elements.c +++ b/examples/dreamcast/kgl/basic/elements/gl-elements.c @@ -9,7 +9,6 @@ #include <stdio.h> #include <stdlib.h> -#include <malloc.h> #include <KGL/gl.h> #include <KGL/glu.h> diff --git a/examples/dreamcast/kgl/basic/zclip_arrays/gl-arrays.c b/examples/dreamcast/kgl/basic/zclip_arrays/gl-arrays.c index 3d0ef7e4..346582b8 100644 --- a/examples/dreamcast/kgl/basic/zclip_arrays/gl-arrays.c +++ b/examples/dreamcast/kgl/basic/zclip_arrays/gl-arrays.c @@ -9,7 +9,6 @@ #include <stdio.h> #include <stdlib.h> -#include <malloc.h> #include <KGL/gl.h> #include <KGL/glu.h> diff --git a/examples/dreamcast/kgl/demos/specular/font.c b/examples/dreamcast/kgl/demos/specular/font.c index 6490d9ec..97bcdfe6 100644 --- a/examples/dreamcast/kgl/demos/specular/font.c +++ b/examples/dreamcast/kgl/demos/specular/font.c @@ -7,8 +7,8 @@ DC Font Render Routine using GL and KOS (C) Josh PH3NOM Pearson 2013 */ -#include <malloc.h> #include <stdio.h> +#include <stdlib.h> #include <KGL/gl.h> diff --git a/examples/dreamcast/parallax/serpent_dma/serpent.c b/examples/dreamcast/parallax/serpent_dma/serpent.c index 11c3924c..bdb51aa1 100644 --- a/examples/dreamcast/parallax/serpent_dma/serpent.c +++ b/examples/dreamcast/parallax/serpent_dma/serpent.c @@ -54,7 +54,7 @@ static void sphere(sphere_t *s) { /* {{{ */ float yaw; pvr_vertex_t *v; - s->data = (pvr_vertex_t *)memalign(32, s->stacks * (s->slices + 2) * sizeof(pvr_vertex_t)); + s->data = (pvr_vertex_t *)aligned_alloc(32, s->stacks * (s->slices + 2) * sizeof(pvr_vertex_t)); if(s->data == NULL) return; v = s->data; diff --git a/examples/dreamcast/pvr/plasma/plasma.c b/examples/dreamcast/pvr/plasma/plasma.c index d4f43bd7..958c8f10 100644 --- a/examples/dreamcast/pvr/plasma/plasma.c +++ b/examples/dreamcast/pvr/plasma/plasma.c @@ -125,7 +125,7 @@ void pvr_setup(void) { for(i = 0; i < 2; i++) { txr[i] = pvr_mem_malloc(64 * 64 * 2); memset(txr[i], 0, 64 * 64 * 2); - txr_buf[i] = memalign(32, 64 * 64 * 2); + txr_buf[i] = aligned_alloc(32, 64 * 64 * 2); pvr_poly_cxt_txr(&cxt, PVR_LIST_OP_POLY, PVR_TXRFMT_RGB565, 64, 64, txr[i], PVR_FILTER_BILINEAR); pvr_poly_compile(&hdr[i], &cxt); diff --git a/examples/dreamcast/pvr/yuv_converter/YUV420/yuv420.c b/examples/dreamcast/pvr/yuv_converter/YUV420/yuv420.c index da414647..2536222f 100644 --- a/examples/dreamcast/pvr/yuv_converter/YUV420/yuv420.c +++ b/examples/dreamcast/pvr/yuv_converter/YUV420/yuv420.c @@ -35,7 +35,7 @@ */ #include <stdio.h> -#include <malloc.h> +#include <stdlib.h> #include <arch/arch.h> #include <arch/cache.h> @@ -71,9 +71,9 @@ static int load_image(void) { goto error; } - y_plane = memalign(32, FRAME_TEXTURE_WIDTH * FRAME_TEXTURE_HEIGHT); - u_plane = memalign(32, FRAME_TEXTURE_WIDTH * FRAME_TEXTURE_HEIGHT / 4); - v_plane = memalign(32, FRAME_TEXTURE_WIDTH * FRAME_TEXTURE_HEIGHT / 4); + y_plane = aligned_alloc(32, FRAME_TEXTURE_WIDTH * FRAME_TEXTURE_HEIGHT); + u_plane = aligned_alloc(32, FRAME_TEXTURE_WIDTH * FRAME_TEXTURE_HEIGHT / 4); + v_plane = aligned_alloc(32, FRAME_TEXTURE_WIDTH * FRAME_TEXTURE_HEIGHT / 4); if(!y_plane || !u_plane || !v_plane) { printf("Could not allocate memory for y,u, or v plane\n"); diff --git a/examples/dreamcast/pvr/yuv_converter/YUV422/yuv422.c b/examples/dreamcast/pvr/yuv_converter/YUV422/yuv422.c index a1bd8036..5b666bc8 100644 --- a/examples/dreamcast/pvr/yuv_converter/YUV422/yuv422.c +++ b/examples/dreamcast/pvr/yuv_converter/YUV422/yuv422.c @@ -35,7 +35,7 @@ */ #include <stdio.h> -#include <malloc.h> +#include <stdlib.h> #include <arch/arch.h> #include <arch/cache.h> @@ -71,9 +71,9 @@ static int load_image(void) { goto error; } - y_plane = memalign(32, FRAME_TEXTURE_WIDTH * FRAME_TEXTURE_HEIGHT); - u_plane = memalign(32, FRAME_TEXTURE_WIDTH * FRAME_TEXTURE_HEIGHT / 2); - v_plane = memalign(32, FRAME_TEXTURE_WIDTH * FRAME_TEXTURE_HEIGHT / 2); + y_plane = aligned_alloc(32, FRAME_TEXTURE_WIDTH * FRAME_TEXTURE_HEIGHT); + u_plane = aligned_alloc(32, FRAME_TEXTURE_WIDTH * FRAME_TEXTURE_HEIGHT / 2); + v_plane = aligned_alloc(32, FRAME_TEXTURE_WIDTH * FRAME_TEXTURE_HEIGHT / 2); if(!y_plane || !u_plane || !v_plane) { printf("Could not allocate memory for y,u, or v plane\n"); diff --git a/examples/dreamcast/rumble/rumble.c b/examples/dreamcast/rumble/rumble.c index 2cb80e79..521b8452 100644 --- a/examples/dreamcast/rumble/rumble.c +++ b/examples/dreamcast/rumble/rumble.c @@ -157,9 +157,10 @@ void wait_for_dev_attach(maple_device_t **dev_ptr, unsigned int func) { point_t w = {40.0f, 200.0f, 10.0f, 0.0f}; /* If we already have it, and it's still valid, leave */ - /* dev->valid is set to 0 by the driver if the device + /* dev->valid is set to false by the driver if the device is detached, but dev will stay not-null */ - if((dev != NULL) && (maple_dev_valid(dev->port, dev->unit) != 0)) return; + if((dev != NULL) && dev->valid) + return; /* Draw up a screen */ pvr_wait_ready(); @@ -178,7 +179,7 @@ void wait_for_dev_attach(maple_device_t **dev_ptr, unsigned int func) { pvr_scene_finish(); /* Repeatedly check until we find one and it's valid */ - while((dev == NULL) || (maple_dev_valid(dev->port, dev->unit) == 0)) { + while((dev == NULL) || !dev->valid) { *dev_ptr = maple_enum_type(0, func); dev = *dev_ptr; usleep(50); @@ -269,6 +270,11 @@ int main(int argc, char *argv[]) { /* Store current button states + buttons which have been released. */ state = (cont_state_t *)maple_dev_status(contdev); + + /* Make sure we can rely on the state, otherwise loop. */ + if(state == NULL) + continue; + rel_buttons = (old_buttons ^ state->buttons); if((state->buttons & CONT_DPAD_LEFT) && (rel_buttons & CONT_DPAD_LEFT)) { @@ -347,7 +353,7 @@ int main(int argc, char *argv[]) { } /* Stop rumbling before exiting, if it still exists. */ - if((purudev != NULL) && (maple_dev_valid(purudev->port, purudev->unit) != 0)) + if((purudev != NULL) && purudev->valid) purupuru_rumble_raw(purudev, 0x00000000); plx_font_destroy(fnt); diff --git a/examples/dreamcast/vmu/vmu_pkg/Makefile b/examples/dreamcast/vmu/vmu_pkg/Makefile index d1c16bb0..55f247b1 100644 --- a/examples/dreamcast/vmu/vmu_pkg/Makefile +++ b/examples/dreamcast/vmu/vmu_pkg/Makefile @@ -7,14 +7,16 @@ TARGET = vmu.elf # List all of your C files here, but change the extension to ".o" -OBJS = vmu.o +OBJS = vmu.o romdisk.o + +KOS_ROMDISK_DIR = romdisk all: rm-elf $(TARGET) include $(KOS_BASE)/Makefile.rules clean: rm-elf - -rm -f $(OBJS) + -rm -f $(OBJS) romdisk.img rm-elf: -rm -f $(TARGET) diff --git a/examples/dreamcast/vmu/vmu_pkg/romdisk/ebook.ico b/examples/dreamcast/vmu/vmu_pkg/romdisk/ebook.ico new file mode 100644 index 00000000..810d99ff Binary files /dev/null and b/examples/dreamcast/vmu/vmu_pkg/romdisk/ebook.ico differ diff --git a/examples/dreamcast/vmu/vmu_pkg/vmu.c b/examples/dreamcast/vmu/vmu_pkg/vmu.c index 65896555..553ef9aa 100644 --- a/examples/dreamcast/vmu/vmu_pkg/vmu.c +++ b/examples/dreamcast/vmu/vmu_pkg/vmu.c @@ -10,6 +10,11 @@ #include <kos.h> +/* An icon is always 32x32 4bpp */ +#define ICON_SIZE (32 * 32 / 2) + +#define NB_ICONS_MAX 3 + void draw_dir(void) { file_t d; int y = 88; @@ -76,6 +81,8 @@ int wait_start(void) { } } +static unsigned char vmu_icon[ICON_SIZE * NB_ICONS_MAX]; + /* Here's the actual meat of it */ void write_entry(void) { vmu_pkg_t pkg; @@ -87,8 +94,9 @@ void write_entry(void) { strcpy(pkg.desc_short, "VMU Test"); strcpy(pkg.desc_long, "This is a test VMU file"); strcpy(pkg.app_id, "KOS"); - pkg.icon_cnt = 0; - pkg.icon_anim_speed = 0; + pkg.icon_cnt = NB_ICONS_MAX; + pkg.icon_data = vmu_icon; + pkg.icon_anim_speed = 8; pkg.eyecatch_type = VMUPKG_EC_NONE; pkg.data_len = 4096; pkg.data = data; @@ -96,6 +104,7 @@ void write_entry(void) { for(i = 0; i < 4096; i++) data[i] = i & 255; + vmu_pkg_load_icon(&pkg, "/rd/ebook.ico"); vmu_pkg_build(&pkg, &pkg_out, &pkg_size); fs_unlink("/vmu/a1/TESTFILE"); diff --git a/include/kos/net.h b/include/kos/net.h index b43ccfb0..26abe780 100644 --- a/include/kos/net.h +++ b/include/kos/net.h @@ -220,12 +220,6 @@ typedef struct knetif { /** \cond */ /* Define the list type */ LIST_HEAD(netif_list, knetif); - -#ifdef PACKED -#undef PACKED -#endif - -#define PACKED __attribute__((packed)) /** \endcond */ /** \defgroup networking_ip IP @@ -253,7 +247,7 @@ typedef struct ip_hdr_s { uint16 checksum; /**< \brief IP checksum */ ...<truncated>... hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: quzar <qu...@us...> - 2025-02-03 06:53:04
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via bad425592df5401515f296802a05ddfef1afe8b5 (commit) via 4969106edddb605584d2dbeb31af9fd3a1e79e0e (commit) via 9670df33546c528cff937f637140b843569b3fe5 (commit) via 4f974a2ea4a6029cef07c3892e54d6af23809643 (commit) via eec75932a4f12963f5f2dcb20802e22f7503f542 (commit) via ef670bf41feed3dfa86cf0777f929700b2b29d9d (commit) via 84b378405de41b0196b7946a306fba7aa9981308 (commit) via 88685f91ca691da06e00fbea0ce3a3f670b96af4 (commit) via 7b9e21e8f21004fd5b12f3fc2bbc4b16edf9a294 (commit) via 2ab1204eedaea205a507ce71999c694a27009e9d (commit) via d8c1ce0321c368998f68a13700beb7a84592f2ca (commit) via 2e539f91d5ac022622547391f2bcf9b5a0cc9e9c (commit) via f3bb2d8952db395011db1c8e86b07aa4ac0192d7 (commit) via 8df6c24a222f70b9be91acccfd8b1cc7384f6f52 (commit) via 163be4b6433b9ba986b76b7c90525bf4813347a1 (commit) via acc4bae0f4370e39073611ccf55a5b44b7ab2452 (commit) via 1e2cbd3cc5516a1827ebd8c5672929e0aedf7485 (commit) via dfd76879d0abaa4a154067225370446e30ae6fb0 (commit) via e3ab7d197a455d4c802d2006243eda4d6ef6fbc9 (commit) from 80a54c601e71dfeb44ec764583815ac353580205 (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 bad425592df5401515f296802a05ddfef1afe8b5 Merge: 4969106e eec75932 Author: Donald Haase <qu...@ya...> Date: Sun Feb 2 21:39:21 2025 -0500 Merge pull request #922 from sizious/dc-chain-mingw64-updates `dc-chain` update documentations commit 4969106edddb605584d2dbeb31af9fd3a1e79e0e Author: Falco Girgis <gyr...@gm...> Date: Sun Feb 2 21:37:17 2025 -0500 VMU Button Bitflag Fix, Plus Maintaining Previous Button States. (#915) * Fixed #defines for VMU button bitflags. - Bitflags were never correctly defined for the VMU buttons in vmu.h, but it was never caught, since you can also access them via bitfields. - Corrected the incorrect flags. * Added tracking for previous VMU button state. In order to do anything useful in terms of responding to button state change events, such as when a button is FIRST pressed or FIRST released, any app would have to maintain the previous state of the buttons in order to compare them to the current state. We've been moving this functionality into KOS, so I've done the same with the VMU buttons. Since the maple state data is static for every device, we aren't storing any extra information anyway. Just using one more byte of the 1024 byte buffer at the end of our device (for a whopping 2 bytes of total button info). - Pulled VMU buttons out of state and into their own union of raw button masks and individual bitfields. - Added logic to driver to cache the previous frame's state - Created new vmu_state_t struct exposing these two frames' worth of button state info. * Made vmu_cond_t struct private. This struct is only for processing the raw maple response packet when querying for button states... There was no reason to expose it as something cluttering up the main API and confusing our users. - Moved vmu_cond_t from vmu.h to vmu.c. - Updated copyright information. commit 9670df33546c528cff937f637140b843569b3fe5 Merge: 4f974a2e ef670bf4 Author: Donald Haase <qu...@ya...> Date: Sun Feb 2 03:04:06 2025 -0500 Merge pull request #913 from KallistiOS/falco/string_h_deprecation Deprecated string.h and removed usages. commit 4f974a2ea4a6029cef07c3892e54d6af23809643 Merge: 80a54c60 88685f91 Author: Donald Haase <qu...@ya...> Date: Sun Feb 2 00:29:45 2025 -0500 Merge pull request #899 from KallistiOS/dont_optimize_sq_flush Ensure sq_writeback is flagged as causing memory to change. commit eec75932a4f12963f5f2dcb20802e22f7503f542 Merge: 7b9e21e8 80a54c60 Author: Mickaël Cardoso <si...@gm...> Date: Wed Jan 29 08:48:04 2025 +0100 Merge branch 'master' into dc-chain-mingw64-updates commit ef670bf41feed3dfa86cf0777f929700b2b29d9d Merge: 84b37840 80a54c60 Author: Falco Girgis <gyr...@gm...> Date: Tue Jan 28 22:06:23 2025 -0600 Merge branch 'master' of github.com:KallistiOS/KallistiOS into falco/string_h_deprecation commit 84b378405de41b0196b7946a306fba7aa9981308 Merge: e3ab7d19 c753c2ba Author: Falco Girgis <gyr...@gm...> Date: Tue Jan 28 21:59:18 2025 -0600 Merge branch 'master' into falco/string_h_deprecation commit 88685f91ca691da06e00fbea0ce3a3f670b96af4 Author: QuzarDC <qu...@co...> Date: Mon Jan 27 22:37:32 2025 -0500 Ensure sq_writeback is flagged as causing memory to change. First reported with #897, a regression from #877. While it's appropriate for the generalized dcache_pref_block to not have outputs, setting the same for the store queue writeback causes it to be optimized away in some situations (specifically DR). This simply rolls back to the previous behavior for the sq case. It should be possible to optimize further, but different attempts led to build failures. commit 7b9e21e8f21004fd5b12f3fc2bbc4b16edf9a294 Author: SiZiOUS <si...@gm...> Date: Mon Jan 27 20:53:23 2025 +0100 `dc-chain`: adding GCC 8.5.0 patch for MinGW-w64 Note: This is the same patch as for the other Windows environments. commit 2ab1204eedaea205a507ce71999c694a27009e9d Author: SiZiOUS <si...@gm...> Date: Sun Jan 26 15:38:04 2025 +0100 `dc-chain`: small cosmetic fix for MinGW. commit d8c1ce0321c368998f68a13700beb7a84592f2ca Author: SiZiOUS <si...@gm...> Date: Sun Jan 26 15:37:29 2025 +0100 `dc-chain`: big update on MinGW-w64 documentation As this is now the foundation used for DreamSDK! commit 2e539f91d5ac022622547391f2bcf9b5a0cc9e9c Author: SiZiOUS <si...@gm...> Date: Sun Jan 26 15:12:35 2025 +0100 `dc-chain`: update changelog and contributors list. commit f3bb2d8952db395011db1c8e86b07aa4ac0192d7 Author: SiZiOUS <si...@gm...> Date: Sun Jan 26 15:03:41 2025 +0100 `dc-chain`: updating original MinGW link mingw.org has been abandoned, this domain is not linked to the original MinGW team anymore. commit 8df6c24a222f70b9be91acccfd8b1cc7384f6f52 Author: SiZiOUS <si...@gm...> Date: Sun Jan 26 14:58:25 2025 +0100 `dc-chain`: harmonizing README links This is just cosmetic fix. commit 163be4b6433b9ba986b76b7c90525bf4813347a1 Author: SiZiOUS <si...@gm...> Date: Sun Jan 26 14:56:39 2025 +0100 `dc-chain`: fix README link for all platforms And not only for MinGW-w64 as intended in the beginning... commit acc4bae0f4370e39073611ccf55a5b44b7ab2452 Author: SiZiOUS <si...@gm...> Date: Sun Jan 26 14:54:18 2025 +0100 `dc-chain`: fix KOS README link commit 1e2cbd3cc5516a1827ebd8c5672929e0aedf7485 Author: SiZiOUS <si...@gm...> Date: Sun Jan 26 14:52:59 2025 +0100 `dc-chain`: fix change log link commit dfd76879d0abaa4a154067225370446e30ae6fb0 Author: SiZiOUS <si...@gm...> Date: Sun Jan 26 14:52:09 2025 +0100 `dc-chain`: removing link on `Makefile.cfg` This file is not provided anymore now. commit e3ab7d197a455d4c802d2006243eda4d6ef6fbc9 Author: Falco Girgis <gyr...@gm...> Date: Sat Jan 25 16:50:04 2025 -0600 Deprecated string.h and removed usages. <kos/string.h> is full of routines which completely break at high optimization levels (they get optimized out), from invoking undefined behavior in C and C++ due to breaking strict aliasing rules. This has caused a myriad of subtle issues at high optimization levels over the years, due to these calls getting optimized away, and now we finally know why. Avoid them at all costs. - Deprecated the heck out of kos/string.h with Doxygen documentation, tags, and attributes explaining why. - Removed all usages of these functions from within KOS. - Removed all usages of these functions from KOS-ports. ----------------------------------------------------------------------- Summary of changes: examples/dreamcast/vmu/vmu_game/vmu_game.c | 5 +- examples/dreamcast/vmu/vmu_pkg/vmu.c | 5 +- include/kos/string.h | 48 ++++++++++++++--- kernel/arch/dreamcast/hardware/maple/maple_utils.c | 2 +- kernel/arch/dreamcast/hardware/maple/vmu.c | 24 ++++++--- kernel/arch/dreamcast/hardware/pvr/pvr_misc.c | 3 +- kernel/arch/dreamcast/hardware/pvr/pvr_scene.c | 3 +- kernel/arch/dreamcast/hardware/pvr/pvr_texture.c | 4 +- kernel/arch/dreamcast/include/arch/cache.h | 10 +++- kernel/arch/dreamcast/include/dc/maple/vmu.h | 63 +++++++++++++--------- kernel/arch/dreamcast/util/fb_console.c | 5 +- kernel/arch/dreamcast/util/fb_console_naomi.c | 5 +- kernel/arch/dreamcast/util/vmu_fb.c | 3 -- utils/dc-chain/README.md | 14 ++--- utils/dc-chain/doc/CHANGELOG.md | 1 + utils/dc-chain/doc/CONTRIBUTORS.md | 4 +- utils/dc-chain/doc/alpine.md | 4 +- utils/dc-chain/doc/bsd.md | 4 +- utils/dc-chain/doc/cygwin.md | 4 +- utils/dc-chain/doc/debian.md | 4 +- utils/dc-chain/doc/macos.md | 4 +- utils/dc-chain/doc/mingw/README.md | 3 +- utils/dc-chain/doc/mingw/mingw-w64.md | 58 +++++++++++--------- utils/dc-chain/doc/mingw/mingw.md | 10 ++-- .../gcc-8.5.0.diff | 0 25 files changed, 175 insertions(+), 115 deletions(-) copy utils/dc-chain/patches/{i686-w64-mingw32 => x86_64-w64-mingw32}/gcc-8.5.0.diff (100%) diff --git a/examples/dreamcast/vmu/vmu_game/vmu_game.c b/examples/dreamcast/vmu/vmu_game/vmu_game.c index 7b90b0ef..b59f2e76 100644 --- a/examples/dreamcast/vmu/vmu_game/vmu_game.c +++ b/examples/dreamcast/vmu/vmu_game/vmu_game.c @@ -8,7 +8,6 @@ a VMU game file to a VMU with a DC-compatible header so it can be played on the vmu. */ #include <kos.h> -#include <kos/string.h> void draw_findings(void) { file_t d; @@ -31,7 +30,7 @@ void new_vmu(void) { if(dev == NULL) { if(dev_checked) { - memset4(vram_s + 88 * 640, 0, 640 * (480 - 64) * 2); + memset(vram_s + 88 * 640, 0, 640 * (480 - 64) * 2); bfont_draw_str_vram_fmt(10, 88, false, "No VMU"); dev_checked = 0; } @@ -39,7 +38,7 @@ void new_vmu(void) { else if(dev_checked) { } else { - memset4(vram_s + 88 * 640, 0, 640 * (480 - 88)); + memset(vram_s + 88 * 640, 0, 640 * (480 - 88)); draw_findings(); dev_checked = 1; } diff --git a/examples/dreamcast/vmu/vmu_pkg/vmu.c b/examples/dreamcast/vmu/vmu_pkg/vmu.c index 6362005d..65896555 100644 --- a/examples/dreamcast/vmu/vmu_pkg/vmu.c +++ b/examples/dreamcast/vmu/vmu_pkg/vmu.c @@ -9,7 +9,6 @@ any other VMU file from the BIOS menus. */ #include <kos.h> -#include <kos/string.h> void draw_dir(void) { file_t d; @@ -42,7 +41,7 @@ void new_vmu(void) { if(dev == NULL) { if(dev_checked) { - memset4(vram_s + 88 * 640, 0, 640 * (480 - 64) * 2); + memset(vram_s + 88 * 640, 0, 640 * (480 - 64) * 2); bfont_draw_str(vram_s + 88 * 640 + 10, 640, 0, "No VMU"); dev_checked = 0; } @@ -50,7 +49,7 @@ void new_vmu(void) { else if(dev_checked) { } else { - memset4(vram_s + 88 * 640, 0, 640 * (480 - 88)); + memset(vram_s + 88 * 640, 0, 640 * (480 - 88)); draw_dir(); dev_checked = 1; } diff --git a/include/kos/string.h b/include/kos/string.h index 7bf7a72b..855a565d 100644 --- a/include/kos/string.h +++ b/include/kos/string.h @@ -1,18 +1,28 @@ /* KallistiOS ##version## kos/string.h - Copyright (C)2004 Megan Potter - + Copyright (C) 2004 Megan Potter + Copyright (C) 2025 Falco Girgis */ /** \file kos/string.h \brief Variants on standard block memory copy/set functions. \ingroup system_types + \deprecated This file contains variants on the standard block memory copy/set functions. These variants copy/set memory in the specified block sizes, which may be helpful for interacting with memory-mapped hardware. + \note + None of these routines are actually faster than using the equivalent + standard C functions such as memcpy() and memset()! + + \warning + Due to the fact that it breaks C and C++'s strict aliasing rules, this + entire API is no longer safe to use, as its calls can get optimized away + and never happen with higher optimization levels! + \author Megan Potter */ @@ -29,56 +39,80 @@ __BEGIN_DECLS */ /** \brief Copy a block of memory, 4 bytes at a time. + \deprecated Invokes undefined behavior. Use memcpy(). This function is identical to memcpy(), except it copies 4 bytes at a time. + \warning + This function breaks C/C++ strict aliasing rules and is no longer + considered safe to use. It's also slow. + \param dest The destination of the copy. \param src The source to copy. \param count The number of bytes to copy. This should be divisible by 4 (and will be rounded down if not). \return The original value of dest. */ -void * memcpy4(void * dest, const void *src, size_t count); +void *memcpy4(void *dest, const void *src, size_t count) + __depr("Unsafe. Use memcpy()."); /** \brief Set a block of memory, 4 bytes at a time. + \deprecated Invokes undefined behavior. Use memset(). This function is identical to memset(), except it sets 4 bytes at a time. This implies that all 32-bits of c are used, not just the first 8 as in memset(). + \warning + This function breaks C/C++ strict aliasing rules and is no longer + considered safe to use. + \param s The destination of the set. \param c The value to set to. \param count The number of bytes to set. This should be divisible by 4 (and will be rounded down if not). \return The original value of dest. */ -void * memset4(void * s, unsigned long c, size_t count); +void *memset4(void *s, unsigned long c, size_t count) + __depr("Unsafe. Use memset()."); /** \brief Copy a block of memory, 2 bytes at a time. + \deprecated Invokes undefined behavior. Use memcpy(). This function is identical to memcpy(), except it copies 2 bytes at a time. + \warning + This function breaks C/C++ strict aliasing rules and is no longer + considered safe to use. It's also slow. + \param dest The destination of the copy. \param src The source to copy. \param count The number of bytes to copy. This should be divisible by 2 (and will be rounded down if not). \return The original value of dest. */ -void * memcpy2(void * dest, const void *src, size_t count); +void *memcpy2(void * dest, const void *src, size_t count) + __depr("Unsafe. Use memcpy()."); -/** \brief Set a block of memory, 2 bytes at a time. +/** \brief Set a block of memory, 2 bytes at a time. + \deprecated Invokes undefined behavior. This function is identical to memset(), except it sets 2 bytes at a time. This implies that all 16-bits of c are used, not just the first 8 as in memset(). + \warning + This function breaks C/C++ strict aliasing rules and is no longer + considered safe to use. + \param s The destination of the set. \param c The value to set to. \param count The number of bytes to set. This should be divisible by 2 (and will be rounded down if not). \return The original value of dest. */ -void * memset2(void * s, unsigned short c, size_t count); +void *memset2(void *s, unsigned short c, size_t count) + __depr("Unsafe."); /** @} */ diff --git a/kernel/arch/dreamcast/hardware/maple/maple_utils.c b/kernel/arch/dreamcast/hardware/maple/maple_utils.c index e10bf365..9fddad06 100644 --- a/kernel/arch/dreamcast/hardware/maple/maple_utils.c +++ b/kernel/arch/dreamcast/hardware/maple/maple_utils.c @@ -172,7 +172,7 @@ void maple_gun_read_pos(int *x, int *y) { /* Debugging help */ void maple_sentinel_setup(void * buffer, int bufsize) { assert(bufsize % 4 == 0); - memset4(buffer, 0xdeadbeef, bufsize); + memset(buffer, 0xdeadbeef, bufsize); } void maple_sentinel_verify(const char * bufname, void * buffer, int bufsize) { diff --git a/kernel/arch/dreamcast/hardware/maple/vmu.c b/kernel/arch/dreamcast/hardware/maple/vmu.c index d03c4557..2a4fc304 100644 --- a/kernel/arch/dreamcast/hardware/maple/vmu.c +++ b/kernel/arch/dreamcast/hardware/maple/vmu.c @@ -3,7 +3,7 @@ vmu.c Copyright (C) 2002, 2003 Megan Potter Copyright (C) 2008 Donald Haase - Copyright (C) 2023 Falco Girgis + Copyright (C) 2023, 2025 Falco Girgis */ /* @@ -28,6 +28,12 @@ #define VMU_BLOCK_WRITE_RETRY_TIME 100 /* time to sleep until retrying a failed write */ +/* VMU's raw condition data: 0 = PRESSED, 1 = RELEASED */ +typedef struct vmu_cond { + uint8_t raw_buttons; + uint8_t dummy[3]; +} vmu_cond_t; + typedef struct vmu_datetime { uint16_t year; /* 0 - 9999 */ uint8_t month; /* 1 - 12 */ @@ -95,8 +101,10 @@ static void vmu_poll_reply(maple_state_t *st, maple_frame_t *frm) { /* Fill the "nice" struct from the raw data */ cooked = (vmu_state_t *)(frm->dev->status); + /* Copy over current button states to previous states. */ + cooked->buttons.previous = cooked->buttons.current; /* Invert raw struct as nice struct */ - cooked->buttons = ~(raw->raw_buttons); + cooked->buttons.current.raw = ~(raw->raw_buttons); /* Check to see if the VMU is upside-down in the controller and readjust its directional buttons accordingly. */ @@ -104,12 +112,12 @@ static void vmu_poll_reply(maple_state_t *st, maple_frame_t *frm) { if(cont && (cont->info.functions & MAPLE_FUNC_CONTROLLER) && (frm->dev->info.connector_direction == cont->info.connector_direction)) { - cooked->buttons = (cooked->buttons & 0xf0) | - (cooked->dpad_up << 1) | /* down */ - (cooked->dpad_down << 0) | /* up */ - (cooked->dpad_left << 3) | /* right */ - (cooked->dpad_right << 2); /* left */ - + cooked->buttons.current.raw = + (cooked->buttons.current.raw & 0xf0) | + (cooked->buttons.current.dpad_up << 1) | /* down */ + (cooked->buttons.current.dpad_down << 0) | /* up */ + (cooked->buttons.current.dpad_left << 3) | /* right */ + (cooked->buttons.current.dpad_right << 2); /* left */ } frm->dev->status_valid = 1; diff --git a/kernel/arch/dreamcast/hardware/pvr/pvr_misc.c b/kernel/arch/dreamcast/hardware/pvr/pvr_misc.c index 740d0f60..46401f98 100644 --- a/kernel/arch/dreamcast/hardware/pvr/pvr_misc.c +++ b/kernel/arch/dreamcast/hardware/pvr/pvr_misc.c @@ -14,7 +14,6 @@ #include <dc/pvr.h> #include <dc/video.h> #include <kos/regfield.h> -#include <kos/string.h> #include "pvr_internal.h" @@ -216,7 +215,7 @@ void pvr_begin_queued_render(void) { bkg.argb3 = pvr_state.bg_color; vrl = (uint32_t *)(PVR_RAM_BASE | PVR_GET(PVR_TA_VERTBUF_POS)); - memcpy4(vrl, &bkg, sizeof(bkg)); + memcpy(vrl, &bkg, sizeof(bkg)); /* Reset the ISP/TSP, just in case */ //PVR_SET(PVR_RESET, PVR_RESET_ISPTSP); diff --git a/kernel/arch/dreamcast/hardware/pvr/pvr_scene.c b/kernel/arch/dreamcast/hardware/pvr/pvr_scene.c index 58b0eb24..928eee0f 100644 --- a/kernel/arch/dreamcast/hardware/pvr/pvr_scene.c +++ b/kernel/arch/dreamcast/hardware/pvr/pvr_scene.c @@ -11,7 +11,6 @@ #include <string.h> #include <kos/genwait.h> #include <kos/regfield.h> -#include <kos/string.h> #include <kos/thread.h> #include <dc/pvr.h> #include <dc/sq.h> @@ -351,7 +350,7 @@ int pvr_scene_finish(void) { } // Put a zero-marker on the end. - memset4(b->base[i] + b->ptr[i], 0, 32); + memset(b->base[i] + b->ptr[i], 0, 32); b->ptr[i] += 32; // Verify that there is no overrun. diff --git a/kernel/arch/dreamcast/hardware/pvr/pvr_texture.c b/kernel/arch/dreamcast/hardware/pvr/pvr_texture.c index 49ea049e..c8d73edc 100644 --- a/kernel/arch/dreamcast/hardware/pvr/pvr_texture.c +++ b/kernel/arch/dreamcast/hardware/pvr/pvr_texture.c @@ -6,9 +6,9 @@ */ #include <assert.h> -#include <kos/string.h> #include <dc/pvr.h> #include <dc/sq.h> +#include <string.h> #include "pvr_internal.h" /* @@ -198,7 +198,7 @@ void pvr_txr_load_kimg(const kos_img_t *img, pvr_ptr_t dst, uint32 flags) { pvr_txr_load(img->data, dst, img->byte_count); } else { - memcpy4(dst, img->data, img->byte_count); + memcpy(dst, img->data, img->byte_count); } } } diff --git a/kernel/arch/dreamcast/include/arch/cache.h b/kernel/arch/dreamcast/include/arch/cache.h index 0581b27a..e0af62be 100644 --- a/kernel/arch/dreamcast/include/arch/cache.h +++ b/kernel/arch/dreamcast/include/arch/cache.h @@ -149,9 +149,15 @@ static __always_inline void dcache_pref_block(const void *src) { This function initiates write-back for one Store Queue. - \param ptr The SQ mapped address to write-back. + \param src The SQ mapped address to write-back. */ -#define dcache_wback_sq(ptr) dcache_pref_block(ptr) +static __always_inline void dcache_wback_sq(void *src) { + __asm__ __volatile__("pref @%0\n" + : /* No outputs */ + : "r" (src) + : "memory" + ); +} /** \brief Allocate one block of the data/operand cache. diff --git a/kernel/arch/dreamcast/include/dc/maple/vmu.h b/kernel/arch/dreamcast/include/dc/maple/vmu.h index 88f35b5b..6eee44b8 100644 --- a/kernel/arch/dreamcast/include/dc/maple/vmu.h +++ b/kernel/arch/dreamcast/include/dc/maple/vmu.h @@ -3,7 +3,8 @@ dc/maple/vmu.h Copyright (C) 2000-2002 Jordan DeLong, Megan Potter Copyright (C) 2008 Donald Haase - Copyright (C) 2023 Falco Girgis, Andy Barajas + Copyright (C) 2023 Andy Barajas + Copyright (C) 2023, 2025 Falco Girgis */ @@ -31,6 +32,7 @@ __BEGIN_DECLS #include <arch/types.h> #include <dc/maple.h> +#include <kos/regfield.h> #include <stdint.h> #include <time.h> @@ -537,39 +539,50 @@ int vmu_get_datetime(maple_device_t *dev, time_t *unix); @{ */ -#define VMU_DPAD_UP (0<<1) /**< \brief Up Dpad button on the VMU */ -#define VMU_DPAD_DOWN (1<<1) /**< \brief Down Dpad button on the VMU */ -#define VMU_DPAD_LEFT (2<<1) /**< \brief Left Dpad button on the VMU */ -#define VMU_DPAD_RIGHT (3<<1) /**< \brief Right Dpad button on the VMU */ -#define VMU_A (4<<1) /**< \brief 'A' button on the VMU */ -#define VMU_B (5<<1) /**< \brief 'B' button on the VMU */ -#define VMU_MODE (6<<1) /**< \brief Mode button on the VMU */ -#define VMU_SLEEP (7<<1) /**< \brief Sleep button on the VMU */ +#define VMU_DPAD_UP BIT(0) /**< Up Dpad button on the VMU */ +#define VMU_DPAD_DOWN BIT(1) /**< Down Dpad button on the VMU */ +#define VMU_DPAD_LEFT BIT(2) /**< Left Dpad button on the VMU */ +#define VMU_DPAD_RIGHT BIT(3) /**< Right Dpad button on the VMU */ +#define VMU_A BIT(4) /**< 'A' button on the VMU */ +#define VMU_B BIT(5) /**< 'B' button on the VMU */ +#define VMU_MODE BIT(6) /**< Mode button on the VMU */ +#define VMU_SLEEP BIT(7) /**< Sleep button on the VMU */ -/** \brief VMU's raw condition data: 0 = PRESSED, 1 = RELEASED */ -typedef struct vmu_cond { - uint8_t raw_buttons; /**< \brief Combined button mask */ - uint8_t dummy[3]; /**< \brief Unused response data */ -} vmu_cond_t; +/** \brief Represents the combined state of all VMU buttons. -/** \brief VMU's "civilized" state data: 0 = RELEASED, 1 = PRESSED + Button states values: + - `0`: Released + - `1`: Pressed \note The Dpad buttons are automatically reoriented for you depending on which direction the VMU is facing in a particular type of controller. */ -typedef union vmu_state { - uint8_t buttons; /**< \brief Combined button state mask */ +typedef union vmu_buttons { + uint8_t raw; /**< Combined button state mask */ struct { - uint8_t dpad_up: 1; /**< \brief Dpad Up button state */ - uint8_t dpad_down: 1; /**< \brief Dpad Down button state */ - uint8_t dpad_left: 1; /**< \brief Dpad Left button state */ - uint8_t dpad_right: 1; /**< \brief Dpad Right button state */ - uint8_t a: 1; /**< \brief 'A' button state */ - uint8_t b: 1; /**< \brief 'B' button state */ - uint8_t mode: 1; /**< \brief Mode button state */ - uint8_t sleep: 1; /**< \brief Sleep button state */ + uint8_t dpad_up: 1; /**< Dpad Up button state */ + uint8_t dpad_down: 1; /**< Dpad Down button state */ + uint8_t dpad_left: 1; /**< Dpad Left button state */ + uint8_t dpad_right: 1; /**< Dpad Right button state */ + uint8_t a: 1; /**< 'A' button state */ + uint8_t b: 1; /**< 'B' button state */ + uint8_t mode: 1; /**< Mode button state */ + uint8_t sleep: 1; /**< Sleep button state */ }; +} vmu_buttons_t; + +/** "Civilized" structure containing VMU's current state. + + \note + Don't forget that if you want valid button state information, you must + enable polling for it in the driver with vmu_set_buttons_enabled()! +*/ +typedef struct vmu_state { + struct { + vmu_buttons_t current; /**< Button states from the current frame */ + vmu_buttons_t previous; /**< Button states from the previous frame */ + } buttons; /**< Latest two frames of button state data */ } vmu_state_t; /** @} */ diff --git a/kernel/arch/dreamcast/util/fb_console.c b/kernel/arch/dreamcast/util/fb_console.c index 681978bf..8bd24ddb 100644 --- a/kernel/arch/dreamcast/util/fb_console.c +++ b/kernel/arch/dreamcast/util/fb_console.c @@ -8,7 +8,6 @@ #include <string.h> #include <errno.h> #include <kos/dbgio.h> -#include <kos/string.h> #include <dc/fb_console.h> #include <dc/biosfont.h> #include <dc/video.h> @@ -76,10 +75,10 @@ static int fb_write(int c) { /* If going down a line put us over the edge of the screen, move everything up a line, fixing the problem. */ if(cur_y + FONT_CHAR_HEIGHT > max_y) { - memcpy4(t + min_y * fb_w, t + (min_y + FONT_CHAR_HEIGHT) * fb_w, + memcpy(t + min_y * fb_w, t + (min_y + FONT_CHAR_HEIGHT) * fb_w, (cur_y - min_y - FONT_CHAR_HEIGHT) * fb_w * 2); cur_y -= FONT_CHAR_HEIGHT; - memset4(t + cur_y * fb_w, 0, FONT_CHAR_HEIGHT * fb_w * 2); + memset(t + cur_y * fb_w, 0, FONT_CHAR_HEIGHT * fb_w * 2); } } diff --git a/kernel/arch/dreamcast/util/fb_console_naomi.c b/kernel/arch/dreamcast/util/fb_console_naomi.c index 65264479..23a18571 100644 --- a/kernel/arch/dreamcast/util/fb_console_naomi.c +++ b/kernel/arch/dreamcast/util/fb_console_naomi.c @@ -8,7 +8,6 @@ #include <string.h> #include <errno.h> #include <kos/dbgio.h> -#include <kos/string.h> #include <dc/fb_console.h> #include <dc/video.h> #include <dc/minifont.h> @@ -78,10 +77,10 @@ static int fb_write(int c) { /* If going down a line put us over the edge of the screen, move everything up a line, fixing the problem. */ if(cur_y + FONT_CHAR_HEIGHT > max_y) { - memcpy4(t + min_y * fb_w, t + (min_y + FONT_CHAR_HEIGHT) * fb_w, + memcpy(t + min_y * fb_w, t + (min_y + FONT_CHAR_HEIGHT) * fb_w, (cur_y - min_y - FONT_CHAR_HEIGHT) * fb_w * 2); cur_y -= FONT_CHAR_HEIGHT; - memset4(t + cur_y * fb_w, 0, FONT_CHAR_HEIGHT * fb_w * 2); + memset(t + cur_y * fb_w, 0, FONT_CHAR_HEIGHT * fb_w * 2); } ...<truncated>... hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: quzar <qu...@us...> - 2025-01-29 15:18:25
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via 80a54c601e71dfeb44ec764583815ac353580205 (commit) via 924ee07a9b9a4883a86b2b1f9200c0b53768a721 (commit) via 5bcea1f24f90c2de7bd3152aa430ebc538a5ce2e (commit) via 6f43940bc18cf0da2eb8a39d41a7984580cd7ac3 (commit) via 07da40a626c400f23b7b9e96dd52693876827480 (commit) via ec0850fd1e4056954c31a20742b26520db5f7b5c (commit) via fe6463c8c8bb5c5dba0f5c13609881877cb4d1ff (commit) via 1cbb414fb78a0bbee8db333e1fb1afe496d99a01 (commit) via 2277c213500bad618d88a5676289cbaca7c8158f (commit) via b6a39e2005d009f8af9446b5683f02667471dfc9 (commit) via f329407dd8045ae8f7a44c3b85eba0721c9a1199 (commit) via 851cf99ddf406938f227ece95c746422b3da2b53 (commit) via 285beb0c3e43ffebde707577ec73ba8424456209 (commit) via fab82ab2d6ae640df0fa32f322288ba15f3d2c55 (commit) via c753c2ba39b5930cfd80663dc904b9fac5aab82a (commit) via 73d0c44d36863ad991c6a66ab4f6a28bd916548c (commit) via 54cd45891861e2dbd839882749baa1f8d9fc1a73 (commit) via 8c52e0be5a8989fb9045255dd1767b0e7f0f7396 (commit) via cd3fdc18c58576e55582ae7f72327e8412de7de5 (commit) via 1529f3fb66a833098c6f10a669ce1b3c01228785 (commit) via 6505375f04621494fbec1fa2e5db4b685a9802f8 (commit) via dd22cc133cb42d3e6cec8cfa4d6190416c119110 (commit) via 0e03833bbe86e805c27b754aff84e4f5e8fde6c3 (commit) via 8426c784cd9f959d8249c5271590e79588f9a5d9 (commit) via a04a29480bc58ffc5905908e6643b9c540d86b36 (commit) via 727c400883b17634f98c4b42207dc8e7f5ca5def (commit) via 7917b346319aa159b10199f77aa091a37e364e20 (commit) via 9688eeefaf568fd3eb8675086c98ee5a5f3e6d6a (commit) via 65e1c505c19a14800da044bab9d3f8a1be3aafaa (commit) via ee00f1a816c947061b8600249b3f466899c11971 (commit) via 23f1cf94a02d5f2b46d8231d475bbee2f0afd483 (commit) via 5d6c022ee979460bd3377f3dc3f0b707f9f4283f (commit) via fe5e812eb272c5643aae8bacd34a13722b94919b (commit) via e8797cca5979b28acbd8da09ca9d3e5fa51fa99f (commit) via b0690ea9fc7b4f389817f0e2f9300c80768b9792 (commit) via 0ee1ae75d6fe8afac6672a3323d21818f2af1d7d (commit) via f0876d4e99485674d91876beea22712fb67dc1ad (commit) via 5b66194b6f1b2a908686a3228b4b83861b2d7482 (commit) via a2c06d1349210237d0a6ffc0d065c2cfa8cf491a (commit) via c620d7c060ff691073fd8eb124be1ccaea35218d (commit) via 03b51ef77bd15aea74d54a03ab09b8a6e043db79 (commit) via 272f3351e2505e4eabcd1d1185e3bd78a94ece17 (commit) via 1fc850b9a3ee2ca0d10b33eae084dfbd6fd30e89 (commit) via 0df44582196029ae2975fbac29577c6166b0796a (commit) via e76e4ffec53d87c1360f2d89b5ad52b52b9dae63 (commit) via 6f46b379338f915fe71e3e79c55a13dde504fa15 (commit) via 2f90256c39d4c698fe1238775c65a0abb57a008c (commit) via 7c3d087100ba3ea4e34f8bb413ee061c492acf6a (commit) via 8e880352b8e2b1bdfe52504c1f7060a195ecf477 (commit) via 66d96f91a5f254e4407d0dde25256be00ff48da4 (commit) via 4169aa2c7b232fdacaaadb4b085476a57b273b3a (commit) via 67fb082e9f1b27fdb18d3b53a193a5bd91a38b3d (commit) via fc5d711ca3797ea5d8c259fa5136dbe59715ab5e (commit) via d1c9414b50ca7e38639d34e8148c9bd2a04b1e75 (commit) via c639750b0951531b8d338db8b5f1b74d7885e767 (commit) from 06b0843665d5a7afa45bf7d679dccf675ec0e453 (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 80a54c601e71dfeb44ec764583815ac353580205 Merge: 924ee07a fe6463c8 Author: Donald Haase <qu...@ya...> Date: Tue Jan 28 22:43:46 2025 -0500 Merge pull request #925 from pcercuei/pvr-dma-next-list pvr: random cleanups and IRQ race fix in dma_next_list() commit 924ee07a9b9a4883a86b2b1f9200c0b53768a721 Merge: 6f43940b 5bcea1f2 Author: Donald Haase <qu...@ya...> Date: Tue Jan 28 22:32:36 2025 -0500 Merge pull request #930 from darcagn/flag_revert Revert PR #887: environ.sh: Disable -fno-builtin, enable -ffast-math commit 5bcea1f24f90c2de7bd3152aa430ebc538a5ce2e Author: darc <da...@pr...> Date: Tue Jan 28 21:26:36 2025 -0600 Revert PR #887: environ.sh: Disable -fno-builtin, enable -ffast-math commit 6f43940bc18cf0da2eb8a39d41a7984580cd7ac3 Merge: 07da40a6 ec0850fd Author: Donald Haase <qu...@ya...> Date: Mon Jan 27 22:47:31 2025 -0500 Merge pull request #927 from KallistiOS/highlander_raytris Remove duplicated copy of the raytris example. commit 07da40a626c400f23b7b9e96dd52693876827480 Merge: f329407d 73d0c44d Author: Donald Haase <qu...@ya...> Date: Mon Jan 27 22:47:15 2025 -0500 Merge pull request #920 from KallistiOS/y1_fix Fix type clash in vmu example. commit ec0850fd1e4056954c31a20742b26520db5f7b5c Author: QuzarDC <qu...@co...> Date: Mon Jan 27 20:42:26 2025 -0500 Remove duplicated copy of the example. commit fe6463c8c8bb5c5dba0f5c13609881877cb4d1ff Author: Paul Cercueil <pa...@cr...> Date: Mon Jan 27 17:22:13 2025 +0100 pvr: Fix pvr_dma_transfer overriding callback data of ongoing transfer The pvr_dma_transfer() would override the callback data, stored in global variables, before even checking that no transfer was ongoing. Address that by moving the place where the variables are set after the DMA available check. And while we're at it, disable interrupts to avoid races between parallel calls of pvr_dma_transfer(). Signed-off-by: Paul Cercueil <pa...@cr...> commit 1cbb414fb78a0bbee8db333e1fb1afe496d99a01 Author: Paul Cercueil <pa...@cr...> Date: Mon Jan 27 16:25:55 2025 +0100 pvr: Fix dma_next_list() racing with itself The very first call to dma_next_list() does not run in an interrupt context, nor does it run with the IRQs disabled. As soon as pvr_dma_load_ta() is called, it is therefore possible to have dma_next_list() re-entered from within the DMA complete interrupt handler. This is fine, as long as we make sure that the function does not do anything after this point that could race with the interrupt handler. One possible race was with the DMA complete interrupt firing before the "pvr_state.lists_dmaed" was updated, in which case the interrupt handler wouldn't get the updated value, or when the interrupt was firing in the middle of updating the "pvr_state.lists_dmaed". Signed-off-by: Paul Cercueil <pa...@cr...> commit 2277c213500bad618d88a5676289cbaca7c8158f Author: Paul Cercueil <pa...@cr...> Date: Mon Jan 27 16:21:59 2025 +0100 pvr: Simplify dma_next_list() Move the initialization of "b" before the loop. Remove commented DBG() macros. Replace the loop break by a "return" since nothing else will be executed after that. This means that the "did" variable can be dropped. Signed-off-by: Paul Cercueil <pa...@cr...> commit b6a39e2005d009f8af9446b5683f02667471dfc9 Author: Paul Cercueil <pa...@cr...> Date: Mon Jan 27 16:14:36 2025 +0100 pvr: Use BIT() macro where it makes sense Use the BIT() macro instead of the expanded version, to make it more obvious that we're manipulating individual bits. Signed-off-by: Paul Cercueil <pa...@cr...> commit f329407dd8045ae8f7a44c3b85eba0721c9a1199 Merge: 851cf99d 6505375f Author: Donald Haase <qu...@ya...> Date: Mon Jan 27 10:10:02 2025 -0500 Merge pull request #918 from KallistiOS/falco/cont_btns_callback_thread_attrib Added thread attribs to cont_btn_callback worker. commit 851cf99ddf406938f227ece95c746422b3da2b53 Merge: 285beb0c dd22cc13 Author: Donald Haase <qu...@ya...> Date: Mon Jan 27 10:09:25 2025 -0500 Merge pull request #916 from KallistiOS/falco/AUTHORS_update_2025 Updated AUTHORS with year 2025 for Falco Girgis. commit 285beb0c3e43ffebde707577ec73ba8424456209 Author: Falco Girgis <gyr...@gm...> Date: Mon Jan 27 09:08:35 2025 -0600 Added support for more queries to sysconf(). (#924) sysconf() is an incredibly useful POSIX utility which gets used by a LOT more software than I think we realize. I just noticed that our upcoming SDL2 port is using it to properly return a bunch of HW queries like available RAM. I did notice, however, that we didn't support querying for cache configuration and a few other things, so I added them. commit fab82ab2d6ae640df0fa32f322288ba15f3d2c55 Author: Falco Girgis <gyr...@gm...> Date: Mon Jan 27 09:07:52 2025 -0600 Added PantherDC to Controller Capability Typelist (#917) So now you can easily query for whether a controller supports all of the inputs supported by the PantherDC controller. commit c753c2ba39b5930cfd80663dc904b9fac5aab82a Author: Cole Hall <col...@gm...> Date: Sun Jan 26 23:03:54 2025 +0000 Add raytris raylib example (#921) * Add raylib Tetris example by Niisoks commit 73d0c44d36863ad991c6a66ab4f6a28bd916548c Author: QuzarDC <qu...@co...> Date: Sun Jan 26 07:36:46 2025 -0500 Fix type clash in vmu example. A strange side-effect from #870 . Now math.h is being included via kos.h which caused the static y1 in vmu.c to clash with the defined `double y1(double)` function from math.h. Corrected this by both restricting the headers being included and renaming the variable. Not quite sure how this doesn't cause problems elsewhere... commit 54cd45891861e2dbd839882749baa1f8d9fc1a73 Merge: cd3fdc18 8c52e0be Author: Donald Haase <qu...@ya...> Date: Sun Jan 26 06:49:41 2025 -0500 Merge pull request #905 from pcercuei/dmac-doc doc: CHANGELOG: Add entry about DMAC API commit 8c52e0be5a8989fb9045255dd1767b0e7f0f7396 Merge: c620d7c0 cd3fdc18 Author: Donald Haase <qu...@ya...> Date: Sun Jan 26 06:48:40 2025 -0500 Merge branch 'master' into dmac-doc commit cd3fdc18c58576e55582ae7f72327e8412de7de5 Merge: 0e03833b 1529f3fb Author: Donald Haase <qu...@ya...> Date: Sat Jan 25 22:41:31 2025 -0500 Merge pull request #919 from darcagn/alignas_fix Revert alignas change in irq.h to fix toolchain building commit 1529f3fb66a833098c6f10a669ce1b3c01228785 Author: darc <da...@pr...> Date: Sat Jan 25 21:22:20 2025 -0600 Revert alignas change to fix toolchain commit 6505375f04621494fbec1fa2e5db4b685a9802f8 Author: Falco Girgis <gyr...@gm...> Date: Sat Jan 25 18:52:56 2025 -0600 Added thread attribs to cont_btn_callback worker. 1) When using the cont_btn_callback() mechanism, a new thread is created, which is left unnamed. This looks kind of janky and confusing when seen in the thread listing when dumping thread info or after an exception. - Added a default label to the worker thread to identify it 2) By far, the most commonly implemented callback with this mechanism tends to be some absolutely trivial logic like a simple call to exit(0). Because of this, games which are low on RAM are typically paying an exuberantly high amount of memory overhead just to call one function with a default stack size of 32KB for the worker. - Added a default stack size of 8KB, which can be overridden at compile-time, consistently with how other default thread sizes can be overwritten. commit dd22cc133cb42d3e6cec8cfa4d6190416c119110 Author: Falco Girgis <gyr...@gm...> Date: Sat Jan 25 17:50:14 2025 -0600 Updated AUTHORS with year 2025 for Falco Girgis. commit 0e03833bbe86e805c27b754aff84e4f5e8fde6c3 Merge: a04a2948 8426c784 Author: Donald Haase <qu...@ya...> Date: Sat Jan 25 17:57:22 2025 -0500 Merge pull request #914 from KallistiOS/falco/irq.c_build_fix Fixed build issue in irq.c. commit 8426c784cd9f959d8249c5271590e79588f9a5d9 Author: Falco Girgis <gyr...@gm...> Date: Sat Jan 25 16:54:51 2025 -0600 Fixed build issue in irq.c. irq_get_handler() was changed from returning a single function pointer to the old handler to return a function pointer/userdata pair with the new API, but this return statement hadn't been updated. - Updated to return a pair of NULL pointers for the callback struct. commit a04a29480bc58ffc5905908e6643b9c540d86b36 Merge: 727c4008 ee00f1a8 Author: Donald Haase <qu...@ya...> Date: Sat Jan 25 17:18:33 2025 -0500 Merge pull request #910 from darcagn/15bump Update GCC 15.0.0-dev profile name to GCC 15.0.1-dev commit 727c400883b17634f98c4b42207dc8e7f5ca5def Merge: 7917b346 23f1cf94 Author: Donald Haase <qu...@ya...> Date: Sat Jan 25 17:17:15 2025 -0500 Merge pull request #891 from pcercuei/mmu-init-basic mmu: Add support for creating static memory maps commit 7917b346319aa159b10199f77aa091a37e364e20 Merge: 9688eeef 7c3d0871 Author: Donald Haase <qu...@ya...> Date: Sat Jan 25 17:15:28 2025 -0500 Merge pull request #883 from KallistiOS/irq_cleanup_3 IRQ Cleanup Part 3 commit 9688eeefaf568fd3eb8675086c98ee5a5f3e6d6a Merge: 65e1c505 c639750b Author: Donald Haase <qu...@ya...> Date: Sat Jan 25 17:14:38 2025 -0500 Merge pull request #870 from pcercuei/drop-vec3f Drop vec3f ASM commit 65e1c505c19a14800da044bab9d3f8a1be3aafaa Merge: 03b51ef7 67fb082e Author: Donald Haase <qu...@ya...> Date: Sat Jan 25 17:13:56 2025 -0500 Merge pull request #887 from pcercuei/environ.sh environ.sh: Disable -fno-builtin, enable -ffast-math commit ee00f1a816c947061b8600249b3f466899c11971 Author: darc <da...@pr...> Date: Fri Jan 24 12:39:42 2025 -0600 Update GCC 15.0.0-dev profile name to GCC 15.0.1-dev commit 23f1cf94a02d5f2b46d8231d475bbee2f0afd483 Author: Paul Cercueil <pa...@cr...> Date: Wed Jan 22 14:45:40 2025 +0100 doc: CHANGELOG: Add basic MMU functionality Signed-off-by: Paul Cercueil <pa...@cr...> commit 5d6c022ee979460bd3377f3dc3f0b707f9f4283f Author: Paul Cercueil <pa...@cr...> Date: Tue Jan 21 01:10:20 2025 +0100 mmu: Add mmu_shutdown_basic() This function can be used to turn off MMU support after it was initialized with mmu_shutdown_basic(). Signed-off-by: Paul Cercueil <pa...@cr...> commit fe5e812eb272c5643aae8bacd34a13722b94919b Author: Paul Cercueil <pa...@cr...> Date: Fri Jan 10 17:45:58 2025 +0100 mmu: Add mmu_page_map_static() This function reserves one TLB entry to create a static mapping from a virtual memory address to a physical memory address. Static mappings are never flushed out of the TLB, and are sometimes useful when the whole MMU function is not necesary. Static memory mappings can also use different page sizes. Signed-off-by: Paul Cercueil <pa...@cr...> commit e8797cca5979b28acbd8da09ca9d3e5fa51fa99f Author: Paul Cercueil <pa...@cr...> Date: Fri Jan 10 18:10:54 2025 +0100 mmu: Add mmu_init_basic() This function can be used to initialize the MMU with the bare minimum. This is useful for applications that just need to create a few static mappings, without needing the whole dynamic mapping mechanism. Signed-off-by: Paul Cercueil <pa...@cr...> commit b0690ea9fc7b4f389817f0e2f9300c80768b9792 Author: Paul Cercueil <pa...@cr...> Date: Fri Jan 10 17:55:23 2025 +0100 mmu: Replace macros with enums and update mmu_page_map() Introduce the page_prot and page_cache enums, and update the mmu_page_map() function to use these types (as well as bools). Signed-off-by: Paul Cercueil <pa...@cr...> commit 0ee1ae75d6fe8afac6672a3323d21818f2af1d7d Author: Paul Cercueil <pa...@cr...> Date: Fri Jan 10 17:49:41 2025 +0100 mmu: Use standard stdint.h types s/uint32/uint32_t/ s/uint8/uint8_t/ No functional change intended. Signed-off-by: Paul Cercueil <pa...@cr...> commit f0876d4e99485674d91876beea22712fb67dc1ad Author: Paul Cercueil <pa...@cr...> Date: Fri Jan 10 17:47:03 2025 +0100 mmu: Move bit definitions to mmu.c, use regfield macros The bit definitions don't really belong into the public API. mmu.c now uses the GENMASK() and REGFIELD_GET() macros from <kos/regfield.h>. Signed-off-by: Paul Cercueil <pa...@cr...> commit 5b66194b6f1b2a908686a3228b4b83861b2d7482 Author: Paul Cercueil <pa...@cr...> Date: Fri Jan 10 17:20:15 2025 +0100 mmu: Factorize code Factorize code by reusing mmu_ldtlb_quick() inside mmu_ldtlb(), and using the BUILD_* macros inside their corresponding SET_* macros. Signed-off-by: Paul Cercueil <pa...@cr...> commit a2c06d1349210237d0a6ffc0d065c2cfa8cf491a Author: Paul Cercueil <pa...@cr...> Date: Mon Sep 23 22:04:38 2024 +0200 mmu: Make mmu_init() void-typed They would always return 0; so they might just as well not return any value. Signed-off-by: Paul Cercueil <pa...@cr...> commit c620d7c060ff691073fd8eb124be1ccaea35218d Author: Paul Cercueil <pa...@cr...> Date: Tue Jan 21 01:04:49 2025 +0100 doc: CHANGELOG: Add entry about DMAC API I forgot to add it in my PR. Also add a proper header to the dmac.c file. Signed-off-by: Paul Cercueil <pa...@cr...> commit 03b51ef77bd15aea74d54a03ab09b8a6e043db79 Merge: 272f3351 1fc850b9 Author: Lawrence Sebald <ljs...@us...> Date: Tue Jan 21 23:05:47 2025 -0500 Merge pull request #906 from KallistiOS/readdir_null_deref Test for NULL response from readdir. commit 272f3351e2505e4eabcd1d1185e3bd78a94ece17 Merge: 06b08436 0df44582 Author: Lawrence Sebald <ljs...@us...> Date: Tue Jan 21 23:04:29 2025 -0500 Merge pull request #834 from darcagn/m4-single-as-default Make m4-single the default floating-point precision ABI commit 1fc850b9a3ee2ca0d10b33eae084dfbd6fd30e89 Author: QuzarDC <qu...@co...> Date: Tue Jan 21 16:18:27 2025 -0500 Test for NULL response from readdir. Prevents null derefs on empty dirs. commit 0df44582196029ae2975fbac29577c6166b0796a Author: darc <da...@pr...> Date: Tue Jan 21 15:17:28 2025 -0600 Adjust loadable/Makefile.prefab to respect KOS_SH4_PRECISION environment variable commit e76e4ffec53d87c1360f2d89b5ad52b52b9dae63 Author: darc <da...@pr...> Date: Tue Jan 21 14:18:30 2025 -0600 Update CHANGELOG.md and RELNOTES.md for m4-single ABI change commit 6f46b379338f915fe71e3e79c55a13dde504fa15 Author: darc <da...@pr...> Date: Tue Nov 19 18:12:30 2024 -0600 Fallback to m4-single-only if GCC is not built with m4-single support commit 2f90256c39d4c698fe1238775c65a0abb57a008c Author: darc <da...@pr...> Date: Mon Oct 14 17:40:45 2024 -0500 Make m4-single the default floating-point precision ABI commit 7c3d087100ba3ea4e34f8bb413ee061c492acf6a Author: QuzarDC <qu...@co...> Date: Sat Jan 18 17:35:29 2025 -0500 Make irq_cb_t a public type and return it in handler accessors. This now allows for chaining of handlers by retrieving the full handler/userdata set. That way when you install your own you can choose to call the previous one within it. commit 8e880352b8e2b1bdfe52504c1f7060a195ecf477 Author: QuzarDC <qu...@co...> Date: Sat Jan 18 03:54:52 2025 -0500 Clear Timer Interrupts in the default handler. Split from #618 . The existing behavior meant that aside from within an installed general handler, the TMU underflow bit would always be cleared prior to calling its assigned handler. It didn't really make sense as the actual handler would then not be able to use this info. Instead, like for TMU0, handlers are installed to all 3 which just perform this timer clear. Each of the replacement handlers used internally already also clear as well. This might impact 3rd party handlers if they presumed that the timer will have always been cleared first. Also some whitespace cleanup. commit 66d96f91a5f254e4407d0dde25256be00ff48da4 Author: QuzarDC <qu...@co...> Date: Sat Jan 18 03:49:32 2025 -0500 Cleanups of comments and switch to C11 alignas. Split from #618 commit 4169aa2c7b232fdacaaadb4b085476a57b273b3a Author: QuzarDC <qu...@co...> Date: Sat Jan 18 03:42:59 2025 -0500 Expose and document irq_get_sr() from entry.s commit 67fb082e9f1b27fdb18d3b53a193a5bd91a38b3d Author: Paul Cercueil <pa...@cr...> Date: Wed Jan 8 13:26:44 2025 +0100 environ.sh: Enable fast-math by default We recommend -ffast-math everywhere, and everyone seems to be using it. Those who don't, probably don't need the full IEEE compliance and just forgot to add the flag. Note that the previous comment suggested that FSQRT was not used without fast-math, but this was wrong. GCC will still emit that instruction in a "fast path" when it knows it can use it, or a call to the C sqrtf() otherwise. Signed-off-by: Paul Cercueil <pa...@cr...> commit fc5d711ca3797ea5d8c259fa5136dbe59715ab5e Author: Paul Cercueil <pa...@cr...> Date: Wed Jan 8 13:21:50 2025 +0100 environ.sh: Disable -fno-builtin I do not see any valid reason to have it enabled by default. It also most likely prevents GCC from generating better code. Signed-off-by: Paul Cercueil <pa...@cr...> commit d1c9414b50ca7e38639d34e8148c9bd2a04b1e75 Author: Paul Cercueil <pa...@cr...> Date: Wed Jan 8 13:14:25 2025 +0100 environ.sh: Enable -mfsrra -mfsca unconditionally The FSRRA and FSCA instructions will not be used by GCC unless -ffast-math is enabled. Therefore we can move them to the environ_dreamcast.sh script, and leave the -ffast-math option in the main environ.sh script. Signed-off-by: Paul Cercueil <pa...@cr...> commit c639750b0951531b8d338db8b5f1b74d7885e767 Author: Paul Cercueil <pa...@cr...> Date: Wed Dec 18 14:54:46 2024 +0100 Drop vec3f ASM Use the vec3f_t type defined by the header, and replace all inline ASM with C code. Apart from the "fipr" instruction, which we already have macros for, there is absolutely no reason to have these algorithms in ASM. Not only it is unnecessary, it is also harmful as the C compiler cannot re-organize those instructions as it sees fit. Signed-off-by: Paul Cercueil <pa...@cr...> ----------------------------------------------------------------------- Summary of changes: AUTHORS | 2 +- doc/CHANGELOG.md | 4 + doc/RELNOTES.md | 44 +- doc/environ.sh.sample | 27 +- environ_dreamcast.sh | 12 +- examples/dreamcast/libdream/vmu/vmu.c | 18 +- examples/dreamcast/raylib/raytris/Makefile | 30 ++ examples/dreamcast/raylib/raytris/README.md | 34 ++ .../raylib/raytris/romdisk/assets/sound/bgm.adpcm | Bin 0 -> 3395744 bytes .../raylib/raytris/romdisk/assets/sound/clear.wav | Bin 0 -> 68270 bytes .../raylib/raytris/romdisk/assets/sound/rotate.wav | Bin 0 -> 29352 bytes .../dreamcast/raylib/raytris/src/blocks/block.cpp | 67 +++ .../dreamcast/raylib/raytris/src/blocks/block.h | 33 ++ .../dreamcast/raylib/raytris/src/blocks/blocks.cpp | 104 +++++ .../dreamcast/raylib/raytris/src/colors/colors.cpp | 21 + .../dreamcast/raylib/raytris/src/colors/colors.h | 21 + .../raylib/raytris/src/constants/constants.h | 33 ++ .../raylib/raytris/src/constants/vmuIcons.cpp | 285 ++++++++++++ .../raylib/raytris/src/constants/vmuIcons.h | 15 + .../dreamcast/raylib/raytris/src/game/game.cpp | 349 ++++++++++++++ examples/dreamcast/raylib/raytris/src/game/game.h | 57 +++ .../dreamcast/raylib/raytris/src/grid/grid.cpp | 102 +++++ examples/dreamcast/raylib/raytris/src/grid/grid.h | 29 ++ .../raylib/raytris/src/position/position.cpp | 11 + .../raylib/raytris/src/position/position.h | 13 + examples/dreamcast/raylib/raytris/src/raytris.cpp | 94 ++++ .../raylib/raytris/src/sound/soundManager.cpp | 24 + .../raylib/raytris/src/sound/soundManager.h | 22 + examples/dreamcast/raylib/raytris/src/system/cd.h | 37 ++ .../raylib/raytris/src/vmu/vmuManager.cpp | 22 + .../dreamcast/raylib/raytris/src/vmu/vmuManager.h | 16 + examples/dreamcast/readme.md | 4 +- kernel/arch/dreamcast/hardware/dmac.c | 6 + kernel/arch/dreamcast/hardware/maple/controller.c | 13 +- kernel/arch/dreamcast/hardware/pvr/pvr_buffers.c | 12 +- kernel/arch/dreamcast/hardware/pvr/pvr_dma.c | 8 +- kernel/arch/dreamcast/hardware/pvr/pvr_irq.c | 58 +-- kernel/arch/dreamcast/hardware/pvr/pvr_misc.c | 5 +- kernel/arch/dreamcast/hardware/pvr/pvr_scene.c | 15 +- kernel/arch/dreamcast/include/arch/irq.h | 80 +++- kernel/arch/dreamcast/include/arch/mmu.h | 143 ++++-- .../arch/dreamcast/include/dc/maple/controller.h | 10 +- kernel/arch/dreamcast/include/dc/vec3f.h | 509 +++++++-------------- kernel/arch/dreamcast/kernel/irq.c | 51 +-- kernel/arch/dreamcast/kernel/mmu.c | 156 ++++--- kernel/fs/fs.c | 6 +- kernel/libc/posix/sysconf.c | 38 +- loadable/Makefile.prefab | 4 +- utils/dc-chain/Makefile.default.cfg | 34 +- utils/dc-chain/README.md | 2 +- utils/dc-chain/docker/README.md | 2 +- .../{gcc-15.0.0-kos.diff => gcc-15.0.1-kos.diff} | 48 +- ...profile.15.0.0-dev.mk => profile.15.0.1-dev.mk} | 4 +- 53 files changed, 2093 insertions(+), 641 deletions(-) create mode 100644 examples/dreamcast/raylib/raytris/Makefile create mode 100644 examples/dreamcast/raylib/raytris/README.md create mode 100644 examples/dreamcast/raylib/raytris/romdisk/assets/sound/bgm.adpcm create mode 100644 examples/dreamcast/raylib/raytris/romdisk/assets/sound/clear.wav create mode 100644 examples/dreamcast/raylib/raytris/romdisk/assets/sound/rotate.wav create mode 100644 examples/dreamcast/raylib/raytris/src/blocks/block.cpp create mode 100644 examples/dreamcast/raylib/raytris/src/blocks/block.h create mode 100644 examples/dreamcast/raylib/raytris/src/blocks/blocks.cpp create mode 100644 examples/dreamcast/raylib/raytris/src/colors/colors.cpp create mode 100644 examples/dreamcast/raylib/raytris/src/colors/colors.h create mode 100644 examples/dreamcast/raylib/raytris/src/constants/constants.h create mode 100644 examples/dreamcast/raylib/raytris/src/constants/vmuIcons.cpp create mode 100644 examples/dreamcast/raylib/raytris/src/constants/vmuIcons.h create mode 100644 examples/dreamcast/raylib/raytris/src/game/game.cpp create mode 100644 examples/dreamcast/raylib/raytris/src/game/game.h create mode 100644 examples/dreamcast/raylib/raytris/src/grid/grid.cpp create mode 100644 examples/dreamcast/raylib/raytris/src/grid/grid.h create mode 100644 examples/dreamcast/raylib/raytris/src/position/position.cpp create mode 100644 examples/dreamcast/raylib/raytris/src/position/position.h create mode 100644 examples/dreamcast/raylib/raytris/src/raytris.cpp create mode 100644 examples/dreamcast/raylib/raytris/src/sound/soundManager.cpp create mode 100644 examples/dreamcast/raylib/raytris/src/sound/soundManager.h create mode 100644 examples/dreamcast/raylib/raytris/src/system/cd.h create mode 100644 examples/dreamcast/raylib/raytris/src/vmu/vmuManager.cpp create mode 100644 examples/dreamcast/raylib/raytris/src/vmu/vmuManager.h rename utils/dc-chain/patches/{gcc-15.0.0-kos.diff => gcc-15.0.1-kos.diff} (74%) rename utils/dc-chain/profiles/{profile.15.0.0-dev.mk => profile.15.0.1-dev.mk} (98%) diff --git a/AUTHORS b/AUTHORS index f476c351..333e288c 100644 --- a/AUTHORS +++ b/AUTHORS @@ -43,7 +43,7 @@ Joe Fenton: 2016 Stefan Galowicz: 2016, 2017 Luke Benstead: 2020, 2021, 2022, 2023 Eric Fradella: 2023, 2024, 2025 -Falco Girgis: 2023, 2024 +Falco Girgis: 2023, 2024, 2025 Ruslan Rostovtsev: 2014, 2016, 2023, 2024 Colton Pawielski: 2023 Andy Barajas: 2023, 2024 diff --git a/doc/CHANGELOG.md b/doc/CHANGELOG.md index 3f7bccac..d297fd41 100644 --- a/doc/CHANGELOG.md +++ b/doc/CHANGELOG.md @@ -13,6 +13,10 @@ Platform-specific changes are prefixed with the platform name, otherwise the cha - **Dreamcast**: Cleaned up, documented, and enhanced BIOS font API [FG] - Rework PVR hybrid mode + IRQ handling [PC] - **Dreamcast**: Add support and update toolchain profiles for Newlib 4.5.0, Binutils 2.43.1, and GDB 15.2 [EF] +- **Dreamcast**: Make m4-single the default floating-point ABI [EF] +- **Dreamcast**: Add DMAC API [PC] +- **Dreamcast**: Add basic MMU functionality [PC] +- **Dreamcast**: Added Raytris raylib example by Niisoks [FG] ## KallistiOS version 2.1.1 - Added pvrtex utility by TapamN to utils [Daniel Fairchild == DF] diff --git a/doc/RELNOTES.md b/doc/RELNOTES.md index 91ffbab3..8ad24c69 100644 --- a/doc/RELNOTES.md +++ b/doc/RELNOTES.md @@ -2,6 +2,44 @@ KallistiOS ##version## Copyright (C) 2002, 2003 Megan Potter Copyright (C) 2012-2019 Lawrence Sebald Copyright (C) 2024 Donald Haase +Copyright (C) 2025 Eric Fradella + +RELEASE NOTES for 2.2.0 +----------------------- +A significant change has been made regarding the default floating-point ABI used +by KallistiOS. In previous KOS releases, and even in commercial games released +during the Dreamcast's lifetime, the `m4-single-only` floating-point ABI was +used. With the `m4-single-only` ABI, the SH4 CPU is always in single-precision +mode and all uses of 64-bit `double` values are truncated to 32-bit `float` +values by the compiler, allowing the compiler to use twice the number of +floating-point registers at the expense of precision. Going forward, KOS now +uses the `m4-single` floating-point ABI by default. With the `m4-single` ABI, +the SH4 CPU is in single-precision mode upon function entry, but the compiler +can change the mode and use true 64-bit `double` values within functions. For +most projects, there are no implications from this change other than gaining +the ability to use 64-bit `double` values. There are, however, two possibilities +for negative effects: + +- In older projects using `double` values (which were actually being truncated + to 32-bit `float` values upon compilation anyway), the code should be changed + to explicitly use `float` values instead. If not changed, fewer floating-point + registers may be available to the compiler, in exchange for a needless bonus + doubling of floating-point precision. + +- The order of floating-point register names is changed. When using + `m4-single-only`, register names are ordered fr4, fr5, fr6, fr7, etc., but in + `m4-single`, register names are ordered fr5, fr4, fr7, fr6, etc. In order to + account for this difference and still have inline assembly functions using + floating-point registers work properly regardless of the ABI used, the + KOS_FPARG(n) macro has been provided in `arch/args.h`. + +Despite the change to `m4-single` by default, KOS is still committed to full +support for `m4-single-only` in addition to offering new support for +`m4-single`. This is selectable using the `KOS_SH4_PRECISION` environment +variable within environ.sh. It is highly recommended to compile KOS, all +kos-ports, and all libraries with the same uniform setting as your projects. +Other ABIs, such as `m4` or `m4-nofpu`, are not supported at this time. + RELEASE NOTES for 2.1.1 ----------------------- @@ -23,9 +61,9 @@ RELEASE NOTES for 2.1.0 # What's New in Version 2.1.0 -KOS v2.1.0 has been a long time in the making. As such, it seemed prudent to -provide an overview of the new functionality since v2.0.0 in 2013. We intend -to have more frequent versioned releases moving forward, so this kind of +KOS v2.1.0 has been a long time in the making. As such, it seemed prudent to +provide an overview of the new functionality since v2.0.0 in 2013. We intend +to have more frequent versioned releases moving forward, so this kind of information should be easily seen in the changelog. # Core Functionality diff --git a/doc/environ.sh.sample b/doc/environ.sh.sample index 14db9945..eb846c4a 100644 --- a/doc/environ.sh.sample +++ b/doc/environ.sh.sample @@ -181,21 +181,24 @@ export KOS_CFLAGS="${KOS_CFLAGS} -fno-builtin" # however, they do so at the price of accuracy and are not IEEE compliant. # NOTE: Enabling this option will also override -fno-builtin! # -#export KOS_CFLAGS="${KOS_CFLAGS} -fbuiltin -ffast-math -ffp-contract=fast -mfsrra -mfsca" +#export KOS_CFLAGS="${KOS_CFLAGS} -fbuiltin -ffast-math -ffp-contract=fast" -# SH4 Floating Point Arithmetic Precision +# SH4 Floating-Point Arithmetic Precision # -# KallistiOS only officially supports the single-precision-only floating-point -# arithmetic mode (-m4-single-only), but double precision, single default -# (-m4-single) or double precision default (-m4) modes can be enabled here by -# adjusting KOS_SH4_PRECISION. -# WARNING: Adjusting this setting has a high likelihood of breaking KallistiOS, -# kos-ports, and existing codebases which assume -m4-single-only. -# Do not touch this setting unless you know what you are doing! -# NOTE: Altering this setting also requires your toolchain to have been built -# with support for these modes, which is not the case by default! +# KallistiOS supports both the single-precision-default ABI (m4-single) and the +# single-precision-only ABI (m4-single-only). When using m4-single, the SH4 will +# be in single-precision mode upon function entry but will switch to double- +# precision mode if 64-bit doubles are used. When using m4-single-only, the SH4 +# will always be in single-precision mode and 64-bit doubles will be truncated to +# 32-bit floats. Historically, m4-single-only was used in both official and +# homebrew Dreamcast software, but m4-single is the default as of KOS 2.2.0 to +# increase compatibility with newer libraries which require 64-bit doubles. # -export KOS_SH4_PRECISION="-m4-single-only" +# WARNING: When adjusting this setting, make sure all software, including +# kos-ports and linked external libraries, are rebuilt using the same +# floating-point precision ABI setting! +# +export KOS_SH4_PRECISION="-m4-single" # Use LRA (Local Register Allocator) Pass # diff --git a/environ_dreamcast.sh b/environ_dreamcast.sh index 2ae5ccb3..f5adfe5a 100644 --- a/environ_dreamcast.sh +++ b/environ_dreamcast.sh @@ -11,12 +11,18 @@ if ! expr ":$PATH:" : ".*:${DC_TOOLS_BASE}:.*" > /dev/null ; then export PATH="${PATH}:${DC_TOOLS_BASE}" fi -# Default the SH4 floating point precision if it isn't already set. +# Default the SH4 floating-point precision if it isn't already set. +# m4-single is used if supported by the current toolchain, otherwise +# m4-single-only is used as a fallback option. if [ -z "${KOS_SH4_PRECISION}" ] ; then - export KOS_SH4_PRECISION="-m4-single-only" + if echo 'int main(){}' | ${KOS_CC} -x c -c -o /dev/null - -m4-single 2>/dev/null; then + export KOS_SH4_PRECISION="-m4-single" + else + export KOS_SH4_PRECISION="-m4-single-only" + fi fi -export KOS_CFLAGS="${KOS_CFLAGS} ${KOS_SH4_PRECISION} -ml -ffunction-sections -fdata-sections -matomic-model=soft-imask -ftls-model=local-exec" +export KOS_CFLAGS="${KOS_CFLAGS} ${KOS_SH4_PRECISION} -ml -mfsrra -mfsca -ffunction-sections -fdata-sections -matomic-model=soft-imask -ftls-model=local-exec" export KOS_AFLAGS="${KOS_AFLAGS} -little" if [ x${KOS_SUBARCH} = xnaomi ]; then diff --git a/examples/dreamcast/libdream/vmu/vmu.c b/examples/dreamcast/libdream/vmu/vmu.c index 3ec198cb..02d5d69a 100644 --- a/examples/dreamcast/libdream/vmu/vmu.c +++ b/examples/dreamcast/libdream/vmu/vmu.c @@ -4,16 +4,22 @@ /* Thanks to Marcus Comstedt for this VMU format info. */ -#include <kos.h> +#include <stdio.h> +#include <string.h> + +#include <dc/biosfont.h> +#include <dc/video.h> + +#include <dc/maple/vmu.h> /* Draws one file entry, along with its "description" in the boot rom file manager. */ -static int y1 = 20 + 36; +static int off1 = 20 + 36; void draw_one(maple_device_t *addr, char *fn, uint16 hdrblock) { - bfont_draw_str(vram_s + y1 * 640 + 10, 640, 0, "File "); - bfont_draw_str(vram_s + y1 * 640 + 10 + 5 * 12, 640, 0, fn); + bfont_draw_str(vram_s + off1 * 640 + 10, 640, 0, "File "); + bfont_draw_str(vram_s + off1 * 640 + 10 + 5 * 12, 640, 0, fn); if(hdrblock) { uint8 buf[1024]; @@ -24,11 +30,11 @@ void draw_one(maple_device_t *addr, char *fn, uint16 hdrblock) { } buf[0x10 + 32] = 0; - bfont_draw_str(vram_s + y1 * 640 + 10 + (6 + strlen(fn)) * 12, 640, 0, + bfont_draw_str(vram_s + off1 * 640 + 10 + (6 + strlen(fn)) * 12, 640, 0, (char *)(buf + 0x10)); } - y1 += 24; + off1 += 24; } /* We only do the monochrome one here to avoid having to diff --git a/examples/dreamcast/raylib/raytris/Makefile b/examples/dreamcast/raylib/raytris/Makefile new file mode 100644 index 00000000..b7362805 --- /dev/null +++ b/examples/dreamcast/raylib/raytris/Makefile @@ -0,0 +1,30 @@ +# +# Raytris +# Copyright (C) 2024 Cole Hall +# + +TARGET = raytris.elf +OBJS = src/raytris.o romdisk.o src/grid/grid.o src/colors/colors.o src/position/position.o src/blocks/block.o src/constants/vmuIcons.o src/game/game.o src/sound/soundManager.o src/vmu/vmuManager.o +KOS_ROMDISK_DIR = romdisk + +KOS_CFLAGS += -I${KOS_PORTS}/include/raylib + +all: rm-elf $(TARGET) + +include $(KOS_BASE)/Makefile.rules + +clean: rm-elf + -rm -f $(OBJS) + +rm-elf: + -rm -f $(TARGET) romdisk.* + +$(TARGET): $(OBJS) + kos-c++ -o $(TARGET) $(OBJS) -lraylib -lGL -lwav + +run: $(TARGET) + $(KOS_LOADER) $(TARGET) + +dist: $(TARGET) + -rm -f $(OBJS) romdisk.img + $(KOS_STRIP) $(TARGET) \ No newline at end of file diff --git a/examples/dreamcast/raylib/raytris/README.md b/examples/dreamcast/raylib/raytris/README.md new file mode 100644 index 00000000..9bb379cb --- /dev/null +++ b/examples/dreamcast/raylib/raytris/README.md @@ -0,0 +1,34 @@ +# Raytris +A simple legally distinct block stacking puzzle game using raylib and kallistios that runs on the sega dreamcast. + +Anyone is free to do whatever they want with the code in this project. + +## Purpose of this Repository +This is a block stacking puzzle game created using raylib following [this tutorial](https://www.youtube.com/watch?v=wVYKG_ch4yM) by youtuber "[Programming With Nick](https://www.youtube.com/@programmingwithnick)". I wanted to create a game for the sega dreamcast and get it running on actual hardware, but don't actually have any real experience with dreamcast homebrew development or C/C++ development, so this repository is going to show my whole learning process. + +I have decided to continue past the tutorial in order to further develop my skills and make a nicer Raytris experience. You can see this [here](https://github.com/Niisoks/Tetris-RayLib4DC). If you are here _just_ to see what the tutorial looks like on kallistios, [please check the branch titled "TutorialCompletion"](https://github.com/Niisoks/Tetris-RayLib4DC/tree/TutorialCompletion). + +## Tools and references used +- [KallistiOS (KOS)](https://github.com/KallistiOS/KallistiOS) + - [Simulant Discord Server](https://discord.gg/NtBGReCtBT) +- [raylib4Dreamcast](https://github.com/raylib4Consoles/raylib4Dreamcast) + - [raylib](https://github.com/raysan5/raylib) + - [raylib examples](https://www.raylib.com/examples.html) +- [Dreamcast Wiki](https://dreamcast.wiki/Dreamcast.wiki) + +## Assets Used +### Music +- [Block Party Shuffle](https://suno.com/) by [BBHoodsta] + +### Sound effects +- [Sound effects](https://www.zapsplat.com/) + +## Thanks and credits +- Everyone who made and maintain kos +- Everyone who helped port raylib to kos +- Raysan5 for making raylib +- Falco Girgis for pointing me to the right people when i needed help +- Ian Michael for explaining what/why i should use certain audio +- BBHoodsta for showing me where the audio examples are +- Programming with nick for making a nice and easy to follow tutorials +- Everyone else who helped me who i forgot about diff --git a/examples/dreamcast/raylib/raytris/romdisk/assets/sound/bgm.adpcm b/examples/dreamcast/raylib/raytris/romdisk/assets/sound/bgm.adpcm new file mode 100644 index 00000000..dc17bfb7 Binary files /dev/null and b/examples/dreamcast/raylib/raytris/romdisk/assets/sound/bgm.adpcm differ diff --git a/examples/dreamcast/raylib/raytris/romdisk/assets/sound/clear.wav b/examples/dreamcast/raylib/raytris/romdisk/assets/sound/clear.wav new file mode 100644 index 00000000..b94bafc1 Binary files /dev/null and b/examples/dreamcast/raylib/raytris/romdisk/assets/sound/clear.wav differ diff --git a/examples/dreamcast/raylib/raytris/romdisk/assets/sound/rotate.wav b/examples/dreamcast/raylib/raytris/romdisk/assets/sound/rotate.wav new file mode 100644 index 00000000..2b1a64e1 Binary files /dev/null and b/examples/dreamcast/raylib/raytris/romdisk/assets/sound/rotate.wav differ diff --git a/examples/dreamcast/raylib/raytris/src/blocks/block.cpp b/examples/dreamcast/raylib/raytris/src/blocks/block.cpp new file mode 100644 index 00000000..ae987855 --- /dev/null +++ b/examples/dreamcast/raylib/raytris/src/blocks/block.cpp @@ -0,0 +1,67 @@ +/* KallistiOS ##version## + examples/dreamcast/raylib/raytris/src/blocks/block.cpp + Copyright (C) 2024 Cole Hall +*/ + +#include "block.h" +#include "../constants/constants.h" +#include "../constants/vmuIcons.h" + +Block::Block(){ + cellSize = Constants::cellSize; + rotationState = 0; + colors = GetCellColors(); + rowOffset = 0; + columnOffset = 0; + vmuIcon = vmuNULL; +} + +void Block::Draw(int offsetX, int offsetY){ + std::vector<Position> tiles = GetCellPositions(); + for(Position item: tiles){ + DrawRectangle( + item.column * cellSize + offsetX, + item.row * cellSize + offsetY, + cellSize - 1, + cellSize -1, + colors[id] + ); + } +} + +void Block::Move(int rows, int columns){ + rowOffset += rows; + columnOffset += columns; +} + +void Block::Reset(){ + rowOffset = 0; + columnOffset = (Constants::numCols / 2) - 1; +} + +std::vector<Position> Block::GetCellPositions(){ + std::vector<Position> tiles = cells[rotationState]; + std::vector<Position> movedTiles; + for(Position item: tiles){ + Position newPos = Position(item.row + rowOffset, item.column + columnOffset); + movedTiles.push_back(newPos); + } + + return movedTiles; +} + +// Rotate clockwise +void Block::Rotate(){ + rotationState ++; + if(rotationState == static_cast<int>(cells.size())){ + rotationState = 0; + } +} + +// Rotate counter clockwise +void Block::UndoRotation(){ + rotationState --; + if(rotationState == -1){ + rotationState = cells.size() -1; + } +} \ No newline at end of file diff --git a/examples/dreamcast/raylib/raytris/src/blocks/block.h b/examples/dreamcast/raylib/raytris/src/blocks/block.h new file mode 100644 index 00000000..45378ea8 --- /dev/null +++ b/examples/dreamcast/raylib/raytris/src/blocks/block.h @@ -0,0 +1,33 @@ +/* KallistiOS ##version## + examples/dreamcast/raylib/raytris/src/blocks/block.h + Copyright (C) 2024 Cole Hall +*/ + +#pragma once + +#include <vector> +#include <map> +#include "../position/position.h" +#include "../colors/colors.h" + +class Block{ + + public: + Block(); + void Draw(int offsetX, int offsetY); + void Move(int rows, int columns); + void Reset(); + std::vector<Position> GetCellPositions(); + void Rotate(); + void UndoRotation(); + int id; + std::map<int, std::vector<Position>> cells; + const char* vmuIcon; + + private: + int cellSize; + int rotationState; + std::vector<Color> colors; + int rowOffset; + int columnOffset; +}; \ No newline at end of file diff --git a/examples/dreamcast/raylib/raytris/src/blocks/blocks.cpp b/examples/dreamcast/raylib/raytris/src/blocks/blocks.cpp new file mode 100644 index 00000000..f1d7c40e --- /dev/null +++ b/examples/dreamcast/raylib/raytris/src/blocks/blocks.cpp @@ -0,0 +1,104 @@ +/* KallistiOS ##version## + examples/dreamcast/raylib/tetris/src/blocks/blocks.cpp + Copyright (C) 2024 Cole Hall +*/ + +#include "block.h" +#include "../position/position.h" +#include "../constants/vmuIcons.h" + +class LBlock : public Block{ + public: + LBlock(){ + id = 1; + vmuIcon = vmuL; + cells[0] = {Position(0, 2), Position(1, 0), Position(1, 1), Position(1, 2)}; + cells[1] = {Position(0, 1), Position(1, 1), Position(2, 1), Position(2, 2)}; + cells[2] = {Position(1, 0), Position(1, 1), Position(1, 2), Position(2, 0)}; + cells[3] = {Position(0, 0), Position(0, 1), Position(1, 1), Position(2, 1)}; + Move(0, 3); ...<truncated>... hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: quzar <qu...@us...> - 2025-01-20 01:47:11
|
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 06b0843665d5a7afa45bf7d679dccf675ec0e453 (commit) via a3231f457f3fb8442c8a7b9e78f42c10ff1f7f80 (commit) via a20c61927841e8ba0d8732c85c3409b393553b76 (commit) via 37d557dea2aa395fe980370d7915d94e1b115ff2 (commit) via 255e17c48f6439508c1b0b493f5622dc1986d6df (commit) via a5657640b2ccf425e1d6e4e4718fb03a56669c2d (commit) via 5b246dbd1ab8c5e0976197a81e91397349907b10 (commit) via c4e7a0b05d8512006950346d98cb211321b17632 (commit) via fb4ff1cefa8d86241e938db3ace0f91abe8ca572 (commit) via 8a277744e2a4c45ff7b94a4a9af894571641e3bf (commit) via 13cdb081a8a4817b194b663ef567426ccf69c285 (commit) via 1a2db8d2044573ca244eedfce78df1c8e489625c (commit) via ac37700bf34123e96086b63382d3d3d860309cbe (commit) via 04ab390efc2495ee202b92dc395ef18b992edfaa (commit) via 4dcc37545696d28251e21970bcece71263d60270 (commit) via cf41ae4243d971c263f08c4b9abd9f84c7efaedc (commit) via 61d140e37afd3284d12d6b04521782cf4ffe5475 (commit) via d721f513c09088aa47bebe696ba1955509bc604e (commit) via 063cfe2ebbf6bd9730ee1341344381dfb5f7fad0 (commit) via eb848555577d6ea21d9ce10c8194b5a56241ec84 (commit) via e5f606fdeb3d7c28a87cee110cca1ffc6f3e4afa (commit) via d9c4aae26c31a19ed4f6102fe8f301130c71ffd3 (commit) via 1f4dfb739bafb86c00d2c9f30c3af37abf112c18 (commit) via 7b1fdffbcd54ce298ab0786266f1e58e59d82e39 (commit) via 54ac13e471616e9e8ccb9dc773e29a1822e5cca9 (commit) via ddf9995ecf05e3b00c90351a67ce89080961baed (commit) via a963d200a5f2eee564f9335347e613374c284ba0 (commit) via 65a36141de8dd0aa42daa171dd09ce6fe3ce46e3 (commit) via acab06e130a1ebdbd7a8341338a4ba701341cc02 (commit) via ef6046fafad8907feb9a1c60ec012379f830fea1 (commit) from 949af4bbfdcf42bec68d87d265fa59d831f1b21b (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 06b0843665d5a7afa45bf7d679dccf675ec0e453 Merge: a3231f45 37d557de Author: Donald Haase <qu...@ya...> Date: Sun Jan 19 20:44:51 2025 -0500 Merge pull request #901 from KallistiOS/unbreak_dcload Correct logic for looking up a dir in dcload_close. commit a3231f457f3fb8442c8a7b9e78f42c10ff1f7f80 Merge: a20c6192 255e17c4 Author: Donald Haase <qu...@ya...> Date: Sun Jan 19 20:44:32 2025 -0500 Merge pull request #894 from KallistiOS/byteswap_builtins Byteswap builtins commit a20c61927841e8ba0d8732c85c3409b393553b76 Author: jnmartin84 <jnm...@gm...> Date: Sun Jan 19 20:43:52 2025 -0500 Allow `loopstart`, `loopend` setting for `snd_sfx_play_ex` (#900) These match settings already present for the aica sfx playing command. commit 37d557dea2aa395fe980370d7915d94e1b115ff2 Author: QuzarDC <qu...@co...> Date: Sun Jan 19 17:12:32 2025 -0500 Correct logic for looking up a dir in dcload_close. commit 255e17c48f6439508c1b0b493f5622dc1986d6df Author: QuzarDC <qu...@co...> Date: Sun Jan 19 14:46:14 2025 -0500 Cleanup arch byteswapping. Repalce the inline asm with gcc builtins which should allow for better optimization. Additionally make them static inline functions to leverage type checking and ease binding. commit a5657640b2ccf425e1d6e4e4718fb03a56669c2d Merge: 5b246dbd 8a277744 Author: Donald Haase <qu...@ya...> Date: Sat Jan 18 03:26:40 2025 -0500 Merge pull request #898 from pcercuei/vmufb-xbm vmufb: Add vmufb_paint_xbm() commit 5b246dbd1ab8c5e0976197a81e91397349907b10 Merge: c4e7a0b0 13cdb081 Author: Donald Haase <qu...@ya...> Date: Sat Jan 18 03:26:09 2025 -0500 Merge pull request #871 from pcercuei/dmac DMA Controller API commit c4e7a0b05d8512006950346d98cb211321b17632 Merge: fb4ff1ce 54ac13e4 Author: Donald Haase <qu...@ya...> Date: Sat Jan 18 03:25:44 2025 -0500 Merge pull request #838 from DC-SWAT/snd_stream_fill Improved sound streams data processing. commit fb4ff1cefa8d86241e938db3ace0f91abe8ca572 Merge: 949af4bb 61d140e3 Author: Donald Haase <qu...@ya...> Date: Sat Jan 18 03:25:05 2025 -0500 Merge pull request #885 from nextgeniuspro/snd_sfx_loop Add looping support to snd_sfxmgr commit 8a277744e2a4c45ff7b94a4a9af894571641e3bf Author: Paul Cercueil <pa...@cr...> Date: Fri Jan 17 12:31:17 2025 +0100 vmufb: Add vmufb_paint_xbm() This function can be used to display a X11 XBM image onto the VMU framebuffer. Signed-off-by: Paul Cercueil <pa...@cr...> commit 13cdb081a8a4817b194b663ef567426ccf69c285 Author: Paul Cercueil <pa...@cr...> Date: Wed Jan 15 18:12:37 2025 +0100 examples: Add DMA speedtest example This speedtest example will benchmark the speed of the DMAC and the speed of the PVR DMA, doing transfers between RAM buffers, between VRAM buffers, and between RAM and VRAM buffers. Signed-off-by: Paul Cercueil <pa...@cr...> commit 1a2db8d2044573ca244eedfce78df1c8e489625c Author: Paul Cercueil <pa...@cr...> Date: Wed Jan 15 18:15:04 2025 +0100 pvr: Flush source buffer in pvr_dma_transfer() The pvr_dma_transfer(), as well as the pvr_txr_load_dma(), pvr_dma_load_ta() and pvr_dma_yuv_conv() functions, expected the source data to be completely flushed to RAM, without it being explicitly written anywhere. Therefore, the expectation was that manual handling of the cache was not required. Update the pvr_dma_transfer() function (called by the other ones) to handle the cache flush itself. Signed-off-by: Paul Cercueil <pa...@cr...> commit ac37700bf34123e96086b63382d3d3d860309cbe Author: Paul Cercueil <pa...@cr...> Date: Wed Jan 15 15:50:46 2025 +0100 timer: Set IRQ source priority with irq_set_priority() Use the dedicated API to set the IRQ source's priority. Signed-off-by: Paul Cercueil <pa...@cr...> commit 04ab390efc2495ee202b92dc395ef18b992edfaa Author: Paul Cercueil <pa...@cr...> Date: Wed Jan 15 15:49:57 2025 +0100 watchdog: Set IRQ source priority with irq_set_priority() Use the dedicated API to set the IRQ source's priority. Signed-off-by: Paul Cercueil <pa...@cr...> commit 4dcc37545696d28251e21970bcece71263d60270 Author: Paul Cercueil <pa...@cr...> Date: Wed Jan 15 15:49:20 2025 +0100 scif: Set IRQ source priority with irq_set_priority() Use the dedicated API to set the IRQ source's priority. Signed-off-by: Paul Cercueil <pa...@cr...> commit cf41ae4243d971c263f08c4b9abd9f84c7efaedc Author: Paul Cercueil <pa...@cr...> Date: Wed Jan 15 15:46:58 2025 +0100 irq: Add irq_{get,set}_priority() functions The irq_set_priority() function can be used to change the priority of a given IRQ source, and to mask IRQs from a given IRQ source. The irq_get_priority() returns the priority value of a given IRQ source. Signed-off-by: Paul Cercueil <pa...@cr...> commit 61d140e37afd3284d12d6b04521782cf4ffe5475 Author: Yev <ev...@gm...> Date: Fri Jan 10 20:56:21 2025 +0100 Add looping support to snd_sfxmgr commit d721f513c09088aa47bebe696ba1955509bc604e Merge: 063cfe2e 4120477f Author: Yev <ev...@gm...> Date: Fri Jan 10 15:13:02 2025 +0100 Merge branch 'master' into snd_sfx_loop commit 063cfe2ebbf6bd9730ee1341344381dfb5f7fad0 Author: Yev <ev...@gm...> Date: Fri Jan 10 11:19:51 2025 +0100 Add looping support to snd_sfxmgr commit eb848555577d6ea21d9ce10c8194b5a56241ec84 Author: Paul Cercueil <pa...@cr...> Date: Wed Jan 8 12:46:17 2025 +0100 irq: Use regfield macros and mask DMA IRQs on shutdown Make the code more self-describing by using the regfield macros. Mask DMA IRQs on shutdown to avoid potential nasty bugs. Signed-off-by: Paul Cercueil <pa...@cr...> commit e5f606fdeb3d7c28a87cee110cca1ffc6f3e4afa Author: Paul Cercueil <pa...@cr...> Date: Sun Dec 15 17:01:31 2024 +0100 pvr: Use DMA Controller API Use the new DMA Controller API instead of poking into the DMAC registers directly. Signed-off-by: Paul Cercueil <pa...@cr...> commit d9c4aae26c31a19ed4f6102fe8f301130c71ffd3 Author: Paul Cercueil <pa...@cr...> Date: Sun Dec 15 16:10:40 2024 +0100 Add DMA Controller API Introduce an API to use the DMA Controller of the SH4. This new API can be used to program DMA transfers between memory and devices, or from memory to memory. Signed-off-by: Paul Cercueil <pa...@cr...> commit 1f4dfb739bafb86c00d2c9f30c3af37abf112c18 Author: Paul Cercueil <pa...@cr...> Date: Tue Jan 7 20:45:33 2025 +0100 irq: Unmask DMA IRQs By default, the DMA IRQs have a priority of 0, which means that they are masked. Increase that to a priority of 3, which unmasks them. Signed-off-by: Paul Cercueil <pa...@cr...> commit 7b1fdffbcd54ce298ab0786266f1e58e59d82e39 Author: Yev <ev...@gm...> Date: Tue Jan 7 17:53:56 2025 +0100 Add looping support to snd_sfxmgr commit 54ac13e471616e9e8ccb9dc773e29a1822e5cca9 Author: DC-SWAT <sw...@21...> Date: Sun Jan 5 23:49:32 2025 +0700 Add check memory allocation for sound streams. commit ddf9995ecf05e3b00c90351a67ce89080961baed Author: DC-SWAT <sw...@21...> Date: Tue Dec 10 17:47:59 2024 +0700 Fix aligment for SPU DMA in sound streams. commit a963d200a5f2eee564f9335347e613374c284ba0 Author: DC-SWAT <sw...@21...> Date: Tue Dec 10 10:46:13 2024 +0700 Handle SPU DMA errors better. commit 65a36141de8dd0aa42daa171dd09ce6fe3ce46e3 Author: DC-SWAT <sw...@21...> Date: Tue Nov 12 15:29:41 2024 +0700 Updated SND_STREAM_BUFFER_MAX commit acab06e130a1ebdbd7a8341338a4ba701341cc02 Author: DC-SWAT <sw...@21...> Date: Wed Nov 6 16:24:09 2024 +0700 Minor fixes from review suggestions. commit ef6046fafad8907feb9a1c60ec012379f830fea1 Author: DC-SWAT <sw...@21...> Date: Mon Oct 28 13:07:41 2024 +0700 Improved sound streams data processing. - Refactoring for data preparation. - Use DMA for all possible transfers. Freeup SQs. - Minor fixes and optimizations. ----------------------------------------------------------------------- Summary of changes: examples/dreamcast/basic/dma/speedtest/Makefile | 20 ++ examples/dreamcast/basic/dma/speedtest/speedtest.c | 133 +++++++ kernel/arch/dreamcast/exports-naomi.txt | 1 + kernel/arch/dreamcast/exports-pristine.txt | 1 + kernel/arch/dreamcast/fs/fs_dcload.c | 2 +- kernel/arch/dreamcast/hardware/Makefile | 2 +- kernel/arch/dreamcast/hardware/dmac.c | 162 +++++++++ kernel/arch/dreamcast/hardware/pvr/pvr_dma.c | 29 +- kernel/arch/dreamcast/hardware/pvr/pvr_irq.c | 6 - kernel/arch/dreamcast/hardware/scif.c | 4 +- kernel/arch/dreamcast/include/arch/byteorder.h | 34 +- kernel/arch/dreamcast/include/arch/dmac.h | 246 +++++++++++++ kernel/arch/dreamcast/include/arch/irq.h | 52 +++ kernel/arch/dreamcast/include/dc/sound/sfxmgr.h | 35 ++ kernel/arch/dreamcast/include/dc/sound/stream.h | 14 +- kernel/arch/dreamcast/include/dc/vmu_fb.h | 22 ++ kernel/arch/dreamcast/kernel/irq.c | 28 ++ kernel/arch/dreamcast/kernel/ser_console.c | 5 +- kernel/arch/dreamcast/kernel/timer.c | 9 +- kernel/arch/dreamcast/kernel/wdt.c | 11 +- kernel/arch/dreamcast/sound/snd_sfxmgr.c | 100 ++++-- kernel/arch/dreamcast/sound/snd_stream.c | 392 ++++++++++----------- kernel/arch/dreamcast/util/vmu_fb.c | 31 +- 23 files changed, 1036 insertions(+), 303 deletions(-) create mode 100644 examples/dreamcast/basic/dma/speedtest/Makefile create mode 100644 examples/dreamcast/basic/dma/speedtest/speedtest.c create mode 100644 kernel/arch/dreamcast/hardware/dmac.c create mode 100644 kernel/arch/dreamcast/include/arch/dmac.h diff --git a/examples/dreamcast/basic/dma/speedtest/Makefile b/examples/dreamcast/basic/dma/speedtest/Makefile new file mode 100644 index 00000000..2b1c31d9 --- /dev/null +++ b/examples/dreamcast/basic/dma/speedtest/Makefile @@ -0,0 +1,20 @@ +# +# DMA speedtest program +# Copyright (C) 2025 Paul Cercueil +# + +TARGET = speedtest.elf +OBJS = speedtest.o + +all: rm-elf $(TARGET) + +include $(KOS_BASE)/Makefile.rules + +clean: rm-elf + -rm -f $(OBJS) + +rm-elf: + -rm -f $(TARGET) + +$(TARGET): $(OBJS) + kos-cc -o $@ $^ diff --git a/examples/dreamcast/basic/dma/speedtest/speedtest.c b/examples/dreamcast/basic/dma/speedtest/speedtest.c new file mode 100644 index 00000000..9572b82a --- /dev/null +++ b/examples/dreamcast/basic/dma/speedtest/speedtest.c @@ -0,0 +1,133 @@ +/* KallistiOS ##version## + + speedtest.c + Copyright (C) 2025 Paul Cercueil +*/ + +#include <stdio.h> +#include <stdint.h> + +#include <arch/dmac.h> +#include <arch/timer.h> +#include <arch/irq.h> +#include <dc/pvr.h> +#include <kos/genwait.h> + +#define ARRAY_SIZE(x) (sizeof(x) ? sizeof(x) / sizeof((x)[0]) : 0) + +#define BUF_SIZE (1024 * 1024) + +static alignas(32) char buf1[BUF_SIZE]; +static alignas(32) char buf2[BUF_SIZE]; + +static void dma_done(void *d) +{ + *(uint64_t *)d = timer_us_gettime64(); + genwait_wake_all(d); +} + +static dma_config_t dma_cfg = { + .channel = 1, + .request = DMA_REQUEST_AUTO_MEM_TO_MEM, + .unit_size = DMA_UNITSIZE_32BYTE, + .src_mode = DMA_ADDRMODE_INCREMENT, + .dst_mode = DMA_ADDRMODE_INCREMENT, + .transmit_mode = DMA_TRANSMITMODE_BURST, + .callback = dma_done, +}; + +static uint64_t +do_dma_transfer(unsigned int test, pvr_ptr_t vram1, pvr_ptr_t vram2) +{ + uint64_t before, after = 0; + + irq_disable_scoped(); + + before = timer_us_gettime64(); + + switch (test) { + case 0: + /* RAM to RAM */ + dma_transfer(&dma_cfg, + dma_map_dst(buf1, BUF_SIZE), + dma_map_src(buf2, BUF_SIZE), + BUF_SIZE, &after); + break; + case 1: + /* RAM to VRAM */ + dma_transfer(&dma_cfg, + hw_to_dma_addr((uintptr_t)vram1), + dma_map_src(buf2, BUF_SIZE), + BUF_SIZE, &after); + break; + case 2: + /* VRAM to RAM */ + dma_transfer(&dma_cfg, + dma_map_dst(buf1, BUF_SIZE), + hw_to_dma_addr((uintptr_t)vram1), + BUF_SIZE, &after); + break; + case 3: + /* VRAM to VRAM */ + dma_transfer(&dma_cfg, + hw_to_dma_addr((uintptr_t)vram1), + hw_to_dma_addr((uintptr_t)vram2), + BUF_SIZE, &after); + break; + case 4: + /* RAM to VRAM using SQs */ + pvr_txr_load(buf1, vram1, BUF_SIZE); + + return timer_us_gettime64() - before; + case 5: + /* RAM to 64-bit VRAM using PVR DMA */ + pvr_txr_load_dma(buf1, vram1, BUF_SIZE, + 0, dma_done, &after); + break; + case 6: + /* RAM to 32-bit VRAM using PVR DMA */ + pvr_dma_transfer(buf1, (uintptr_t)vram1, BUF_SIZE, + PVR_DMA_VRAM32, 0, + dma_done, &after); + break; + } + + while ((volatile uint64_t)after == 0) + genwait_wait(&after, "IRQ wait", 0, NULL); + + return after - before; +} + +static const char * const test_lbl[] = { + "DMAC, RAM to RAM: ", + "DMAC, RAM to VRAM: ", + "DMAC, VRAM to RAM: ", + "DMAC, VRAM to VRAM: ", + "PVR SQs: ", + "PVR DMA, 64-bit: ", + "PVR DMA, 32-bit: ", +}; + +int main(int argc, char **argv) +{ + pvr_ptr_t vram, vram2; + uint64_t time_us; + unsigned int i; + + pvr_init_defaults(); + + vram = pvr_mem_malloc(BUF_SIZE); + vram2 = pvr_mem_malloc(BUF_SIZE); + + for (i = 0; i < ARRAY_SIZE(test_lbl); i++) { + time_us = do_dma_transfer(i, vram, vram2); + printf("%s%f MiB/s\n", + test_lbl[i], (float)BUF_SIZE / (float)time_us); + + } + + pvr_mem_free(vram); + pvr_mem_free(vram2); + + return 0; +} diff --git a/kernel/arch/dreamcast/exports-naomi.txt b/kernel/arch/dreamcast/exports-naomi.txt index 20fac7bb..8624b585 100644 --- a/kernel/arch/dreamcast/exports-naomi.txt +++ b/kernel/arch/dreamcast/exports-naomi.txt @@ -118,6 +118,7 @@ snd_sfx_load_fd snd_sfx_play snd_sfx_stop_all snd_sfx_play_chn +snd_sfx_play_ex snd_sfx_stop snd_sfx_chn_alloc snd_sfx_chn_free diff --git a/kernel/arch/dreamcast/exports-pristine.txt b/kernel/arch/dreamcast/exports-pristine.txt index 829d112d..ac7531ab 100644 --- a/kernel/arch/dreamcast/exports-pristine.txt +++ b/kernel/arch/dreamcast/exports-pristine.txt @@ -174,6 +174,7 @@ snd_sfx_load_fd snd_sfx_play snd_sfx_stop_all snd_sfx_play_chn +snd_sfx_play_ex snd_sfx_stop snd_sfx_chn_alloc snd_sfx_chn_free diff --git a/kernel/arch/dreamcast/fs/fs_dcload.c b/kernel/arch/dreamcast/fs/fs_dcload.c index b27c935e..302db0b1 100644 --- a/kernel/arch/dreamcast/fs/fs_dcload.c +++ b/kernel/arch/dreamcast/fs/fs_dcload.c @@ -175,7 +175,7 @@ static int dcload_close(void * h) { i = hnd_is_dir(hnd); /* We found it in the list, so it's a dir */ - if(!i) { + if(i) { dclsc(DCLOAD_CLOSEDIR, hnd); LIST_REMOVE(i, fhlist); free(i->path); diff --git a/kernel/arch/dreamcast/hardware/Makefile b/kernel/arch/dreamcast/hardware/Makefile index f83f51db..bf010e51 100644 --- a/kernel/arch/dreamcast/hardware/Makefile +++ b/kernel/arch/dreamcast/hardware/Makefile @@ -28,7 +28,7 @@ OBJS += asic.o g2bus.o OBJS += video.o vblank.o # CPU-related -OBJS += sq.o sq_fast_cpy.o scif.o ubc.o +OBJS += sq.o sq_fast_cpy.o scif.o ubc.o dmac.o # SPI device support OBJS += scif-spi.o sd.o diff --git a/kernel/arch/dreamcast/hardware/dmac.c b/kernel/arch/dreamcast/hardware/dmac.c new file mode 100644 index 00000000..67bd9c54 --- /dev/null +++ b/kernel/arch/dreamcast/hardware/dmac.c @@ -0,0 +1,162 @@ +#include <arch/cache.h> +#include <arch/dmac.h> +#include <arch/irq.h> +#include <arch/memory.h> +#include <kos/dbglog.h> +#include <kos/genwait.h> +#include <kos/regfield.h> + +#include <errno.h> + +#define DMAC_BASE 0xffa00000 + +typedef enum dma_register { + DMA_REG_SAR = 0x00, /* Source Address Register */ + DMA_REG_DAR = 0x04, /* Destination Address Register */ + DMA_REG_TCR = 0x08, /* Transfer Count Register */ + DMA_REG_CHCR = 0x0C, /* Channel Control Register */ + DMA_REG_DMAOR = 0x40, /* DMA Operation Register */ +} dma_register_t; + +#define REG_CHCR_DST_ADDRMODE GENMASK(15, 14) +#define REG_CHCR_SRC_ADDRMODE GENMASK(13, 12) +#define REG_CHCR_REQUEST GENMASK(11, 8) +#define REG_CHCR_TRANSMIT_MODE BIT(7) +#define REG_CHCR_BUSWIDTH GENMASK(6, 4) +#define REG_CHCR_INTERRUPT_EN BIT(2) +#define REG_CHCR_TRANSFER_END BIT(1) +#define REG_CHCR_DMAC_EN BIT(0) + +static const dma_config_t *channels_cfg[4]; + +static const irq_t channel_to_irq[] = { + [0] = EXC_DMAC_DMTE0, + [1] = EXC_DMAC_DMTE1, + [2] = EXC_DMAC_DMTE2, + [3] = EXC_DMAC_DMTE3, +}; + +static inline unsigned char irq_to_channel(irq_t irq) { + return (irq - EXC_DMAC_DMTE0) >> 5; +} + +static uint32_t dmac_read(dma_channel_t channel, dma_register_t reg) { + return *(volatile uint32_t *)(DMAC_BASE + channel * 0x10 + reg); +} + +static void dmac_write(dma_channel_t channel, dma_register_t reg, uint32_t val) { + *(volatile uint32_t *)(DMAC_BASE + channel * 0x10 + reg) = val; +} + +dma_addr_t hw_to_dma_addr(uintptr_t hw_addr) { + return (dma_addr_t)(hw_addr & MEM_AREA_CACHE_MASK); +} + +static dma_addr_t dma_map_src_dst(uintptr_t addr, size_t len, bool is_dst) { + switch(addr & ~MEM_AREA_CACHE_MASK) { + case MEM_AREA_P0_BASE: + case MEM_AREA_P1_BASE: + case MEM_AREA_P3_BASE: + if(is_dst) + dcache_inval_range(addr, len); + else + dcache_flush_range(addr, len); + break; + + default: + /* Nothing to do */ + break; + } + + return hw_to_dma_addr(addr); +} + +dma_addr_t dma_map_src(const void *ptr, size_t len) { + return dma_map_src_dst((uintptr_t)ptr, len, false); +} + +dma_addr_t dma_map_dst(void *ptr, size_t len) { + return dma_map_src_dst((uintptr_t)ptr, len, true); +} + +static const unsigned char dma_unit_size[] = { + [DMA_UNITSIZE_64BIT] = 8, + [DMA_UNITSIZE_8BIT] = 1, + [DMA_UNITSIZE_16BIT] = 2, + [DMA_UNITSIZE_32BIT] = 4, + [DMA_UNITSIZE_32BYTE] = 32, +}; + +static void dma_irq_handler(irq_t code, irq_context_t *context, void *d) { + unsigned char channel = irq_to_channel(code); + + (void)context; + + /* ACK the IRQ by clearing CHCR */ + dmac_write(channel, DMA_REG_CHCR, 0); + + genwait_wake_all((void *)&channels_cfg[channel]->callback); + channels_cfg[channel]->callback(d); +} + +static bool dma_is_running(dma_channel_t channel) { + uint32_t chcr = dmac_read(channel, DMA_REG_CHCR); + + return (chcr & (REG_CHCR_TRANSFER_END | REG_CHCR_DMAC_EN)) == REG_CHCR_DMAC_EN; +} + +void dma_wait_complete(dma_channel_t channel) { + irq_disable_scoped(); + + while(dma_is_running(channel)) { + if(!irq_inside_int()) { + if(channels_cfg[channel]->callback) + genwait_wait(channels_cfg[channel]->callback, "DMA complete wait", 0, NULL); + else + thd_pass(); + } + } +} + +int dma_transfer(const dma_config_t *cfg, dma_addr_t dst, dma_addr_t src, + size_t len, void *cb_data) { + unsigned int transfer_size = dma_unit_size[cfg->unit_size]; + uint32_t chcr; + + if((len | dst | src) & (transfer_size - 1)) { + dbglog(DBG_ERROR, "dmac: src/dst/len not aligned to the bus width\n"); + errno = EFAULT; + return -1; + } + + irq_disable_scoped(); + + dma_wait_complete(cfg->channel); + channels_cfg[cfg->channel] = cfg; + + dmac_write(cfg->channel, DMA_REG_CHCR, 0); + dmac_write(cfg->channel, DMA_REG_SAR, src); + dmac_write(cfg->channel, DMA_REG_DAR, dst); + dmac_write(cfg->channel, DMA_REG_TCR, len >> __builtin_ctz(transfer_size)); + + irq_set_handler(channel_to_irq[cfg->channel], dma_irq_handler, cb_data); + + chcr = FIELD_PREP(REG_CHCR_DST_ADDRMODE, cfg->dst_mode) + | FIELD_PREP(REG_CHCR_SRC_ADDRMODE, cfg->src_mode) + | FIELD_PREP(REG_CHCR_REQUEST, cfg->request) + | FIELD_PREP(REG_CHCR_TRANSMIT_MODE, cfg->transmit_mode) + | FIELD_PREP(REG_CHCR_BUSWIDTH, cfg->unit_size) + | FIELD_PREP(REG_CHCR_INTERRUPT_EN, !!cfg->callback) + | FIELD_PREP(REG_CHCR_DMAC_EN, 1); + + dmac_write(cfg->channel, DMA_REG_CHCR, chcr); + + return 0; +} + +size_t dma_transfer_get_remaining(dma_channel_t channel) { + unsigned char unit_size = channels_cfg[channel]->unit_size; + uint32_t tcr = dmac_read(channel, DMA_REG_TCR); + + return tcr * dma_unit_size[unit_size]; +} diff --git a/kernel/arch/dreamcast/hardware/pvr/pvr_dma.c b/kernel/arch/dreamcast/hardware/pvr/pvr_dma.c index 40ed9cd9..98196e6b 100644 --- a/kernel/arch/dreamcast/hardware/pvr/pvr_dma.c +++ b/kernel/arch/dreamcast/hardware/pvr/pvr_dma.c @@ -11,9 +11,9 @@ #include <stdio.h> #include <errno.h> +#include <arch/dmac.h> #include <dc/pvr.h> #include <dc/asic.h> -#include <dc/dmac.h> #include <dc/sq.h> #include <kos/thread.h> #include <kos/sem.h> @@ -42,7 +42,7 @@ static void pvr_dma_irq_hnd(uint32_t code, void *data) { (void)code; (void)data; - if(DMAC_DMATCR2 != 0) + if(dma_transfer_get_remaining(DMA_CHANNEL_2) != 0) dbglog(DBG_INFO, "pvr_dma: The dma did not complete successfully\n"); /* Call the callback, if any. */ @@ -95,10 +95,18 @@ static uintptr_t pvr_dest_addr(uintptr_t dest, pvr_dma_type_t type) { return dest_addr; } +static const dma_config_t pvr_dma_config = { + .channel = DMA_CHANNEL_2, + .request = DMA_REQUEST_EXTERNAL_MEM_TO_DEV, + .unit_size = DMA_UNITSIZE_32BYTE, + .src_mode = DMA_ADDRMODE_INCREMENT, + .transmit_mode = DMA_TRANSMITMODE_BURST, +}; + int pvr_dma_transfer(const void *src, uintptr_t dest, size_t count, pvr_dma_type_t type, bool block, pvr_dma_callback_t callback, void *cbdata) { - uintptr_t src_addr = ((uintptr_t)src); + dma_addr_t src_addr = dma_map_src(src, count); /* Check for 32-byte alignment */ if(src_addr & 0x1F) { @@ -118,21 +126,8 @@ int pvr_dma_transfer(const void *src, uintptr_t dest, size_t count, return -1; } - if(DMAC_CHCR2 & 0x1) /* DE bit set so we must clear it */ - DMAC_CHCR2 &= ~0x1; - - if(DMAC_CHCR2 & 0x2) /* TE bit set so we must clear it */ - DMAC_CHCR2 &= ~0x2; - - DMAC_SAR2 = src_addr; - DMAC_DMATCR2 = count / 32; - DMAC_CHCR2 = 0x12c1; - - if((DMAC_DMAOR & DMAOR_STATUS_MASK) != DMAOR_NORMAL_OPERATION) { - dbglog(DBG_ERROR, "pvr_dma: Failed DMAOR check\n"); - errno = EIO; + if(dma_transfer(&pvr_dma_config, 0, src_addr, count, NULL)) return -1; - } pvr_dma[PVR_STATE] = pvr_dest_addr(dest, type); pvr_dma[PVR_LEN] = count; diff --git a/kernel/arch/dreamcast/hardware/pvr/pvr_irq.c b/kernel/arch/dreamcast/hardware/pvr/pvr_irq.c index 5feb2f1c..d54057d5 100644 --- a/kernel/arch/dreamcast/hardware/pvr/pvr_irq.c +++ b/kernel/arch/dreamcast/hardware/pvr/pvr_irq.c @@ -49,12 +49,6 @@ static void dma_next_list(void *thread) { continue; } - // Flush the last 32 bytes out of dcache, just in case. - // dcache_flush_range((ptr_t)(b->base[i] + b->ptr[i] - 32), 32); - dcache_flush_range((ptr_t)(b->base[i]), b->ptr[i] + 32); - //amt = b->ptr[i] > 16384 ? 16384 : b->ptr[i]; - //dcache_flush_range((ptr_t)(b->base[i] + b->ptr[i] - amt), amt); - // Start the DMA transfer, chaining to ourselves. //DBG(("dma_begin(buf %d, list %d, base %p, len %d)\n", // pvr_state.ram_target ^ 1, i, diff --git a/kernel/arch/dreamcast/hardware/scif.c b/kernel/arch/dreamcast/hardware/scif.c index 1e87f826..4ceab8ca 100644 --- a/kernel/arch/dreamcast/hardware/scif.c +++ b/kernel/arch/dreamcast/hardware/scif.c @@ -165,7 +165,7 @@ int scif_set_irq_usage(int on) { irq_set_handler(EXC_SCIF_ERI, scif_err_irq, NULL); irq_set_handler(EXC_SCIF_BRI, scif_err_irq, NULL); irq_set_handler(EXC_SCIF_RXI, scif_data_irq, NULL); - *((vuint16*)0xffd0000c) |= 0x000e << 4; + irq_set_priority(IRQ_SRC_SCIF, 14); /* Enable transmit/receive, recv/recv error ints */ SCSCR2 |= 0x48; @@ -175,7 +175,7 @@ int scif_set_irq_usage(int on) { SCSCR2 &= ~0x48; ...<truncated>... hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: quzar <qu...@us...> - 2025-01-15 04:38:29
|
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 949af4bbfdcf42bec68d87d265fa59d831f1b21b (commit) via e96a0dd35653657b5172b95bf89712d4a583453e (commit) via b01c03a8f263c5df01fb73e1ec7e6563a06c06de (commit) via 8ca42961e97bad2f3c64e6b29b14f8d1cc8a978e (commit) via 88232c248ded7795a849a82017a06327b7ca3e5c (commit) via 9aa41bb15afa4f2e15763b7b4fd8b8eab0248f97 (commit) via e23732f16e28f02813e2cbdba36a5bca50c2d687 (commit) via db865c58dfd8d1dbf4ec3f58757f658e8fe3309f (commit) via 9643f03cb7aaee1b77f4f49663f0100f00334746 (commit) via 443bcc39c75e1cf5b96fe9f1f9661ddf68221006 (commit) via 86465e336cded75236a53c0e05f096d062b5ffba (commit) via 4c987a727496a0bb97aff31381fdd791377e2ea5 (commit) via 7193f1ca344ccaa0741383875e50aa0c2146f133 (commit) via 78f450ff297c3b4d18dbe8ed61fc7975fc153edf (commit) via 2666394e823ee53e4715aad4bafec44ad20f7dcd (commit) via dd287228e3e06eeaa59da99bd23e99a17840079f (commit) via 9165f26d65c9a22e5a45b8fb510bf9fb1d8fec04 (commit) via 5ea0ac6175979e5cf5a8b13407a2b3066bbb2be2 (commit) via 0637a90dbeae8f87728fa06ac45d7b6324625b29 (commit) via 95592bccdd52c730025a60e1b636daf4fc835192 (commit) via de21e057c3a41488553b61db4d2fef7ad8e145ba (commit) via 8e25a1930ba5ca9f8825e1e381ee54229245d685 (commit) via 6c9f5f632dfffbc5b7a7f1e26da59a2bf9871efb (commit) via b147382890f551e88ef7e1ba9b61c363d49b3bd5 (commit) via 0f171547e2411d62f8c02c77423025776a4e0e6a (commit) via ccec1cc36977acce789ed7b36ce066ce9ec15399 (commit) via ae9083924dd643a277efca80294879042f5a770c (commit) via 01ece409a12ae43643c593da266b71fed6dc0278 (commit) via ba9abe5eba98c7075f8670cfcdcb7d92c74b7340 (commit) via 721a210503b46cbaa14d2a1e03024a55375e4c4b (commit) from 4120477f4344f89a5bcc121ced62ff751901db17 (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 949af4bbfdcf42bec68d87d265fa59d831f1b21b Merge: e96a0dd3 e23732f1 Author: Donald Haase <qu...@ya...> Date: Tue Jan 14 23:19:11 2025 -0500 Merge pull request #896 from pcercuei/perf-counters Fix and improve performance counters commit e96a0dd35653657b5172b95bf89712d4a583453e Merge: b01c03a8 7193f1ca Author: Donald Haase <qu...@ya...> Date: Tue Jan 14 23:14:00 2025 -0500 Merge pull request #893 from KallistiOS/unhack_fs_dcload Unhack fs dcload commit b01c03a8f263c5df01fb73e1ec7e6563a06c06de Merge: 8ca42961 443bcc39 Author: Donald Haase <qu...@ya...> Date: Tue Jan 14 23:13:37 2025 -0500 Merge pull request #895 from darcagn/update-changelogs Update changelogs and AUTHORS commit 8ca42961e97bad2f3c64e6b29b14f8d1cc8a978e Merge: 88232c24 8e25a193 Author: Donald Haase <qu...@ya...> Date: Tue Jan 14 23:09:11 2025 -0500 Merge pull request #890 from pcercuei/pvr-fix-mutex-unlock pvr: Fix dma_next_list() incorrectly unlocking mutex commit 88232c248ded7795a849a82017a06327b7ca3e5c Merge: 9aa41bb1 6c9f5f63 Author: Donald Haase <qu...@ya...> Date: Tue Jan 14 23:06:58 2025 -0500 Merge pull request #889 from KallistiOS/sfxbuf_lto Fix undefined references to free with lto. commit 9aa41bb15afa4f2e15763b7b4fd8b8eab0248f97 Merge: 4120477f 4c987a72 Author: Donald Haase <qu...@ya...> Date: Tue Jan 14 23:06:41 2025 -0500 Merge pull request #837 from DC-SWAT/aica_iface_fix Speedup and fix AICA cmd iface. Protect SQs on G2 bus. commit e23732f16e28f02813e2cbdba36a5bca50c2d687 Author: Paul Cercueil <pa...@cr...> Date: Tue Jan 14 19:27:07 2025 +0100 perfcntr: Slightly reduce latency of perf_cntr_timer_ns() To reduce the latency of perf_cntr_timer_ns(), perform the perf_cntr_timer_enabled() check *before* reading the counter. The argument that the counter should be read first as to not "record overhead" is bogus; the reason being, if you use these timers to measure the time taken between points A and B, you will always end up measuring the "perf_cntr_timer_enabled()" overhead, just at a different extremity. Therefore, if we "record overhead" in both cases, it's better to use the case where we have slightly lower latency. Signed-off-by: Paul Cercueil <pa...@cr...> commit db865c58dfd8d1dbf4ec3f58757f658e8fe3309f Author: Paul Cercueil <pa...@cr...> Date: Tue Jan 14 19:16:49 2025 +0100 perfcntr: Handle counter overflow while reading values Read the high part twice, before and after reading the high part, to make sure that the low counter didn't overflow. We can detect an overflow by the two reads of the high part returning different values. Note that we don't mask the low 16 bits anymore, as the upper 16 bits are zero anyway. Signed-off-by: Paul Cercueil <pa...@cr...> commit 9643f03cb7aaee1b77f4f49663f0100f00334746 Author: Paul Cercueil <pa...@cr...> Date: Tue Jan 14 19:31:51 2025 +0100 timer: Mark timer reading loop condition as unlikely The timer reading loop condition is extremely unlikely; therefore we can make the function slightly better by tagging it as such. Signed-off-by: Paul Cercueil <pa...@cr...> commit 443bcc39c75e1cf5b96fe9f1f9661ddf68221006 Author: darc <da...@pr...> Date: Mon Jan 13 17:10:49 2025 -0600 Update dc-chain changelog for recent changes commit 86465e336cded75236a53c0e05f096d062b5ffba Author: darc <da...@pr...> Date: Mon Jan 13 17:11:19 2025 -0600 Update dates in AUTHORS commit 4c987a727496a0bb97aff31381fdd791377e2ea5 Author: DC-SWAT <sw...@21...> Date: Sun Jan 12 11:30:07 2025 +0700 Moving g2_fifo_wait() after g2_lock() commit 7193f1ca344ccaa0741383875e50aa0c2146f133 Author: QuzarDC <qu...@co...> Date: Sat Jan 11 14:26:51 2025 -0500 Cleanups of includes, comments, and whitespace. commit 78f450ff297c3b4d18dbe8ed61fc7975fc153edf Author: QuzarDC <qu...@co...> Date: Sat Jan 11 13:16:09 2025 -0500 Track a dirent per dir. Previously it was a static dirent object which was not only not 'thread-safe' but meant that one could not be calling readdir against two different dirs in the same thread. commit 2666394e823ee53e4715aad4bafec44ad20f7dcd Author: QuzarDC <qu...@co...> Date: Sat Jan 11 13:14:23 2025 -0500 Ensure the fs_dcload dir table is always behind the mutex. Help prevent possible racing between dir ops. commit dd287228e3e06eeaa59da99bd23e99a17840079f Author: QuzarDC <qu...@co...> Date: Sat Jan 11 13:12:56 2025 -0500 Add rewwinddir to fs_dcload This was added to ip and ser versions of dcload ages ago but for some reason never to KOS. commit 9165f26d65c9a22e5a45b8fb510bf9fb1d8fec04 Author: QuzarDC <qu...@co...> Date: Sat Jan 11 12:07:21 2025 -0500 Make fs functions static. No other vfs driver exposes its internal functions like fs_dcload does. Additionally newer functions that were added like fcntl were already static. commit 5ea0ac6175979e5cf5a8b13407a2b3066bbb2be2 Author: QuzarDC <qu...@co...> Date: Sat Jan 11 11:41:16 2025 -0500 Remove lwip compatibility functions. We have not supported this in over a decade. dcls is meant to take this role. commit 0637a90dbeae8f87728fa06ac45d7b6324625b29 Author: QuzarDC <qu...@co...> Date: Sat Jan 11 02:52:11 2025 -0500 Cache dir paths for readdir. Now that we are caching dirs generally, lets add the path string. This allows the removal of the static dcload_path, which had the drawback of preventing arbitrary use of `readdir`. commit 95592bccdd52c730025a60e1b636daf4fc835192 Author: QuzarDC <qu...@co...> Date: Sat Jan 11 02:38:18 2025 -0500 Refactor to add error checking for oom. commit de21e057c3a41488553b61db4d2fef7ad8e145ba Author: QuzarDC <qu...@co...> Date: Fri Jan 10 21:09:49 2025 -0500 Remove hack of detecting a dir as fd > 100 It seems this awful hack was possible due to dcload returning the host-side `DIR *` as the fd for dirs. The problem is that it's absolute bunk as there's no guarantee that the fds for non-dirs from the host side returned by `open` will be less than 100. This could mean that a file gets opened and not be able to be closed properly. This also clears the way to remove the hack from the host-side dc-loads, and to correct readdir behavior. commit 8e25a1930ba5ca9f8825e1e381ee54229245d685 Author: Paul Cercueil <pa...@cr...> Date: Fri Jan 10 14:53:45 2025 +0100 pvr: Fix dma_next_list() incorrectly unlocking mutex Only the first call of dma_next_list() is done by the calling thread; the function is registered as the DMA complete callback, so the following calls are done in interrupt context. In that case, the mutex should be unlocked differently by passing a pointer to the thread that locked it. This was detected by defaulting all mutexes to error-checking. Signed-off-by: Paul Cercueil <pa...@cr...> commit 6c9f5f632dfffbc5b7a7f1e26da59a2bf9871efb Author: QuzarDC <qu...@co...> Date: Fri Jan 10 00:25:41 2025 -0500 Fix undefined references to free with lto. I can only presume that the strict include list in this (as opposed to kos.h) meant that there happened to be no references to stdlib in its includes. commit b147382890f551e88ef7e1ba9b61c363d49b3bd5 Author: DC-SWAT <sw...@21...> Date: Sun Jan 5 23:39:32 2025 +0700 Cosmetic fixes from suggestions. commit 0f171547e2411d62f8c02c77423025776a4e0e6a Author: DC-SWAT <sw...@21...> Date: Sat Nov 9 16:15:45 2024 +0700 Change spinlock to mutex, doc and style fixes. commit ccec1cc36977acce789ed7b36ce066ce9ec15399 Author: DC-SWAT <sw...@21...> Date: Tue Nov 5 18:25:13 2024 +0700 Added snd_get_pos() and snd_is_playing(). commit ae9083924dd643a277efca80294879042f5a770c Author: DC-SWAT <sw...@21...> Date: Tue Nov 5 10:25:47 2024 +0700 Fixed aligning for AICA cmd channel buffer. commit 01ece409a12ae43643c593da266b71fed6dc0278 Author: DC-SWAT <sw...@21...> Date: Tue Nov 5 10:24:22 2024 +0700 Added spinlock for start/stop the queue. commit ba9abe5eba98c7075f8670cfcdcb7d92c74b7340 Author: DC-SWAT <sw...@21...> Date: Wed Oct 30 11:05:12 2024 +0700 Protect the SQs on G2 bus. Also speedup spu_reset_chans(). commit 721a210503b46cbaa14d2a1e03024a55375e4c4b Author: DC-SWAT <sw...@21...> Date: Wed Oct 30 10:54:15 2024 +0700 Speedup and fix AICA cmd iface ----------------------------------------------------------------------- Summary of changes: AUTHORS | 6 +- doc/CHANGELOG.md | 1 + examples/dreamcast/sound/sfxbuf/main.c | 1 + kernel/arch/dreamcast/exports-naomi.txt | 2 + kernel/arch/dreamcast/exports-pristine.txt | 2 + kernel/arch/dreamcast/fs/fs_dcload.c | 238 ++++++++++----------- kernel/arch/dreamcast/hardware/pvr/pvr_irq.c | 13 +- kernel/arch/dreamcast/hardware/spu.c | 45 +++- kernel/arch/dreamcast/include/dc/fs_dcload.h | 56 ++--- kernel/arch/dreamcast/include/dc/g2bus.h | 25 +++ kernel/arch/dreamcast/include/dc/sound/aica_comm.h | 2 +- kernel/arch/dreamcast/include/dc/sound/sound.h | 26 ++- kernel/arch/dreamcast/kernel/perfctr.c | 22 +- kernel/arch/dreamcast/kernel/timer.c | 2 +- kernel/arch/dreamcast/sound/arm/aica_cmd_iface.h | 4 + kernel/arch/dreamcast/sound/snd_iface.c | 96 +++++---- kernel/arch/dreamcast/sound/snd_stream.c | 11 +- utils/dc-chain/doc/CHANGELOG.md | 1 + 18 files changed, 313 insertions(+), 240 deletions(-) diff --git a/AUTHORS b/AUTHORS index 5f886980..f476c351 100644 --- a/AUTHORS +++ b/AUTHORS @@ -27,7 +27,7 @@ Sam Steele: 2004 Gil Megidish: 2002 Florian Schulze: 2002 Walter van Niftrik: 2005 -Donald Haase: 2008, 2014, 2023, 2024 +Donald Haase: 2008, 2014, 2023, 2024, 2025 Andrew Kieschnick: 2000, 2001, 2002, 2003 Jordan DeLong: 2000, 2001, 2002 Bero: 2002 @@ -42,12 +42,12 @@ Josh Pearson: 2013, 2014, 2015, 2016 Joe Fenton: 2016 Stefan Galowicz: 2016, 2017 Luke Benstead: 2020, 2021, 2022, 2023 -Eric Fradella: 2023, 2024 +Eric Fradella: 2023, 2024, 2025 Falco Girgis: 2023, 2024 Ruslan Rostovtsev: 2014, 2016, 2023, 2024 Colton Pawielski: 2023 Andy Barajas: 2023, 2024 -Paul Cercueil: 2023, 2024 +Paul Cercueil: 2023, 2024, 2025 Files with Specific licenses: ----------------------------- diff --git a/doc/CHANGELOG.md b/doc/CHANGELOG.md index 5dea7cd1..3f7bccac 100644 --- a/doc/CHANGELOG.md +++ b/doc/CHANGELOG.md @@ -12,6 +12,7 @@ Platform-specific changes are prefixed with the platform name, otherwise the cha - **Dreamcast**: Add pvr palette example [AB] - **Dreamcast**: Cleaned up, documented, and enhanced BIOS font API [FG] - Rework PVR hybrid mode + IRQ handling [PC] +- **Dreamcast**: Add support and update toolchain profiles for Newlib 4.5.0, Binutils 2.43.1, and GDB 15.2 [EF] ## KallistiOS version 2.1.1 - Added pvrtex utility by TapamN to utils [Daniel Fairchild == DF] diff --git a/examples/dreamcast/sound/sfxbuf/main.c b/examples/dreamcast/sound/sfxbuf/main.c index df7d8016..4d42ba2a 100644 --- a/examples/dreamcast/sound/sfxbuf/main.c +++ b/examples/dreamcast/sound/sfxbuf/main.c @@ -8,6 +8,7 @@ */ #include <stdio.h> +#include <stdlib.h> #include <string.h> #include <kos/init.h> #include <dc/biosfont.h> diff --git a/kernel/arch/dreamcast/exports-naomi.txt b/kernel/arch/dreamcast/exports-naomi.txt index 4e3c4615..20fac7bb 100644 --- a/kernel/arch/dreamcast/exports-naomi.txt +++ b/kernel/arch/dreamcast/exports-naomi.txt @@ -146,6 +146,8 @@ snd_pcm16_split snd_pcm16_split_sq snd_pcm8_split snd_adpcm_split +snd_get_pos +snd_is_playing # Video vid_mode diff --git a/kernel/arch/dreamcast/exports-pristine.txt b/kernel/arch/dreamcast/exports-pristine.txt index 89750ed6..829d112d 100644 --- a/kernel/arch/dreamcast/exports-pristine.txt +++ b/kernel/arch/dreamcast/exports-pristine.txt @@ -202,6 +202,8 @@ snd_pcm16_split snd_pcm16_split_sq snd_pcm8_split snd_adpcm_split +snd_get_pos +snd_is_playing # Video vid_mode diff --git a/kernel/arch/dreamcast/fs/fs_dcload.c b/kernel/arch/dreamcast/fs/fs_dcload.c index c40e21f3..b27c935e 100644 --- a/kernel/arch/dreamcast/fs/fs_dcload.c +++ b/kernel/arch/dreamcast/fs/fs_dcload.c @@ -4,6 +4,7 @@ Copyright (C) 2002 Andrew Kieschnick Copyright (C) 2004 Megan Potter Copyright (C) 2012 Lawrence Sebald + Copyright (C) 2025 Donald Haase */ @@ -19,51 +20,56 @@ printf goes to the dc-tool console #include <dc/fifo.h> #include <dc/fs_dcload.h> -#include <kos/thread.h> #include <arch/spinlock.h> -#include <arch/arch.h> #include <kos/dbgio.h> #include <kos/fs.h> +#include <kos/init.h> #include <errno.h> #include <stdio.h> -#include <ctype.h> #include <string.h> #include <malloc.h> -#include <errno.h> +#include <sys/queue.h> + +/* A linked list of dir entries. */ +typedef struct dcl_dir { + LIST_ENTRY(dcl_dir) fhlist; + int hnd; + char *path; + dirent_t dirent; +} dcl_dir_t; + +LIST_HEAD(dcl_de, dcl_dir); + +static struct dcl_de dir_head = LIST_HEAD_INITIALIZER(0); + +static dcl_dir_t *hnd_is_dir(int hnd) { + dcl_dir_t *i; + + if(!hnd) return NULL; + + LIST_FOREACH(i, &dir_head, fhlist) { + if(i->hnd == (int)hnd) + break; + } + + return i; +} static spinlock_t mutex = SPINLOCK_INITIALIZER; -#define plain_dclsc(...) ({ \ +#define dclsc(...) ({ \ irq_disable_scoped(); \ while(FIFO_STATUS & FIFO_SH4) \ ; \ dcloadsyscall(__VA_ARGS__); \ }) -// #define plain_dclsc(...) dcloadsyscall(__VA_ARGS__) - -static void * lwip_dclsc = 0; - -#define dclsc(...) ({ \ - int rv; \ - if(lwip_dclsc) \ - rv = (*(int (*)()) lwip_dclsc)(__VA_ARGS__); \ - else \ - rv = plain_dclsc(__VA_ARGS__); \ - rv; \ - }) - /* Printk replacement */ int dcload_write_buffer(const uint8 *data, int len, int xlat) { (void)xlat; - if(lwip_dclsc && irq_inside_int()) { - errno = EAGAIN; - return -1; - } - spinlock_lock_scoped(&mutex); dclsc(DCLOAD_WRITE, 1, data, len); @@ -75,8 +81,6 @@ int dcload_read_cons(void) { } size_t dcload_gdbpacket(const char* in_buf, size_t in_size, char* out_buf, size_t out_size) { - if(lwip_dclsc && irq_inside_int()) - return 0; spinlock_lock_scoped(&mutex); @@ -85,17 +89,16 @@ size_t dcload_gdbpacket(const char* in_buf, size_t in_size, char* out_buf, size_ return dclsc(DCLOAD_GDBPACKET, in_buf, (in_size << 16) | (out_size & 0xffff), out_buf); } -static char *dcload_path = NULL; -void *dcload_open(vfs_handler_t * vfs, const char *fn, int mode) { +static void *dcload_open(vfs_handler_t * vfs, const char *fn, int mode) { + char *dcload_path = NULL; + dcl_dir_t *entry; int hnd = 0; int dcload_mode = 0; int mm = (mode & O_MODE_MASK); + size_t fn_len = 0; (void)vfs; - if(lwip_dclsc && irq_inside_int()) - return (void *)0; - spinlock_lock_scoped(&mutex); if(mode & O_DIR) { @@ -105,22 +108,42 @@ void *dcload_open(vfs_handler_t * vfs, const char *fn, int mode) { hnd = dclsc(DCLOAD_OPENDIR, fn); - if(hnd) { - if(dcload_path) - free(dcload_path); + if(!hnd) { + /* It could be caused by other issues, such as + pathname being too long or symlink loops, but + ENOTDIR seems to be the best generic and we should + set something */ + errno = ENOTDIR; + return (void *)NULL; + } - if(fn[strlen(fn) - 1] == '/') { - dcload_path = malloc(strlen(fn) + 1); - strcpy(dcload_path, fn); - } - else { - dcload_path = malloc(strlen(fn) + 2); - strcpy(dcload_path, fn); - strcat(dcload_path, "/"); - } + /* We got something back so create an dir list entry for it */ + entry = malloc(sizeof(dcl_dir_t)); + if(!entry) { + errno = ENOMEM; + return (void *)NULL; } + + fn_len = strlen(fn); + if(fn[fn_len - 1] == '/') fn_len--; + + dcload_path = malloc(fn_len + 2); + if(!dcload_path) { + errno = ENOMEM; + free(entry); + return (void *)NULL; + } + + memcpy(dcload_path, fn, fn_len); + dcload_path[fn_len] = '/'; + dcload_path[fn_len+1] = '\0'; + + /* Now that everything is ready, add to list */ + entry->hnd = hnd; + entry->path = dcload_path; + LIST_INSERT_HEAD(&dir_head, entry, fhlist); } - else { /* hack */ + else { if(mm == O_RDONLY) dcload_mode = 0; else if((mm & O_RDWR) == O_RDWR) @@ -141,19 +164,23 @@ void *dcload_open(vfs_handler_t * vfs, const char *fn, int mode) { return (void *)hnd; } -int dcload_close(void * h) { +static int dcload_close(void * h) { uint32 hnd = (uint32)h; - - if(lwip_dclsc && irq_inside_int()) { - errno = EINTR; - return -1; - } + dcl_dir_t *i; spinlock_lock_scoped(&mutex); if(hnd) { - if(hnd > 100) /* hack */ + /* Check if it's a dir */ + i = hnd_is_dir(hnd); + + /* We found it in the list, so it's a dir */ + if(!i) { dclsc(DCLOAD_CLOSEDIR, hnd); + LIST_REMOVE(i, fhlist); + free(i->path); + free(i); + } else { hnd--; /* KOS uses 0 for error, not -1 */ dclsc(DCLOAD_CLOSE, hnd); @@ -163,13 +190,10 @@ int dcload_close(void * h) { return 0; } -ssize_t dcload_read(void * h, void *buf, size_t cnt) { +static ssize_t dcload_read(void * h, void *buf, size_t cnt) { ssize_t ret = -1; uint32 hnd = (uint32)h; - if(lwip_dclsc && irq_inside_int()) - return 0; - spinlock_lock_scoped(&mutex); if(hnd) { @@ -180,13 +204,10 @@ ssize_t dcload_read(void * h, void *buf, size_t cnt) { return ret; } -ssize_t dcload_write(void * h, const void *buf, size_t cnt) { +static ssize_t dcload_write(void * h, const void *buf, size_t cnt) { ssize_t ret = -1; uint32 hnd = (uint32)h; - if(lwip_dclsc && irq_inside_int()) - return 0; - spinlock_lock_scoped(&mutex); if(hnd) { @@ -197,13 +218,10 @@ ssize_t dcload_write(void * h, const void *buf, size_t cnt) { return ret; } -off_t dcload_seek(void * h, off_t offset, int whence) { +static off_t dcload_seek(void * h, off_t offset, int whence) { off_t ret = -1; uint32 hnd = (uint32)h; - if(lwip_dclsc && irq_inside_int()) - return 0; - spinlock_lock_scoped(&mutex); if(hnd) { @@ -214,13 +232,10 @@ off_t dcload_seek(void * h, off_t offset, int whence) { return ret; } -off_t dcload_tell(void * h) { +static off_t dcload_tell(void * h) { off_t ret = -1; uint32 hnd = (uint32)h; - if(lwip_dclsc && irq_inside_int()) - return 0; - spinlock_lock_scoped(&mutex); if(hnd) { @@ -231,14 +246,11 @@ off_t dcload_tell(void * h) { return ret; } -size_t dcload_total(void * h) { +static size_t dcload_total(void * h) { size_t ret = -1; size_t cur; uint32 hnd = (uint32)h; - if(lwip_dclsc && irq_inside_int()) - return 0; - spinlock_lock_scoped(&mutex); if(hnd) { @@ -251,38 +263,32 @@ size_t dcload_total(void * h) { return ret; } -/* Not thread-safe, but that's ok because neither is the FS */ -static dirent_t dirent; -dirent_t *dcload_readdir(void * h) { +static dirent_t *dcload_readdir(void * h) { dirent_t *rv = NULL; dcload_dirent_t *dcld; dcload_stat_t filestat; char *fn; uint32 hnd = (uint32)h; + dcl_dir_t *entry; - if(lwip_dclsc && irq_inside_int()) { - errno = EAGAIN; - return NULL; - } + spinlock_lock_scoped(&mutex); - if(hnd < 100) { + if(!(entry = hnd_is_dir(hnd))) { errno = EBADF; return NULL; } - spinlock_lock_scoped(&mutex); - dcld = (dcload_dirent_t *)dclsc(DCLOAD_READDIR, hnd); if(dcld) { - rv = &dirent; + rv = &(entry->dirent); strcpy(rv->name, dcld->d_name); rv->size = 0; rv->time = 0; rv->attr = 0; /* what the hell is attr supposed to be anyways? */ - fn = malloc(strlen(dcload_path) + strlen(dcld->d_name) + 1); - strcpy(fn, dcload_path); + fn = malloc(strlen(entry->path) + strlen(dcld->d_name) + 1); + strcpy(fn, entry->path); strcat(fn, dcld->d_name); if(!dclsc(DCLOAD_STAT, fn, &filestat)) { @@ -303,14 +309,11 @@ dirent_t *dcload_readdir(void * h) { return rv; } -int dcload_rename(vfs_handler_t * vfs, const char *fn1, const char *fn2) { +static int dcload_rename(vfs_handler_t * vfs, const char *fn1, const char *fn2) { int ret; (void)vfs; - if(lwip_dclsc && irq_inside_int()) - return 0; - spinlock_lock_scoped(&mutex); /* really stupid hack, since I didn't put rename() in dcload */ @@ -323,12 +326,9 @@ int dcload_rename(vfs_handler_t * vfs, const char *fn1, const char *fn2) { return ret; } -int dcload_unlink(vfs_handler_t * vfs, const char *fn) { +static int dcload_unlink(vfs_handler_t * vfs, const char *fn) { (void)vfs; - if(lwip_dclsc && irq_inside_int()) - return 0; - spinlock_lock_scoped(&mutex); return dclsc(DCLOAD_UNLINK, fn); @@ -342,9 +342,6 @@ static int dcload_stat(vfs_handler_t *vfs, const char *path, struct stat *st, (void)flag; - if(lwip_dclsc && irq_inside_int()) - return 0; - /* Root directory '/pc' */ if(len == 0 || (len == 1 && *path == '/')) { memset(st, 0, sizeof(struct stat)); @@ -408,6 +405,17 @@ static int dcload_fcntl(void *h, int cmd, va_list ap) { return rv; } +static int dcload_rewinddir(void *h) { + uint32_t hnd = (uint32_t)h; + + spinlock_lock_scoped(&mutex); + + if(!hnd_is_dir(hnd)) + return -1; + + return dclsc(DCLOAD_REWINDDIR, hnd); +} + /* Pull all that together */ static vfs_handler_t vh = { /* Name handler */ @@ -446,12 +454,12 @@ static vfs_handler_t vh = { NULL, /* tell64 */ NULL, /* total64 */ NULL, /* readlink */ - NULL, /* rewinddir */ + dcload_rewinddir, NULL /* fstat */ }; -// We have to provide a minimal interface in case dcload usage is -// disabled through init flags. +/* We have to provide a minimal interface in case dcload usage is + disabled through init flags. */ static int never_detected(void) { return 0; } @@ -491,8 +499,8 @@ void fs_dcload_init_console(void) { dbgio_dcload.write_buffer = dcload_write_buffer; // dbgio_dcload.read = dcload_read_cons; - // We actually need to detect here to make sure we're not on - // dcload-serial, or scif_init must not proceed. + /* We actually need to detect here to make sure we're not on + dcload-serial, or scif_init must not proceed. */ ...<truncated>... hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: quzar <qu...@us...> - 2025-01-10 05:23:52
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via 4120477f4344f89a5bcc121ced62ff751901db17 (commit) via b7b0cac5a9bfbcddee99a9bd2d5ec5efc69c8947 (commit) via 98b9dac2f4e93cae4f9c710385e5ce380f59c51d (commit) via ce51da725e8bfada9081e7d2920361a698d2541e (commit) via c7ec613196b80908f0f1eb1065c8df89099f1ddd (commit) via 134228724529e561420ed88477abc0c1676de03b (commit) via 6cc0c509120bbd4686f6bdec5c0df857dadb976e (commit) via 26f49ee127ee0d92dd0874285878f14b6291f7f2 (commit) via c0405501a9f139b70bf15e074fd3d6c5eed77984 (commit) via 449ab7d2befe23478115fde1a6568d6cbf8ea9d2 (commit) via 24f61291155e8c8204631ef5a77f19f8e77051f9 (commit) via 32ca2c2c0c8bf02051ccdc15d407cc92a9556d1a (commit) via 5999ca2ef73dae22ca518e5143385aac6432d910 (commit) via e554125ecb3c8220e0cdc29a56db4aa68e90afca (commit) via 4b11c9e60120ccd6cb1dbbcf17a9631d9a58e8fe (commit) via 421454fd77147251d19e5038095791b931ea97c7 (commit) via d7ebcc825b30a0df2dd2b0bc11c503275e54509d (commit) from 515eaeef6a3823b17d50c037fd74099e055dcb81 (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 4120477f4344f89a5bcc121ced62ff751901db17 Merge: b7b0cac5 c7ec6131 Author: Donald Haase <qu...@ya...> Date: Fri Jan 10 00:07:55 2025 -0500 Merge pull request #884 from pcercuei/shrink-irq irq: Shrink IRQ table size commit b7b0cac5a9bfbcddee99a9bd2d5ec5efc69c8947 Merge: 98b9dac2 13422872 Author: Donald Haase <qu...@ya...> Date: Fri Jan 10 00:03:39 2025 -0500 Merge pull request #876 from pcercuei/spinlock-cleanup Spinlock cleanups commit 98b9dac2f4e93cae4f9c710385e5ce380f59c51d Merge: 515eaeef ce51da72 Author: Donald Haase <qu...@ya...> Date: Fri Jan 10 00:02:15 2025 -0500 Merge pull request #888 from pcercuei/asm-not-asm arch.h: Use __asm__ instead of asm commit ce51da725e8bfada9081e7d2920361a698d2541e Author: Paul Cercueil <pa...@cr...> Date: Thu Jan 9 12:58:56 2025 +0100 arch.h: Use __asm__ instead of asm Using just "asm" seems to cause compilation errors when building some external software that use ISO compliant C and not the GNU version. Signed-off-by: Paul Cercueil <pa...@cr...> commit c7ec613196b80908f0f1eb1065c8df89099f1ddd Author: Paul Cercueil <pa...@cr...> Date: Tue Jan 7 16:13:51 2025 +0100 irq: Shrink IRQ table size All exception codes were divisible by 32, except for the two soft exceptions. Since they do not represent any hardware value, modify these code so that they are also divisible by 32, and make them smaller than 0x800. This means that all exception codes can now be represented in just 6 bits, and the IRQ table can be reduced from 0x100 entries to just 0x40 entries. This saves 1.5 KiB, but more importantly, the table now fits in just 16 cache lines instead of 64 cache lines. Signed-off-by: Paul Cercueil <pa...@cr...> commit 134228724529e561420ed88477abc0c1676de03b Author: Paul Cercueil <pa...@cr...> Date: Thu Jan 2 15:12:03 2025 +0100 atomics: Use spinlock_lock_scoped() Use spinlock_lock_scoped() to simplify code. Signed-off-by: Paul Cercueil <pa...@cr...> commit 6cc0c509120bbd4686f6bdec5c0df857dadb976e Author: Paul Cercueil <pa...@cr...> Date: Thu Jan 2 15:10:13 2025 +0100 atomics: Use irq_disable_scoped() Use irq_disable_scoped() to simplify code. Signed-off-by: Paul Cercueil <pa...@cr...> commit 26f49ee127ee0d92dd0874285878f14b6291f7f2 Author: Paul Cercueil <pa...@cr...> Date: Thu Jan 2 15:05:35 2025 +0100 atomics: Whitespace fixes Remove stray spaces that were polluting atomics.c. Signed-off-by: Paul Cercueil <pa...@cr...> commit c0405501a9f139b70bf15e074fd3d6c5eed77984 Author: Paul Cercueil <pa...@cr...> Date: Thu Jan 2 15:02:52 2025 +0100 malloc_debug: Use spinlock_lock_scoped() Use spinlock_lock_scoped() to simplify code. Note that after this change, the mutex is unlocked after the debug message in malloc(). This should be fine, as free() was already calling printf() several times with the spinlock held. Signed-off-by: Paul Cercueil <pa...@cr...> commit 449ab7d2befe23478115fde1a6568d6cbf8ea9d2 Author: Paul Cercueil <pa...@cr...> Date: Thu Jan 2 15:02:25 2025 +0100 tls: Use spinlock_lock_scoped() Use spinlock_lock_scoped() to simplify code. Signed-off-by: Paul Cercueil <pa...@cr...> commit 24f61291155e8c8204631ef5a77f19f8e77051f9 Author: Paul Cercueil <pa...@cr...> Date: Thu Jan 2 15:01:14 2025 +0100 snd_mem: Use spinlock_lock_irqsafe() Use spinlock_lock_irqsafe() to simplify code. Note that snd_mem_shutdown() and snd_mem_free() now won't set an errno on error. This is because those functions do not return any error code, so it makes no sense to set errno either. Signed-off-by: Paul Cercueil <pa...@cr...> commit 32ca2c2c0c8bf02051ccdc15d407cc92a9556d1a Author: Paul Cercueil <pa...@cr...> Date: Thu Jan 2 14:59:08 2025 +0100 fs_dcload: Use spinlock_lock_scoped() Use spinlock_lock_scoped() to simplify code. Signed-off-by: Paul Cercueil <pa...@cr...> commit 5999ca2ef73dae22ca518e5143385aac6432d910 Author: Paul Cercueil <pa...@cr...> Date: Thu Jan 2 14:57:41 2025 +0100 fs_dcload: Use irq_disable_scoped() Use irq_disable_scoped() inside the plain_dclsc() macro. Note that the behaviour is slightly different as we do not check whether or not we are running in an interrupt context. This was changed because it actually makes zero difference. Signed-off-by: Paul Cercueil <pa...@cr...> commit e554125ecb3c8220e0cdc29a56db4aa68e90afca Author: Paul Cercueil <pa...@cr...> Date: Thu Jan 2 14:49:31 2025 +0100 spinlock: Add spinlock_lock_irqsafe() This function behaves like spinlock_lock(), except that it will not spin if the lock cannot be obtained when running within an interrupt context. Signed-off-by: Paul Cercueil <pa...@cr...> commit 4b11c9e60120ccd6cb1dbbcf17a9631d9a58e8fe Author: Paul Cercueil <pa...@cr...> Date: Thu Jan 2 14:32:02 2025 +0100 spinlock: Add spinlock_lock_scoped() Similar to irq_disable_scoped() or mutex_lock_scoped(), the new spinlock_lock_scoped() macro Signed-off-by: Paul Cercueil <pa...@cr...> commit 421454fd77147251d19e5038095791b931ea97c7 Author: Paul Cercueil <pa...@cr...> Date: Thu Jan 2 14:20:38 2025 +0100 spinlock: Update inline ASM Instead of specifying that the inline ASM modifies memory without more information, tell it that the memory pointed by the spinlock pointer will be modified. The compiler then knows that it does not have to reload all the variables from memory after a call to spinlock_trylock() or spinlock_lock(). Signed-off-by: Paul Cercueil <pa...@cr...> commit d7ebcc825b30a0df2dd2b0bc11c503275e54509d Author: Paul Cercueil <pa...@cr...> Date: Thu Jan 2 14:13:21 2025 +0100 spinlock: Transform macros into inline functions There is no valid reason to have the spinlock API as macros. Convert it to static inline functions to benefit from type checking. Note that spinlock_trylock() was moved up in the file so that it can be used within spinlock_lock() to factorize code. Signed-off-by: Paul Cercueil <pa...@cr...> ----------------------------------------------------------------------- Summary of changes: kernel/arch/dreamcast/fs/fs_dcload.c | 64 ++++--------- kernel/arch/dreamcast/include/arch/arch.h | 2 +- kernel/arch/dreamcast/include/arch/irq.h | 4 +- kernel/arch/dreamcast/include/arch/spinlock.h | 126 ++++++++++++++++---------- kernel/arch/dreamcast/kernel/irq.c | 12 +-- kernel/arch/dreamcast/sound/snd_mem.c | 55 +++-------- kernel/libc/c11/atomics.c | 93 +++++++------------ kernel/mm/malloc_debug.c | 7 +- kernel/thread/tls.c | 19 ++-- 9 files changed, 164 insertions(+), 218 deletions(-) diff --git a/kernel/arch/dreamcast/fs/fs_dcload.c b/kernel/arch/dreamcast/fs/fs_dcload.c index 949952ab..c40e21f3 100644 --- a/kernel/arch/dreamcast/fs/fs_dcload.c +++ b/kernel/arch/dreamcast/fs/fs_dcload.c @@ -35,16 +35,10 @@ printf goes to the dc-tool console static spinlock_t mutex = SPINLOCK_INITIALIZER; #define plain_dclsc(...) ({ \ - int old = 0, rv; \ - if(!irq_inside_int()) { \ - old = irq_disable(); \ - } \ + irq_disable_scoped(); \ while(FIFO_STATUS & FIFO_SH4) \ ; \ - rv = dcloadsyscall(__VA_ARGS__); \ - if(!irq_inside_int()) \ - irq_restore(old); \ - rv; \ + dcloadsyscall(__VA_ARGS__); \ }) // #define plain_dclsc(...) dcloadsyscall(__VA_ARGS__) @@ -70,9 +64,8 @@ int dcload_write_buffer(const uint8 *data, int len, int xlat) { return -1; } - spinlock_lock(&mutex); + spinlock_lock_scoped(&mutex); dclsc(DCLOAD_WRITE, 1, data, len); - spinlock_unlock(&mutex); return len; } @@ -82,25 +75,19 @@ int dcload_read_cons(void) { } size_t dcload_gdbpacket(const char* in_buf, size_t in_size, char* out_buf, size_t out_size) { - size_t ret = -1; - if(lwip_dclsc && irq_inside_int()) return 0; - spinlock_lock(&mutex); + spinlock_lock_scoped(&mutex); /* we have to pack the sizes together because the dcloadsyscall handler can only take 4 parameters */ - ret = dclsc(DCLOAD_GDBPACKET, in_buf, (in_size << 16) | (out_size & 0xffff), out_buf); - - spinlock_unlock(&mutex); - return ret; + return dclsc(DCLOAD_GDBPACKET, in_buf, (in_size << 16) | (out_size & 0xffff), out_buf); } static char *dcload_path = NULL; void *dcload_open(vfs_handler_t * vfs, const char *fn, int mode) { int hnd = 0; - uint32 h; int dcload_mode = 0; int mm = (mode & O_MODE_MASK); @@ -109,7 +96,7 @@ void *dcload_open(vfs_handler_t * vfs, const char *fn, int mode) { if(lwip_dclsc && irq_inside_int()) return (void *)0; - spinlock_lock(&mutex); + spinlock_lock_scoped(&mutex); if(mode & O_DIR) { if(fn[0] == '\0') { @@ -151,11 +138,7 @@ void *dcload_open(vfs_handler_t * vfs, const char *fn, int mode) { hnd++; /* KOS uses 0 for error, not -1 */ } - h = hnd; - - spinlock_unlock(&mutex); - - return (void *)h; + return (void *)hnd; } int dcload_close(void * h) { @@ -166,7 +149,7 @@ int dcload_close(void * h) { return -1; } - spinlock_lock(&mutex); + spinlock_lock_scoped(&mutex); if(hnd) { if(hnd > 100) /* hack */ @@ -177,7 +160,6 @@ int dcload_close(void * h) { } } - spinlock_unlock(&mutex); return 0; } @@ -188,14 +170,13 @@ ssize_t dcload_read(void * h, void *buf, size_t cnt) { if(lwip_dclsc && irq_inside_int()) return 0; - spinlock_lock(&mutex); + spinlock_lock_scoped(&mutex); if(hnd) { hnd--; /* KOS uses 0 for error, not -1 */ ret = dclsc(DCLOAD_READ, hnd, buf, cnt); } - spinlock_unlock(&mutex); return ret; } @@ -206,14 +187,13 @@ ssize_t dcload_write(void * h, const void *buf, size_t cnt) { if(lwip_dclsc && irq_inside_int()) return 0; - spinlock_lock(&mutex); + spinlock_lock_scoped(&mutex); if(hnd) { hnd--; /* KOS uses 0 for error, not -1 */ ret = dclsc(DCLOAD_WRITE, hnd, buf, cnt); } - spinlock_unlock(&mutex); return ret; } @@ -224,14 +204,13 @@ off_t dcload_seek(void * h, off_t offset, int whence) { if(lwip_dclsc && irq_inside_int()) return 0; - spinlock_lock(&mutex); + spinlock_lock_scoped(&mutex); if(hnd) { hnd--; /* KOS uses 0 for error, not -1 */ ret = dclsc(DCLOAD_LSEEK, hnd, offset, whence); } - spinlock_unlock(&mutex); return ret; } @@ -242,14 +221,13 @@ off_t dcload_tell(void * h) { if(lwip_dclsc && irq_inside_int()) return 0; - spinlock_lock(&mutex); + spinlock_lock_scoped(&mutex); if(hnd) { hnd--; /* KOS uses 0 for error, not -1 */ ret = dclsc(DCLOAD_LSEEK, hnd, 0, SEEK_CUR); } - spinlock_unlock(&mutex); return ret; } @@ -261,7 +239,7 @@ size_t dcload_total(void * h) { if(lwip_dclsc && irq_inside_int()) return 0; - spinlock_lock(&mutex); + spinlock_lock_scoped(&mutex); if(hnd) { hnd--; /* KOS uses 0 for error, not -1 */ @@ -270,7 +248,6 @@ size_t dcload_total(void * h) { dclsc(DCLOAD_LSEEK, hnd, cur, SEEK_SET); } - spinlock_unlock(&mutex); return ret; } @@ -293,7 +270,7 @@ dirent_t *dcload_readdir(void * h) { return NULL; } - spinlock_lock(&mutex); + spinlock_lock_scoped(&mutex); dcld = (dcload_dirent_t *)dclsc(DCLOAD_READDIR, hnd); @@ -323,7 +300,6 @@ dirent_t *dcload_readdir(void * h) { free(fn); } - spinlock_unlock(&mutex); return rv; } @@ -335,7 +311,7 @@ int dcload_rename(vfs_handler_t * vfs, const char *fn1, const char *fn2) { if(lwip_dclsc && irq_inside_int()) return 0; - spinlock_lock(&mutex); + spinlock_lock_scoped(&mutex); /* really stupid hack, since I didn't put rename() in dcload */ @@ -344,24 +320,18 @@ int dcload_rename(vfs_handler_t * vfs, const char *fn1, const char *fn2) { if(!ret) ret = dclsc(DCLOAD_UNLINK, fn1); - spinlock_unlock(&mutex); return ret; } int dcload_unlink(vfs_handler_t * vfs, const char *fn) { - int ret; - (void)vfs; if(lwip_dclsc && irq_inside_int()) return 0; - spinlock_lock(&mutex); - - ret = dclsc(DCLOAD_UNLINK, fn); + spinlock_lock_scoped(&mutex); - spinlock_unlock(&mutex); - return ret; + return dclsc(DCLOAD_UNLINK, fn); } static int dcload_stat(vfs_handler_t *vfs, const char *path, struct stat *st, diff --git a/kernel/arch/dreamcast/include/arch/arch.h b/kernel/arch/dreamcast/include/arch/arch.h index 3bdc06c3..b26d9ea3 100644 --- a/kernel/arch/dreamcast/include/arch/arch.h +++ b/kernel/arch/dreamcast/include/arch/arch.h @@ -387,7 +387,7 @@ static inline uintptr_t arch_get_ret_addr(void) { \note This only works if you don't disable frame pointers. */ static inline uintptr_t arch_get_fptr(void) { - register uintptr_t fp asm("r14"); + register uintptr_t fp __asm__("r14"); return fp; } diff --git a/kernel/arch/dreamcast/include/arch/irq.h b/kernel/arch/dreamcast/include/arch/irq.h index 54c46889..7770a429 100644 --- a/kernel/arch/dreamcast/include/arch/irq.h +++ b/kernel/arch/dreamcast/include/arch/irq.h @@ -251,8 +251,8 @@ typedef enum irq_exception { EXC_SCIF_RXI = 0x0720, /**< `[POST ]` SCIF Receive ready */ EXC_SCIF_BRI = 0x0740, /**< `[POST ]` SCIF break */ EXC_SCIF_TXI = 0x0760, /**< `[POST ]` SCIF Transmit ready */ - EXC_DOUBLE_FAULT = 0x0ff0, /**< `[SOFT ]` Exception happened in an ISR */ - EXC_UNHANDLED_EXC = 0x0fe0 /**< `[SOFT ]` Exception went unhandled */ + EXC_DOUBLE_FAULT = 0x0780, /**< `[SOFT ]` Exception happened in an ISR */ + EXC_UNHANDLED_EXC = 0x07e0 /**< `[SOFT ]` Exception went unhandled */ } irq_t; diff --git a/kernel/arch/dreamcast/include/arch/spinlock.h b/kernel/arch/dreamcast/include/arch/spinlock.h index edebdef0..f7a45121 100644 --- a/kernel/arch/dreamcast/include/arch/spinlock.h +++ b/kernel/arch/dreamcast/include/arch/spinlock.h @@ -30,6 +30,8 @@ #include <sys/cdefs.h> __BEGIN_DECLS +#include <stdbool.h> + /* DC implementation uses threads most of the time */ #include <kos/thread.h> @@ -45,80 +47,112 @@ typedef volatile int spinlock_t; /** \brief Initialize a spinlock. - This function-like macro abstracts initializing a spinlock, in case the + This function abstracts initializing a spinlock, in case the initializer is not applicable to what you are doing. - \param A A pointer to the spinlock to be initialized. + \param lock A pointer to the spinlock to be initialized. */ -#define spinlock_init(A) *(A) = SPINLOCK_INITIALIZER +static inline void spinlock_init(spinlock_t *lock) { + *lock = SPINLOCK_INITIALIZER; +} /* Note here that even if threads aren't enabled, we'll still set the lock so that it can be used for anti-IRQ protection (e.g., malloc) */ +/** \brief Try to lock, without spinning. + + This function will attempt to lock the lock, but will not spin. Instead, it + will return whether the lock was obtained or not. + + \param lock A pointer to the spinlock to be locked. + \return False if the lock is held by another thread. True if + the lock was successfully obtained. +*/ +static inline bool spinlock_trylock(spinlock_t *lock) { + bool locked = false; + + __asm__ __volatile__("tas.b @%2\n\t" + "movt %0\n\t" + : "=r"(locked), "=m"(*lock) + : "r"(lock) + : "t"); + + return locked; +} + /** \brief Spin on a lock. - This macro will spin on the lock, and will not return until the lock has + This function will spin on the lock, and will not return until the lock has been obtained for the calling thread. - \param A A pointer to the spinlock to be locked. + \param lock A pointer to the spinlock to be locked. */ -#define spinlock_lock(A) do { \ - spinlock_t * __lock = A; \ - int __gotlock = 0; \ - while(1) { \ - __asm__ __volatile__("tas.b @%1\n\t" \ - "movt %0\n\t" \ - : "=r" (__gotlock) \ - : "r" (__lock) \ - : "t", "memory"); \ - if(!__gotlock) \ - thd_pass(); \ - else break; \ - } \ - } while(0) +static inline void spinlock_lock(spinlock_t *lock) { + while(!spinlock_trylock(lock)) + thd_pass(); +} -/** \brief Try to lock, without spinning. +/** \brief Spin on a lock. - This macro will attempt to lock the lock, but will not spin. Instead, it - will return whether the lock was obtained or not. + This function will spin on the lock, and will not return until the lock has + been obtained for the calling thread, unless it is called from within an + interrupt context. - \param A A pointer to the spinlock to be locked. - \return 0 if the lock is held by another thread. Non-zero if - the lock was successfully obtained. + \param lock A pointer to the spinlock to be locked. + \return True if the spinlock could be locked, false otherwise. */ -#define spinlock_trylock(A) ({ \ - int __gotlock = 0; \ - do { \ - spinlock_t *__lock = A; \ - __asm__ __volatile__("tas.b @%1\n\t" \ - "movt %0\n\t" \ - : "=r" (__gotlock) \ - : "r" (__lock) \ - : "t", "memory"); \ - } while(0); \ - __gotlock; \ - }) +static inline bool spinlock_lock_irqsafe(spinlock_t *lock) { + if(irq_inside_int()) + return spinlock_trylock(lock); + + spinlock_lock(lock); + return true; +} /** \brief Free a lock. - This macro will unlock the lock that is currently held by the calling - thread. Do not use this macro unless you actually hold the lock! + This function will unlock the lock that is currently held by the calling + thread. Do not use this function unless you actually hold the lock! - \param A A pointer to the spinlock to be unlocked. + \param lock A pointer to the spinlock to be unlocked. */ -#define spinlock_unlock(A) do { \ - *(A) = 0; \ - } while(0) +static inline void spinlock_unlock(spinlock_t *lock) { + *lock = 0; +} /** \brief Determine if a lock is locked. - This macro will return whether or not the lock specified is actually locked + This function will return whether or not the lock specified is actually locked when it is called. This is NOT a thread-safe way of determining if a lock will be locked when you get around to locking it! - \param A A pointer to the spinlock to be checked. + \param lock A pointer to the spinlock to be checked. + \return True if the spinlock is locked, false otherwise. +*/ +static inline bool spinlock_is_locked(spinlock_t *lock) { + return *lock != 0; +} + +/** \cond INTERNAL */ +static inline void __spinlock_scoped_cleanup(spinlock_t **lock) { + spinlock_unlock(*lock); +} + +#define ___spinlock_lock_scoped(m, l) \ + spinlock_t *__scoped_spinlock_##l __attribute__((cleanup(__spinlock_scoped_cleanup))) = (spinlock_lock(m), (m)) +#define __spinlock_lock_scoped(m, l) ___spinlock_lock_scoped(m, l) +/** \endcond */ + +/** \brief Spin on a lock with scope management. + + This macro will spin on the lock, similar to spinlock_lock(), with the + difference that the lock will automatically be freed once the execution + exits the functional block in which the macro was called. + + \param lock A pointer to the spinlock to be locked. */ -#define spinlock_is_locked(A) ( *(A) != 0 ) +#define spinlock_lock_scoped(lock) \ + __spinlock_lock_scoped((lock), __LINE__) __END_DECLS diff --git a/kernel/arch/dreamcast/kernel/irq.c b/kernel/arch/dreamcast/kernel/irq.c index 658819c0..edab4a3b 100644 --- a/kernel/arch/dreamcast/kernel/irq.c +++ b/kernel/arch/dreamcast/kernel/irq.c @@ -39,7 +39,7 @@ struct trapa_cb { }; /* Individual exception handlers */ -static struct irq_cb irq_handlers[0x100]; +static struct irq_cb irq_handlers[0x40]; /* TRAPA exception handlers */ static struct trapa_cb trapa_handlers[0x100]; @@ -62,7 +62,7 @@ int irq_set_handler(irq_t code, irq_handler hnd, void *data) { if(code >= 0x1000 || (code & 0x000f)) return -1; - code >>= 4; + code >>= 5; irq_handlers[code] = (struct irq_cb){ hnd, data }; return 0; @@ -74,7 +74,7 @@ irq_handler irq_get_handler(irq_t code) { if(code >= 0x1000 || (code & 0x000f)) return NULL; - code >>= 4; + code >>= 5; return irq_handlers[code].hdl; } @@ -226,7 +226,7 @@ void irq_handle_exception(int code) { } if(inside_int) { - hnd = &irq_handlers[EXC_DOUBLE_FAULT >> 4]; + hnd = &irq_handlers[EXC_DOUBLE_FAULT >> 5]; if(hnd->hdl != NULL) hnd->hdl(EXC_DOUBLE_FAULT, irq_srt_addr, hnd->data); else @@ -266,7 +266,7 @@ void irq_handle_exception(int code) { /* If there's a handler, call it */ { - hnd = &irq_handlers[evt >> 4]; + hnd = &irq_handlers[evt >> 5]; if(hnd->hdl != NULL) { hnd->hdl(evt, irq_srt_addr, hnd->data); handled = 1; @@ -274,7 +274,7 @@ void irq_handle_exception(int code) { } if(!handled) { - hnd = &irq_handlers[EXC_UNHANDLED_EXC >> 4]; + hnd = &irq_handlers[EXC_UNHANDLED_EXC >> 5]; if(hnd->hdl != NULL) hnd->hdl(evt, irq_srt_addr, hnd->data); else diff --git a/kernel/arch/dreamcast/sound/snd_mem.c b/kernel/arch/dreamcast/sound/snd_mem.c index 1e6e5527..a458817a 100644 --- a/kernel/arch/dreamcast/sound/snd_mem.c +++ b/kernel/arch/dreamcast/sound/snd_mem.c @@ -72,14 +72,9 @@ int snd_mem_init(uint32 reserve) { if(initted) snd_mem_shutdown(); ...<truncated>... hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: quzar <qu...@us...> - 2025-01-07 16:04: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 515eaeef6a3823b17d50c037fd74099e055dcb81 (commit) via f22bd64664566b3edb017488cf591d514db7a997 (commit) via 449c369024dad40d4ef61655c633a67440f77922 (commit) via 4ab09d5e998f30e240f0abca9fc1f0c4239efa23 (commit) via 90ed4b408852a3ebfb48679a0904af6beda572aa (commit) via b5dba54346f93568e833303b90c9b85ba8f7543e (commit) via bd52193bbbe48e1bcd0e231a26f994fa36e32660 (commit) via b259c700c8ab3c4694829fc3e2bdef266a257039 (commit) via 7560594e9e4d303d398d8a727e2b3616e66cc971 (commit) from 99b18e3a864c4f591f73dad893b10d0f4920de81 (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 515eaeef6a3823b17d50c037fd74099e055dcb81 Merge: f22bd646 90ed4b40 Author: Donald Haase <qu...@ya...> Date: Tue Jan 7 09:34:07 2025 -0500 Merge pull request #882 from pcercuei/pvr-better-compile pvr_prim: Speed up header compilation commit f22bd64664566b3edb017488cf591d514db7a997 Merge: 449c3690 7560594e Author: Donald Haase <qu...@ya...> Date: Tue Jan 7 09:33:02 2025 -0500 Merge pull request #881 from KallistiOS/termios Remove dependence on minimal termios stub. commit 449c369024dad40d4ef61655c633a67440f77922 Merge: 4ab09d5e b5dba543 Author: Donald Haase <qu...@ya...> Date: Tue Jan 7 09:32:35 2025 -0500 Merge pull request #880 from darcagn/chain-updates dc-chain Updates commit 4ab09d5e998f30e240f0abca9fc1f0c4239efa23 Merge: 99b18e3a bd52193b Author: Donald Haase <qu...@ya...> Date: Sun Jan 5 20:34:04 2025 -0500 Merge pull request #867 from pcercuei/aligned-alloc koslib: Drop our aligned_alloc() commit 90ed4b408852a3ebfb48679a0904af6beda572aa Author: Paul Cercueil <pa...@cr...> Date: Sun Jan 5 18:04:35 2025 +0100 pvr_prim: Speed up header compilation Use the fact that the headers are always aligned to 32 bytes, and allocate a dirty cache line when writing the first 4 bytes. This avoids a possible cache miss that would have loaded the header's 32 bytes from RAM, which would have subsequently been overwritten. Signed-off-by: Paul Cercueil <pa...@cr...> commit b5dba54346f93568e833303b90c9b85ba8f7543e Author: darc <da...@pr...> Date: Fri Jan 3 17:10:31 2025 -0600 dc-chain Updates - Newlib 4.5.0 patch added - Migration to Newlib 4.5.0 and Binutils 2.43.1 for profiles newer than stable - Offsets adjusted when applicable for development toolchain patches - Profile successful build dates updated - GDB updated to 15.2 for all profiles commit bd52193bbbe48e1bcd0e231a26f994fa36e32660 Author: Paul Cercueil <pa...@cr...> Date: Mon Dec 9 15:53:11 2024 +0100 koslib: Drop our aligned_alloc() Newlib already provides this function; which means that sometimes KOS' implementation was picked, and sometimes Newlib's implementation was picked. This was a problem with LTO in particular, as Newlib's implementation would fail to link against KOS-provided memalign() with old toolchains (newer toolchains link against memalign_r()). Address this issue by dropping KOS' aligned_alloc(), and marking its memalign() implementation as "always used", which fixes the linking when using LTO. Signed-off-by: Paul Cercueil <pa...@cr...> commit b259c700c8ab3c4694829fc3e2bdef266a257039 Author: Paul Cercueil <pa...@cr...> Date: Thu Jan 2 16:14:04 2025 +0100 koslib: Provide _memalign_r() The newlib_malloc.c file was missing the _memalign_r() stub. Signed-off-by: Paul Cercueil <pa...@cr...> commit 7560594e9e4d303d398d8a727e2b3616e66cc971 Author: QuzarDC <qu...@co...> Date: Sat Jan 4 07:00:35 2025 -0500 Remove dependence on minimal termios stub. For #636 a stub of termios functionality was added in order to support isatty. This broke libjimtcl and would break other software that detected termios compatibility as it implemented only the minimum needed for isatty. This replaces the use of tcgetattr with a check of the kos vfs handler to test if it's pty. The stub termios header and tcgetattr is then removed. ----------------------------------------------------------------------- Summary of changes: include/sys/ioctl.h | 12 +----- include/sys/termios.h | 48 --------------------- kernel/arch/dreamcast/hardware/pvr/pvr_prim.c | 34 ++++++++++++--- kernel/fs/fs_pty.c | 35 +-------------- kernel/libc/c11/Makefile | 2 +- kernel/libc/c11/aligned_alloc.c | 18 -------- kernel/libc/koslib/malloc.c | 1 + kernel/libc/newlib/Makefile | 2 +- kernel/libc/newlib/newlib_isatty.c | 18 ++++++-- kernel/libc/newlib/newlib_malloc.c | 7 +++ kernel/libc/newlib/newlib_tcgetattr.c | 12 ------ utils/dc-chain/README.md | 14 +++--- utils/dc-chain/patches/gcc-15.0.0-kos.diff | 4 +- utils/dc-chain/patches/gcc-rustc-kos.diff | 4 +- .../newlib-4.4.0.20231231-kos.diff | 0 ...120-kos.diff => newlib-4.5.0.20241231-kos.diff} | 50 +++++++++++----------- utils/dc-chain/profiles/profile.10.5.0.mk | 2 +- utils/dc-chain/profiles/profile.11.5.0.mk | 2 +- utils/dc-chain/profiles/profile.12.4.0.mk | 2 +- utils/dc-chain/profiles/profile.13.3.0.mk | 8 ++-- utils/dc-chain/profiles/profile.13.3.1-dev.mk | 10 ++--- utils/dc-chain/profiles/profile.14.2.0.mk | 8 ++-- utils/dc-chain/profiles/profile.14.2.1-dev.mk | 10 ++--- utils/dc-chain/profiles/profile.15.0.0-dev.mk | 10 ++--- utils/dc-chain/profiles/profile.9.5.0-winxp.mk | 2 +- utils/dc-chain/profiles/profile.gccrs-dev.mk | 10 ++--- utils/dc-chain/profiles/profile.rustc-dev.mk | 10 ++--- utils/dc-chain/profiles/profile.stable.mk | 2 +- 28 files changed, 128 insertions(+), 209 deletions(-) delete mode 100644 include/sys/termios.h delete mode 100644 kernel/libc/c11/aligned_alloc.c delete mode 100644 kernel/libc/newlib/newlib_tcgetattr.c rename utils/dc-chain/patches/{ => historical}/newlib-4.4.0.20231231-kos.diff (100%) copy utils/dc-chain/patches/{newlib-4.3.0.20230120-kos.diff => newlib-4.5.0.20241231-kos.diff} (74%) mode change 100755 => 100644 diff --git a/include/sys/ioctl.h b/include/sys/ioctl.h index 1bbd3ae3..0baa546a 100644 --- a/include/sys/ioctl.h +++ b/include/sys/ioctl.h @@ -5,7 +5,7 @@ */ -/** \file sys/uio.h +/** \file sys/ioctl.h \brief Header for terminal control operations. \ingroup vfs_posix @@ -19,22 +19,12 @@ #ifndef __SYS_IOCTL_H #define __SYS_IOCTL_H -#include <sys/termios.h> - #include <sys/cdefs.h> __BEGIN_DECLS #include <kos/fs.h> -#ifndef TCGETS -#define TCGETS 0x5401 -#endif - -#ifndef TIOCGETA -#define TIOCGETA TCGETS -#endif - /* Define ioctl as an alias for fs_ioctl */ #define ioctl fs_ioctl diff --git a/include/sys/termios.h b/include/sys/termios.h deleted file mode 100644 index 8a03a459..00000000 --- a/include/sys/termios.h +++ /dev/null @@ -1,48 +0,0 @@ -/* KallistiOS ##version## - - sys/termios.h - Copyright (C) 2024 Andress Barajas - -*/ - -/** \file sys/termios.h - \brief Header for terminal I/O control. - \ingroup vfs_posix - - This file contains definitions for terminal I/O control operations, as specified by - the POSIX standard. The termios structure and associated constants and functions - are used to configure and control asynchronous communications ports. - - \author Andress Barajas -*/ - -#ifndef __SYS_TERMIOS_H -#define __SYS_TERMIOS_H - -#include <sys/cdefs.h> - -__BEGIN_DECLS - -#include <stdint.h> - -#define NCCS 32 - -typedef uint32_t tcflag_t; -typedef uint8_t cc_t; -typedef uint32_t speed_t; - -struct termios { - tcflag_t c_iflag; /* input modes */ - tcflag_t c_oflag; /* output modes */ - tcflag_t c_cflag; /* control modes */ - tcflag_t c_lflag; /* local modes */ - cc_t c_cc[NCCS]; /* control chars */ - speed_t c_ispeed; /* input speed */ - speed_t c_ospeed; /* output speed */ -}; - -int tcgetattr(int fd, struct termios *termios_p); - -__END_DECLS - -#endif /* __SYS_TERMIOS_H */ diff --git a/kernel/arch/dreamcast/hardware/pvr/pvr_prim.c b/kernel/arch/dreamcast/hardware/pvr/pvr_prim.c index 2558b1e8..73d6e38a 100644 --- a/kernel/arch/dreamcast/hardware/pvr/pvr_prim.c +++ b/kernel/arch/dreamcast/hardware/pvr/pvr_prim.c @@ -7,6 +7,7 @@ #include <assert.h> #include <string.h> +#include <arch/cache.h> #include <dc/pvr.h> #include "pvr_internal.h" @@ -21,7 +22,7 @@ /* Compile a polygon context into a polygon header */ void pvr_poly_compile(pvr_poly_hdr_t *dst, const pvr_poly_cxt_t *src) { - uint32_t txr_base; + uint32_t txr_base, cmd; /* Temporary variables we can read-write-modify, since we cannot do so from within the SQs, and we want to be able to compile this header from a PVR DR API submission target. */ @@ -31,7 +32,7 @@ void pvr_poly_compile(pvr_poly_hdr_t *dst, const pvr_poly_cxt_t *src) { into place, and OR it into the final result. */ /* The base values for CMD */ - dst->cmd = PVR_CMD_POLYHDR + cmd = PVR_CMD_POLYHDR | FIELD_PREP(PVR_TA_CMD_TXRENABLE, src->txr.enable) | FIELD_PREP(PVR_TA_CMD_TYPE, src->list_type) | FIELD_PREP(PVR_TA_CMD_CLRFMT, src->fmt.color) @@ -42,6 +43,10 @@ void pvr_poly_compile(pvr_poly_hdr_t *dst, const pvr_poly_cxt_t *src) { | FIELD_PREP(PVR_TA_CMD_MODIFIERMODE, src->gen.modifier_mode) | FIELD_PREP(PVR_TA_CMD_SPECULAR, src->gen.specular); + /* pvr_poly_hdr_t is cacheline-aligned and we're writing all 32 bytes: + * we can allocate a dirty cache line */ + dcache_alloc_block(dst, cmd); + /* Polygon mode 1 */ dst->mode1 = FIELD_PREP(PVR_TA_PM1_DEPTHCMP, src->depth.comparison) | FIELD_PREP(PVR_TA_PM1_CULLING, src->gen.culling) @@ -268,19 +273,23 @@ void pvr_sprite_cxt_txr(pvr_sprite_cxt_t *dst, pvr_list_t list, } void pvr_sprite_compile(pvr_sprite_hdr_t *dst, const pvr_sprite_cxt_t *src) { - uint32_t txr_base, mode2, mode3; + uint32_t txr_base, cmd, mode2, mode3; /* Basically we just take each parameter, clip it, shift it into place, and OR it into the final result. */ /* The base values for CMD */ - dst->cmd = PVR_CMD_SPRITE + cmd = PVR_CMD_SPRITE | FIELD_PREP(PVR_TA_CMD_TXRENABLE, src->txr.enable) | FIELD_PREP(PVR_TA_CMD_TYPE, src->list_type) | FIELD_PREP(PVR_TA_CMD_UVFMT, PVR_UVFMT_16BIT) | FIELD_PREP(PVR_TA_CMD_USERCLIP, src->gen.clip_mode) | FIELD_PREP(PVR_TA_CMD_SPECULAR, src->gen.specular); + /* pvr_sprite_hdr_t is cacheline-aligned and we're writing all 32 bytes: + * we can allocate a dirty cache line */ + dcache_alloc_block(dst, cmd); + /* Polygon mode 1 */ dst->mode1 = FIELD_PREP(PVR_TA_PM1_DEPTHCMP, src->depth.comparison) | FIELD_PREP(PVR_TA_PM1_CULLING, src->gen.culling) @@ -333,8 +342,15 @@ void pvr_sprite_compile(pvr_sprite_hdr_t *dst, const pvr_sprite_cxt_t *src) { void pvr_mod_compile(pvr_mod_hdr_t *dst, pvr_list_t list, uint32 mode, uint32 cull) { - dst->cmd = PVR_CMD_MODIFIER + uint32_t cmd; + + cmd = PVR_CMD_MODIFIER | FIELD_PREP(PVR_TA_CMD_TYPE, list); + + /* pvr_mod_hdr_t is cacheline-aligned and we're writing all 32 bytes: + * we can allocate a dirty cache line */ + dcache_alloc_block(dst, cmd); + dst->mode1 = FIELD_PREP(PVR_TA_PM1_MODIFIERINST, mode) | FIELD_PREP(PVR_TA_PM1_CULLING, cull); @@ -344,14 +360,14 @@ void pvr_mod_compile(pvr_mod_hdr_t *dst, pvr_list_t list, uint32 mode, /* Compile a polygon context into a polygon header that is affected by modifier volumes */ void pvr_poly_mod_compile(pvr_poly_mod_hdr_t *dst, const pvr_poly_cxt_t *src) { - uint32_t txr_base; + uint32_t txr_base, cmd; uint32_t mode2, mode3; /* Basically we just take each parameter, clip it, shift it into place, and OR it into the final result. */ /* The base values for CMD */ - dst->cmd = PVR_CMD_POLYHDR + cmd = PVR_CMD_POLYHDR | FIELD_PREP(PVR_TA_CMD_TXRENABLE, src->txr.enable) | FIELD_PREP(PVR_TA_CMD_TYPE, src->list_type) | FIELD_PREP(PVR_TA_CMD_CLRFMT, src->fmt.color) @@ -362,6 +378,10 @@ void pvr_poly_mod_compile(pvr_poly_mod_hdr_t *dst, const pvr_poly_cxt_t *src) { | FIELD_PREP(PVR_TA_CMD_MODIFIERMODE, src->gen.modifier_mode) | FIELD_PREP(PVR_TA_CMD_SPECULAR, src->gen.specular); + /* pvr_poly_mod_hdr_t is cacheline-aligned and we're writing all 32 bytes: + * we can allocate a dirty cache line */ + dcache_alloc_block(dst, cmd); + /* Polygon mode 1 */ dst->mode1 = FIELD_PREP(PVR_TA_PM1_DEPTHCMP, src->depth.comparison) | FIELD_PREP(PVR_TA_PM1_CULLING, src->gen.culling) diff --git a/kernel/fs/fs_pty.c b/kernel/fs/fs_pty.c index 6bb80e1b..50349477 100644 --- a/kernel/fs/fs_pty.c +++ b/kernel/fs/fs_pty.c @@ -62,8 +62,6 @@ typedef struct ptyhalf { mutex_t mutex; condvar_t ready_read, ready_write; - - struct termios termios; } ptyhalf_t; /* Our global pty list */ @@ -155,10 +153,6 @@ int fs_pty_create(char *buffer, int maxbuflen, file_t *master_out, file_t *slave /* Reset their refcnts (these will get increased in a minute) */ master->refcnt = slave->refcnt = 0; - /* Initialize the termios structures with default values */ - memset(&master->termios, 0, sizeof(struct termios)); - memset(&slave->termios, 0, sizeof(struct termios)); - /* Allocate a mutex for each for multiple readers or writers */ mutex_init(&master->mutex, MUTEX_TYPE_NORMAL); cond_init(&master->ready_read); @@ -679,33 +673,6 @@ static dirent_t * pty_readdir(void * h) { return &dl->dirent; } -static int pty_ioctl(void *h, int cmd, va_list ap) { - pipefd_t *fd = (pipefd_t *)h; - ptyhalf_t *ph = fd->d.p; - void *arg = va_arg(ap, void*); - - if (!fd || fd->type != PF_PTY) { - errno = EBADF; - return -1; - } - - switch (cmd) { - case TIOCGETA: - if(arg == NULL) { - errno = EINVAL; - return -1; - } - memcpy(arg, &ph->termios, sizeof(struct termios)); - return 0; - - /* Add other ioctl cases here */ - - default: - errno = ENOTTY; - return -1; - } -} - static int pty_stat(vfs_handler_t *vfs, const char *path, struct stat *st, int flag) { ptyhalf_t *ph; @@ -859,7 +826,7 @@ static vfs_handler_t vh = { NULL, pty_total, pty_readdir, - pty_ioctl, + NULL, NULL, NULL, NULL, diff --git a/kernel/libc/c11/Makefile b/kernel/libc/c11/Makefile index 2c42f70c..4b955a73 100644 --- a/kernel/libc/c11/Makefile +++ b/kernel/libc/c11/Makefile @@ -11,6 +11,6 @@ OBJS = call_once.o cnd_broadcast.o cnd_destroy.o cnd_init.o cnd_signal.o \ mtx_timedlock.o mtx_trylock.o mtx_unlock.o thrd_create.o thrd_current.o \ thrd_detach.o thrd_equal.o thrd_exit.o thrd_join.o thrd_sleep.o \ thrd_yield.o tss_create.o tss_delete.o tss_get.o tss_set.o \ - aligned_alloc.o timespec_get.o timegm.o atomics.o + timespec_get.o timegm.o atomics.o include $(KOS_BASE)/Makefile.prefab diff --git a/kernel/libc/c11/aligned_alloc.c b/kernel/libc/c11/aligned_alloc.c deleted file mode 100644 index d5ae9a8b..00000000 --- a/kernel/libc/c11/aligned_alloc.c +++ /dev/null @@ -1,18 +0,0 @@ -/* KallistiOS ##version## - - aligned_alloc.c - Copyright (C) 2015 Lawrence Sebald -*/ - -#include <malloc.h> - -/* Declare memalign, since it may not be available in strict standard-compliant - mode. */ -extern void *memalign(size_t alignment, size_t size); - -void *aligned_alloc(size_t alignment, size_t size) { - if(size % alignment) - return NULL; - - return memalign(alignment, size); -} diff --git a/kernel/libc/koslib/malloc.c b/kernel/libc/koslib/malloc.c index 8c302ab3..8e2e17ce 100644 --- a/kernel/libc/koslib/malloc.c +++ b/kernel/libc/koslib/malloc.c @@ -1037,6 +1037,7 @@ extern "C" { Overreliance on memalign is a sure way to fragment space. */ + __used #if __STD_C Void_t* public_mEMALIGn(size_t, size_t); #else diff --git a/kernel/libc/newlib/Makefile b/kernel/libc/newlib/Makefile index 5d4b2114..873cf773 100644 --- a/kernel/libc/newlib/Makefile +++ b/kernel/libc/newlib/Makefile @@ -19,6 +19,6 @@ OBJS = lock_common.o newlib_close.o newlib_env_lock.o newlib_environ.o \ newlib_lseek.o newlib_malloc.o newlib_open.o \ newlib_read.o newlib_sbrk.o newlib_stat.o newlib_times.o \ newlib_unlink.o newlib_wait.o newlib_write.o newlib_fcntl.o \ - newlib_tcgetattr.o verify_newlib.o + verify_newlib.o include $(KOS_BASE)/Makefile.prefab diff --git a/kernel/libc/newlib/newlib_isatty.c b/kernel/libc/newlib/newlib_isatty.c index bc6c0dea..05d37a88 100644 --- a/kernel/libc/newlib/newlib_isatty.c +++ b/kernel/libc/newlib/newlib_isatty.c @@ -8,13 +8,14 @@ */ #include <unistd.h> +#include <string.h> #include <errno.h> #include <sys/reent.h> -#include <sys/termios.h> +#include <kos/fs.h> int isatty(int fd) { - struct termios term; + vfs_handler_t *vh; if(fd < 0) { errno = EBADF; @@ -26,7 +27,18 @@ int isatty(int fd) { if(fd == STDIN_FILENO) return 1; - return tcgetattr(fd, &term) == 0; + vh = fs_get_handler(fd); + + if(vh == NULL) + return 0; + + /* pty is the only tty we support */ + if(!strcmp(vh->nmmgr.pathname,"/pty")) + return 1; + else { + errno = ENOTTY; + return 0; + } } int _isatty_r(struct _reent *reent, int fd) { diff --git a/kernel/libc/newlib/newlib_malloc.c b/kernel/libc/newlib/newlib_malloc.c index ec16315b..05b32c5b 100644 --- a/kernel/libc/newlib/newlib_malloc.c +++ b/kernel/libc/newlib/newlib_malloc.c @@ -8,6 +8,8 @@ #include <stdlib.h> #include <reent.h> +void *memalign(size_t alignment, size_t size); + // We have to provide these for Newlib's reent pieces. __used void _free_r(struct _reent *re, void *ptr) { @@ -29,3 +31,8 @@ __used void *_realloc_r(struct _reent *re, void *ptr, size_t size) { (void)re; return realloc(ptr, size); } + +__used void *_memalign_r(struct _reent *re, size_t align, size_t nbytes) { + (void)re; + return memalign(align, nbytes); +} diff --git a/kernel/libc/newlib/newlib_tcgetattr.c b/kernel/libc/newlib/newlib_tcgetattr.c deleted file mode 100644 index 865e8750..00000000 --- a/kernel/libc/newlib/newlib_tcgetattr.c +++ /dev/null @@ -1,12 +0,0 @@ -/* KallistiOS ##version## - - newlib_tcgetattr.c - Copyright (C) 2024 Andress Barajas - -*/ - -#include <sys/ioctl.h> - -int tcgetattr(int fd, struct termios *termios_p) { - return ioctl(fd, TIOCGETA, termios_p); -} diff --git a/utils/dc-chain/README.md b/utils/dc-chain/README.md index 1e802874..4d272961 100644 --- a/utils/dc-chain/README.md +++ b/utils/dc-chain/README.md @@ -104,13 +104,13 @@ The following toolchain profiles are available for users to select in | 11.5.0 | 11.5.0 | 4.3.0 | 2.43 | 8.5.0 | 2.43 | Latest release in the GCC 11 series, released 2024-07-19<br />GCC 11 series support ended upstream | | 12.3.0 | 12.3.0 | 4.3.0 | 2.43 | 8.5.0 | 2.43 | Latest release in the GCC 12 series, released 2023-05-08 | | **stable** | **13.2.0** | **4.3.0** | **2.43** | **8.5.0** | **2.43** | **Tested stable; based on GCC 13.2.0, released 2023-07-27** | -| 13.3.0 | 13.3.0 | 4.4.0 | 2.43 | 8.5.0 | 2.43 | Latest release in the GCC 13 series, released 2024-05-21 | -| 14.2.0 | 14.2.0 | 4.4.0 | 2.43 | 8.5.0 | 2.43 | Latest release in the GCC 14 series, released 2024-08-01 | -| 13.3.1-dev | 13.3.1 (git) | 4.4.0 | 2.43 | 8.5.0 | 2.43 | Bleeding edge GCC 13 series from git | -| 14.2.1-dev | 14.2.1 (git) | 4.4.0 | 2.43 | 8.5.0 | 2.43 | Bleeding edge GCC 14 series from git | -| 15.0.0-dev | 15.0.0 (git) | 4.4.0 | 2.43 | 8.5.0 | 2.43 | Bleeding edge GCC 15 series from git | -| gccrs-dev | 14.x | 4.4.0 | 2.43 | 8.5.0 | 2.43 | GCC fork for development of the GCCRS Rust compiler | -| rustc-dev | 14.x | 4.4.0 | 2.43 | 8.5.0 | 2.43 | GCC fork for development of the libgccjit rustc GCC codegen | +| 13.3.0 | 13.3.0 | 4.5.0 | 2.43.1 | 8.5.0 | 2.43.1 | Latest release in the GCC 13 series, released 2024-05-21 | +| 14.2.0 | 14.2.0 | 4.5.0 | 2.43.1 | 8.5.0 | 2.43.1 | Latest release in the GCC 14 series, released 2024-08-01 | +| 13.3.1-dev | 13.3.1 (git) | 4.5.0 | 2.43.1 | 8.5.0 | 2.43.1 | Bleeding edge GCC 13 series from git | +| 14.2.1-dev | 14.2.1 (git) | 4.5.0 | 2.43.1 | 8.5.0 | 2.43.1 | Bleeding edge GCC 14 series from git | +| 15.0.0-dev | 15.0.0 (git) | 4.5.0 | 2.43.1 | 8.5.0 | 2.43.1 | Bleeding edge GCC 15 series from git | +| gccrs-dev | 14.x | 4.5.0 | 2.43.1 | 8.5.0 | 2.43.1 | GCC fork for development of the GCCRS Rust compiler | +| rustc-dev | 14.x | 4.5.0 | 2.43.1 | 8.5.0 | 2.43.1 | GCC fork for development of the libgccjit rustc GCC codegen | The **stable** profile is the primary, widely tested target for KallistiOS, and is the most recent toolchain profile known to work with all example programs. diff --git a/utils/dc-chain/patches/gcc-15.0.0-kos.diff b/utils/dc-chain/patches/gcc-15.0.0-kos.diff index b937ea5d..ad7060cf 100644 --- a/utils/dc-chain/patches/gcc-15.0.0-kos.diff +++ b/utils/dc-chain/patches/gcc-15.0.0-kos.diff @@ -16,7 +16,7 @@ diff -ruN gcc-15.0.0/gcc/config/sh/sh-c.cc gcc-15.0.0-kos/gcc/config/sh/sh-c.cc diff -ruN gcc-15.0.0/gcc/configure gcc-15.0.0-kos/gcc/configure --- gcc-15.0.0/gcc/configure 2024-01-04 16:01:33.801051764 -0600 +++ gcc-15.0.0-kos/gcc/configure 2024-01-04 16:01:42.913094480 -0600 -@@ -13051,7 +13051,7 @@ +@@ -13122,7 +13122,7 @@ target_thread_file='single' ;; aix | dce | lynx | mipssde | posix | rtems | \ @@ -40,7 +40,7 @@ diff -ruN gcc-15.0.0/libgcc/config/sh/t-sh gcc-15.0.0-kos/libgcc/config/sh/t-sh diff -ruN gcc-15.0.0/libgcc/configure gcc-15.0.0-kos/libgcc/configure --- gcc-15.0.0/libgcc/configure 2024-01-04 16:01:37.139067412 -0600 +++ gcc-15.0.0-kos/libgcc/configure 2024-01-04 16:01:42.914094485 -0600 -@@ -5731,6 +5731,7 @@ +@@ -5733,6 +5733,7 @@ tpf) thread_header=config/s390/gthr-tpf.h ;; vxworks) thread_header=config/gthr-vxworks.h ;; win32) thread_header=config/i386/gthr-win32.h ;; diff --git a/utils/dc-chain/patches/gcc-rustc-kos.diff b/utils/dc-chain/patches/gcc-rustc-kos.diff index e3ad59c2..2d239353 100644 --- a/utils/dc-chain/patches/gcc-rustc-kos.diff +++ b/utils/dc-chain/patches/gcc-rustc-kos.diff @@ -16,7 +16,7 @@ diff --color -ruN gcc-rustc/gcc/config/sh/sh-c.cc gcc-rustc-kos/gcc/config/sh/sh diff --color -ruN gcc-rustc/gcc/configure gcc-rustc-kos/gcc/configure --- gcc-rustc/gcc/configure 2024-02-02 23:52:38.301387207 -0600 +++ gcc-rustc-kos/gcc/configure 2024-02-02 23:52:57.786480571 -0600 -@@ -13217,7 +13217,7 @@ +@@ -13108,7 +13108,7 @@ target_thread_file='single' ;; aix | dce | lynx | mipssde | posix | rtems | \ @@ -40,7 +40,7 @@ diff --color -ruN gcc-rustc/libgcc/config/sh/t-sh gcc-rustc-kos/libgcc/config/sh diff --color -ruN gcc-rustc/libgcc/configure gcc-rustc-kos/libgcc/configure --- gcc-rustc/libgcc/configure 2024-02-02 23:52:41.146400839 -0600 +++ gcc-rustc-kos/libgcc/configure 2024-02-02 23:52:57.787480576 -0600 -@@ -5763,6 +5763,7 @@ +@@ -5732,6 +5732,7 @@ ...<truncated>... hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: quzar <qu...@us...> - 2025-01-05 20:12: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 99b18e3a864c4f591f73dad893b10d0f4920de81 (commit) via 01a695b8afba0b44cc8e672ca693ea5285201d3e (commit) via 2e52944bb98e951a6f39a531e95c92ccbb2c1830 (commit) via 9809b9d5ff3a24777341d16570b70f8f868ddca8 (commit) via 19ce9ecad9136f36c1f3d170a0eedde22218eeb7 (commit) from c27605764db8ce5fa1a0dcb97042f581f6489483 (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 99b18e3a864c4f591f73dad893b10d0f4920de81 Merge: c2760576 01a695b8 Author: Donald Haase <qu...@ya...> Date: Sun Jan 5 15:04:15 2025 -0500 Merge pull request #877 from pcercuei/fck-macros Convert some macros to inline functions and improve inline ASM commit 01a695b8afba0b44cc8e672ca693ea5285201d3e Author: Paul Cercueil <pa...@cr...> Date: Thu Jan 2 15:44:33 2025 +0100 arch.h: Simplify inline ASM The arch_get_ret_addr() used the weird "=&z" output modifier. The '&' means the register is an "early clobber", which makes no sense for a single-instruction ASM code. The 'z' means (AFAIK) that the destination register is r0, which we don't really need here. The output modifier can therefore be replaced by the much more normal "=r" token. Besides, given that the STS opcode called does not modify memory in any way, the "memory" clobber specifier can go. For arch_get_fptr(), there is no need for any inline ASM - we can just return the content of the r14 register. Signed-off-by: Paul Cercueil <pa...@cr...> commit 2e52944bb98e951a6f39a531e95c92ccbb2c1830 Author: Paul Cercueil <pa...@cr...> Date: Thu Jan 2 15:43:16 2025 +0100 arch.h: Transform macros into inline functions There is no valid reason to have the arch API has macros. Convert it to static inline functions to benefit from type checking. Signed-off-by: Paul Cercueil <pa...@cr...> commit 9809b9d5ff3a24777341d16570b70f8f868ddca8 Author: Paul Cercueil <pa...@cr...> Date: Sun Jan 5 17:10:51 2025 +0100 cache: Improve dcache_alloc_block() Instead of using the "memory" clobber, instruct the compiler that the 32 bytes located at the address passed as parameter have been written. The compiler then knows that anything read or written to that memory area prior to the dcache_alloc_block() call is dead code, and anything read or written outside this area is still valid after the call. The "volatile" specifier has been dropped as well, given that the compiler has now all the information it needs, and can freely reorganize the instructions as needed. Signed-off-by: Paul Cercueil <pa...@cr...> commit 19ce9ecad9136f36c1f3d170a0eedde22218eeb7 Author: Paul Cercueil <pa...@cr...> Date: Thu Jan 2 15:39:32 2025 +0100 cache: PREF instruction does not clobber memory From the compiler point of view, the PREF instruction does not modify the content of the memory; therefore the "memory" clobber is not useful here. The compiler then knows that it does not have to reload all the variables from memory after a call to dcache_pref_block(). Signed-off-by: Paul Cercueil <pa...@cr...> ----------------------------------------------------------------------- Summary of changes: kernel/arch/dreamcast/include/arch/arch.h | 55 +++++++++++++++++------------- kernel/arch/dreamcast/include/arch/cache.h | 24 ++++++++----- 2 files changed, 47 insertions(+), 32 deletions(-) diff --git a/kernel/arch/dreamcast/include/arch/arch.h b/kernel/arch/dreamcast/include/arch/arch.h index e944762b..3bdc06c3 100644 --- a/kernel/arch/dreamcast/include/arch/arch.h +++ b/kernel/arch/dreamcast/include/arch/arch.h @@ -22,6 +22,8 @@ #include <kos/cdefs.h> __BEGIN_DECLS +#include <stdbool.h> + #include <arch/types.h> /** \defgroup arch Architecture @@ -352,12 +354,12 @@ const char *kos_get_license(void); */ const char *kos_get_authors(void); -/** \brief Dreamcast specific sleep mode "function". - \ingroup arch +/** \brief Dreamcast specific sleep mode function. + \ingroup arch */ -#define arch_sleep() do { \ - __asm__ __volatile__("sleep"); \ - } while(0) +static inline void arch_sleep(void) { + __asm__ __volatile__("sleep\n"); +} /** \brief DC specific "function" to get the return address from the current function. @@ -365,13 +367,13 @@ const char *kos_get_authors(void); \return The return address of the current function. */ -#define arch_get_ret_addr() ({ \ - uint32 pr; \ - __asm__ __volatile__("sts pr,%0\n" \ - : "=&z" (pr) \ - : /* no inputs */ \ - : "memory" ); \ - pr; }) +static 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 @@ -384,13 +386,11 @@ const char *kos_get_authors(void); \return The frame pointer from the current function. \note This only works if you don't disable frame pointers. */ -#define arch_get_fptr() ({ \ - uint32 fp; \ - __asm__ __volatile__("mov r14,%0\n" \ - : "=&z" (fp) \ - : /* no inputs */ \ - : "memory" ); \ - fp; }) +static 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. @@ -399,7 +399,9 @@ const char *kos_get_authors(void); \param fptr The frame pointer to look at. \return The return address of the pointer. */ -#define arch_fptr_ret_addr(fptr) (*((uint32*)(fptr))) +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. @@ -408,7 +410,9 @@ const char *kos_get_authors(void); \param fptr The frame pointer to look at. \return The previous frame pointer. */ -#define arch_fptr_next(fptr) (*((uint32*)((fptr)+4))) +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. @@ -417,7 +421,9 @@ const char *kos_get_authors(void); \return Whether the address is valid or not for normal memory access. */ -#define arch_valid_address(ptr) ((ptr_t)(ptr) >= 0x8c010000 && (ptr_t)(ptr) < _arch_mem_top) +static inline bool arch_valid_address(uintptr_t ptr) { + return ptr >= 0x8c010000 && ptr < _arch_mem_top; +} /** \brief Returns true if the passed address is in the text section of your program. @@ -426,8 +432,9 @@ const char *kos_get_authors(void); \return Whether the address is valid or not for text memory access. */ -#define arch_valid_text_address(ptr) \ - ((uintptr_t)(ptr) >= (uintptr_t)&_executable_start && (uintptr_t)(ptr) < (uintptr_t)&_etext) +static inline bool arch_valid_text_address(uintptr_t ptr) { + return ptr >= (uintptr_t)&_executable_start && ptr < (uintptr_t)&_etext; +} __END_DECLS diff --git a/kernel/arch/dreamcast/include/arch/cache.h b/kernel/arch/dreamcast/include/arch/cache.h index 2dca15cd..0581b27a 100644 --- a/kernel/arch/dreamcast/include/arch/cache.h +++ b/kernel/arch/dreamcast/include/arch/cache.h @@ -139,9 +139,9 @@ void dcache_purge_all_with_buffer(uintptr_t start, size_t count); */ static __always_inline void dcache_pref_block(const void *src) { __asm__ __volatile__("pref @%0\n" - : + : /* No outputs */ : "r" (src) - : "memory" + : /* No clobbers */ ); } @@ -157,14 +157,22 @@ static __always_inline void dcache_pref_block(const void *src) { This function allocate a block of the data/operand cache. - \param src The physical address to allocate. + \param src The address to allocate (32-byte aligned) \param value The value written to first 4-byte. */ -static __always_inline void dcache_alloc_block(const void *src, uint32_t value) { - __asm__ __volatile__ ("movca.l r0, @%0\n\t" - : - : "r" (src), "z" (value) - : "memory" +static __always_inline void dcache_alloc_block(void *src, uint32_t value) { + uint32_t *src32 = (uint32_t *)src; + + __asm__ ("movca.l r0, @%8\n\t" + : "=m"(src32[0]), + "=m"(src32[1]), + "=m"(src32[2]), + "=m"(src32[3]), + "=m"(src32[4]), + "=m"(src32[5]), + "=m"(src32[6]), + "=m"(src32[7]) + : "r" (src32), "z" (value) ); } hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: quzar <qu...@us...> - 2025-01-04 23:28:34
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via c27605764db8ce5fa1a0dcb97042f581f6489483 (commit) via 332849239339b6f9c03262409af7432be7df2087 (commit) via a7b91654aa5f09f8cec425972b7e16c40de3a068 (commit) via 8b5678199a54459aeaa27b4e2e25a8cdb400cbd5 (commit) via 1354971121aa233f09865f874b6fdd0c3e4b583f (commit) via cd5d5209e023002a296a2a70767f385844be29fb (commit) via c36af5c408315f846f685740c247f40788b204f6 (commit) via 0aff2640833cadc17b24784b8912bc605b4c3b55 (commit) via 1314a7b2efe4caacb5aa4d6bdeae6c4185f8260a (commit) via 0059576045f2d437ab19c4e786b703d68c9eb964 (commit) via f015717383fbe72bf171bee54b4abb60928d2345 (commit) via ea5e113375ca4dcc552dbe78d1d586e741e23241 (commit) via 8448dfbd22363124ffc5121b171c325176b34229 (commit) via 51f122fa0d94834a4603df4cd7baa07753176f4d (commit) via 528a91b7ee47bb20e38d010852a0643fc28d955e (commit) via 6321f11fb0ab6e921a5d675a960958cfc4adb3c8 (commit) via 55261b67b197a4a3d276bb46807f0466c60c8e5f (commit) via dfcb36237c952afed34c47aeb37f87200c222a29 (commit) via 6bedd3a455b7bc7e2bfa21d2731af682de2dfe75 (commit) from 3ac9880e61d086cd62d31bbad63d4998821a4858 (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 c27605764db8ce5fa1a0dcb97042f581f6489483 Merge: 33284923 ea5e1133 Author: Donald Haase <qu...@ya...> Date: Sat Jan 4 18:26:51 2025 -0500 Merge pull request #874 from KallistiOS/pvr_refresh_I PVR Function Prototypes Cleanup (pvr.h refactor #539 part 1) commit 332849239339b6f9c03262409af7432be7df2087 Merge: a7b91654 13549711 Author: Donald Haase <qu...@ya...> Date: Sat Jan 4 18:13:58 2025 -0500 Merge pull request #879 from pcercuei/pvr-fix-sq-with-dma pvr: Do not check DMA completion in pvr_sq functions commit a7b91654aa5f09f8cec425972b7e16c40de3a068 Merge: 8b567819 00595760 Author: Donald Haase <qu...@ya...> Date: Sat Jan 4 18:11:24 2025 -0500 Merge pull request #859 from pcercuei/pvr-get-front-buffer Add pvr_wait_render_done() and pvr_get_front_buffer() commit 8b5678199a54459aeaa27b4e2e25a8cdb400cbd5 Merge: cd5d5209 c36af5c4 Author: Donald Haase <qu...@ya...> Date: Sat Jan 4 18:01:36 2025 -0500 Merge pull request #866 from pcercuei/pvr-fix-dma-mode pvr: Fix direct rendering when DMA mode is enabled commit 1354971121aa233f09865f874b6fdd0c3e4b583f Author: Paul Cercueil <pa...@cr...> Date: Fri Jan 3 18:42:52 2025 +0100 pvr: Do not check DMA completion in pvr_sq functions The only reason why you would want to wait for any pending DMA transfer to complete before using the SQs is when the DMA transfer targets the TA, in which case a SQ transfer to the TA would be asking for trouble. However, the PVR scene code is already making sure that the TA is ready before a new list can be opened; this means that it is guaranteed that lists configured for DMA will be done transferring before anything is transferred to the TA via SQs. Therefore, with the current driver code, there is no point in waiting for DMA completion. With that said, the code actually did not wait for DMA completion, but was doing something much worse: in the case where a DMA transfer was in progress, it would simply display an error, and return without processing the SQ transfer. This caused heavy errors, including crashes, for instance when a list's "EOL marker" could not be added. Address this issue by simply not checking for the DMA completion in the pvr_sq functions. Fixes #878. Signed-off-by: Paul Cercueil <pa...@cr...> commit cd5d5209e023002a296a2a70767f385844be29fb Merge: 3ac9880e 0aff2640 Author: Donald Haase <qu...@ya...> Date: Thu Dec 26 11:08:09 2024 -0500 Merge pull request #861 from DC-SWAT/gd_dma_cache_fix Fix and improve CPU cache management for devices on G1 bus. commit c36af5c408315f846f685740c247f40788b204f6 Author: Paul Cercueil <pa...@cr...> Date: Mon Dec 9 15:56:04 2024 +0100 pvr: Fix direct rendering when DMA mode is enabled The "pvr_state.lists_closed" was reset only when DMA mode was not enabled. This caused problems when the geometry was only submitted via direct rendering. Signed-off-by: Paul Cercueil <pa...@cr...> commit 0aff2640833cadc17b24784b8912bc605b4c3b55 Author: DC-SWAT <sw...@21...> Date: Wed Dec 4 11:12:40 2024 +0700 g1ata: Improved check for the need for CPU cache manage. commit 1314a7b2efe4caacb5aa4d6bdeae6c4185f8260a Author: DC-SWAT <sw...@21...> Date: Wed Dec 4 11:12:35 2024 +0700 cdrom: Alignment check and manage CPU cache for sector read. commit 0059576045f2d437ab19c4e786b703d68c9eb964 Author: Paul Cercueil <pa...@cr...> Date: Tue Dec 3 21:16:48 2024 +0100 pvr: Add pvr_init() flag to disable vertex buffer double-buffering Having a double-buffering mechanism for the vertex buffer makes it possible to upload geometry data to the Tile Accelerator while the PVR is busy rendering the previous scene. However, it means having two buffers for the geometry data. Some applications may prefer using a much smaller vertex buffer to lower VRAM usage, even if it means the TA and PVR cannot be used at the same time. Signed-off-by: Paul Cercueil <pa...@cr...> commit f015717383fbe72bf171bee54b4abb60928d2345 Author: Paul Cercueil <pa...@cr...> Date: Fri Nov 29 13:54:26 2024 +0100 pvr: Add pvr_get_front_buffer() This function can be used to retrieve a pointer to the front buffer, aka. the last fully rendered buffer that is either being displayed right now, or is queued to be displayed. Signed-off-by: Paul Cercueil <pa...@cr...> commit ea5e113375ca4dcc552dbe78d1d586e741e23241 Author: QuzarDC <qu...@co...> Date: Thu Nov 28 22:06:50 2024 -0500 Update pvr_mem function prototype types commit 8448dfbd22363124ffc5121b171c325176b34229 Author: Paul Cercueil <pa...@cr...> Date: Sat Nov 9 21:36:24 2024 +0100 pvr: add pvr_wait_render_done() This function can be used to wait until the PVR is done rendering a previous scene. This can be useful for instance to make sure that the PVR is done using textures that have to be updated, before updating those. Signed-off-by: Paul Cercueil <pa...@cr...> commit 51f122fa0d94834a4603df4cd7baa07753176f4d Author: QuzarDC <qu...@co...> Date: Thu Nov 28 00:21:25 2024 -0500 Clean up function prototypes in pvr_fog commit 528a91b7ee47bb20e38d010852a0643fc28d955e Author: QuzarDC <qu...@co...> Date: Wed Nov 27 21:42:52 2024 -0500 Clean up function typing in pvr_scene. commit 6321f11fb0ab6e921a5d675a960958cfc4adb3c8 Author: QuzarDC <qu...@co...> Date: Tue Nov 26 15:39:12 2024 -0500 Update init functions to constify params. commit 55261b67b197a4a3d276bb46807f0466c60c8e5f Author: QuzarDC <qu...@co...> Date: Tue Nov 26 11:52:19 2024 -0500 Update typing in pvr_set_shadow_scale - Updated enable param to bool, as well as the logic that clamped it. - Updated examples to use the new type. commit dfcb36237c952afed34c47aeb37f87200c222a29 Author: QuzarDC <qu...@co...> Date: Tue Nov 26 11:32:27 2024 -0500 Clean up typing in pvr dma - Update block parameter of loads and blocking var to bool. - Update source pointers of loads to const. - Update pvr_dma_ready to return a bool. commit 6bedd3a455b7bc7e2bfa21d2731af682de2dfe75 Author: QuzarDC <qu...@co...> Date: Tue Nov 26 10:49:40 2024 -0500 Clean up typing for pvr_buffers.c - Use bool rather than int for 'presort'. - Set the param of pvr_allocate_buffers to a const. ----------------------------------------------------------------------- Summary of changes: examples/dreamcast/pvr/cheap_shadow/shadow.c | 6 +- .../dreamcast/pvr/modifier_volume_zclip/example.c | 2 +- kernel/arch/dreamcast/hardware/cdrom.c | 36 ++++++++-- kernel/arch/dreamcast/hardware/g1ata.c | 33 ++++++--- kernel/arch/dreamcast/hardware/pvr/pvr_buffers.c | 8 +-- kernel/arch/dreamcast/hardware/pvr/pvr_dma.c | 34 +++------ kernel/arch/dreamcast/hardware/pvr/pvr_fog.c | 10 +-- .../dreamcast/hardware/pvr/pvr_init_shutdown.c | 11 ++- kernel/arch/dreamcast/hardware/pvr/pvr_internal.h | 8 ++- kernel/arch/dreamcast/hardware/pvr/pvr_irq.c | 4 +- kernel/arch/dreamcast/hardware/pvr/pvr_mem.c | 6 +- kernel/arch/dreamcast/hardware/pvr/pvr_misc.c | 24 ++++++- kernel/arch/dreamcast/hardware/pvr/pvr_scene.c | 34 ++++++--- kernel/arch/dreamcast/include/dc/cdrom.h | 11 ++- kernel/arch/dreamcast/include/dc/g1ata.h | 10 ++- kernel/arch/dreamcast/include/dc/pvr.h | 83 +++++++++++++++------- 16 files changed, 220 insertions(+), 100 deletions(-) diff --git a/examples/dreamcast/pvr/cheap_shadow/shadow.c b/examples/dreamcast/pvr/cheap_shadow/shadow.c index 08e38724..349f5126 100644 --- a/examples/dreamcast/pvr/cheap_shadow/shadow.c +++ b/examples/dreamcast/pvr/cheap_shadow/shadow.c @@ -96,11 +96,11 @@ int check_start(void) { if(state->joyy > 64) { shadow = CLAMP(0.0f, 1.0f, shadow + 0.01f); - pvr_set_shadow_scale(1, shadow); + pvr_set_shadow_scale(true, shadow); } else if(state->joyy < -64) { shadow = CLAMP(0.0f, 1.0f, shadow - 0.01f); - pvr_set_shadow_scale(1, shadow); + pvr_set_shadow_scale(true, shadow); } if(state->buttons & CONT_START) @@ -212,7 +212,7 @@ int main(int argc, char *argv[]) { /* Enable Cheap Shadow mode and set affected polygons to be at half of their normal intensity. */ - pvr_set_shadow_scale(1, shadow); + pvr_set_shadow_scale(true, shadow); setup(); diff --git a/examples/dreamcast/pvr/modifier_volume_zclip/example.c b/examples/dreamcast/pvr/modifier_volume_zclip/example.c index 564137bc..ef7eb608 100644 --- a/examples/dreamcast/pvr/modifier_volume_zclip/example.c +++ b/examples/dreamcast/pvr/modifier_volume_zclip/example.c @@ -252,7 +252,7 @@ int main(int argc, char* argv[]) pvr_init(¶ms); pvr_set_bg_color(0, 0.5f, 1.0f); /* Enable cheap shadow */ - pvr_set_shadow_scale(1, 0.5f); + pvr_set_shadow_scale(true, 0.5f); /* init plane */ box_tex = pvr_mem_malloc(256 * 256 * 2); diff --git a/kernel/arch/dreamcast/hardware/cdrom.c b/kernel/arch/dreamcast/hardware/cdrom.c index 09ec0ca6..70a4cabb 100644 --- a/kernel/arch/dreamcast/hardware/cdrom.c +++ b/kernel/arch/dreamcast/hardware/cdrom.c @@ -5,12 +5,13 @@ Copyright (C) 2000 Megan Potter Copyright (C) 2014 Lawrence Sebald Copyright (C) 2014 Donald Haase - Copyright (C) 2023 Ruslan Rostovtsev + Copyright (C) 2023, 2024 Ruslan Rostovtsev Copyright (C) 2024 Andy Barajas */ #include <assert.h> +#include <arch/cache.h> #include <arch/timer.h> #include <arch/memory.h> @@ -55,6 +56,8 @@ typedef int gdc_cmd_hnd_t; /* The G1 ATA access mutex */ mutex_t _g1_ata_mutex = MUTEX_INITIALIZER; +static int cur_sector_size = 2048; + /* Shortcut to cdrom_reinit_ex. Typically this is the only thing changed. */ int cdrom_set_sector_size(int size) { return cdrom_reinit_ex(-1, -1, size); @@ -215,6 +218,7 @@ int cdrom_change_datatype(int sector_part, int cdxa, int sector_size) { params[2] = cdxa; /* CD-XA mode 1/2 */ params[3] = sector_size; /* sector size */ + cur_sector_size = sector_size; return syscall_gdrom_sector_mode(params); } @@ -265,10 +269,10 @@ int cdrom_read_sectors_ex(void *buffer, int sector, int cnt, int mode) { int is_test; } params; int rv = ERR_OK; + uintptr_t buf_addr = ((uintptr_t)buffer); params.sec = sector; /* Starting sector */ params.num = cnt; /* Number of sectors */ - params.buffer = buffer; /* Output buffer */ params.is_test = 0; /* Enable test mode */ /* The DMA mode blocks the thread it is called in by the way we execute @@ -276,10 +280,34 @@ int cdrom_read_sectors_ex(void *buffer, int sector, int cnt, int mode) { /* XXX: DMA Mode may conflict with using a second G1ATA device. More testing is needed from someone with such a device. */ - if(mode == CDROM_READ_DMA) + if(mode == CDROM_READ_DMA) { + if(buf_addr & 0x1f) { + dbglog(DBG_ERROR, "cdrom_read_sectors_ex: Unaligned memory for DMA (32-byte).\n"); + return ERR_SYS; + } + /* Use the physical memory address. */ + params.buffer = (void *)(buf_addr & MEM_AREA_CACHE_MASK); + + /* Invalidate the CPU cache only for cacheable memory areas. + Otherwise, it is assumed that either this operation is unnecessary + (another DMA is being used) or that the caller is responsible + for managing the CPU data cache. + */ + if((buf_addr & MEM_AREA_P2_BASE) != MEM_AREA_P2_BASE) { + /* Invalidate the dcache over the range of the data. */ + dcache_inval_range(buf_addr, cnt * cur_sector_size); + } rv = cdrom_exec_cmd(CMD_DMAREAD, ¶ms); - else if(mode == CDROM_READ_PIO) + } + else if(mode == CDROM_READ_PIO) { + params.buffer = buffer; + + if(buf_addr & 0x01) { + dbglog(DBG_ERROR, "cdrom_read_sectors_ex: Unaligned memory for PIO (2-byte).\n"); + return ERR_SYS; + } rv = cdrom_exec_cmd(CMD_PIOREAD, ¶ms); + } return rv; } diff --git a/kernel/arch/dreamcast/hardware/g1ata.c b/kernel/arch/dreamcast/hardware/g1ata.c index badc9ebc..35dad2db 100644 --- a/kernel/arch/dreamcast/hardware/g1ata.c +++ b/kernel/arch/dreamcast/hardware/g1ata.c @@ -20,6 +20,7 @@ #include <arch/timer.h> #include <arch/cache.h> #include <arch/irq.h> +#include <arch/memory.h> /* This file implements support for accessing devices over the G1 bus by the @@ -618,7 +619,7 @@ out: int g1_ata_read_lba_dma(uint64_t sector, size_t count, void *buf, int block) { int lba28, old, can_lba48 = CAN_USE_LBA48(); - uint32_t addr; + uintptr_t addr; uint8_t cmd; /* Make sure we're actually being asked to do work... */ @@ -661,7 +662,7 @@ int g1_ata_read_lba_dma(uint64_t sector, size_t count, void *buf, } /* Check the alignment of the address. */ - addr = ((uint32_t)buf) & 0x0FFFFFFF; + addr = (uintptr_t)buf; if(addr & 0x1F) { dbglog(DBG_ERROR, "g1_ata_read_lba_dma: Unaligned output address\n"); @@ -669,11 +670,19 @@ int g1_ata_read_lba_dma(uint64_t sector, size_t count, void *buf, return -1; } - if((addr >> 24) == 0x0C) { + /* Invalidate the CPU cache only for cacheable memory areas. + Otherwise, it is assumed that either this operation is unnecessary + (another DMA is being used) or that the caller is responsible + for managing the CPU data cache. + */ + if((addr & MEM_AREA_P2_BASE) != MEM_AREA_P2_BASE) { /* Invalidate the dcache over the range of the data. */ - dcache_inval_range((uint32)buf, count * 512); + dcache_inval_range(addr, count * 512); } + /* Use the physical memory address. */ + addr &= MEM_AREA_CACHE_MASK; + /* Lock the mutex. It will be unlocked later in the IRQ handler. */ if(g1_ata_mutex_lock()) return -1; @@ -801,7 +810,7 @@ int g1_ata_write_lba(uint64_t sector, size_t count, const void *buf) { int g1_ata_write_lba_dma(uint64_t sector, size_t count, const void *buf, int block) { int cmd, lba28, old, can_lba48 = CAN_USE_LBA48(); - uint32_t addr; + uintptr_t addr; /* Make sure we're actually being asked to do work... */ if(!count) @@ -843,7 +852,7 @@ int g1_ata_write_lba_dma(uint64_t sector, size_t count, const void *buf, } /* Check the alignment of the address. */ - addr = ((uint32_t)buf) & 0x0FFFFFFF; + addr = (uintptr_t)buf; if(addr & 0x1F) { dbglog(DBG_ERROR, "g1_ata_write_lba_dma: Unaligned input address\n"); @@ -851,11 +860,19 @@ int g1_ata_write_lba_dma(uint64_t sector, size_t count, const void *buf, return -1; } - if((addr >> 24) == 0x0C) { + /* Flush the CPU cache only for cacheable memory areas. + Otherwise, it is assumed that either this operation is unnecessary + (another DMA is being used) or that the caller is responsible + for managing the CPU data cache. + */ + if((addr & MEM_AREA_P2_BASE) != MEM_AREA_P2_BASE) { /* Flush the dcache over the range of the data. */ - dcache_flush_range((uint32)buf, count * 512); + dcache_flush_range(addr, count * 512); } + /* Use the physical memory address. */ + addr &= MEM_AREA_CACHE_MASK; + /* Lock the mutex. It will be unlocked in the IRQ handler later. */ if(g1_ata_mutex_lock()) return -1; diff --git a/kernel/arch/dreamcast/hardware/pvr/pvr_buffers.c b/kernel/arch/dreamcast/hardware/pvr/pvr_buffers.c index 0d5bc628..9c251acb 100644 --- a/kernel/arch/dreamcast/hardware/pvr/pvr_buffers.c +++ b/kernel/arch/dreamcast/hardware/pvr/pvr_buffers.c @@ -34,7 +34,7 @@ /* Fill Tile Matrix buffers. This function takes a base address and sets up the rendering structures there. Each tile of the screen (32x32) receives a small buffer space. */ -static void pvr_init_tile_matrix(int which, int presort) { +static void pvr_init_tile_matrix(int which, bool presort) { volatile pvr_ta_buffers_t *buf; int x, y, tn; uint32 *vr; /* Note: We're working in 4-byte pointer maths in this function */ @@ -125,14 +125,14 @@ static void pvr_init_tile_matrix(int which, int presort) { } /* Fill all tile matrices */ -void pvr_init_tile_matrices(int presort) { +void pvr_init_tile_matrices(bool presort) { int i; for(i = 0; i < 2; i++) pvr_init_tile_matrix(i, presort); } -void pvr_set_presort_mode(int presort) { +void pvr_set_presort_mode(bool presort) { pvr_init_tile_matrix(pvr_state.ta_target, presort); } @@ -151,7 +151,7 @@ up and placed at 0x000000 and 0x400000. #define BUF_ALIGN_MASK (BUF_ALIGN - 1) #define APPLY_ALIGNMENT(addr) (((addr) + BUF_ALIGN_MASK) & ~BUF_ALIGN_MASK) -void pvr_allocate_buffers(pvr_init_params_t *params) { +void pvr_allocate_buffers(const pvr_init_params_t *params) { volatile pvr_ta_buffers_t *buf; volatile pvr_frame_buffers_t *fbuf; int i, j; diff --git a/kernel/arch/dreamcast/hardware/pvr/pvr_dma.c b/kernel/arch/dreamcast/hardware/pvr/pvr_dma.c index 521a5215..40ed9cd9 100644 --- a/kernel/arch/dreamcast/hardware/pvr/pvr_dma.c +++ b/kernel/arch/dreamcast/hardware/pvr/pvr_dma.c @@ -24,7 +24,7 @@ /* Signaling semaphore */ static semaphore_t dma_done; -static int32_t dma_blocking; +static bool dma_blocking; static pvr_dma_callback_t dma_callback; static void *dma_cbdata; @@ -62,7 +62,7 @@ static void pvr_dma_irq_hnd(uint32_t code, void *data) { if(dma_blocking) { sem_signal(&dma_done); thd_schedule(1, 0); - dma_blocking = 0; + dma_blocking = false; } } @@ -96,7 +96,7 @@ static uintptr_t pvr_dest_addr(uintptr_t dest, pvr_dma_type_t type) { } int pvr_dma_transfer(const void *src, uintptr_t dest, size_t count, - pvr_dma_type_t type, int block, + pvr_dma_type_t type, bool block, pvr_dma_callback_t callback, void *cbdata) { uintptr_t src_addr = ((uintptr_t)src); @@ -146,30 +146,30 @@ int pvr_dma_transfer(const void *src, uintptr_t dest, size_t count, } /* Count is in bytes. */ -int pvr_txr_load_dma(void *src, pvr_ptr_t dest, size_t count, int block, +int pvr_txr_load_dma(const void *src, pvr_ptr_t dest, size_t count, bool block, pvr_dma_callback_t callback, void *cbdata) { return pvr_dma_transfer(src, (uintptr_t)dest, count, PVR_DMA_VRAM64, block, callback, cbdata); } -int pvr_dma_load_ta(void *src, size_t count, int block, +int pvr_dma_load_ta(const void *src, size_t count, bool block, pvr_dma_callback_t callback, void *cbdata) { return pvr_dma_transfer(src, (uintptr_t)0, count, PVR_DMA_TA, block, callback, cbdata); } -int pvr_dma_yuv_conv(void *src, size_t count, int block, +int pvr_dma_yuv_conv(const void *src, size_t count, bool block, pvr_dma_callback_t callback, void *cbdata) { return pvr_dma_transfer(src, (uintptr_t)0, count, PVR_DMA_YUV, block, callback, cbdata); } -int pvr_dma_ready(void) { +bool pvr_dma_ready(void) { return pvr_dma[PVR_DST] == 0; } void pvr_dma_init(void) { /* Create an initially blocked semaphore */ sem_init(&dma_done, 0); - dma_blocking = 0; + dma_blocking = false; dma_callback = NULL; dma_cbdata = 0; @@ -200,12 +200,6 @@ void pvr_dma_shutdown(void) { void *pvr_sq_load(void *dest, const void *src, size_t n, pvr_dma_type_t type) { void *dma_area_ptr; - if(pvr_dma[PVR_DST] != 0) { - dbglog(DBG_ERROR, "pvr_sq_load: PVR DMA has not finished\n"); - errno = EINPROGRESS; - return NULL; - } - dma_area_ptr = (void *)pvr_dest_addr((uintptr_t)dest, type); sq_cpy(dma_area_ptr, src, n); @@ -216,12 +210,6 @@ void *pvr_sq_load(void *dest, const void *src, size_t n, pvr_dma_type_t type) { void *pvr_sq_set16(void *dest, uint32_t c, size_t n, pvr_dma_type_t type) { void *dma_area_ptr; - if(pvr_dma[PVR_DST] != 0) { - dbglog(DBG_ERROR, "pvr_sq_set16: PVR DMA has not finished\n"); - errno = EINPROGRESS; - return NULL; - } - dma_area_ptr = (void *)pvr_dest_addr((uintptr_t)dest, type); sq_set16(dma_area_ptr, c, n); @@ -232,12 +220,6 @@ void *pvr_sq_set16(void *dest, uint32_t c, size_t n, pvr_dma_type_t type) { void *pvr_sq_set32(void *dest, uint32_t c, size_t n, pvr_dma_type_t type) { void *dma_area_ptr; - if(pvr_dma[PVR_DST] != 0) { - dbglog(DBG_ERROR, "pvr_sq_set32: PVR DMA has not finished\n"); - errno = EINPROGRESS; - return NULL; - } - dma_area_ptr = (void *)pvr_dest_addr((uintptr_t)dest, type); sq_set32(dma_area_ptr, c, n); diff --git a/kernel/arch/dreamcast/hardware/pvr/pvr_fog.c b/kernel/arch/dreamcast/hardware/pvr/pvr_fog.c index 9b5aaa61..b7da92d3 100644 --- a/kernel/arch/dreamcast/hardware/pvr/pvr_fog.c +++ b/kernel/arch/dreamcast/hardware/pvr/pvr_fog.c @@ -158,7 +158,7 @@ union ieee32_t { /* A fast negative argument only exp function - That is it treats any * argument as a negative number */ -float neg_exp(float arg) { +static float neg_exp(float arg) { float result, f; int k; @@ -206,7 +206,7 @@ float neg_exp(float arg) { The special values for infinity and NaN are not dealt with at all. */ -uint32 float16(float f) { +static uint32 float16(float f) { union ieee32_t float32; uint32 float16; uint32 sign, exponent, mantissa; @@ -343,14 +343,14 @@ void pvr_fog_table_linear(float start, float end) { * 0th entry is farthest from eye. Last entry is nearest to eye. * The larger the value the heavier the fog. */ -void pvr_fog_table_custom(float tbl1[]) { +void pvr_fog_table_custom(float *table) { uint32 idx, i; uint32 value, valh, vall; - valh = (uint32)(fog_alpha * 255.0f * CLAMP01(tbl1[0])) & 0xff; + valh = (uint32)(fog_alpha * 255.0f * CLAMP01(table[0])) & 0xff; for(idx = PVR_FOG_TABLE_BASE, i = 1; idx < TABLE_LEN; idx += 4, i++) { - vall = (uint32)(fog_alpha * 255.0f * CLAMP01(tbl1[i])) & 0xff; + vall = (uint32)(fog_alpha * 255.0f * CLAMP01(table[i])) & 0xff; value = (((valh) << 8 & 0xff00) + vall); PVR_SET(idx, value); valh = vall; diff --git a/kernel/arch/dreamcast/hardware/pvr/pvr_init_shutdown.c b/kernel/arch/dreamcast/hardware/pvr/pvr_init_shutdown.c index cbe77d70..c70758cf 100644 --- a/kernel/arch/dreamcast/hardware/pvr/pvr_init_shutdown.c +++ b/kernel/arch/dreamcast/hardware/pvr/pvr_init_shutdown.c @@ -25,7 +25,7 @@ and translucent lists, and 0's for everything else; 512k of vertex buffer. This is equivalent to the old ta_init_defaults() for now. */ int pvr_init_defaults(void) { - pvr_init_params_t params = { + const pvr_init_params_t params = { /* Enable opaque and translucent polygons with size 16 */ { PVR_BINSIZE_16, PVR_BINSIZE_0, PVR_BINSIZE_16, PVR_BINSIZE_0, PVR_BINSIZE_0 }, @@ -42,7 +42,10 @@ int pvr_init_defaults(void) { 0, /* Extra OPBs */ - 3 + 3, + + /* Vertex buffer double-buffering enabled */ + 0 }; return pvr_init(¶ms); @@ -52,7 +55,7 @@ int pvr_init_defaults(void) { and using the specified parameters; note that bins and vertex buffers come from the texture memory pool! Expects that a 2D mode was initialized already using the vid_* API. */ -int pvr_init(pvr_init_params_t *params) { +int pvr_init(const pvr_init_params_t *params) { /* If we're already initialized, fail */ if(pvr_state.valid == 1) { dbglog(DBG_WARNING, "pvr: pvr_init called twice!\n"); @@ -89,6 +92,8 @@ int pvr_init(pvr_init_params_t *params) { // Copy over FSAA setting. pvr_state.fsaa = params->fsaa_enabled; + pvr_state.vbuf_doublebuf = !params->vbuf_doublebuf_disabled; + /* Everything's clear, do the initial buffer pointer setup */ pvr_allocate_buffers(params); diff --git a/kernel/arch/dreamcast/hardware/pvr/pvr_internal.h b/kernel/arch/dreamcast/hardware/pvr/pvr_internal.h index 4c7c72da..22114dc3 100644 --- a/kernel/arch/dreamcast/hardware/pvr/pvr_internal.h +++ b/kernel/arch/dreamcast/hardware/pvr/pvr_internal.h @@ -16,6 +16,7 @@ code. If something is needed from this, an external interface should be added to dc/pvr.h. */ +#include <stdbool.h> #include <kos/mutex.h> /**** State stuff ***************************************************/ @@ -210,6 +211,9 @@ typedef struct { // Non-zero if FSAA was enabled at init time. int fsaa; + // Non-zero if using double-buffering for the vertex buffer. + int vbuf_doublebuf; + // Non-zero if we are rendering to a texture int to_texture[2]; @@ -248,10 +252,10 @@ typedef struct pvr_bkg_poly { /**** pvr_buffers.c ***************************************************/ /* Initialize buffers for TA/ISP/TSP usage */ -void pvr_allocate_buffers(pvr_init_params_t *params); +void pvr_allocate_buffers(const pvr_init_params_t *params); /* Fill the tile matrices (after it's initialized) */ -void pvr_init_tile_matrices(int presort); +void pvr_init_tile_matrices(bool presort); /**** pvr_misc.c ******************************************************/ diff --git a/kernel/arch/dreamcast/hardware/pvr/pvr_irq.c b/kernel/arch/dreamcast/hardware/pvr/pvr_irq.c index 9d456c32..13848d29 100644 --- a/kernel/arch/dreamcast/hardware/pvr/pvr_irq.c +++ b/kernel/arch/dreamcast/hardware/pvr/pvr_irq.c @@ -112,7 +112,7 @@ static void pvr_render_lists(void) { // Begin rendering from the dirty TA buffer into the clean // frame buffer. //DBG(("start_render(%d -> %d)\n", pvr_state.ta_target, pvr_state.view_target ^ 1)); - pvr_state.ta_target ^= 1; + pvr_state.ta_target ^= pvr_state.vbuf_doublebuf; pvr_begin_queued_render(); pvr_state.render_busy = 1; pvr_sync_stats(PVR_SYNC_RNDSTART); @@ -191,6 +191,8 @@ void pvr_int_handler(uint32 code, void *data) { ...<truncated>... hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: quzar <qu...@us...> - 2024-12-25 18:19: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 3ac9880e61d086cd62d31bbad63d4998821a4858 (commit) via 2a3fa1a7554ac96db8a7ad28c7cd855707450b14 (commit) via 737f0e9cb8464ee8c575b8715d6e4b3d693a1869 (commit) via 03d84556fb3bcbda04bbd2b15f5e0404ad5bb0be (commit) via 8761ef2801cc6f764ccd562f5a62260ff3423f0b (commit) via 1fff2052019bbeb6f1a69873505c243dbe2b713a (commit) via 0fe965953efcf412c00dc6e8d7289de921f7b993 (commit) via edbdb2e78383c481568f91913359b73469015a48 (commit) via a5908659f0b8f7ee5e480c715d5895b5fb6fde80 (commit) via 3ed0eb36bd4f4218f4946d2e96f518bdcb64748a (commit) via fb4724195afd3750ff0ebd420dc25cc2c4e1c3aa (commit) via 25106a1a086e954fa2eeb2ab090d747af20493bb (commit) via fc002a381309fa4dbb494fdd45d1cb44f42a5332 (commit) via d84827a86a9ea3dd5d19455b3e341a575e64a821 (commit) from bae7adbde177c04560de31577932ace50988b238 (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 3ac9880e61d086cd62d31bbad63d4998821a4858 Merge: 2a3fa1a7 d84827a8 Author: Lawrence Sebald <ljs...@us...> Date: Mon Dec 23 23:06:11 2024 -0500 Merge pull request #818 from KallistiOS/MP_overlap Ensure the name manager selects the best match on lookup. commit 2a3fa1a7554ac96db8a7ad28c7cd855707450b14 Merge: 03d84556 737f0e9c Author: Lawrence Sebald <ljs...@us...> Date: Mon Dec 23 23:03:36 2024 -0500 Merge pull request #864 from jnmartin84/snd_sfx_buf Add snd_sfx_load functions that take pointers instead of files commit 737f0e9cb8464ee8c575b8715d6e4b3d693a1869 Author: Lawrence Sebald <ljs...@us...> Date: Mon Dec 23 23:02:50 2024 -0500 Apply suggestions from code review commit 03d84556fb3bcbda04bbd2b15f5e0404ad5bb0be Merge: 8761ef28 fc002a38 Author: Lawrence Sebald <ljs...@us...> Date: Mon Dec 23 22:56:36 2024 -0500 Merge pull request #856 from KallistiOS/v2.1.1-Docs Update the changelog and relnotes for v2.1.1 commit 8761ef2801cc6f764ccd562f5a62260ff3423f0b Merge: 1fff2052 25106a1a Author: Lawrence Sebald <ljs...@us...> Date: Mon Dec 23 22:55:03 2024 -0500 Merge pull request #863 from pcercuei/which-dc-chain dc-chain: Use "which" instead of "command" commit 1fff2052019bbeb6f1a69873505c243dbe2b713a Merge: bae7adbd 0fe96595 Author: Lawrence Sebald <ljs...@us...> Date: Mon Dec 23 22:50:29 2024 -0500 Merge pull request #872 from hcartiaux/posixify Posixify environ_*.sh files commit 0fe965953efcf412c00dc6e8d7289de921f7b993 Author: Hyacinthe Cartiaux <hya...@fr...> Date: Fri Dec 20 10:58:53 2024 +0100 Posixify environ_*.sh files commit edbdb2e78383c481568f91913359b73469015a48 Author: jnmartin84 <jnm...@gm...> Date: Fri Dec 6 09:17:51 2024 -0500 add snd_sfx_load_buf example commit a5908659f0b8f7ee5e480c715d5895b5fb6fde80 Author: jnmartin84 <jnm...@gm...> Date: Fri Dec 6 09:12:38 2024 -0500 clean up variable, function names; formatting commit 3ed0eb36bd4f4218f4946d2e96f518bdcb64748a Author: jnmartin84 <jnm...@gm...> Date: Thu Dec 5 17:39:14 2024 -0500 add new snd_sfx_load buf functions to header commit fb4724195afd3750ff0ebd420dc25cc2c4e1c3aa Author: jnmartin84 <jnm...@gm...> Date: Thu Dec 5 17:36:41 2024 -0500 add _buf methods take wav or raw sound data directly from memory and load into sfx commit 25106a1a086e954fa2eeb2ab090d747af20493bb Author: Paul Cercueil <pa...@cr...> Date: Wed Dec 4 22:06:38 2024 +0100 dc-chain: Use "which" instead of "command" "command" is technically the right one as it is recommended over "which". However, Ubuntu 20.04 does not seem to have a built-in "command", or at least it is not callable from a Makefile's $(shell). Fixes #860. Signed-off-by: Paul Cercueil <pa...@cr...> commit fc002a381309fa4dbb494fdd45d1cb44f42a5332 Author: QuzarDC <qu...@co...> Date: Sat Nov 23 00:10:51 2024 -0500 Update the changelog and relnotes for v2.1.1 commit d84827a86a9ea3dd5d19455b3e341a575e64a821 Author: QuzarDC <qu...@co...> Date: Mon Oct 14 03:01:02 2024 -0400 Ensure the name manager selects the best match on lookup. Before this it would always simply pick the first. This change allows registered names to overlap and still be found. So now you can mount something to `/c` without breaking `/cd`. ----------------------------------------------------------------------- Summary of changes: doc/CHANGELOG.md | 16 +- doc/RELNOTES.md | 15 ++ environ_base.sh | 4 +- environ_dreamcast.sh | 2 +- examples/dreamcast/sound/{sfx => sfxbuf}/Makefile | 4 +- examples/dreamcast/sound/{sfx => sfxbuf}/main.c | 41 ++-- .../sound/{sfx => sfxbuf}/romdisk/beep-1.wav | Bin .../sound/{sfx => sfxbuf}/romdisk/beep-2.wav | Bin .../sound/{sfx => sfxbuf}/romdisk/beep-3.wav | Bin .../sound/{sfx => sfxbuf}/romdisk/beep-4.wav | Bin kernel/arch/dreamcast/include/dc/sound/sfxmgr.h | 36 ++++ kernel/arch/dreamcast/sound/snd_sfxmgr.c | 216 +++++++++++++++++++++ kernel/exports/nmmgr.c | 18 +- utils/dc-chain/scripts/utils.mk | 2 +- 14 files changed, 325 insertions(+), 29 deletions(-) copy examples/dreamcast/sound/{sfx => sfxbuf}/Makefile (85%) copy examples/dreamcast/sound/{sfx => sfxbuf}/main.c (84%) copy examples/dreamcast/sound/{sfx => sfxbuf}/romdisk/beep-1.wav (100%) copy examples/dreamcast/sound/{sfx => sfxbuf}/romdisk/beep-2.wav (100%) copy examples/dreamcast/sound/{sfx => sfxbuf}/romdisk/beep-3.wav (100%) copy examples/dreamcast/sound/{sfx => sfxbuf}/romdisk/beep-4.wav (100%) diff --git a/doc/CHANGELOG.md b/doc/CHANGELOG.md index bda36885..5dea7cd1 100644 --- a/doc/CHANGELOG.md +++ b/doc/CHANGELOG.md @@ -3,17 +3,22 @@ Platform-specific changes are prefixed with the platform name, otherwise the change is platform-independent. The name/initials of the person who is responsible for the change are listed in [square brackets] for most versions (where they are missing from early versions, assume that they should be attributed to Megan Potter). ## KallistiOS version 2.2.0 -- Added pvrtex utility by TapamN to utils [DF == Daniel Fairchild] -- Added . & .. directories to filesystems that lack it [AB] +- Added . & .. directories to filesystems that lack it [Andress Barajas == AB] - Replaced previous implementation of realpath() to remove license from AUTHORS [AB] -- Enabled hybrid PVR DR/DMA vertex submission in driver + sped up pvr_prim() [FG] -- Add thread priority boosting system [Paul Cercueil = PC] +- Enabled hybrid PVR DR/DMA vertex submission in driver + sped up pvr_prim() [Falco Girgis == FG] +- Add thread priority boosting system [Paul Cercueil == PC] - Add performance monitor API [PC] - Add/Fixed stat() implementations for all filesystems [AB] -- **Dreamcast**: Add network speedtest and pvr palette examples [AB] +- **Dreamcast**: Add pvr palette example [AB] - **Dreamcast**: Cleaned up, documented, and enhanced BIOS font API [FG] - Rework PVR hybrid mode + IRQ handling [PC] +## KallistiOS version 2.1.1 +- Added pvrtex utility by TapamN to utils [Daniel Fairchild == DF] +- **Dreamcast**: Added a set of known working purupuru bit patterns and a browsing mechanism to the rumble example [DF] +- **Dreamcast**: Added new example to demonstrate the use of the PVR to draw lines with quads (pvr/pvrline) [Jason Martin == JM] +- **Dreamcast**: Add network speedtest example [Andress Barajas == AB] + ## KallistiOS version 2.1.0 - Cleaned up generated stubs files on a make clean [Lawrence Sebald == LS] - **Dreamcast**: Added a function to detect if the program is being run on a retail Dreamcast or a Set5.xx device [LS] @@ -235,7 +240,6 @@ Platform-specific changes are prefixed with the platform name, otherwise the cha - **Dreamcast**: Update GCC 14.x toolchain profile to 14.2 [EF] - **Dreamcast**: Update GCC 11.x toolchain profile to 11.5, update Binutils to 2.43 [EF] - **Dreamcast**: Fix ARM toolchain build error when JIT is enabled for SH toolchain [EF] -- **Dreamcast**: Added a set of known working purupuru bit patterns and a browsing mechanism to the rumble example [DF == Daniel Fairchild] - Added full support for <time.h> additions from C23 standard. [FG] - Fixes mutexes not working properly [PC] - **Dreamcast**: fs_dcload: Set errno on error in dcload_stat() [PC] diff --git a/doc/RELNOTES.md b/doc/RELNOTES.md index e6f5cb12..91ffbab3 100644 --- a/doc/RELNOTES.md +++ b/doc/RELNOTES.md @@ -3,6 +3,21 @@ Copyright (C) 2002, 2003 Megan Potter Copyright (C) 2012-2019 Lawrence Sebald Copyright (C) 2024 Donald Haase +RELEASE NOTES for 2.1.1 +----------------------- + +This minor patch version is primarily aimed at fixing the versioning system +which simply didn't work as implemented in v2.1.0. Alongside that another few +dozen PRs were included that containing minor bugfixes and documentation updates. + +Also included is a new host-side util pvrtex which converts standard images +to formats used directly by the Dreamcast's PowerVR (utils/pvrtex), a significant +rewrite of wav2adpcm which converts standard sound data into the smaller ADPCM +format used by the Dreamcast's AICA (utils/wav2adpcm), an example that +demonstrates how to draw lines with quads via the pvr (pvr/pvrline), one for +testing network speed (network/speedtest) and another on how to use libADX +from kos-ports for audio playback (sound/libADX). + RELEASE NOTES for 2.1.0 ----------------------- diff --git a/environ_base.sh b/environ_base.sh index ca64b7b4..092d366f 100644 --- a/environ_base.sh +++ b/environ_base.sh @@ -18,12 +18,12 @@ export KOS_ARCH_DIR="${KOS_BASE}/kernel/arch/${KOS_ARCH}" . ${KOS_BASE}/environ_${KOS_ARCH}.sh # Add the compiler bins dir to the path if it is not already. -if [[ ":$PATH:" != *":${KOS_CC_BASE}/bin:"* ]]; then +if ! expr ":$PATH:" : ".*:${KOS_CC_BASE}/bin:.*" > /dev/null ; then export PATH="${PATH}:${KOS_CC_BASE}/bin" fi # Add the build wrappers dir to the path if it is not already. -if [[ ":$PATH:" != *":${KOS_BASE}/utils/build_wrappers:"* ]]; then +if ! expr ":$PATH:" : ".*:${KOS_BASE}/utils/build_wrappers:.*" > /dev/null ; then export PATH="${PATH}:${KOS_BASE}/utils/build_wrappers" fi diff --git a/environ_dreamcast.sh b/environ_dreamcast.sh index cc5d3700..2ae5ccb3 100644 --- a/environ_dreamcast.sh +++ b/environ_dreamcast.sh @@ -7,7 +7,7 @@ if [ -z "${DC_TOOLS_BASE}" ] ; then fi # Add the external DC tools dir to the path if it is not already. -if [[ ":$PATH:" != *":${DC_TOOLS_BASE}:"* ]]; then +if ! expr ":$PATH:" : ".*:${DC_TOOLS_BASE}:.*" > /dev/null ; then export PATH="${PATH}:${DC_TOOLS_BASE}" fi diff --git a/examples/dreamcast/sound/sfx/Makefile b/examples/dreamcast/sound/sfxbuf/Makefile similarity index 85% copy from examples/dreamcast/sound/sfx/Makefile copy to examples/dreamcast/sound/sfxbuf/Makefile index c2d38efb..d2b1cafb 100644 --- a/examples/dreamcast/sound/sfx/Makefile +++ b/examples/dreamcast/sound/sfxbuf/Makefile @@ -1,9 +1,9 @@ # KallistiOS ##version## # -# examples/dreamcast/sound/sfx/Makefile +# examples/dreamcast/sound/sfxbuf/Makefile # -TARGET = sfx.elf +TARGET = sfxbuf.elf OBJS = main.o romdisk.o KOS_ROMDISK_DIR = romdisk diff --git a/examples/dreamcast/sound/sfx/main.c b/examples/dreamcast/sound/sfxbuf/main.c similarity index 84% copy from examples/dreamcast/sound/sfx/main.c copy to examples/dreamcast/sound/sfxbuf/main.c index 7a4cf1a8..df7d8016 100644 --- a/examples/dreamcast/sound/sfx/main.c +++ b/examples/dreamcast/sound/sfxbuf/main.c @@ -36,12 +36,31 @@ int main(int argc, char **argv) { snd_init(); // Load wav files found in romdisk - // Beep wav files found in the romdisk where provided by + // Beep wav files found in the romdisk where provided by // https://gamesounds.xyz/?dir=Sound%20Effects/Beeps - sfxhnd_t beep1 = snd_sfx_load("/rd/beep-1.wav"); - sfxhnd_t beep2 = snd_sfx_load("/rd/beep-2.wav"); - sfxhnd_t beep3 = snd_sfx_load("/rd/beep-3.wav"); - sfxhnd_t beep4 = snd_sfx_load("/rd/beep-4.wav"); + char *beep1buf; + char *beep2buf; + char *beep3buf; + char *beep4buf; + + fs_load("/rd/beep-1.wav", (void**)&beep1buf); + fs_load("/rd/beep-2.wav", (void**)&beep2buf); + fs_load("/rd/beep-3.wav", (void**)&beep3buf); + fs_load("/rd/beep-4.wav", (void**)&beep4buf); + + sfxhnd_t beep1 = snd_sfx_load_buf(beep1buf); + sfxhnd_t beep2 = snd_sfx_load_buf(beep2buf); + sfxhnd_t beep3 = snd_sfx_load_buf(beep3buf); + sfxhnd_t beep4 = snd_sfx_load_buf(beep4buf); + + if (beep1buf) + free(beep1buf); + if (beep2buf) + free(beep2buf); + if (beep3buf) + free(beep3buf); + if (beep4buf) + free(beep4buf); uint32_t current_buttons = 0; uint32_t changed_buttons = 0; @@ -53,7 +72,7 @@ int main(int argc, char **argv) { current_buttons = cond->buttons; changed_buttons = current_buttons ^ previous_buttons; previous_buttons = current_buttons; - + // Play sounds on different channels if(button_pressed(current_buttons, changed_buttons, CONT_A)) { snd_sfx_play(beep1, volume, CENTER); @@ -67,7 +86,7 @@ int main(int argc, char **argv) { if(button_pressed(current_buttons, changed_buttons, CONT_Y)) { snd_sfx_play(beep4, volume, CENTER); } - + // Play sounds on same channel if(button_pressed(current_buttons, changed_buttons, CONT_DPAD_DOWN)) { snd_sfx_play_chn(0, beep1, volume, CENTER); @@ -107,12 +126,12 @@ int main(int argc, char **argv) { } // Unload all sound effects from sound RAM - snd_sfx_unload(beep1); + snd_sfx_unload(beep1); snd_sfx_unload(beep2); - snd_sfx_unload(beep3); + snd_sfx_unload(beep3); snd_sfx_unload(beep4); // OR - // snd_sfx_unload_all(); + // snd_sfx_unload_all(); snd_shutdown(); @@ -126,7 +145,7 @@ static void draw_instructions(uint8_t volume) { memset(current_volume_str, 0, 32); snprintf(current_volume_str, 32, "Current Volume: %3i", volume); - + bfont_draw_str(vram_s + y*640+x, 640, color, "Press A,B,X,Y to play beeps on separate channels"); y += 48; bfont_draw_str(vram_s + y*640+x, 640, color, "Press UP,DOWN,LEFT,RIGHT on D-Pad to play beeps"); diff --git a/examples/dreamcast/sound/sfx/romdisk/beep-1.wav b/examples/dreamcast/sound/sfxbuf/romdisk/beep-1.wav similarity index 100% copy from examples/dreamcast/sound/sfx/romdisk/beep-1.wav copy to examples/dreamcast/sound/sfxbuf/romdisk/beep-1.wav diff --git a/examples/dreamcast/sound/sfx/romdisk/beep-2.wav b/examples/dreamcast/sound/sfxbuf/romdisk/beep-2.wav similarity index 100% copy from examples/dreamcast/sound/sfx/romdisk/beep-2.wav copy to examples/dreamcast/sound/sfxbuf/romdisk/beep-2.wav diff --git a/examples/dreamcast/sound/sfx/romdisk/beep-3.wav b/examples/dreamcast/sound/sfxbuf/romdisk/beep-3.wav similarity index 100% copy from examples/dreamcast/sound/sfx/romdisk/beep-3.wav copy to examples/dreamcast/sound/sfxbuf/romdisk/beep-3.wav diff --git a/examples/dreamcast/sound/sfx/romdisk/beep-4.wav b/examples/dreamcast/sound/sfxbuf/romdisk/beep-4.wav similarity index 100% copy from examples/dreamcast/sound/sfx/romdisk/beep-4.wav copy to examples/dreamcast/sound/sfxbuf/romdisk/beep-4.wav diff --git a/kernel/arch/dreamcast/include/dc/sound/sfxmgr.h b/kernel/arch/dreamcast/include/dc/sound/sfxmgr.h index 39451dcd..7c49fb70 100644 --- a/kernel/arch/dreamcast/include/dc/sound/sfxmgr.h +++ b/kernel/arch/dreamcast/include/dc/sound/sfxmgr.h @@ -106,6 +106,42 @@ sfxhnd_t snd_sfx_load_ex(const char *fn, uint32_t rate, uint16_t bitsize, uint16 */ sfxhnd_t snd_sfx_load_fd(file_t fd, size_t len, uint32_t rate, uint16_t bitsize, uint16_t channels); +/** \brief Load a sound effect. + + This function loads a sound effect from a WAV file contained in memory and + returns a handle to it. The sound effect can be either stereo or mono, and + must either be 8-bit or 16-bit uncompressed PCM samples, or 4-bit Yamaha + ADPCM. + + \warning The sound effect you are loading must be at most 65534 samples + in length. + + \param buf The buffer to load. + \return A handle to the sound effect on success. On error, + SFXHND_INVALID is returned. +*/ +sfxhnd_t snd_sfx_load_buf(char *buf); + +/** \brief Load a sound effect without wav header from buffer. + + This function loads a sound effect from raw data contained in memory and + returns a handle to it. The sound effect can be either stereo or mono, and + must either be 8-bit or 16-bit uncompressed PCM samples, or 4-bit Yamaha + ADPCM. + + \warning The sound effect you are loading must be at most 65534 samples + in length and multiple by 32 bytes for each channel. + + \param buf The buffer. + \param len The file length. + \param rate The frequency of the sound. + \param bitsize The sample size (bits per sample). + \param channels Number of channels. + \return A handle to the sound effect on success. On error, + SFXHND_INVALID is returned. +*/ +sfxhnd_t snd_sfx_load_raw_buf(char *buf, size_t len, uint32_t rate, uint16_t bitsize, uint16_t channels); + /** \brief Unload a sound effect. This function unloads a previously loaded sound effect, and frees the memory diff --git a/kernel/arch/dreamcast/sound/snd_sfxmgr.c b/kernel/arch/dreamcast/sound/snd_sfxmgr.c index 54fae98e..1766216d 100644 --- a/kernel/arch/dreamcast/sound/snd_sfxmgr.c +++ b/kernel/arch/dreamcast/sound/snd_sfxmgr.c @@ -170,6 +170,54 @@ static int read_wav_header(file_t fd, wavhdr_t *wavhdr) { return 0; } +static int read_wav_header_buf(char *buf, wavhdr_t *wavhdr, size_t *bufidx) { + /* maintain buffer index during function */ + size_t tmp_bufidx = *bufidx; + + memcpy(&(wavhdr->magic), buf, sizeof(wavhdr->magic)); + tmp_bufidx += sizeof(wavhdr->magic); + + if(strncmp((const char*)wavhdr->magic.riff, "RIFF", 4)) { + dbglog(DBG_WARNING, "snd_sfx: sfx buffer is not RIFF\n"); + return -1; + } + + /* Check file magic */ + if(strncmp((const char*)wavhdr->magic.riff_format, "WAVE", 4)) { + dbglog(DBG_WARNING, "snd_sfx: sfx buffer is not RIFF WAVE\n"); + return -1; + } + + do { + /* Read the chunk header */ + memcpy(&(wavhdr->chunk), buf + tmp_bufidx, sizeof(wavhdr->chunk)); + tmp_bufidx += sizeof(wavhdr->chunk); + + /* If it is the fmt chunk, grab the fields we care about and skip the + rest of the section if there is more */ + if(strncmp((const char *)wavhdr->chunk.id, "fmt ", 4) == 0) { + memcpy(&(wavhdr->fmt), buf + tmp_bufidx, sizeof(wavhdr->fmt)); + tmp_bufidx += sizeof(wavhdr->fmt); + + /* Skip the rest of the fmt chunk */ + tmp_bufidx += wavhdr->chunk.size - sizeof(wavhdr->fmt); + } + /* If we found the data chunk, we are done */ + else if(strncmp((const char *)wavhdr->chunk.id, "data", 4) == 0) { + break; + } + /* Skip meta data */ + else { + tmp_bufidx += wavhdr->chunk.size; + } + } while(1); + + /* update buffer index for caller */ + *bufidx = tmp_bufidx; + + return 0; +} + static uint8_t *read_wav_data(file_t fd, wavhdr_t *wavhdr) { /* Allocate memory for WAV data */ uint8_t *wav_data = memalign(32, wavhdr->chunk.size); @@ -187,6 +235,26 @@ static uint8_t *read_wav_data(file_t fd, wavhdr_t *wavhdr) { return wav_data; } +static uint8_t *read_wav_data_buf(char *buf, wavhdr_t *wavhdr, size_t *bufidx) { + /* maintain buffer index during function */ + size_t tmp_bufidx = *bufidx; + + /* Allocate memory for WAV data */ + uint8_t *wav_data = memalign(32, wavhdr->chunk.size); + + if(wav_data == NULL) + return NULL; + + /* Read WAV data */ + memcpy(wav_data, buf + tmp_bufidx, wavhdr->chunk.size); + tmp_bufidx += wavhdr->chunk.size; + + /* update buffer index for caller */ + *bufidx = tmp_bufidx; + + return wav_data; +} + static snd_effect_t *create_snd_effect(wavhdr_t *wavhdr, uint8_t *wav_data) { snd_effect_t *effect; uint32_t len, rate; @@ -502,6 +570,154 @@ err_occurred: return SFXHND_INVALID; } +/* Load a sound effect from a WAV file and return a handle to it */ +sfxhnd_t snd_sfx_load_buf(char *buf) { + wavhdr_t wavhdr; + snd_effect_t *effect; + uint8_t *wav_data; + uint32_t sample_count; + size_t bufidx = 0; + + if(!buf) { + dbglog(DBG_ERROR, "snd_sfx_load_buf: can't read wav data from NULL"); + return SFXHND_INVALID; + } + + /* Read WAV header */ + if(read_wav_header_buf(buf, &wavhdr, &bufidx) < 0) { + dbglog(DBG_ERROR, "snd_sfx_load_buf: error reading wav header from buffer %08x\n", (uintptr_t)buf); + return SFXHND_INVALID; + } + /* + dbglog(DBG_DEBUG, "WAVE file is %s, %luHZ, %d bits/sample, " + "%u bytes total, format %d\n", + wavhdr.fmt.channels == 1 ? "mono" : "stereo", + wavhdr.fmt.sample_rate, + wavhdr.fmt.sample_size, + wavhdr.chunk.size, + wavhdr.fmt.format); + */ + sample_count = wavhdr.fmt.sample_size >= 8 ? + wavhdr.chunk.size / ((wavhdr.fmt.sample_size / 8) * wavhdr.fmt.channels) : + (wavhdr.chunk.size * 2) / wavhdr.fmt.channels; + + if(sample_count > 65534) { + dbglog(DBG_WARNING, "snd_sfx_load: WAVE file is over 65534 samples\n"); + } + + /* Read WAV data */ + wav_data = read_wav_data_buf(buf, &wavhdr, &bufidx); + /* Caller manages buffer, don't free here */ + if(!wav_data) + return SFXHND_INVALID; + + /* Create and initialize sound effect */ + effect = create_snd_effect(&wavhdr, wav_data); + if(!effect) { + free(wav_data); + return SFXHND_INVALID; + } + + /* Finish up and return the sound effect handle */ + free(wav_data); + LIST_INSERT_HEAD(&snd_effects, effect, list); + + return (sfxhnd_t)effect; +} + +sfxhnd_t snd_sfx_load_raw_buf(char *buf, size_t len, uint32_t rate, uint16_t bitsize, uint16_t channels) { + snd_effect_t *effect; + size_t chan_len, read_len; + uint8_t *tmp_buff = NULL; + size_t bufidx = 0; + + if(!buf) { + dbglog(DBG_ERROR, "snd_sfx_load_raw_buf: can't read PCM buffer from NULL"); + return SFXHND_INVALID; + } + + chan_len = len / channels; + effect = malloc(sizeof(snd_effect_t)); + + if(effect == NULL) { + return SFXHND_INVALID; + } + + memset(effect, 0, sizeof(snd_effect_t)); + + effect->rate = rate; + effect->stereo = channels > 1; + + switch(bitsize) { + case 4: + effect->fmt = AICA_SM_ADPCM; + effect->len = (len * 2) / channels; + break; + case 8: + effect->fmt = AICA_SM_8BIT; + effect->len = len / channels; + break; + case 16: + effect->fmt = AICA_SM_16BIT; + effect->len = (len / 2) / channels; + break; + default: + goto err_occurred; + } + + if(effect->len > 65534) { + dbglog(DBG_WARNING, "snd_sfx_load_raw_buf: PCM buffer is over 65534 samples\n"); + } + + effect->locl = snd_mem_malloc(chan_len); + + if(!effect->locl) { + goto err_occurred; + } + + read_len = chan_len; + if(read_len > 0) { + tmp_buff = memalign(32, read_len); + memcpy(tmp_buff, buf, read_len); + bufidx += read_len; + + spu_memload_sq(effect->locl, tmp_buff, read_len); + } + + if(channels > 1) { + effect->locr = snd_mem_malloc(chan_len); + + if(!effect->locr) { + goto err_occurred; + } + + read_len = chan_len; + if(read_len > 0) { + memcpy(tmp_buff, buf + bufidx, read_len); + bufidx += read_len; + spu_memload_sq(effect->locr, tmp_buff, read_len); + } + } + + if(tmp_buff) { + free(tmp_buff); + } + ...<truncated>... hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: quzar <qu...@us...> - 2024-12-25 17:50:20
|
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 annotated tag, v2.1.1 has been created at a062bd534f1d4ac55c880a7e0d2936bd9f11b790 (tag) tagging d6f42aecdfef897de019f8a82345194bec17d1c6 (commit) replaces v2.1.0 tagged by QuzarDC on Wed Dec 25 12:29:49 2024 -0500 - Log ----------------------------------------------------------------- Release 2.1.1 Andy Barajas (10): Fix versioning (#844) Bump tag to 1 (#845) Fix kos doxygen warnings (#711) Cleanup documentation. Rearrange error checking code. Remove unused symbol. (#716) Fix KOS warning when compiling SDL2 using m4-single (#724) Update wav2adpcm (#755) Bug in bin2c's Makefile, the bin2c target does not depend on bin2c.c (#777) Network speedtest (#671) Remove compiling pvrtex with LTO because it is not needed and can cause issues on certain hosts. (#789) Fix dreampresent compile error by moving constants out of the methods (#814) Cole Hall (1): Fix license link in README.md (#776) Donald Haase (4): Add workaround for inlining to support c89 user code (namely opus libs from kos-ports). (#768) Clean up usage of `INLINE` in utils (#771) By default have dbgio disabled until init. This prevents asserting if we try to use it prior to dbgio being initialized, which happens if we use KM_DBG with dcload serial as it allocates memory (triggering dbgio) to set up a compression buffer. (#673) The sys/queue `_FOREACH` functions are not safe to free their elements. (#823) Falco Girgis (3): Modified PVR cxt compilation to be write-only. (#751) Fixed KOS's Makefile.rules. (#752) Fixed pvrtex warnings with Clang18 host compiler (#791) Gleb Mazovetskiy (1): environ_base.sh: Remove `-fno-operator-names` flag (#785) Jose Ribeiro (1): Add documentation guide for users and maintainers (#759) Paul Cercueil (2): utils/pvrtex: fix and improve Makefile (#749) CMake: Use kos-cc as the assembler (#782) QuzarDC (2): Expanded VFS documentation (#684) Updating and truncating changelog and relnotes for v2.1.1 SiZiOUS (2): `LibADX`: adding an example for ADX playback (#715) `utils`: adding `font2txf`, a tool to make TXF from TrueType/OpenType fonts (#704) Stefanos Kornilios Mitsis Poiitidis (1): aica: Channel masks are 64 bits, use ULL consts Tchan0 (2): gitignore: add .vscode folders Naomi: examples Makefile: exclude network, modem & g1ata (#713) darcagn (3): Adjust pvrtex .gitignore and Makefile (#721) Update pvrtex/stb_image.h from v2.27 to v2.30 to fix compilation warning (#731) Prevent thd_shutdown() from destroying kernel thread (#757) dfchil (4): Add pvrtex utility (#602) Pvrtex minor fixes (#720) Added a set of known working purupuru bit patterns to the rumble example (#682) Added small approval test on binary output from pvrtex (#732) jnmartin84 (1): Add an example of how to render lines with the PVR. (#714) voxel-public (1): Update mat_transform parameter description (#770) ----------------------------------------------------------------------- hooks/post-receive -- A pseudo Operating System for the Dreamcast. |