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: quzar <qu...@us...> - 2024-03-30 05:18:36
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via 437c662388de933fabaf472603dd358cc8ba2c28 (commit) from 33acd8aee18d22d6871696e48977b68db55dd947 (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 437c662388de933fabaf472603dd358cc8ba2c28 Author: Charlotte Koch <dre...@gm...> Date: Fri Mar 29 22:10:16 2024 -0700 Explicitly use GNU extension to allow flexible array member in struct dirent (#499) This allows C++ code to use DIR and related functions (opendir(), closedir(), etc.) ----------------------------------------------------------------------- Summary of changes: include/sys/dirent.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/sys/dirent.h b/include/sys/dirent.h index ec4bedec..77595bd4 100644 --- a/include/sys/dirent.h +++ b/include/sys/dirent.h @@ -66,7 +66,7 @@ struct dirent { off_t d_off; /**< \brief File offset */ uint16_t d_reclen; /**< \brief Record length */ uint8_t d_type; /**< \brief File type */ - char d_name[]; /**< \brief Filename */ + char d_name[0]; /**< \brief Filename */ }; /** \brief Type representing a directory stream. hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: ljsebald <ljs...@us...> - 2024-03-24 17:17:14
|
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 33acd8aee18d22d6871696e48977b68db55dd947 (commit) via e2f0c88e2e64d4b3b578456140bd6862b88be46a (commit) via ab0c189b56d5f72ec30ec91a2ec6d95343697c27 (commit) via 043b75675864d949866c903dedeffb7cc4415f49 (commit) via 3e84dead5470afe8c234a6c751b0ef3f39719005 (commit) via 15ba6fd1847cf45052a9e61a4d6a27b3f3e859bc (commit) from 6321b5edb09a89d7f90ba56927f858df981bb27a (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 33acd8aee18d22d6871696e48977b68db55dd947 Merge: e2f0c88e 3e84dead Author: Lawrence Sebald <ljs...@us...> Date: Sun Mar 24 13:07:54 2024 -0400 Merge pull request #497 from pcercuei/gcc-disable-doc dc-chain: Disable GCC documentation commit e2f0c88e2e64d4b3b578456140bd6862b88be46a Merge: 043b7567 ab0c189b Author: Lawrence Sebald <ljs...@us...> Date: Sun Mar 24 13:07:24 2024 -0400 Merge pull request #496 from KallistiOS/cmake_sysroot Adding KOS_PORTS dir as sysroot for cmake to find libraries commit ab0c189b56d5f72ec30ec91a2ec6d95343697c27 Merge: 15ba6fd1 043b7567 Author: Lawrence Sebald <ljs...@us...> Date: Sun Mar 24 13:07:04 2024 -0400 Merge branch 'master' into cmake_sysroot commit 043b75675864d949866c903dedeffb7cc4415f49 Author: Paul Cercueil <pa...@cr...> Date: Sun Mar 24 07:14:08 2024 +0100 Threaded ASIC IRQ handlers (#393) * irq: Use standard stdint.h types Use the standard 'uint32_t' type instead of the custom 'uint32' one. Signed-off-by: Paul Cercueil <pa...@cr...> * dc: irq: Pass data pointer to IRQ handlers Update the IRQ API to allow clients to register a data pointer alongside the callback. Signed-off-by: Paul Cercueil <pa...@cr...> * dc: asic: Add function asic_evt_remove_handler() This function can be used to unregister any handler set to the given ASIC event. Signed-off-by: Paul Cercueil <pa...@cr...> * dc: asic: Pass data pointer to IRQ handlers Allow registering a pointer alongside the IRQ handler. The pointer will be passed as argument to the callback function. Signed-off-by: Paul Cercueil <pa...@cr...> * dc: vblank: Pass data pointer to VBLANK IRQ handler Allow registering a pointer alongside the IRQ handler. The pointer will be passed as argument to the callback function. Signed-off-by: Paul Cercueil <pa...@cr...> * maple: Pass down state pointer to IRQ callbacks Avoid global accesses to the 'maple_state' variable; instead, access it through a 'state' parameter that's passed as argument to the IRQ callbacks. Signed-off-by: Paul Cercueil <pa...@cr...> * dc: ubc: Pass data pointer to IRQ handlers Update the UBC interrupt handler code to pass a pointer to the channel_state array. Signed-off-by: Paul Cercueil <pa...@cr...> * dc: asic: Add support for threaded IRQ handlers Threaded IRQ handlers are functions which will be called within a thread, when a given IRQ happens. The advantage vs. regular IRQ handlers is that they are executed outside the IRQ context, and as a result, can hold locks and sleep if needed. Signed-off-by: Paul Cercueil <pa...@cr...> --------- Signed-off-by: Paul Cercueil <pa...@cr...> commit 3e84dead5470afe8c234a6c751b0ef3f39719005 Author: Paul Cercueil <pa...@cr...> Date: Tue Mar 19 19:07:27 2024 +0100 dc-chain: Disable GCC documentation We do not need to build GCC's documentation; and it was a common failure point as old versions of GCC don't play well with the recent makeinfo/texinfo programs. Signed-off-by: Paul Cercueil <pa...@cr...> commit 15ba6fd1847cf45052a9e61a4d6a27b3f3e859bc Author: QuzarDC <qu...@co...> Date: Mon Mar 18 11:51:26 2024 -0400 Adding KOS_PORTS dir as sysroot for cmake to find libraries ----------------------------------------------------------------------- Summary of changes: kernel/arch/dreamcast/fs/fs_iso9660.c | 5 +- kernel/arch/dreamcast/hardware/asic.c | 155 +++++++++++++++++++-- kernel/arch/dreamcast/hardware/g1ata.c | 15 +- kernel/arch/dreamcast/hardware/g2dma.c | 8 +- kernel/arch/dreamcast/hardware/maple/controller.c | 2 +- kernel/arch/dreamcast/hardware/maple/dreameye.c | 8 +- kernel/arch/dreamcast/hardware/maple/keyboard.c | 2 +- .../dreamcast/hardware/maple/maple_init_shutdown.c | 6 +- kernel/arch/dreamcast/hardware/maple/maple_irq.c | 90 ++++++------ kernel/arch/dreamcast/hardware/maple/mouse.c | 2 +- kernel/arch/dreamcast/hardware/maple/purupuru.c | 2 +- kernel/arch/dreamcast/hardware/maple/sip.c | 6 +- kernel/arch/dreamcast/hardware/maple/vmu.c | 10 +- kernel/arch/dreamcast/hardware/modem/mintr.c | 15 +- .../dreamcast/hardware/network/broadband_adapter.c | 9 +- .../arch/dreamcast/hardware/network/lan_adapter.c | 9 +- kernel/arch/dreamcast/hardware/pvr/pvr_dma.c | 7 +- .../dreamcast/hardware/pvr/pvr_init_shutdown.c | 36 ++--- kernel/arch/dreamcast/hardware/pvr/pvr_internal.h | 2 +- kernel/arch/dreamcast/hardware/pvr/pvr_irq.c | 4 +- kernel/arch/dreamcast/hardware/scif.c | 18 +-- kernel/arch/dreamcast/hardware/ubc.c | 19 +-- kernel/arch/dreamcast/hardware/vblank.c | 14 +- kernel/arch/dreamcast/include/arch/irq.h | 42 +++--- kernel/arch/dreamcast/include/dc/asic.h | 38 ++++- kernel/arch/dreamcast/include/dc/maple.h | 10 +- kernel/arch/dreamcast/include/dc/vblank.h | 3 +- kernel/arch/dreamcast/kernel/gdb_stub.c | 23 +-- kernel/arch/dreamcast/kernel/irq.c | 96 +++++++------ kernel/arch/dreamcast/kernel/mmu.c | 49 ++++--- kernel/arch/dreamcast/kernel/timer.c | 12 +- kernel/arch/dreamcast/kernel/wdt.c | 7 +- utils/cmake/dreamcast.toolchain.cmake | 1 + utils/dc-chain/scripts/gcc-pass1.mk | 1 + utils/dc-chain/scripts/gcc-pass2.mk | 1 + 35 files changed, 469 insertions(+), 258 deletions(-) diff --git a/kernel/arch/dreamcast/fs/fs_iso9660.c b/kernel/arch/dreamcast/fs/fs_iso9660.c index 7f72de39..20d6f766 100644 --- a/kernel/arch/dreamcast/fs/fs_iso9660.c +++ b/kernel/arch/dreamcast/fs/fs_iso9660.c @@ -928,10 +928,11 @@ int iso_reset(void) { time someone calls in it'll get reset. */ static int iso_last_status; static int iso_vblank_hnd; -static void iso_vblank(uint32 evt) { +static void iso_vblank(uint32 evt, void *data) { int status, disc_type; (void)evt; + (void)data; /* Get the status. This may fail if a CD operation is in progress in the foreground. */ @@ -1077,7 +1078,7 @@ int fs_iso9660_init(void) { iso_last_status = -1; /* Register with the vblank */ - iso_vblank_hnd = vblank_handler_add(iso_vblank); + iso_vblank_hnd = vblank_handler_add(iso_vblank, NULL); /* Register with VFS */ return nmmgr_handler_add(&vh.nmmgr); diff --git a/kernel/arch/dreamcast/hardware/asic.c b/kernel/arch/dreamcast/hardware/asic.c index ab939568..3bc486c6 100644 --- a/kernel/arch/dreamcast/hardware/asic.c +++ b/kernel/arch/dreamcast/hardware/asic.c @@ -93,12 +93,15 @@ */ +#include <stdbool.h> +#include <stdlib.h> #include <string.h> #include <stdio.h> #include <assert.h> #include <arch/irq.h> #include <dc/asic.h> #include <arch/spinlock.h> +#include <kos/genwait.h> /* XXX These based on g1ata.c and pvr.h and should be replaced by a standardized method */ #define IN32(addr) (* ( (volatile uint32_t *)(addr) ) ) @@ -110,13 +113,31 @@ #define ASIC_EVT_REGS 3 #define ASIC_EVT_REG_HNDS 32 +typedef struct { + asic_evt_handler hdl; + void *data; +} asic_evt_handler_entry_t; + +struct asic_thdata { + asic_evt_handler hdl; + uint32_t source; + kthread_t *thd; + int genwait_obj; + void *data; + volatile bool quit; + volatile bool pending; + void (*ack_and_mask)(uint16_t); + void (*unmask)(uint16_t); +}; + /* Exception table -- this table matches each potential G2 event to a function pointer. If the pointer is null, then nothing happens. Otherwise, the function will handle the exception. */ -static asic_evt_handler asic_evt_handlers[ASIC_EVT_REGS][ASIC_EVT_REG_HNDS]; +static asic_evt_handler_entry_t +asic_evt_handlers[ASIC_EVT_REGS][ASIC_EVT_REG_HNDS]; /* Set a handler, or remove a handler */ -void asic_evt_set_handler(uint16_t code, asic_evt_handler hnd) { +void asic_evt_set_handler(uint16_t code, asic_evt_handler hnd, void *data) { uint8_t evtreg, evt; evtreg = (code >> 8) & 0xff; @@ -124,12 +145,14 @@ void asic_evt_set_handler(uint16_t code, asic_evt_handler hnd) { assert((evtreg < ASIC_EVT_REGS) && (evt < ASIC_EVT_REG_HNDS)); - asic_evt_handlers[evtreg][evt] = hnd; + asic_evt_handlers[evtreg][evt] = (asic_evt_handler_entry_t){ hnd, data }; } /* The ASIC event handler; this is called from the global IRQ handler to handle external IRQ 9. */ -static void handler_irq9(irq_t source, irq_context_t *context) { +static void handler_irq9(irq_t source, irq_context_t *context, void *data) { + const asic_evt_handler_entry_t (*const handlers)[ASIC_EVT_REG_HNDS] = data; + const asic_evt_handler_entry_t *entry; uint8_t reg, i; (void)source; @@ -146,11 +169,10 @@ static void handler_irq9(irq_t source, irq_context_t *context) { /* Search for relevant handlers */ for(i = 0; i < ASIC_EVT_REG_HNDS; i++) { - if(mask & (1 << i)) { - if(asic_evt_handlers[reg][i] != NULL) { - asic_evt_handlers[reg][i]((reg << 8) | i); - } - } + entry = &handlers[reg][i]; + + if((mask & (1 << i)) && entry->hdl != NULL) + entry->hdl((reg << 8) | i, entry->data); } } } @@ -206,9 +228,9 @@ static void asic_evt_init(void) { memset(asic_evt_handlers, 0, sizeof(asic_evt_handlers)); /* Hook IRQ9,B,D */ - irq_set_handler(EXC_IRQ9, handler_irq9); - irq_set_handler(EXC_IRQB, handler_irq9); - irq_set_handler(EXC_IRQD, handler_irq9); + irq_set_handler(EXC_IRQ9, handler_irq9, asic_evt_handlers); + irq_set_handler(EXC_IRQB, handler_irq9, asic_evt_handlers); + irq_set_handler(EXC_IRQD, handler_irq9, asic_evt_handlers); } /* Shutdown events */ @@ -217,9 +239,9 @@ static void asic_evt_shutdown(void) { asic_evt_disable_all(); /* Unhook handlers */ - irq_set_handler(EXC_IRQ9, NULL); - irq_set_handler(EXC_IRQB, NULL); - irq_set_handler(EXC_IRQD, NULL); + irq_set_handler(EXC_IRQ9, NULL, NULL); + irq_set_handler(EXC_IRQB, NULL, NULL); + irq_set_handler(EXC_IRQD, NULL, NULL); } /* Init routine */ @@ -230,3 +252,106 @@ void asic_init(void) { void asic_shutdown(void) { asic_evt_shutdown(); } + +static void * asic_threaded_irq(void *data) { + struct asic_thdata *thdata = data; + int flags; + + for (;;) { + flags = irq_disable(); + + if (!thdata->pending) + genwait_wait(&thdata->genwait_obj, thdata->thd->label, 0, NULL); + + irq_restore(flags); + + if (thdata->quit) + break; + + thdata->pending = false; + thdata->hdl(thdata->source, thdata->data); + + if (thdata->unmask) + thdata->unmask(thdata->source); + } + + return NULL; +} + +static void asic_thirq_dispatch(uint32_t source, void *data) { + struct asic_thdata *thdata = data; + + if (thdata->ack_and_mask) + thdata->ack_and_mask(source); + + thdata->source = source; + + thdata->pending = true; + genwait_wake_one(&thdata->genwait_obj); +} + +int asic_evt_request_threaded_handler(uint16_t code, asic_evt_handler hnd, + void *data, + void (*ack_and_mask)(uint16_t), + void (*unmask)(uint16_t)) +{ + struct asic_thdata *thdata; + uint32_t flags; + + thdata = malloc(sizeof(*thdata)); + if (!thdata) + return -1; /* TODO: What return code? */ + + thdata->hdl = hnd; + thdata->data = data; + thdata->quit = false; + thdata->pending = false; + thdata->ack_and_mask = ack_and_mask; + thdata->unmask = unmask; + + flags = irq_disable(); + + thdata->thd = thd_create(0, asic_threaded_irq, thdata); + if (!thdata->thd) { + irq_restore(flags); + free(thdata); + return -1; /* TODO: What return code? */ + } + + /* Set a reasonable name to ID the thread */ + snprintf(thdata->thd->label, KTHREAD_LABEL_SIZE, + "Threaded IRQ code: 0x%x evt: 0x%.4x", + ((code >> 16) & 0xf), (code & 0xffff)); + + /* Highest priority */ + //thd_set_prio(thdata->thd, 0); + + asic_evt_set_handler(code, asic_thirq_dispatch, thdata); + + irq_restore(flags); + + return 0; +} + +void asic_evt_remove_handler(uint16_t code) +{ + asic_evt_handler_entry_t entry; + struct asic_thdata *thdata; + uint8_t evtreg, evt; + + evtreg = (code >> 8) & 0xff; + evt = code & 0xff; + + entry = asic_evt_handlers[evtreg][evt]; + asic_evt_set_handler(code, NULL, NULL); + + if (entry.hdl == asic_thirq_dispatch) { + thdata = entry.data; + thdata->quit = true; + + genwait_wake_one(&thdata->genwait_obj); + thd_join(thdata->thd, NULL); + + free(thdata); + } +} diff --git a/kernel/arch/dreamcast/hardware/g1ata.c b/kernel/arch/dreamcast/hardware/g1ata.c index 9de6b30a..5d4e3fcc 100644 --- a/kernel/arch/dreamcast/hardware/g1ata.c +++ b/kernel/arch/dreamcast/hardware/g1ata.c @@ -211,9 +211,10 @@ inline int g1_ata_mutex_unlock(void) { return mutex_unlock(&_g1_ata_mutex); } -static void g1_dma_irq_hnd(uint32 code) { +static void g1_dma_irq_hnd(uint32 code, void *data) { /* XXXX: Probably should look at the code to make sure it isn't an error. */ (void)code; + (void)data; if(dma_in_progress) { /* Signal the calling thread to continue, if it is blocking. */ @@ -1388,11 +1389,11 @@ int g1_ata_init(void) { } /* Hook all the DMA related events. */ - asic_evt_set_handler(ASIC_EVT_GD_DMA, g1_dma_irq_hnd); + asic_evt_set_handler(ASIC_EVT_GD_DMA, g1_dma_irq_hnd, NULL); asic_evt_enable(ASIC_EVT_GD_DMA, ASIC_IRQB); - asic_evt_set_handler(ASIC_EVT_GD_DMA_OVERRUN, g1_dma_irq_hnd); + asic_evt_set_handler(ASIC_EVT_GD_DMA_OVERRUN, g1_dma_irq_hnd, NULL); asic_evt_enable(ASIC_EVT_GD_DMA_OVERRUN, ASIC_IRQB); - asic_evt_set_handler(ASIC_EVT_GD_DMA_ILLADDR, g1_dma_irq_hnd); + asic_evt_set_handler(ASIC_EVT_GD_DMA_ILLADDR, g1_dma_irq_hnd, NULL); asic_evt_enable(ASIC_EVT_GD_DMA_ILLADDR, ASIC_IRQB); initted = 1; @@ -1415,9 +1416,9 @@ void g1_ata_shutdown(void) { /* Unhook the events and disable the IRQs. */ asic_evt_disable(ASIC_EVT_GD_DMA, ASIC_IRQB); - asic_evt_set_handler(ASIC_EVT_GD_DMA, NULL); + asic_evt_remove_handler(ASIC_EVT_GD_DMA); asic_evt_disable(ASIC_EVT_GD_DMA_OVERRUN, ASIC_IRQB); - asic_evt_set_handler(ASIC_EVT_GD_DMA_OVERRUN, NULL); + asic_evt_remove_handler(ASIC_EVT_GD_DMA_OVERRUN); asic_evt_disable(ASIC_EVT_GD_DMA_ILLADDR, ASIC_IRQB); - asic_evt_set_handler(ASIC_EVT_GD_DMA_ILLADDR, NULL); + asic_evt_remove_handler(ASIC_EVT_GD_DMA_ILLADDR); } diff --git a/kernel/arch/dreamcast/hardware/g2dma.c b/kernel/arch/dreamcast/hardware/g2dma.c index 6ad85f36..829b76f0 100644 --- a/kernel/arch/dreamcast/hardware/g2dma.c +++ b/kernel/arch/dreamcast/hardware/g2dma.c @@ -128,9 +128,11 @@ inline static void dma_disable(uint32_t chn) { g2_dma->dma[chn].start = 0; } -static void g2_dma_irq_hnd(uint32_t code) { +static void g2_dma_irq_hnd(uint32_t code, void *data) { int chn = code - ASIC_EVT_G2_DMA0; + (void)data; + if(chn < G2_DMA_CHAN_SPU || chn > G2_DMA_CHAN_CH3) { dbglog(DBG_ERROR, "g2_dma: Wrong channel received in g2_dma_irq_hnd"); return; @@ -224,7 +226,7 @@ int g2_dma_init(void) { dma_cbdata[i] = 0; /* Hook the interrupt */ - asic_evt_set_handler(ASIC_EVT_G2_DMA0 + i, g2_dma_irq_hnd); + asic_evt_set_handler(ASIC_EVT_G2_DMA0 + i, g2_dma_irq_hnd, NULL); asic_evt_enable(ASIC_EVT_G2_DMA0 + i, ASIC_IRQB); } @@ -246,7 +248,7 @@ void g2_dma_shutdown(void) { for(i = 0; i < 4; i++) { /* Unhook the G2 interrupt */ asic_evt_disable(ASIC_EVT_G2_DMA0 + i, ASIC_IRQB); - asic_evt_set_handler(ASIC_EVT_G2_DMA0 + i, NULL); + asic_evt_remove_handler(ASIC_EVT_G2_DMA0 + i); /* Destroy the semaphore */ sem_destroy(&dma_done[i]); diff --git a/kernel/arch/dreamcast/hardware/maple/controller.c b/kernel/arch/dreamcast/hardware/maple/controller.c index ec2c243c..f6678c1f 100644 --- a/kernel/arch/dreamcast/hardware/maple/controller.c +++ b/kernel/arch/dreamcast/hardware/maple/controller.c @@ -49,7 +49,7 @@ void cont_btn_callback(uint8_t addr, uint32_t btns, cont_btn_callback_t cb) { } /* Response callback for the GETCOND Maple command. */ -static void cont_reply(maple_frame_t *frm) { +static void cont_reply(maple_state_t *, maple_frame_t *frm) { maple_response_t *resp; uint32_t *respbuf; cont_cond_t *raw; diff --git a/kernel/arch/dreamcast/hardware/maple/dreameye.c b/kernel/arch/dreamcast/hardware/maple/dreameye.c index 08e22655..fad5d40e 100644 --- a/kernel/arch/dreamcast/hardware/maple/dreameye.c +++ b/kernel/arch/dreamcast/hardware/maple/dreameye.c @@ -19,7 +19,7 @@ static int dreameye_send_get_image(maple_device_t *dev, static dreameye_state_t *first_state = NULL; -static void dreameye_get_image_count_cb(maple_frame_t *frame) { +static void dreameye_get_image_count_cb(maple_state_t *, maple_frame_t *frame) { dreameye_state_t *de; maple_response_t *resp; uint32 *respbuf32; @@ -59,7 +59,7 @@ static void dreameye_get_image_count_cb(maple_frame_t *frame) { genwait_wake_all(frame); } -static void dreameye_get_transfer_count_cb(maple_frame_t *frame) { +static void dreameye_get_transfer_count_cb(maple_state_t *, maple_frame_t *frame) { dreameye_state_t *de; maple_response_t *resp; uint32 *respbuf32; @@ -139,7 +139,7 @@ int dreameye_get_image_count(maple_device_t *dev, int block) { return MAPLE_EOK; } -static void dreameye_get_image_cb(maple_frame_t *frame) { +static void dreameye_get_image_cb(maple_state_t *, maple_frame_t *frame) { maple_device_t *dev; maple_response_t *resp; uint32 *respbuf32; @@ -327,7 +327,7 @@ fail: return MAPLE_EFAIL; } -static void dreameye_erase_cb(maple_frame_t *frame) { +static void dreameye_erase_cb(maple_state_t *, maple_frame_t *frame) { maple_response_t *resp; uint8 *respbuf; diff --git a/kernel/arch/dreamcast/hardware/maple/keyboard.c b/kernel/arch/dreamcast/hardware/maple/keyboard.c index 95bb091d..df184310 100644 --- a/kernel/arch/dreamcast/hardware/maple/keyboard.c +++ b/kernel/arch/dreamcast/hardware/maple/keyboard.c @@ -521,7 +521,7 @@ static void kbd_check_poll(maple_frame_t *frm) { } } -static void kbd_reply(maple_frame_t *frm) { +static void kbd_reply(maple_state_t *, maple_frame_t *frm) { maple_response_t *resp; uint32 *respbuf; kbd_state_t *state; diff --git a/kernel/arch/dreamcast/hardware/maple/maple_init_shutdown.c b/kernel/arch/dreamcast/hardware/maple/maple_init_shutdown.c index 1f6b64ae..488f9592 100644 --- a/kernel/arch/dreamcast/hardware/maple/maple_init_shutdown.c +++ b/kernel/arch/dreamcast/hardware/maple/maple_init_shutdown.c @@ -95,8 +95,8 @@ static void maple_hw_init(void) { maple_bus_enable(); /* Hook the necessary interrupts */ - maple_state.vbl_handle = vblank_handler_add(maple_vbl_irq_hnd); - asic_evt_set_handler(ASIC_EVT_MAPLE_DMA, maple_dma_irq_hnd); + maple_state.vbl_handle = vblank_handler_add(maple_vbl_irq_hnd, &maple_state); + asic_evt_set_handler(ASIC_EVT_MAPLE_DMA, maple_dma_irq_hnd, &maple_state); asic_evt_enable(ASIC_EVT_MAPLE_DMA, ASIC_IRQ_DEFAULT); } @@ -108,7 +108,7 @@ void maple_hw_shutdown(void) { /* Unhook interrupts */ vblank_handler_remove(maple_state.vbl_handle); - asic_evt_set_handler(ASIC_EVT_MAPLE_DMA, NULL); + asic_evt_remove_handler(ASIC_EVT_MAPLE_DMA); asic_evt_disable(ASIC_EVT_MAPLE_DMA, ASIC_IRQ_DEFAULT); /* Stop any existing maple DMA and shut down the bus */ diff --git a/kernel/arch/dreamcast/hardware/maple/maple_irq.c b/kernel/arch/dreamcast/hardware/maple/maple_irq.c index d174eb01..85a155a8 100644 --- a/kernel/arch/dreamcast/hardware/maple/maple_irq.c +++ b/kernel/arch/dreamcast/hardware/maple/maple_irq.c @@ -19,13 +19,13 @@ /* VBlank IRQ handler */ /* Fwd declare */ -static void vbl_autodet_callback(maple_frame_t *); +static void vbl_autodet_callback(maple_state_t *state, maple_frame_t *frm); /* Send a DEVINFO command for the given port/unit */ -static void vbl_send_devinfo(int p, int u) { +static void vbl_send_devinfo(maple_state_t *state, int p, int u) { maple_device_t * dev; - dev = &maple_state.ports[p].units[u]; + dev = &state->ports[p].units[u]; /* Reserve access; if we don't get it, forget about it */ if(maple_frame_lock(&dev->frame) < 0) @@ -42,25 +42,25 @@ static void vbl_send_devinfo(int p, int u) { /* Do a potential disconnect on the named device (check to make sure it was connected first) */ -static void vbl_chk_disconnect(int p, int u) { - if(maple_state.ports[p].units[u].valid) { +static void vbl_chk_disconnect(maple_state_t *state, int p, int u) { + if(state->ports[p].units[u].valid) { #if MAPLE_IRQ_DEBUG dbglog(DBG_KDEBUG, "maple: detach on device %c%c\n", 'A' + p, '0' + u); #endif if(maple_driver_detach(p, u) >= 0) { - assert(!maple_state.ports[p].units[u].valid); + assert(!state->ports[p].units[u].valid); } } } /* Check the sub-devices for a top-level port */ -static void vbl_chk_subdevs(int p, uint8 newmask) { +static void vbl_chk_subdevs(maple_state_t *state, int p, uint8 newmask) { int oldmask, chkmask, u; /* Get the old mask */ - oldmask = maple_state.ports[p].units[0].dev_mask; + oldmask = state->ports[p].units[0].dev_mask; /* Is it different from the new mask? */ if(oldmask != newmask) { @@ -73,16 +73,16 @@ static void vbl_chk_subdevs(int p, uint8 newmask) { device. Do a driver detach on it. */ if(!(oldmask & chkmask) && (newmask & chkmask)) { /* Send a further query */ - vbl_send_devinfo(p, u); + vbl_send_devinfo(state, p, u); } else if((oldmask & chkmask) && !(newmask & chkmask)) { ...<truncated>... hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: ljsebald <ljs...@us...> - 2024-03-18 02:16:03
|
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 6321b5edb09a89d7f90ba56927f858df981bb27a (commit) via 1259a4474c5e9cf94cfc55bc3cca521d4c73a93f (commit) via 68b489dea38fc6d2103ab333230750830499855d (commit) via 67be188ddb7db70eb59a224ab0425113a6a46f7a (commit) from 33c7ee5dbacfb0d2e862377da8ffb4ac00818cf1 (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 6321b5edb09a89d7f90ba56927f858df981bb27a Merge: 1259a447 68b489de Author: Lawrence Sebald <ljs...@us...> Date: Sun Mar 17 22:15:12 2024 -0400 Merge pull request #495 from KallistiOS/posix_clock_declarations Added declarations for clock_xxx() POSIX API commit 1259a4474c5e9cf94cfc55bc3cca521d4c73a93f Merge: 33c7ee5d 67be188d Author: Lawrence Sebald <ljs...@us...> Date: Sun Mar 17 22:13:27 2024 -0400 Merge pull request #491 from KallistiOS/gdb142 Update configs with GDB 14.1 to 14.2 commit 68b489dea38fc6d2103ab333230750830499855d Author: Falco Girgis <gyr...@gm...> Date: Sun Mar 17 11:38:15 2024 -0500 Fixed declarations for clock_xx() POSIX API Since we were never defining _POSIX_TIMERS support within KOS (we don't support all of its functionality), Newlib was never providing us with the declarations for the POSIX clock_xxx() date/time API which we do implement. - Added explicit prototypes for POSIX clock_gettime(), clock_settime(), and clock_getres(). commit 67be188ddb7db70eb59a224ab0425113a6a46f7a Author: darc <da...@pr...> Date: Sun Mar 3 17:51:07 2024 -0600 Update configs with GDB 14.1 to 14.2 ----------------------------------------------------------------------- Summary of changes: include/kos/time.h | 14 ++++++++++++++ include/sys/_pthread.h | 3 --- utils/dc-chain/config/config.mk.10.5.0.sample | 2 +- utils/dc-chain/config/config.mk.11.4.0.sample | 2 +- utils/dc-chain/config/config.mk.12.3.0.sample | 2 +- utils/dc-chain/config/config.mk.13.2.1-dev.sample | 2 +- utils/dc-chain/config/config.mk.14.0.1-dev.sample | 2 +- utils/dc-chain/config/config.mk.9.5.0-winxp.sample | 2 +- utils/dc-chain/config/config.mk.stable.sample | 2 +- 9 files changed, 21 insertions(+), 10 deletions(-) diff --git a/include/kos/time.h b/include/kos/time.h index 67f28d4a..3995c061 100644 --- a/include/kos/time.h +++ b/include/kos/time.h @@ -15,6 +15,10 @@ This will probably go away at some point in the future, if/when Newlib gets an implementation of this function. But for now, it's here. + \todo + - Implement _POSIX_TIMERS, which requires POSIX signals back-end. + - Implement thread-specific CPU time + \author Lawrence Sebald \author Falco Girgis */ @@ -37,8 +41,11 @@ __BEGIN_DECLS struct timespec; #define TIME_UTC 1 + +/* Microsecond resolution for clock(), per POSIX standard */ #define CLOCKS_PER_SEC 1000000 +/* C11 nanosecond-resolution timing. */ extern int timespec_get(struct timespec *ts, int base); #endif /* !defined(__STRICT_ANSI__) || (__STDC_VERSION__ >= 201112L) || (__cplusplus >= 201703L) */ @@ -64,6 +71,13 @@ extern int timespec_get(struct timespec *ts, int base); #endif */ +/* Explicitly provided function declarations for POSIX clock API, since + getting them from Newlib requires supporting the rest of the _POSIX_TIMERS + API, which is not implemented yet. */ +extern int clock_settime(__clockid_t clock_id, const struct timespec *ts); +extern int clock_gettime(__clockid_t clock_id, struct timespec *ts); +extern int clock_getres(__clockid_t clock_id, struct timespec *res); + #endif /* !defined(__STRICT_ANSI__) || (_POSIX_C_SOURCE >= 199309L) */ __END_DECLS diff --git a/include/sys/_pthread.h b/include/sys/_pthread.h index aa9ae369..a53bdd28 100644 --- a/include/sys/_pthread.h +++ b/include/sys/_pthread.h @@ -14,7 +14,4 @@ /** \brief POSIX timeouts supported (sorta) */ #define _POSIX_TIMEOUTS -/** \brief POSIX timers supported (not really) */ -#define _POSIX_TIMERS - #endif /* __SYS__PTHREAD_H */ diff --git a/utils/dc-chain/config/config.mk.10.5.0.sample b/utils/dc-chain/config/config.mk.10.5.0.sample index a91da992..69bb718b 100644 --- a/utils/dc-chain/config/config.mk.10.5.0.sample +++ b/utils/dc-chain/config/config.mk.10.5.0.sample @@ -9,7 +9,7 @@ sh_binutils_ver=2.41 sh_gcc_ver=10.5.0 newlib_ver=4.3.0.20230120 -gdb_ver=14.1 +gdb_ver=14.2 # Tarball extensions to download for SH sh_binutils_download_type=xz diff --git a/utils/dc-chain/config/config.mk.11.4.0.sample b/utils/dc-chain/config/config.mk.11.4.0.sample index 9fcd42c7..1d2e466d 100644 --- a/utils/dc-chain/config/config.mk.11.4.0.sample +++ b/utils/dc-chain/config/config.mk.11.4.0.sample @@ -9,7 +9,7 @@ sh_binutils_ver=2.41 sh_gcc_ver=11.4.0 newlib_ver=4.3.0.20230120 -gdb_ver=14.1 +gdb_ver=14.2 # Tarball extensions to download for SH sh_binutils_download_type=xz diff --git a/utils/dc-chain/config/config.mk.12.3.0.sample b/utils/dc-chain/config/config.mk.12.3.0.sample index c33fe0d1..8bae848e 100644 --- a/utils/dc-chain/config/config.mk.12.3.0.sample +++ b/utils/dc-chain/config/config.mk.12.3.0.sample @@ -9,7 +9,7 @@ sh_binutils_ver=2.41 sh_gcc_ver=12.3.0 newlib_ver=4.3.0.20230120 -gdb_ver=14.1 +gdb_ver=14.2 # Tarball extensions to download for SH sh_binutils_download_type=xz diff --git a/utils/dc-chain/config/config.mk.13.2.1-dev.sample b/utils/dc-chain/config/config.mk.13.2.1-dev.sample index be251783..7576900c 100644 --- a/utils/dc-chain/config/config.mk.13.2.1-dev.sample +++ b/utils/dc-chain/config/config.mk.13.2.1-dev.sample @@ -16,7 +16,7 @@ sh_binutils_ver=2.42 sh_gcc_ver=13.2.1 newlib_ver=4.4.0.20231231 -gdb_ver=14.1 +gdb_ver=14.2 # Tarball extensions to download for SH sh_binutils_download_type=xz diff --git a/utils/dc-chain/config/config.mk.14.0.1-dev.sample b/utils/dc-chain/config/config.mk.14.0.1-dev.sample index 03d5cb4d..2bc94b07 100644 --- a/utils/dc-chain/config/config.mk.14.0.1-dev.sample +++ b/utils/dc-chain/config/config.mk.14.0.1-dev.sample @@ -16,7 +16,7 @@ sh_binutils_ver=2.42 sh_gcc_ver=14.0.1 newlib_ver=4.4.0.20231231 -gdb_ver=14.1 +gdb_ver=14.2 # Tarball extensions to download for SH sh_binutils_download_type=xz diff --git a/utils/dc-chain/config/config.mk.9.5.0-winxp.sample b/utils/dc-chain/config/config.mk.9.5.0-winxp.sample index 75024821..cd19f6d2 100644 --- a/utils/dc-chain/config/config.mk.9.5.0-winxp.sample +++ b/utils/dc-chain/config/config.mk.9.5.0-winxp.sample @@ -9,7 +9,7 @@ sh_binutils_ver=2.34 sh_gcc_ver=9.5.0 newlib_ver=4.3.0.20230120 -gdb_ver=14.1 +gdb_ver=14.2 # Tarball extensions to download for SH sh_binutils_download_type=xz diff --git a/utils/dc-chain/config/config.mk.stable.sample b/utils/dc-chain/config/config.mk.stable.sample index 6e5b932c..61897fa4 100644 --- a/utils/dc-chain/config/config.mk.stable.sample +++ b/utils/dc-chain/config/config.mk.stable.sample @@ -9,7 +9,7 @@ sh_binutils_ver=2.41 sh_gcc_ver=13.2.0 newlib_ver=4.3.0.20230120 -gdb_ver=14.1 +gdb_ver=14.2 # Tarball extensions to download for SH sh_binutils_download_type=xz hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: ljsebald <ljs...@us...> - 2024-03-06 02:38:06
|
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 33c7ee5dbacfb0d2e862377da8ffb4ac00818cf1 (commit) via b8c43614690309800bef15c76cd93334ce30b828 (commit) via 79c1d3c4fbbcac690c58174e6bfc132a349d30de (commit) from ba408f3d97331498552a1eeff538e31deb1626a9 (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 33c7ee5dbacfb0d2e862377da8ffb4ac00818cf1 Merge: b8c43614 79c1d3c4 Author: Lawrence Sebald <ljs...@us...> Date: Tue Mar 5 21:36:42 2024 -0500 Merge pull request #492 from KallistiOS/mb_cleanup Correct clean/dist for new multibuffer example commit b8c43614690309800bef15c76cd93334ce30b828 Author: Paul Cercueil <pa...@cr...> Date: Wed Mar 6 03:36:10 2024 +0100 CMake work (#490) * Add KOS wrapper for cmake-curses-gui Add a kos-ccmake wrapper similar to kos-cmake, which will use the "ccmake" program (provided by the cmake-curses-gui on Debian/Ubuntu) instead. Signed-off-by: Paul Cercueil <pa...@cr...> * cmake: Set sysroot in toolchain file Set the sysroot, so that CMake will be able to find the cross-compiled libraries and headers from the kos-ports folder. Signed-off-by: Paul Cercueil <pa...@cr...> * cmake: Use platform file for the Dreamcast Set CMAKE_SYSTEM_NAME to "Dreamcast". CMake will then try to locate a "Platform/Dreamcast.cmake" file from its module paths. In there, we can override the CMAKE_INSTALL_PREFIX so that it always defaults to an empty string and not /usr or /usr/local. Signed-off-by: Paul Cercueil <pa...@cr...> --------- Signed-off-by: Paul Cercueil <pa...@cr...> commit 79c1d3c4fbbcac690c58174e6bfc132a349d30de Author: QuzarDC <qu...@co...> Date: Mon Mar 4 13:17:32 2024 -0500 Correct clean/dist for new multibuffer example ----------------------------------------------------------------------- Summary of changes: examples/dreamcast/video/Makefile | 4 ++-- utils/cmake/Platform/Dreamcast.cmake | 9 +++++++++ utils/cmake/dreamcast.toolchain.cmake | 7 ++++++- utils/gnu_wrappers/{kos-cmake => kos-ccmake} | 7 ++++++- 4 files changed, 23 insertions(+), 4 deletions(-) create mode 100644 utils/cmake/Platform/Dreamcast.cmake copy utils/gnu_wrappers/{kos-cmake => kos-ccmake} (66%) diff --git a/examples/dreamcast/video/Makefile b/examples/dreamcast/video/Makefile index 27c19c24..a24bf8b0 100644 --- a/examples/dreamcast/video/Makefile +++ b/examples/dreamcast/video/Makefile @@ -14,10 +14,10 @@ clean: $(KOS_MAKE) -C bfont clean $(KOS_MAKE) -C palmenu clean $(KOS_MAKE) -C minifont clean - $(KOS_MAKE) -C multibuffer + $(KOS_MAKE) -C multibuffer clean dist: $(KOS_MAKE) -C bfont dist $(KOS_MAKE) -C palmenu dist $(KOS_MAKE) -C minifont dist - $(KOS_MAKE) -C multibuffer + $(KOS_MAKE) -C multibuffer dist diff --git a/utils/cmake/Platform/Dreamcast.cmake b/utils/cmake/Platform/Dreamcast.cmake new file mode 100644 index 00000000..87e31a20 --- /dev/null +++ b/utils/cmake/Platform/Dreamcast.cmake @@ -0,0 +1,9 @@ +# CMake platform file for the Dreamcast. +# Copyright (C) 2024 Paul Cercueil + +include(Platform/Generic) +set(CMAKE_EXECUTABLE_SUFFIX .elf) + +if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) + set(CMAKE_INSTALL_PREFIX "" CACHE PATH "Install prefix" FORCE) +endif() diff --git a/utils/cmake/dreamcast.toolchain.cmake b/utils/cmake/dreamcast.toolchain.cmake index 6c423eea..faf3a5ba 100644 --- a/utils/cmake/dreamcast.toolchain.cmake +++ b/utils/cmake/dreamcast.toolchain.cmake @@ -51,8 +51,10 @@ if(NOT DEFINED KOS_PORTS) message(VERBOSE "KOS_PORTS: ${KOS_PORTS}") endif() +list(APPEND CMAKE_MODULE_PATH $ENV{KOS_BASE}/utils/cmake) + ##### Configure CMake System ##### -set(CMAKE_SYSTEM_NAME Generic-ELF) +set(CMAKE_SYSTEM_NAME Dreamcast) set(CMAKE_SYSTEM_VERSION 1) set(CMAKE_SYSTEM_PROCESSOR SH4) set(PLATFORM_DREAMCAST TRUE) @@ -71,6 +73,9 @@ set(CMAKE_FIND_LIBRARY_SUFFIXES ".a") # Never use the CMAKE_FIND_ROOT_PATH to find programs with find_program() set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +# Set sysroot to kos-ports folder +set(CMAKE_SYSROOT ${KOS_PORTS}) + ##### Add Platform-Specific #defines ##### add_compile_definitions(__DREAMCAST__ _arch_dreamcast) diff --git a/utils/gnu_wrappers/kos-cmake b/utils/gnu_wrappers/kos-ccmake similarity index 66% copy from utils/gnu_wrappers/kos-cmake copy to utils/gnu_wrappers/kos-ccmake index 120174a3..c987ea0e 100755 --- a/utils/gnu_wrappers/kos-cmake +++ b/utils/gnu_wrappers/kos-ccmake @@ -7,7 +7,12 @@ if [ -z "${KOS_BASE}" ]; then exit 1 fi -cmake \ +if [ -z "$(which ccmake)" ]; then + echo "ccmake program is not present. Please install ccmake or cmake-curses-gui." + exit 1 +fi + +ccmake \ -DCMAKE_TOOLCHAIN_FILE="${KOS_BASE}/utils/cmake/dreamcast.toolchain.cmake" \ "$@" hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: ljsebald <ljs...@us...> - 2024-02-23 01:33:18
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via ba408f3d97331498552a1eeff538e31deb1626a9 (commit) via 0d267e91f546f047fc326acddf90f52cfc94dcf2 (commit) via 0dc229f86c37b6a52f6c823002b36310dde0eae5 (commit) via 30b0112ed38dde16b6cc3a85d2adee8ccea11d26 (commit) from 32799ba83d3a7524110d2ab7f9138d3623803912 (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 ba408f3d97331498552a1eeff538e31deb1626a9 Merge: 0d267e91 30b0112e Author: Lawrence Sebald <ljs...@us...> Date: Thu Feb 22 20:32:30 2024 -0500 Merge pull request #488 from DC-SWAT/pvr_typos_fix Fixed typos in PVR code. commit 0d267e91f546f047fc326acddf90f52cfc94dcf2 Merge: 32799ba8 0dc229f8 Author: Lawrence Sebald <ljs...@us...> Date: Thu Feb 22 20:30:23 2024 -0500 Merge pull request #489 from dkm/dkm/tune_gcc_config gcc: configure GCC to let it know we use GNU tools commit 0dc229f86c37b6a52f6c823002b36310dde0eae5 Author: Marc Poulhiès <dk...@ka...> Date: Wed Feb 21 08:08:21 2024 +0100 gcc: configure GCC to let it know we use GNU tools In particular, the gcc driver will correctly pass -I from the command line to the assembler. Signed-off-by: Marc Poulhiès <dk...@ka...> commit 30b0112ed38dde16b6cc3a85d2adee8ccea11d26 Author: DC-SWAT <sw...@21...> Date: Wed Feb 21 11:13:18 2024 +0700 Fixed typos in PVR code. ----------------------------------------------------------------------- Summary of changes: kernel/arch/dreamcast/hardware/pvr/pvr_texture.c | 2 +- kernel/arch/dreamcast/include/dc/asic.h | 2 +- kernel/arch/dreamcast/include/dc/pvr.h | 2 +- utils/dc-chain/scripts/gcc-pass1.mk | 2 ++ utils/dc-chain/scripts/gcc-pass2.mk | 2 ++ 5 files changed, 7 insertions(+), 3 deletions(-) diff --git a/kernel/arch/dreamcast/hardware/pvr/pvr_texture.c b/kernel/arch/dreamcast/hardware/pvr/pvr_texture.c index 8fb435fe..0b5506dc 100644 --- a/kernel/arch/dreamcast/hardware/pvr/pvr_texture.c +++ b/kernel/arch/dreamcast/hardware/pvr/pvr_texture.c @@ -195,7 +195,7 @@ void pvr_txr_load_kimg(kos_img_t *img, pvr_ptr_t dst, uint32 flags) { mutex_unlock((mutex_t *)&pvr_state.dma_lock); } else if(flags & PVR_TXRLOAD_SQ) { - pvr_txr_load(dst, img->data, img->byte_count); + pvr_txr_load(img->data, dst, img->byte_count); } else { memcpy4(dst, img->data, img->byte_count); diff --git a/kernel/arch/dreamcast/include/dc/asic.h b/kernel/arch/dreamcast/include/dc/asic.h index 2efe77d7..b9045373 100644 --- a/kernel/arch/dreamcast/include/dc/asic.h +++ b/kernel/arch/dreamcast/include/dc/asic.h @@ -58,7 +58,7 @@ __BEGIN_DECLS #define ASIC_EVT_PVR_VBLANK_END 0x0004 /**< \brief VBLANK end interrupt */ #define ASIC_EVT_PVR_HBLANK_BEGIN 0x0005 /**< \brief HBLANK begin interrupt */ -#define ASIC_EVT_PVR_YUV_DONE 0x0007 /**< \brief YUV completed */ +#define ASIC_EVT_PVR_YUV_DONE 0x0006 /**< \brief YUV completed */ #define ASIC_EVT_PVR_OPAQUEDONE 0x0007 /**< \brief Opaque list completed */ #define ASIC_EVT_PVR_OPAQUEMODDONE 0x0008 /**< \brief Opaque modifiers completed */ #define ASIC_EVT_PVR_TRANSDONE 0x0009 /**< \brief Transparent list completed */ diff --git a/kernel/arch/dreamcast/include/dc/pvr.h b/kernel/arch/dreamcast/include/dc/pvr.h index 1bb72912..2b9917d7 100644 --- a/kernel/arch/dreamcast/include/dc/pvr.h +++ b/kernel/arch/dreamcast/include/dc/pvr.h @@ -2395,7 +2395,7 @@ int pvr_dma_transfer(void *src, uintptr_t dest, size_t count, int type, #define PVR_DMA_TA 2 /**< \brief Transfer to the tile accelerator */ #define PVR_DMA_YUV 3 /**< \brief Transfer to the YUV converter (TA) */ #define PVR_DMA_VRAM32_SB 4 /**< \brief Transfer to/from VRAM using PVR i/f */ -#define PVR_DMA_VRAM64_SB 4 /**< \brief Transfer to/from VRAM using PVR i/f */ +#define PVR_DMA_VRAM64_SB 5 /**< \brief Transfer to/from VRAM using PVR i/f */ /** @} */ /** \brief Load a texture using TA DMA. diff --git a/utils/dc-chain/scripts/gcc-pass1.mk b/utils/dc-chain/scripts/gcc-pass1.mk index 20c71c5f..0ce06f3f 100644 --- a/utils/dc-chain/scripts/gcc-pass1.mk +++ b/utils/dc-chain/scripts/gcc-pass1.mk @@ -17,6 +17,8 @@ $(build_gcc_pass1): logdir ../$(src_dir)/configure \ --target=$(target) \ --prefix=$(prefix) \ + --with-gnu-as \ + --with-gnu-ld \ --without-headers \ --with-newlib \ --enable-languages=c \ diff --git a/utils/dc-chain/scripts/gcc-pass2.mk b/utils/dc-chain/scripts/gcc-pass2.mk index 96d6760a..4cede52b 100644 --- a/utils/dc-chain/scripts/gcc-pass2.mk +++ b/utils/dc-chain/scripts/gcc-pass2.mk @@ -14,6 +14,8 @@ $(build_gcc_pass2): logdir ../$(src_dir)/configure \ --target=$(target) \ --prefix=$(prefix) \ + --with-gnu-as \ + --with-gnu-ld \ --with-newlib \ --disable-libssp \ --enable-threads=$(thread_model) \ hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: quzar <qu...@us...> - 2024-02-10 21:50:08
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "UNNAMED PROJECT". The branch, implicit_sndmp3 has been created at da4c349312c23ffdfe7d15f25e29e1a3916ee9e7 (commit) - Log ----------------------------------------------------------------- commit da4c349312c23ffdfe7d15f25e29e1a3916ee9e7 Author: QuzarDC <qu...@co...> Date: Sat Feb 10 16:49:39 2024 -0500 Properly prototype sndmp3 funcs ----------------------------------------------------------------------- hooks/post-receive -- UNNAMED PROJECT |
From: ljsebald <ljs...@us...> - 2024-02-10 20:19:15
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via 32799ba83d3a7524110d2ab7f9138d3623803912 (commit) via 2f2fc6fd0d98c72f0590468ea131388f37bb4054 (commit) via e39a04b53e5584aa059e15c867485bbd8bdf7d74 (commit) via 40b5d2c52c43d4ac992530aff7b7b20499cbf9cf (commit) via 3bf805f624022e18b4f0419dd744eb2187aadf40 (commit) via 20a18806e95a6681786cf21d19c939576d044842 (commit) from 529376543f707ebb285164105a7f5d2a89b134d8 (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 32799ba83d3a7524110d2ab7f9138d3623803912 Merge: 2f2fc6fd 40b5d2c5 Author: Lawrence Sebald <ljs...@us...> Date: Sat Feb 10 15:18:30 2024 -0500 Merge pull request #486 from KallistiOS/libpng_bug_note Add check for host libpng version to warn of possible error commit 2f2fc6fd0d98c72f0590468ea131388f37bb4054 Merge: 3bf805f6 e39a04b5 Author: Lawrence Sebald <ljs...@us...> Date: Sat Feb 10 15:17:52 2024 -0500 Merge pull request #487 from KallistiOS/m4-single-only-fix Patch Newlib to fix -m4-single-only on GCC 14 based toolchains commit e39a04b53e5584aa059e15c867485bbd8bdf7d74 Author: darc <da...@pr...> Date: Sat Feb 10 09:59:27 2024 -0600 Patch Newlib libm/complex functions to eliminate implicit function declarations commit 40b5d2c52c43d4ac992530aff7b7b20499cbf9cf Author: QuzarDC <qu...@co...> Date: Thu Feb 8 21:16:48 2024 -0500 Add check for host libpng version to warn of possible error commit 3bf805f624022e18b4f0419dd744eb2187aadf40 Merge: 52937654 20a18806 Author: Lawrence Sebald <ljs...@us...> Date: Mon Feb 5 17:39:48 2024 -0500 Merge pull request #485 from Tchan0/dockerfile_add_alternate_github_url Dockerfile: add alternate github url commit 20a18806e95a6681786cf21d19c939576d044842 Author: Tchan0 <617...@us...> Date: Mon Feb 5 18:30:37 2024 +0100 Dockerfile: add alternate github url kos-ports has a fallback to download from github. Now the dockerfile has that too. ----------------------------------------------------------------------- Summary of changes: utils/dc-chain/config/README.md | 2 +- utils/dc-chain/config/config.mk.14.0.1-dev.sample | 4 +- utils/dc-chain/docker/Dockerfile | 2 +- .../patches/newlib-4.4.0.20231231-kos.diff | 287 ++++++++++++++++++++- utils/vqenc/readpng.h | 6 + 5 files changed, 282 insertions(+), 19 deletions(-) mode change 100755 => 100644 utils/dc-chain/patches/newlib-4.4.0.20231231-kos.diff diff --git a/utils/dc-chain/config/README.md b/utils/dc-chain/config/README.md index 14356e76..a02f7d11 100644 --- a/utils/dc-chain/config/README.md +++ b/utils/dc-chain/config/README.md @@ -10,7 +10,7 @@ The available templates include the following configurations: | config.mk.12.3.0.sample | 12.3.0 | 4.3.0 | 2.41 | 8.5.0 | 2.41 | modern toolchain with GCC 12 | | **config.mk.stable.sample** | **13.2.0** | **4.3.0** | **2.41** | **8.5.0** | **2.41** | **modern toolchain with GCC 13.2.0 release**<br />**current "stable" configuration** | | config.mk.13.2.1-dev.sample | 13.2.1 (git) | 4.4.0 | 2.41 | 8.5.0 | 2.41 | latest GCC 13 development version from git<br />known to build without issues | -| config.mk.14.0.1-dev.sample | 14.0.1 (git) | 4.4.0 | 2.41 | 8.5.0 | 2.41 | latest GCC 14 development version from git<br />builds with caveats, see sample file for more info | +| config.mk.14.0.1-dev.sample | 14.0.1 (git) | 4.4.0 | 2.41 | 8.5.0 | 2.41 | latest GCC 14 development version from git<br />known to build without issues | The **stable** configuration is the primary, widely tested target for KallistiOS, and is the most recent toolchain configuration known to work with all example programs. The **legacy** configurations contain an older versions of the toolchain that may be useful in compiling older software. The non-"stable" alternative configurations 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 configurations. diff --git a/utils/dc-chain/config/config.mk.14.0.1-dev.sample b/utils/dc-chain/config/config.mk.14.0.1-dev.sample index 1b61eb96..03d5cb4d 100644 --- a/utils/dc-chain/config/config.mk.14.0.1-dev.sample +++ b/utils/dc-chain/config/config.mk.14.0.1-dev.sample @@ -8,9 +8,7 @@ ############################################################################### ############################################################################### ### THIS CONFIG IS FOR AN EXPERIMENTAL VERSION OF GCC! -## THERE IS ONE KNOWN ISSUE BUILDING THIS VERSION as of 2024-01-29: -## 1. GCC 14.0.1 currently does not build with m4-single-only precision, which -## is the only officially supported KOS mode for floating-point precision. +## THERE ARE NO KNOWN ISSUES BUILDING THIS VERSION as of 2024-02-10. ############################################################################### ############################################################################### diff --git a/utils/dc-chain/docker/Dockerfile b/utils/dc-chain/docker/Dockerfile index ecdc4622..eefb3afb 100644 --- a/utils/dc-chain/docker/Dockerfile +++ b/utils/dc-chain/docker/Dockerfile @@ -34,7 +34,7 @@ RUN apk --update add --no-cache \ # You may adapt the KallistiOS repository URL if needed ARG dc_chain=stable RUN mkdir -p /opt/toolchains/dc \ - && git clone https://git.code.sf.net/p/cadcdev/kallistios /opt/toolchains/dc/kos \ + && git clone https://git.code.sf.net/p/cadcdev/kallistios /opt/toolchains/dc/kos || git clone https://github.com/KallistiOS/KallistiOS.git /opt/toolchains/dc/kos \ && cd /opt/toolchains/dc/kos/utils/dc-chain \ && cp config/config.mk.$dc_chain.sample config.mk \ && sed -i -e 's/#use_custom_dependencies=1/use_custom_dependencies=1/g' config.mk \ diff --git a/utils/dc-chain/patches/newlib-4.4.0.20231231-kos.diff b/utils/dc-chain/patches/newlib-4.4.0.20231231-kos.diff old mode 100755 new mode 100644 index d3281bc8..d193d45f --- a/utils/dc-chain/patches/newlib-4.4.0.20231231-kos.diff +++ b/utils/dc-chain/patches/newlib-4.4.0.20231231-kos.diff @@ -1,6 +1,6 @@ diff --color -ruN newlib-4.4.0.20231231/newlib/configure.host newlib-4.4.0.20231231-kos/newlib/configure.host ---- newlib-4.4.0.20231231/newlib/configure.host 2023-02-02 15:26:13.620093007 -0600 -+++ newlib-4.4.0.20231231-kos/newlib/configure.host 2023-02-02 15:26:28.805127895 -0600 +--- newlib-4.4.0.20231231/newlib/configure.host 2024-02-10 09:30:58.772247624 -0600 ++++ newlib-4.4.0.20231231-kos/newlib/configure.host 2024-02-10 09:31:16.329331366 -0600 @@ -322,6 +322,7 @@ ;; sh | sh64) @@ -10,8 +10,8 @@ diff --color -ruN newlib-4.4.0.20231231/newlib/configure.host newlib-4.4.0.20231 sparc*) libm_machine_dir=sparc diff --color -ruN newlib-4.4.0.20231231/newlib/libc/include/assert.h newlib-4.4.0.20231231-kos/newlib/libc/include/assert.h ---- newlib-4.4.0.20231231/newlib/libc/include/assert.h 2023-02-02 15:26:13.629093028 -0600 -+++ newlib-4.4.0.20231231-kos/newlib/libc/include/assert.h 2023-02-02 15:26:28.805127895 -0600 +--- newlib-4.4.0.20231231/newlib/libc/include/assert.h 2024-02-10 09:30:58.781247667 -0600 ++++ newlib-4.4.0.20231231-kos/newlib/libc/include/assert.h 2024-02-10 09:31:16.329331366 -0600 @@ -13,8 +13,8 @@ #ifdef NDEBUG /* required by ANSI standard */ # define assert(__e) ((void)0) @@ -39,8 +39,8 @@ diff --color -ruN newlib-4.4.0.20231231/newlib/libc/include/assert.h newlib-4.4. #if __STDC_VERSION__ >= 201112L && !defined __cplusplus # define static_assert _Static_assert diff --color -ruN newlib-4.4.0.20231231/newlib/libc/include/sys/_pthreadtypes.h newlib-4.4.0.20231231-kos/newlib/libc/include/sys/_pthreadtypes.h ---- newlib-4.4.0.20231231/newlib/libc/include/sys/_pthreadtypes.h 2023-02-02 15:26:13.632093035 -0600 -+++ newlib-4.4.0.20231231-kos/newlib/libc/include/sys/_pthreadtypes.h 2023-02-02 15:26:28.805127895 -0600 +--- newlib-4.4.0.20231231/newlib/libc/include/sys/_pthreadtypes.h 2024-02-10 09:30:58.783247676 -0600 ++++ newlib-4.4.0.20231231-kos/newlib/libc/include/sys/_pthreadtypes.h 2024-02-10 09:31:16.329331366 -0600 @@ -22,16 +22,6 @@ #include <sys/sched.h> @@ -188,8 +188,8 @@ diff --color -ruN newlib-4.4.0.20231231/newlib/libc/include/sys/_pthreadtypes.h - #endif /* ! _SYS__PTHREADTYPES_H_ */ diff --color -ruN newlib-4.4.0.20231231/newlib/libc/include/sys/signal.h newlib-4.4.0.20231231-kos/newlib/libc/include/sys/signal.h ---- newlib-4.4.0.20231231/newlib/libc/include/sys/signal.h 2023-02-02 15:26:13.633093038 -0600 -+++ newlib-4.4.0.20231231-kos/newlib/libc/include/sys/signal.h 2023-02-02 15:26:28.805127895 -0600 +--- newlib-4.4.0.20231231/newlib/libc/include/sys/signal.h 2024-02-10 09:30:58.783247676 -0600 ++++ newlib-4.4.0.20231231-kos/newlib/libc/include/sys/signal.h 2024-02-10 09:31:16.329331366 -0600 @@ -223,9 +223,11 @@ int sigaltstack (const stack_t *__restrict, stack_t *__restrict); #endif @@ -203,8 +203,8 @@ diff --color -ruN newlib-4.4.0.20231231/newlib/libc/include/sys/signal.h newlib- #if __POSIX_VISIBLE >= 199309 diff --color -ruN newlib-4.4.0.20231231/newlib/libc/include/sys/_types.h newlib-4.4.0.20231231-kos/newlib/libc/include/sys/_types.h ---- newlib-4.4.0.20231231/newlib/libc/include/sys/_types.h 2023-02-02 15:26:13.632093035 -0600 -+++ newlib-4.4.0.20231231-kos/newlib/libc/include/sys/_types.h 2023-02-02 15:26:28.806127897 -0600 +--- newlib-4.4.0.20231231/newlib/libc/include/sys/_types.h 2024-02-10 09:30:58.783247676 -0600 ++++ newlib-4.4.0.20231231-kos/newlib/libc/include/sys/_types.h 2024-02-10 09:31:16.329331366 -0600 @@ -69,7 +69,7 @@ #ifndef __machine_ino_t_defined @@ -215,8 +215,8 @@ diff --color -ruN newlib-4.4.0.20231231/newlib/libc/include/sys/_types.h newlib- #else typedef unsigned short __ino_t; diff --color -ruN newlib-4.4.0.20231231/newlib/libc/ssp/stack_protector.c newlib-4.4.0.20231231-kos/newlib/libc/ssp/stack_protector.c ---- newlib-4.4.0.20231231/newlib/libc/ssp/stack_protector.c 2023-02-02 15:26:13.656093090 -0600 -+++ newlib-4.4.0.20231231-kos/newlib/libc/ssp/stack_protector.c 2023-02-02 15:26:28.806127897 -0600 +--- newlib-4.4.0.20231231/newlib/libc/ssp/stack_protector.c 2024-02-10 09:30:58.832247910 -0600 ++++ newlib-4.4.0.20231231-kos/newlib/libc/ssp/stack_protector.c 2024-02-10 09:31:16.329331366 -0600 @@ -32,12 +32,11 @@ #endif @@ -232,8 +232,8 @@ diff --color -ruN newlib-4.4.0.20231231/newlib/libc/ssp/stack_protector.c newlib } diff --color -ruN newlib-4.4.0.20231231/newlib/libc/stdlib/assert.c newlib-4.4.0.20231231-kos/newlib/libc/stdlib/assert.c ---- newlib-4.4.0.20231231/newlib/libc/stdlib/assert.c 2023-02-02 15:26:13.661093102 -0600 -+++ newlib-4.4.0.20231231-kos/newlib/libc/stdlib/assert.c 2023-02-02 15:26:28.806127897 -0600 +--- newlib-4.4.0.20231231/newlib/libc/stdlib/assert.c 2024-02-10 09:30:58.811247810 -0600 ++++ newlib-4.4.0.20231231-kos/newlib/libc/stdlib/assert.c 2024-02-10 09:31:16.329331366 -0600 @@ -47,6 +47,8 @@ #include <stdlib.h> #include <stdio.h> @@ -251,3 +251,262 @@ diff --color -ruN newlib-4.4.0.20231231/newlib/libc/stdlib/assert.c newlib-4.4.0 +// This is put in here to cause link errors if a proper newlib isn't present. +int __newlib_kos_patch = 1; + +diff --color -ruN newlib-4.4.0.20231231/newlib/libm/complex/cargl.c newlib-4.4.0.20231231-kos/newlib/libm/complex/cargl.c +--- newlib-4.4.0.20231231/newlib/libm/complex/cargl.c 2024-02-10 09:30:58.838247939 -0600 ++++ newlib-4.4.0.20231231-kos/newlib/libm/complex/cargl.c 2024-02-10 09:25:08.854578630 -0600 +@@ -7,12 +7,11 @@ + #include <complex.h> + #include <math.h> + ++/* On platforms where long double is as wide as double. */ ++#ifdef _LDBL_EQ_DBL + long double + cargl(long double complex z) + { +- #ifdef _LDBL_EQ_DBL + return carg (z); +- #else +- return atan2l (cimagl (z), creall (z)); +- #endif + } ++#endif +diff --color -ruN newlib-4.4.0.20231231/newlib/libm/complex/catanl.c newlib-4.4.0.20231231-kos/newlib/libm/complex/catanl.c +--- newlib-4.4.0.20231231/newlib/libm/complex/catanl.c 2024-02-10 09:30:58.838247939 -0600 ++++ newlib-4.4.0.20231231-kos/newlib/libm/complex/catanl.c 2024-02-10 09:25:03.094551157 -0600 +@@ -33,6 +33,8 @@ + #include <math.h> + #include "cephes_subrl.h" + ++/* On platforms where long double is as wide as double. */ ++#ifdef _LDBL_EQ_DBL + #ifdef __weak_alias + __weak_alias(catanl, _catanl) + #endif +@@ -72,4 +74,4 @@ + w = HUGE_VALL + HUGE_VALL * I; + return w; + } +- ++#endif +diff --color -ruN newlib-4.4.0.20231231/newlib/libm/complex/ccoshl.c newlib-4.4.0.20231231-kos/newlib/libm/complex/ccoshl.c +--- newlib-4.4.0.20231231/newlib/libm/complex/ccoshl.c 2024-02-10 09:30:58.838247939 -0600 ++++ newlib-4.4.0.20231231-kos/newlib/libm/complex/ccoshl.c 2024-02-10 09:25:21.637639601 -0600 +@@ -32,6 +32,8 @@ + #include <complex.h> + #include <math.h> + ++/* On platforms where long double is as wide as double. */ ++#ifdef _LDBL_EQ_DBL + long double complex + ccoshl(long double complex z) + { +@@ -43,3 +45,4 @@ + w = coshl(x) * cosl(y) + (sinhl(x) * sinl(y)) * I; + return w; + } ++#endif +diff --color -ruN newlib-4.4.0.20231231/newlib/libm/complex/ccosl.c newlib-4.4.0.20231231-kos/newlib/libm/complex/ccosl.c +--- newlib-4.4.0.20231231/newlib/libm/complex/ccosl.c 2024-02-10 09:30:58.838247939 -0600 ++++ newlib-4.4.0.20231231-kos/newlib/libm/complex/ccosl.c 2024-02-10 09:26:34.295986157 -0600 +@@ -33,6 +33,8 @@ + #include <math.h> + #include "cephes_subrl.h" + ++/* On platforms where long double is as wide as double. */ ++#ifdef _LDBL_EQ_DBL + long double complex + ccosl(long double complex z) + { +@@ -43,3 +45,4 @@ + w = cosl(creall(z)) * ch - (sinl(creall(z)) * sh) * I; + return w; + } ++#endif +diff --color -ruN newlib-4.4.0.20231231/newlib/libm/complex/cephes_subrl.c newlib-4.4.0.20231231-kos/newlib/libm/complex/cephes_subrl.c +--- newlib-4.4.0.20231231/newlib/libm/complex/cephes_subrl.c 2024-02-10 09:30:58.839247944 -0600 ++++ newlib-4.4.0.20231231-kos/newlib/libm/complex/cephes_subrl.c 2024-02-10 09:26:48.976056176 -0600 +@@ -35,6 +35,8 @@ + + /* calculate cosh and sinh */ + ++/* On platforms where long double is as wide as double. */ ++#ifdef _LDBL_EQ_DBL + void + _cchshl(long double x, long double *c, long double *s) + { +@@ -51,6 +53,7 @@ + *c = e + ei; + } + } ++#endif + + /* Program to subtract nearest integer multiple of PI */ + +@@ -85,6 +88,8 @@ + + /* Taylor series expansion for cosh(2y) - cos(2x) */ + ++/* On platforms where long double is as wide as double. */ ++#ifdef _LDBL_EQ_DBL + long double + _ctansl(long double complex z) + { +@@ -126,3 +131,4 @@ + } while (fabsl(t/d) > MACHEPL); + return d; + } ++#endif +diff --color -ruN newlib-4.4.0.20231231/newlib/libm/complex/cexpl.c newlib-4.4.0.20231231-kos/newlib/libm/complex/cexpl.c +--- newlib-4.4.0.20231231/newlib/libm/complex/cexpl.c 2024-02-10 09:30:58.839247944 -0600 ++++ newlib-4.4.0.20231231-kos/newlib/libm/complex/cexpl.c 2024-02-10 09:26:53.999080135 -0600 +@@ -32,6 +32,8 @@ + #include <complex.h> + #include <math.h> + ++/* On platforms where long double is as wide as double. */ ++#ifdef _LDBL_EQ_DBL + long double complex + cexpl(long double complex z) + { +@@ -44,3 +46,4 @@ + w = r * cosl(y) + r * sinl(y) * I; + return w; + } ++#endif +diff --color -ruN newlib-4.4.0.20231231/newlib/libm/complex/clogl.c newlib-4.4.0.20231231-kos/newlib/libm/complex/clogl.c +--- newlib-4.4.0.20231231/newlib/libm/complex/clogl.c 2024-02-10 09:30:58.839247944 -0600 ++++ newlib-4.4.0.20231231-kos/newlib/libm/complex/clogl.c 2024-02-10 09:27:03.088123487 -0600 +@@ -32,6 +32,8 @@ + #include <complex.h> + #include <math.h> + ++/* On platforms where long double is as wide as double. */ ++#ifdef _LDBL_EQ_DBL + long double complex + clogl(long double complex z) + { +@@ -44,3 +46,4 @@ + w = p + rr * I; + return w; + } ++#endif +diff --color -ruN newlib-4.4.0.20231231/newlib/libm/complex/cpowl.c newlib-4.4.0.20231231-kos/newlib/libm/complex/cpowl.c +--- newlib-4.4.0.20231231/newlib/libm/complex/cpowl.c 2024-02-10 09:30:58.839247944 -0600 ++++ newlib-4.4.0.20231231-kos/newlib/libm/complex/cpowl.c 2024-02-10 09:27:11.728164697 -0600 +@@ -32,6 +32,8 @@ + #include <complex.h> + #include <math.h> + ++/* On platforms where long double is as wide as double. */ ++#ifdef _LDBL_EQ_DBL + long double complex + cpowl(long double complex a, long double complex z) + { +@@ -54,3 +56,4 @@ + w = r * cosl(theta) + (r * sinl(theta)) * I; + return w; + } ++#endif +diff --color -ruN newlib-4.4.0.20231231/newlib/libm/complex/cprojl.c newlib-4.4.0.20231231-kos/newlib/libm/complex/cprojl.c +--- newlib-4.4.0.20231231/newlib/libm/complex/cprojl.c 2024-02-10 09:30:58.838247939 -0600 ++++ newlib-4.4.0.20231231-kos/newlib/libm/complex/cprojl.c 2024-02-10 09:27:19.272200680 -0600 +@@ -45,6 +45,9 @@ + * + * INFINITY + I * copysign(0.0, cimag(z)) + */ ++ ++/* On platforms where long double is as wide as double. */ ++#ifdef _LDBL_EQ_DBL + long double complex + cprojl(long double complex z) + { +@@ -62,3 +65,4 @@ + + return (w.z); + } ++#endif +diff --color -ruN newlib-4.4.0.20231231/newlib/libm/complex/csinhl.c newlib-4.4.0.20231231-kos/newlib/libm/complex/csinhl.c +--- newlib-4.4.0.20231231/newlib/libm/complex/csinhl.c 2024-02-10 09:30:58.838247939 -0600 ++++ newlib-4.4.0.20231231-kos/newlib/libm/complex/csinhl.c 2024-02-10 09:27:27.167238336 -0600 +@@ -32,6 +32,8 @@ + #include <complex.h> + #include <math.h> + ++/* On platforms where long double is as wide as double. */ ++#ifdef _LDBL_EQ_DBL + long double complex + csinhl(long double complex z) + { +@@ -43,3 +45,4 @@ + w = sinhl(x) * cosl(y) + (coshl(x) * sinl(y)) * I; + return w; + } ++#endif +diff --color -ruN newlib-4.4.0.20231231/newlib/libm/complex/csinl.c newlib-4.4.0.20231231-kos/newlib/libm/complex/csinl.c +--- newlib-4.4.0.20231231/newlib/libm/complex/csinl.c 2024-02-10 09:30:58.838247939 -0600 ++++ newlib-4.4.0.20231231-kos/newlib/libm/complex/csinl.c 2024-02-10 09:27:34.343272564 -0600 +@@ -33,6 +33,8 @@ + #include <math.h> + #include "cephes_subrl.h" + ++/* On platforms where long double is as wide as double. */ ++#ifdef _LDBL_EQ_DBL + long double complex + csinl(long double complex z) + { +@@ -43,3 +45,4 @@ + w = sinl(creall(z)) * ch + (cosl(creall(z)) * sh) * I; + return w; + } ++#endif +diff --color -ruN newlib-4.4.0.20231231/newlib/libm/complex/csqrtl.c newlib-4.4.0.20231231-kos/newlib/libm/complex/csqrtl.c +--- newlib-4.4.0.20231231/newlib/libm/complex/csqrtl.c 2024-02-10 09:30:58.838247939 -0600 ++++ newlib-4.4.0.20231231-kos/newlib/libm/complex/csqrtl.c 2024-02-10 09:27:56.954380412 -0600 +@@ -49,6 +49,8 @@ + + #define cpackl(r, i) ((r) + (i) * I) + ++/* On platforms where long double is as wide as double. */ ++#ifdef _LDBL_EQ_DBL + long double complex + csqrtl(long double complex z) + { +@@ -110,3 +112,4 @@ + else + return (result); + } ++#endif +diff --color -ruN newlib-4.4.0.20231231/newlib/libm/complex/ctanhl.c newlib-4.4.0.20231231-kos/newlib/libm/complex/ctanhl.c +--- newlib-4.4.0.20231231/newlib/libm/complex/ctanhl.c 2024-02-10 09:30:58.839247944 -0600 ++++ newlib-4.4.0.20231231-kos/newlib/libm/complex/ctanhl.c 2024-02-10 09:28:01.056399977 -0600 +@@ -32,6 +32,8 @@ + #include <complex.h> + #include <math.h> + ++/* On platforms where long double is as wide as double. */ ++#ifdef _LDBL_EQ_DBL + long double complex + ctanhl(long double complex z) + { +@@ -45,3 +47,4 @@ + + return w; + } ++#endif +diff --color -ruN newlib-4.4.0.20231231/newlib/libm/complex/ctanl.c newlib-4.4.0.20231231-kos/newlib/libm/complex/ctanl.c +--- newlib-4.4.0.20231231/newlib/libm/complex/ctanl.c 2024-02-10 09:30:58.839247944 -0600 ++++ newlib-4.4.0.20231231-kos/newlib/libm/complex/ctanl.c 2024-02-10 09:28:05.960423368 -0600 +@@ -34,6 +34,8 @@ + #include <math.h> + #include "cephes_subrl.h" + ++/* On platforms where long double is as wide as double. */ ++#ifdef _LDBL_EQ_DBL + long double complex + ctanl(long double complex z) + { +@@ -54,3 +56,4 @@ + w = sinl(2.0L * creall(z)) / d + (sinhl(2.0L * cimagl(z)) / d) * I; + return w; + } ++#endif diff --git a/utils/vqenc/readpng.h b/utils/vqenc/readpng.h index 9fa2defb..54e78e69 100644 --- a/utils/vqenc/readpng.h +++ b/utils/vqenc/readpng.h @@ -24,6 +24,12 @@ typedef unsigned char uint8; */ # define Trace(x) ; #endif +#if ((PNG_LIBPNG_VER_MAJOR == 1) && \ + (PNG_LIBPNG_VER_MINOR == 6) && \ + (PNG_LIBPNG_VER_RELEASE == 41) ) +# warning libpng v1.6.41 has a known bug that may result in failed reading. Please update. +#endif + void readpng_version_info(void); uint32 readpng_init(FILE *infile); hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: darcagn <da...@us...> - 2024-02-04 22:45:07
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via 529376543f707ebb285164105a7f5d2a89b134d8 (commit) via ccddc34c4e142f75aaba84db3389a0b4c27c4cb5 (commit) via fc7d7f47f46d99c0543a85a5dbb136619aee8098 (commit) from a6ac69842f75a75a1e16c481dd76d17186f8f477 (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 529376543f707ebb285164105a7f5d2a89b134d8 Merge: a6ac6984 ccddc34c Author: darcagn <da...@pr...> Date: Sun Feb 4 16:44:30 2024 -0600 Merge pull request #484 from maishuji/fix/fix-kos-add-romdisk-func-retrieving-kos-base-from-env Fix cmake function kos_add_romdisk not getting KOS_BASE from ENV commit ccddc34c4e142f75aaba84db3389a0b4c27c4cb5 Merge: fc7d7f47 a6ac6984 Author: Falco Girgis <gyr...@gm...> Date: Sun Feb 4 23:30:50 2024 +0100 Merge branch 'master' into fix/fix-kos-add-romdisk-func-retrieving-kos-base-from-env commit fc7d7f47f46d99c0543a85a5dbb136619aee8098 Author: maishuji <605...@us...> Date: Sun Feb 4 19:54:59 2024 +0100 Fix cmake function kos_add_romdisk not getting KOS_BASE from ENV ----------------------------------------------------------------------- Summary of changes: utils/cmake/dreamcast.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/cmake/dreamcast.cmake b/utils/cmake/dreamcast.cmake index f700cdf1..607ace5c 100644 --- a/utils/cmake/dreamcast.cmake +++ b/utils/cmake/dreamcast.cmake @@ -60,7 +60,7 @@ function(kos_add_romdisk target romdiskPath) add_custom_command( OUTPUT ${obj} DEPENDS ${obj_tmp} - COMMAND ${CMAKE_C_COMPILER} -o ${obj} -r ${obj_tmp} -L${KOS_BASE}/lib/dreamcast -Wl,--whole-archive -lromdiskbase + COMMAND ${CMAKE_C_COMPILER} -o ${obj} -r ${obj_tmp} -L$ENV{KOS_BASE}/lib/dreamcast -Wl,--whole-archive -lromdiskbase COMMAND rm ${obj_tmp} ) hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: ljsebald <ljs...@us...> - 2024-02-04 16:27:22
|
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 a6ac69842f75a75a1e16c481dd76d17186f8f477 (commit) from d059b922625b6fd1f05dac4381b48d0ba571650b (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 a6ac69842f75a75a1e16c481dd76d17186f8f477 Author: Donald Haase <qu...@ya...> Date: Sun Feb 4 11:26:33 2024 -0500 BBA Driver Cleanup (#278) * Correct leaving read without unlocking * Adding register values for RX config, minor cleanups. * Shift RX Config register defines to header file. Minor cleanups. Refactoring and bugfixing of link change state. * Testing to see if the whole idea of forcing ARN on initial link change was bunk. This happens in bba_hw_init and on any link change. * Replace magic values with register defines. Remove comments with 0x00000e0a as that is identical to the RX_CONFIG_DEFAULT | RT_RXC_APM | RT_RXC_AB * Last pass of removing magic numbers. * A deeper cleaning of the driver, maybe too far * Re-add RX_NOWRAP, as it is checked for optional wrapping behavior * Last change, just update some other magic numbers * Correct buffer offsets ----------------------------------------------------------------------- Summary of changes: .../dreamcast/hardware/network/broadband_adapter.c | 219 +++++++-------------- .../dreamcast/include/dc/net/broadband_adapter.h | 50 +++-- 2 files changed, 108 insertions(+), 161 deletions(-) diff --git a/kernel/arch/dreamcast/hardware/network/broadband_adapter.c b/kernel/arch/dreamcast/hardware/network/broadband_adapter.c index 9eda6d8f..1140cd29 100644 --- a/kernel/arch/dreamcast/hardware/network/broadband_adapter.c +++ b/kernel/arch/dreamcast/hardware/network/broadband_adapter.c @@ -18,31 +18,26 @@ #include <dc/flashrom.h> #include <arch/irq.h> #include <arch/cache.h> +#include <arch/memory.h> #include <kos/net.h> #include <kos/thread.h> #include <kos/sem.h> -//#define vid_border_color(r, g, b) (void)0 /* nothing */ - /* Configuration definitions */ #define RTL_MEM (0x1840000) -#define RX_NOWRAP 1 /* 1 for no wrapping or 0 to use wrapping mode (Ignored for 64Kb buffer length) */ -#define RX_MAX_DMA_BURST 6 /* 2^(4+n) bytes from 0-6 (16b - 1Kb) or 7 for unlimited */ -#define RX_BUFFER_LEN_SHIFT 1 /* 0 : 8Kb, 1 : 16Kb, 2 : 32Kb, 3 : 64Kb */ -#define RX_FIFO_THRESHOLD 0 /* 2^(4+n) bytes from 0-6 (16b - 1Kb) or 7 for none */ -#define RX_EARLY_THRESHOLD 0 /* Early RX Threshold multiplier n/16 or 0 for none */ +#define RX_NOWRAP RT_RXC_WRAP /* Default to no wrapping */ +#define RX_BUFFER_SHIFT 1 /* 0 : 8Kb, 1 : 16Kb, 2 : 32Kb, 3 : 64Kb */ + +#define RX_CONFIG_DEFAULT (RT_ERTH(0) | RT_RXC_RXFTH(0) | \ + RT_RXC_RBLEN(RX_BUFFER_SHIFT) | RT_RXC_MXDMA(6) | RX_NOWRAP) -#define RX_CONFIG (RX_EARLY_THRESHOLD<<24) | (RX_FIFO_THRESHOLD<<13) | \ - (RX_BUFFER_LEN_SHIFT<<11) | (RX_MAX_DMA_BURST<<8) | \ - (RX_NOWRAP<<7) +#define RX_BUFFER_LEN (0x2000 << RX_BUFFER_SHIFT) #define TX_MAX_DMA_BURST 6 /* 2^(4+n) bytes from 0-7 (16b - 2Kb) */ #define TX_CONFIG (TX_MAX_DMA_BURST<<8) -#define RX_BUFFER_LEN (0x2000<<RX_BUFFER_LEN_SHIFT) - #define TX_BUFFER_OFFSET (RX_BUFFER_LEN + 0x2000) #define TX_BUFFER_LEN (0x800) #define TX_NB_BUFFERS 4 @@ -50,9 +45,6 @@ /* This was originally set as ASIC_IRQB */ #define BBA_ASIC_IRQ ASIC_IRQ_DEFAULT -/* Use a customized g2_read_block function */ -#define FAST_G2_READ - /* DMA transfer will be used only if the amount of bytes exceeds that threshold */ #define DMA_THRESHOLD 128 // looks like a good value @@ -220,18 +212,18 @@ struct { #define NIC(ADDR) (GAPS_BASE + 0x1700 + (ADDR)) /* 8 and 32 bit access to the PCI MEMMAP space (configured by GAPS) */ -static uint32 const rtl_mem = 0xa0000000 + RTL_MEM; +static uint32 const rtl_mem = MEM_AREA_P2_BASE + RTL_MEM; /* TX buffer pointers */ -static uint32 const txdesc[4] = { - 0xa0000000 + RTL_MEM + TX_BUFFER_OFFSET, - 0xa0000800 + RTL_MEM + TX_BUFFER_OFFSET, - 0xa0001000 + RTL_MEM + TX_BUFFER_OFFSET, - 0xa0001800 + RTL_MEM + TX_BUFFER_OFFSET, +static uint32 const txdesc[TX_NB_BUFFERS] = { + MEM_AREA_P2_BASE + (TX_BUFFER_LEN * 0) + RTL_MEM + TX_BUFFER_OFFSET, + MEM_AREA_P2_BASE + (TX_BUFFER_LEN * 1) + RTL_MEM + TX_BUFFER_OFFSET, + MEM_AREA_P2_BASE + (TX_BUFFER_LEN * 2) + RTL_MEM + TX_BUFFER_OFFSET, + MEM_AREA_P2_BASE + (TX_BUFFER_LEN * 3) + RTL_MEM + TX_BUFFER_OFFSET, }; /* Is the link stabilized? */ -static volatile int link_stable, link_initial; +static volatile int link_stable; /* Receive callback */ static eth_rx_callback_t eth_rx_callback; @@ -277,7 +269,6 @@ static int bba_hw_init(void) { uint32 tmp; link_stable = 0; - link_initial = 0; /* Initialize GAPS */ if(gaps_init() < 0) @@ -343,7 +334,7 @@ static int bba_hw_init(void) { g2_write_8(NIC(RT_CHIPCMD), RT_CMD_RX_ENABLE | RT_CMD_TX_ENABLE); /* Set Rx FIFO threshold to 1K, Rx size to 16k+16, 1024 byte DMA burst */ - g2_write_32(NIC(RT_RXCONFIG), RX_CONFIG); + g2_write_32(NIC(RT_RXCONFIG), RX_CONFIG_DEFAULT); /* Set Tx 1024 byte DMA burst */ g2_write_32(NIC(RT_TXCONFIG), TX_CONFIG); @@ -402,7 +393,7 @@ static int bba_hw_init(void) { rtl.cur_rx = 0; /* Enable receiving broadcast and physical match packets */ - g2_write_32(NIC(RT_RXCONFIG), g2_read_32(NIC(RT_RXCONFIG)) | 0x0000000a); + g2_write_32(NIC(RT_RXCONFIG), g2_read_32(NIC(RT_RXCONFIG)) | RT_RXC_APM | RT_RXC_AB); return 0; } @@ -414,14 +405,12 @@ static void rx_reset(void) { rtl.cur_rx = 0; g2_write_8(NIC(RT_CHIPCMD), RT_CMD_TX_ENABLE); - //g2_write_32(NIC(RT_RXCONFIG), 0x00000e0a); - g2_write_32(NIC(RT_RXCONFIG), RX_CONFIG | 0x0000000a); + g2_write_32(NIC(RT_RXCONFIG), RX_CONFIG_DEFAULT | RT_RXC_APM | RT_RXC_AB); while(!(g2_read_8(NIC(RT_CHIPCMD)) & RT_CMD_RX_ENABLE)) g2_write_8(NIC(RT_CHIPCMD), RT_CMD_TX_ENABLE | RT_CMD_RX_ENABLE); - //g2_write_32(NIC(RT_RXCONFIG), 0x00000e0a); - g2_write_32(NIC(RT_RXCONFIG), RX_CONFIG | 0x0000000a); + g2_write_32(NIC(RT_RXCONFIG), RX_CONFIG_DEFAULT | RT_RXC_APM | RT_RXC_AB); g2_write_16(NIC(RT_INTRSTATUS), 0xffff); } @@ -434,15 +423,7 @@ static void bba_hw_shutdown(void) { asic_evt_set_handler(ASIC_EVT_EXP_PCI, NULL); } - -//#define g2_read_block_8(a, b, len) memcpy(a, b, len) -//#define g2_read_block_8(a, b, len) memcpy4(a, b, (len) + 3) -//#define g2_read_block_8(a, b, len) sq_cpy(a, b, (len) + 31) -//#define g2_read_block_8(a, b, len) g2_read_block_32(a, b, ((len)+3) >> 2) -#ifdef FAST_G2_READ -#define g2_read_block_8 my_g2_read_block_8 - -static void g2_read_block_8(uint8 *dst, uint8 *src, int len) { +static void g2_read_block_8_fast(uint8 *dst, uint8 *src, int len) { if(len <= 0) return; @@ -450,13 +431,6 @@ static void g2_read_block_8(uint8 *dst, uint8 *src, int len) { ctx = g2_lock(); - /* This is in case dst is not multiple of 4, which never happens here */ - /* while( (((uint32)dst)&3) ) { */ - /* *dst++ = *src++; */ - /* if(!--len) */ - /* return; */ - /* } */ - uint32 * d = (uint32 *) dst; uint32 * s = (uint32 *) src; len = (len + 3) >> 2; @@ -466,27 +440,26 @@ static void g2_read_block_8(uint8 *dst, uint8 *src, int len) { --len; } - if(!len) - return; + if(len > 0) { - len >>= 3; - - do { - d[0] = *s++; - d[1] = *s++; - d[2] = *s++; - d[3] = *s++; - d[4] = *s++; - d[5] = *s++; - d[6] = *s++; - d[7] = *s++; - d += 8; + len >>= 3; + + do { + d[0] = *s++; + d[1] = *s++; + d[2] = *s++; + d[3] = *s++; + d[4] = *s++; + d[5] = *s++; + d[6] = *s++; + d[7] = *s++; + d += 8; + } + while(--len); } - while(--len); g2_unlock(ctx); } -#endif #define RXBSZ (64*1024) /* must be a power of two */ @@ -496,10 +469,7 @@ static struct pkt { uint8 * rxbuff; } rx_pkt[MAX_PKTS]; -#define BEFORE 0 // 32*1024 -#define AFTER 0 // (BEFORE + 32*1024) - -static uint8 rxbuff[RXBSZ + 2 * 1600 + AFTER] __attribute__((aligned(32))); +static uint8 rxbuff[RXBSZ + 2 * 1600] __attribute__((aligned(32))); static uint32 rxbuff_pos; static int rxin; static int rxout; @@ -596,11 +566,10 @@ static int bba_copy_dma(uint8 * dst, uint32 s, int len) { return 0; } else { - g2_read_block_8(dst, src, len); + g2_read_block_8_fast(dst, src, len); return !dma_used; } } -#undef g2_read_block_8 /* Utility function to copy out a some data from the ring buffer into an SH-4 buffer. This is done to make sure the buffers don't overflow. */ @@ -630,19 +599,16 @@ static int rx_enq(int ring_offset, size_t pkt_size) { /* If there's no one to receive it, don't bother. */ if(eth_rx_callback) { if(rxin != rxout && - (((rx_pkt[rxout].rxbuff - (rxbuff + 32 + BEFORE)) - rxbuff_pos) & (RXBSZ - 1)) < pkt_size + 2048) { - /* printf("diff %d, %d\n", (( (rx_pkt[rxout].rxbuff - rxbuff) - rxbuff_pos ) & (RXBSZ-1)), */ - /* pkt_size); */ - //dbglog(DBG_KDEBUG, "rx_enq: lagging\n"); + (((rx_pkt[rxout].rxbuff - (rxbuff + 32)) - rxbuff_pos) & (RXBSZ - 1)) < pkt_size + 2048) { return -1; } /* Receive buffer: temporary space to copy out received data */ #ifdef USE_P2_AREA - rx_pkt[rxin].rxbuff = rxbuff + 32 + BEFORE + (rxbuff_pos | 0xa0000000) + (ring_offset & 31); + rx_pkt[rxin].rxbuff = rxbuff + 32 + (rxbuff_pos | MEM_AREA_P2_BASE) + (ring_offset & 31); #else - rx_pkt[rxin].rxbuff = rxbuff + 32 + BEFORE + rxbuff_pos + (ring_offset & 31); + rx_pkt[rxin].rxbuff = rxbuff + 32 + rxbuff_pos + (ring_offset & 31); #endif @@ -662,19 +628,6 @@ static int bba_rtx(const uint8 * pkt, int len, int wait) static int bba_tx(const uint8 * pkt, int len, int wait) #endif { - /* - int i; - - dbglog(DBG_KDEBUG,"Transmitting packet:\r\n"); - for(i=0; i<len; i++) { - dbglog(DBG_KDEBUG,"%02x ", pkt[i]); - if(i && !(i % 16)) - printf("\r\n"); - } - dbglog(DBG_KDEBUG,"\r\n"); - */ - - //wait = BBA_TX_WAIT; if(!link_stable) { if(wait == BBA_TX_WAIT) { while(!link_stable) @@ -686,14 +639,14 @@ static int bba_tx(const uint8 * pkt, int len, int wait) /* Wait till it's clear to transmit */ if(wait == BBA_TX_WAIT) { - while(!(g2_read_32(NIC(RT_TXSTATUS0 + 4 * rtl.cur_tx)) & 0x2000)) { - if(g2_read_32(NIC(RT_TXSTATUS0 + 4 * rtl.cur_tx)) & 0x40000000) + while(!(g2_read_32(NIC(RT_TXSTATUS0 + 4 * rtl.cur_tx)) & RT_TX_HOST_OWNS)) { + if(g2_read_32(NIC(RT_TXSTATUS0 + 4 * rtl.cur_tx)) & RT_TX_ABORTED) g2_write_32(NIC(RT_TXSTATUS0 + 4 * rtl.cur_tx), g2_read_32(NIC(RT_TXSTATUS0 + 4 * rtl.cur_tx)) | 1); } } else { - if(!(g2_read_32(NIC(RT_TXSTATUS0 + 4 * rtl.cur_tx)) & 0x2000)) { + if(!(g2_read_32(NIC(RT_TXSTATUS0 + 4 * rtl.cur_tx)) & RT_TX_HOST_OWNS)) { return BBA_TX_AGAIN; } } @@ -737,9 +690,6 @@ int bba_tx(const uint8 * pkt, int len, int wait) { int res; if(irq_inside_int()) { - /* printf("bba_tx called from an irq !\n"); */ - /* return 0; */ - //return bba_rtx(pkt, len, wait); if(sem_trywait(&tx_sema)) { //printf("bba_tx called from an irq while a thread was running it !\n"); return BBA_TX_OK; /* sorry guys ... */ @@ -765,7 +715,6 @@ void bba_unlock(void) { //sem_signal(&bba_rx_sema2); } -static int bcolor; static void *bba_rx_threadfunc(void *dummy) { (void)dummy; @@ -776,8 +725,6 @@ static void *bba_rx_threadfunc(void *dummy) { if(bba_rx_exit_thread) break; - bcolor = 255; - //vid_border_color(255, 255, 0); bba_lock(); if(rxout != rxin) { @@ -788,8 +735,6 @@ static void *bba_rx_threadfunc(void *dummy) { rxout = (rxout + 1) % MAX_PKTS; } - bcolor = 0; - //vid_border_color(0, 0, 0); bba_unlock(); } @@ -803,8 +748,7 @@ static void bba_rx(void) { uint32 rx_status; size_t pkt_size, ring_offset; - //vid_border_color(255, 0, 255); - while(!(g2_read_8(NIC(RT_CHIPCMD)) & 1)) { + while(!(g2_read_8(NIC(RT_CHIPCMD)) & RT_CMD_RX_BUF_EMPTY)) { /* Get frame size and status */ ring_offset = rtl.cur_rx % RX_BUFFER_LEN; rx_status = g2_read_32(rtl_mem + ring_offset); @@ -816,12 +760,6 @@ static void bba_rx(void) { break; } - /* if( ( ( g2_read_16(NIC(RT_RXBUFHEAD)) - ring_offset ) & (RX_BUFFER_LEN-1)) < */ - /* ( (rx_size+4+3) & (RX_BUFFER_LEN-3-1) )) { */ - /* //dbglog(DBG_KDEBUG, "bba: oops\n"); */ - /* break; */ - /* } */ - if((rx_status & 1) && (pkt_size <= 1514)) { /* Add it to the rx queue */ int res = rx_enq(ring_offset + 4, pkt_size); @@ -841,8 +779,32 @@ static void bba_rx(void) { break; } } +} + +static void bba_link_change(void) { + // This should really be a bit more complete, but this + // should be sufficient. - //vid_border_color(bcolor, bcolor, 0); + // Is our link there? + if(g2_read_16(NIC(RT_MII_BMSR)) & RT_MII_LINK) { + // We must have just finished an auto-negotiation. + dbglog(DBG_INFO, "bba: link stable\n"); + + // The link is back. + link_stable = 1; + } + else { + dbglog(DBG_INFO, "bba: link lost\n"); + + // Do an auto-negotiation. + g2_write_16(NIC(RT_MII_BMCR), + RT_MII_RESET | + RT_MII_AN_ENABLE | + RT_MII_AN_START); + + // The link is gone. + link_stable = 0; + } } /* Ethernet IRQ handler */ @@ -851,7 +813,6 @@ static void bba_irq_hnd(uint32 code) { (void)code; - //vid_border_color(0, 255, 0); /* Acknowledge 8193 interrupt, except RX ACK bits. We'll handle those in the RX int handler. */ intr = g2_read_16(NIC(RT_INTRSTATUS)); @@ -877,43 +838,7 @@ static void bba_irq_hnd(uint32 code) { } if(intr & RT_INT_LINK_CHANGE) { - // Get the MII media status reg. - uint32 bmsr = g2_read_16(NIC(RT_MII_BMSR)); - - // If this is the first time, force a renegotiation. - if(!link_initial) { - bmsr &= ~(RT_MII_LINK | RT_MII_AN_COMPLETE); - dbglog(DBG_INFO, "bba: initial link change, redoing auto-neg\n"); - } - - // This should really be a bit more complete, but this - // should be sufficient. - - // Is our link there? - if(bmsr & RT_MII_LINK) { - // We must have just finished an auto-negotiation. - dbglog(DBG_INFO, "bba: link stable\n"); - - // The link is back. - link_stable = 1; - } - else { - if(link_initial) - dbglog(DBG_INFO, "bba: link lost\n"); - - // Do an auto-negotiation. - g2_write_16(NIC(RT_MII_BMCR), - RT_MII_RESET | - RT_MII_AN_ENABLE | - RT_MII_AN_START); - - // The link is gone. - link_stable = 0; - } - - // We've done our initial link interrupt now. - link_initial = 1; - + bba_link_change(); hnd = 1; } @@ -931,8 +856,6 @@ static void bba_irq_hnd(uint32 code) { if(!hnd) { dbglog(DBG_KDEBUG, "bba: spurious interrupt, status is %08x\n", intr); } - - //vid_border_color(0, 0, 0); } /****************************************************************************/ @@ -1117,7 +1040,7 @@ static int bba_if_set_mc(netif_t *self, const uint8 *list, int count) { /* Disable multicast reception */ old = g2_read_32(NIC(RT_RXCONFIG)); - g2_write_32(NIC(RT_RXCONFIG), old & ~0x00000004); + g2_write_32(NIC(RT_RXCONFIG), old & ~RT_RXC_AM); } else { int i, pos; @@ -1136,7 +1059,7 @@ static int bba_if_set_mc(netif_t *self, const uint8 *list, int count) { /* Enable multicast reception */ old = g2_read_32(NIC(RT_RXCONFIG)); - g2_write_32(NIC(RT_RXCONFIG), old | 0x00000004); + g2_write_32(NIC(RT_RXCONFIG), old | RT_RXC_AM); } return 0; diff --git a/kernel/arch/dreamcast/include/dc/net/broadband_adapter.h b/kernel/arch/dreamcast/include/dc/net/broadband_adapter.h index d2710220..2b0b4727 100644 --- a/kernel/arch/dreamcast/include/dc/net/broadband_adapter.h +++ b/kernel/arch/dreamcast/include/dc/net/broadband_adapter.h @@ -165,7 +165,7 @@ __BEGIN_DECLS #define RT_INT_RX_ACK (RT_INT_RXFIFO_OVERFLOW | RT_INT_RXBUF_OVERFLOW | RT_INT_RX_OK) /** @} */ -/** \defgroup bba_tbits Transmit Status Bits +/** \defgroup bba_tbits RTL8139C Transmit Status Bits \brief BBA transmit status register fields @{ */ @@ -182,18 +182,42 @@ __BEGIN_DECLS \brief BBA receive status register fields @{ */ -#define RT_RX_MULTICAST 0x00008000 /**< \brief Multicast packet */ -#define RT_RX_PAM 0x00004000 /**< \brief Physical address matched */ -#define RT_RX_BROADCAST 0x00002000 /**< \brief Broadcast address matched */ -#define RT_RX_BAD_SYMBOL 0x00000020 /**< \brief Invalid symbol in 100TX packet */ -#define RT_RX_RUNT 0x00000010 /**< \brief Packet size is <64 bytes */ -#define RT_RX_TOO_LONG 0x00000008 /**< \brief Packet size is >4K bytes */ -#define RT_RX_CRC_ERR 0x00000004 /**< \brief CRC error */ -#define RT_RX_FRAME_ALIGN 0x00000002 /**< \brief Frame alignment error */ -#define RT_RX_STATUS_OK 0x00000001 /**< \brief Status ok: a good packet was received */ +#define RT_RX_MULTICAST 0x8000 /**< \brief Multicast packet */ +#define RT_RX_PAM 0x4000 /**< \brief Physical address matched */ +#define RT_RX_BROADCAST 0x2000 /**< \brief Broadcast address matched */ +#define RT_RX_BAD_SYMBOL 0x0020 /**< \brief Invalid symbol in 100TX packet */ +#define RT_RX_RUNT 0x0010 /**< \brief Packet size is <64 bytes */ +#define RT_RX_TOO_LONG 0x0008 /**< \brief Packet size is >4K bytes */ +#define RT_RX_CRC_ERR 0x0004 /**< \brief CRC error */ +#define RT_RX_FRAME_ALIGN 0x0002 /**< \brief Frame alignment error */ +#define RT_RX_STATUS_OK 0x0001 /**< \brief Status ok: a good packet was received */ /** @} */ -/** \defgroup bba_config1bits Config Register 1 Bits +/** \defgroup bba_config5bits RTL8139C RX Config Register (RT_RXCONFIG) bits + + From RTL8139C(L) datasheet v1.4. + + @{ +*/ +#define RT_ERTH(n) ((n) <<24) /**< \brief Early RX Threshold multiplier n/16 or 0 for none */ + +#define RT_RXC_MulERINT 0x00020000 /**< \brief 0 for Early Receive Interrupt only on familiar protocols 1 for any */ +#define RT_RXC_RER8 0x00010000 /**< \brief 1 sets the acceptance of runt error packets */ +#define RT_RXC_RXFTH(n) ((n) <<13) /**< \brief 2^(4+n) bytes from 0-6 (16b - 1Kb) or 7 for none */ +#define RT_RXC_RBLEN(n) ((n) <<11) /**< \brief Set Rx ring buffer len to 16b + 2^(3+n) kb. */ +#define RT_RXC_MXDMA(n) ((n) << 8) /**< \brief 2^(4+n) bytes from 0-6 (16b - 1Kb) or 7 for unlimited */ + +#define RT_RXC_WRAP 0x00000080 /**< \brief 0 to use wrapping mode or 1 to not (Ignored for 64Kb buffer length) */ ...<truncated>... hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: ljsebald <ljs...@us...> - 2024-02-04 15:29:52
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via d059b922625b6fd1f05dac4381b48d0ba571650b (commit) via 98efab32800bbabe844959d88980aed00c4fe543 (commit) via f99a1ccc24d10993feb1a189efddea92bfdd5e47 (commit) via 169e7c2c95eb6ba7f0b11bc29107c7f8bed5df12 (commit) via fc20f7d94f5c3da0cf0ae3ef5c6fe540a592b037 (commit) from 04c4dfa47d060320d0cf8b46c96f5b97e5183884 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit d059b922625b6fd1f05dac4381b48d0ba571650b Merge: 98efab32 f99a1ccc Author: Lawrence Sebald <ljs...@us...> Date: Sun Feb 4 10:29:14 2024 -0500 Merge pull request #482 from Tchan0/Naomi_Allow_dcload Allow use of dcload for dbgio/fs on NAOMI. commit 98efab32800bbabe844959d88980aed00c4fe543 Merge: 04c4dfa4 169e7c2c Author: Lawrence Sebald <ljs...@us...> Date: Sun Feb 4 10:27:12 2024 -0500 Merge pull request #481 from KallistiOS/define_safe Add parens to macros for usage safety commit f99a1ccc24d10993feb1a189efddea92bfdd5e47 Author: Tchan0 <617...@us...> Date: Sun Feb 4 10:28:05 2024 +0100 Naomi: allow dcload Allow dcload to work when compiling for Naomi subarch commit 169e7c2c95eb6ba7f0b11bc29107c7f8bed5df12 Author: QuzarDC <qu...@co...> Date: Sat Feb 3 11:24:21 2024 -0500 Add safety parens around macro args commit fc20f7d94f5c3da0cf0ae3ef5c6fe540a592b037 Author: QuzarDC <qu...@co...> Date: Fri Feb 2 23:50:24 2024 -0500 Add safety parens around macro args ----------------------------------------------------------------------- Summary of changes: examples/dreamcast/gldc/basic/gl/pvr-texture.c | 2 +- examples/dreamcast/gldc/nehe/nehe06/pvr-texture.c | 2 +- examples/dreamcast/gldc/nehe/nehe08/pvr-texture.c | 2 +- examples/dreamcast/gldc/nehe/nehe09/pvr-texture.c | 2 +- examples/dreamcast/gldc/nehe/nehe16/pvr-texture.c | 2 +- examples/dreamcast/mruby/dreampresent/dckos.c | 2 +- examples/dreamcast/mruby/mrbtris/dckos.c | 2 +- examples/dreamcast/pvr/bumpmap/bump.c | 2 +- examples/dreamcast/pvr/cheap_shadow/shadow.c | 2 +- kernel/arch/dreamcast/hardware/asic.c | 2 +- kernel/arch/dreamcast/hardware/g1ata.c | 12 ++++++------ kernel/arch/dreamcast/hardware/pvr/pvr_buffers.c | 2 +- kernel/arch/dreamcast/hardware/sd.c | 2 +- kernel/arch/dreamcast/hardware/ubc.c | 8 ++++---- kernel/arch/dreamcast/include/arch/arch.h | 4 ++-- kernel/arch/dreamcast/kernel/init.c | 13 ++----------- kernel/arch/dreamcast/kernel/wdt.c | 2 +- kernel/net/net_tcp.c | 2 +- 18 files changed, 28 insertions(+), 37 deletions(-) diff --git a/examples/dreamcast/gldc/basic/gl/pvr-texture.c b/examples/dreamcast/gldc/basic/gl/pvr-texture.c index 00592c37..05c5af77 100644 --- a/examples/dreamcast/gldc/basic/gl/pvr-texture.c +++ b/examples/dreamcast/gldc/basic/gl/pvr-texture.c @@ -16,7 +16,7 @@ #include <GL/glext.h> #define PVR_HDR_SIZE 0x20 -#define MAX(x, y) ((x > y) ? x : y) +#define MAX(x, y) ((x) > (y) ? (x) : (y)) static GLuint PVR_TextureHeight(unsigned char *HDR); static GLuint PVR_TextureWidth(unsigned char *HDR); diff --git a/examples/dreamcast/gldc/nehe/nehe06/pvr-texture.c b/examples/dreamcast/gldc/nehe/nehe06/pvr-texture.c index 00592c37..05c5af77 100644 --- a/examples/dreamcast/gldc/nehe/nehe06/pvr-texture.c +++ b/examples/dreamcast/gldc/nehe/nehe06/pvr-texture.c @@ -16,7 +16,7 @@ #include <GL/glext.h> #define PVR_HDR_SIZE 0x20 -#define MAX(x, y) ((x > y) ? x : y) +#define MAX(x, y) ((x) > (y) ? (x) : (y)) static GLuint PVR_TextureHeight(unsigned char *HDR); static GLuint PVR_TextureWidth(unsigned char *HDR); diff --git a/examples/dreamcast/gldc/nehe/nehe08/pvr-texture.c b/examples/dreamcast/gldc/nehe/nehe08/pvr-texture.c index 00592c37..05c5af77 100644 --- a/examples/dreamcast/gldc/nehe/nehe08/pvr-texture.c +++ b/examples/dreamcast/gldc/nehe/nehe08/pvr-texture.c @@ -16,7 +16,7 @@ #include <GL/glext.h> #define PVR_HDR_SIZE 0x20 -#define MAX(x, y) ((x > y) ? x : y) +#define MAX(x, y) ((x) > (y) ? (x) : (y)) static GLuint PVR_TextureHeight(unsigned char *HDR); static GLuint PVR_TextureWidth(unsigned char *HDR); diff --git a/examples/dreamcast/gldc/nehe/nehe09/pvr-texture.c b/examples/dreamcast/gldc/nehe/nehe09/pvr-texture.c index 00592c37..05c5af77 100644 --- a/examples/dreamcast/gldc/nehe/nehe09/pvr-texture.c +++ b/examples/dreamcast/gldc/nehe/nehe09/pvr-texture.c @@ -16,7 +16,7 @@ #include <GL/glext.h> #define PVR_HDR_SIZE 0x20 -#define MAX(x, y) ((x > y) ? x : y) +#define MAX(x, y) ((x) > (y) ? (x) : (y)) static GLuint PVR_TextureHeight(unsigned char *HDR); static GLuint PVR_TextureWidth(unsigned char *HDR); diff --git a/examples/dreamcast/gldc/nehe/nehe16/pvr-texture.c b/examples/dreamcast/gldc/nehe/nehe16/pvr-texture.c index 00592c37..05c5af77 100644 --- a/examples/dreamcast/gldc/nehe/nehe16/pvr-texture.c +++ b/examples/dreamcast/gldc/nehe/nehe16/pvr-texture.c @@ -16,7 +16,7 @@ #include <GL/glext.h> #define PVR_HDR_SIZE 0x20 -#define MAX(x, y) ((x > y) ? x : y) +#define MAX(x, y) ((x) > (y) ? (x) : (y)) static GLuint PVR_TextureHeight(unsigned char *HDR); static GLuint PVR_TextureWidth(unsigned char *HDR); diff --git a/examples/dreamcast/mruby/dreampresent/dckos.c b/examples/dreamcast/mruby/dreampresent/dckos.c index e34c1e8a..53dc7ec6 100644 --- a/examples/dreamcast/mruby/dreampresent/dckos.c +++ b/examples/dreamcast/mruby/dreampresent/dckos.c @@ -42,7 +42,7 @@ #define CONV1555TO565(colour) ( (((colour) & 0x7C00) << 1) | (((colour) & 0x03E0) << 1) | ((colour) & 0x001F) ) // CONVERT R, G, B to RGB565 -#define PACK_PIXEL(r, g, b) ( ((r & 0xF8) << 8) | ((g & 0xFC) << 3) | (b >> 3) ) +#define PACK_PIXEL(r, g, b) ( (((r) & 0xF8) << 8) | (((g) & 0xFC) << 3) | ((b) >> 3) ) int PX_PER_LINE = 640; diff --git a/examples/dreamcast/mruby/mrbtris/dckos.c b/examples/dreamcast/mruby/mrbtris/dckos.c index 68fe87a8..ea2e3e51 100644 --- a/examples/dreamcast/mruby/mrbtris/dckos.c +++ b/examples/dreamcast/mruby/mrbtris/dckos.c @@ -36,7 +36,7 @@ #include <stdio.h> #include <inttypes.h> -#define PACK_PIXEL(r, g, b) ( ((r & 0xF8) << 8) | ((g & 0xFC) << 3) | (b >> 3) ) +#define PACK_PIXEL(r, g, b) ( (((r) & 0xF8) << 8) | (((g) & 0xFC) << 3) | ((b) >> 3) ) #define BUFSIZE 100 diff --git a/examples/dreamcast/pvr/bumpmap/bump.c b/examples/dreamcast/pvr/bumpmap/bump.c index fc33a989..c33d669b 100644 --- a/examples/dreamcast/pvr/bumpmap/bump.c +++ b/examples/dreamcast/pvr/bumpmap/bump.c @@ -30,7 +30,7 @@ static int textured = 1; #define SIZE 256 -#define CLAMP(low, high, value) (value < low ? low : (value > high ? high : value)) +#define CLAMP(low, high, value) ((value) < (low) ? (low) : ((value) > (high) ? (high) : (value))) static pvr_ptr_t load_texture(const char fn[]) { FILE *fp; diff --git a/examples/dreamcast/pvr/cheap_shadow/shadow.c b/examples/dreamcast/pvr/cheap_shadow/shadow.c index 43619103..08e38724 100644 --- a/examples/dreamcast/pvr/cheap_shadow/shadow.c +++ b/examples/dreamcast/pvr/cheap_shadow/shadow.c @@ -25,7 +25,7 @@ static float mx = 320.0f, my = 240.0f; static pvr_list_t list = PVR_LIST_OP_POLY; static float shadow = 0.5f; -#define CLAMP(low, high, value) (value < low ? low : (value > high ? high : value)) +#define CLAMP(low, high, value) ((value) < (low) ? (low) : ((value) > (high) ? (high) : (value))) void setup(void) { pvr_poly_cxt_t cxt; diff --git a/kernel/arch/dreamcast/hardware/asic.c b/kernel/arch/dreamcast/hardware/asic.c index c45978c6..ab939568 100644 --- a/kernel/arch/dreamcast/hardware/asic.c +++ b/kernel/arch/dreamcast/hardware/asic.c @@ -105,7 +105,7 @@ #define OUT32(addr, data) IN32(addr) = (data) /* The set of asic regs are spaced by 0x10 with 0x4 between each sub reg */ -#define ASIC_EVT_REG_ADDR(irq, sub) (ASIC_IRQD_A + (irq * 0x10) + (sub * 0x4)) +#define ASIC_EVT_REG_ADDR(irq, sub) (ASIC_IRQD_A + ((irq) * 0x10) + ((sub) * 0x4)) #define ASIC_EVT_REGS 3 #define ASIC_EVT_REG_HNDS 32 diff --git a/kernel/arch/dreamcast/hardware/g1ata.c b/kernel/arch/dreamcast/hardware/g1ata.c index 41927be6..9de6b30a 100644 --- a/kernel/arch/dreamcast/hardware/g1ata.c +++ b/kernel/arch/dreamcast/hardware/g1ata.c @@ -155,12 +155,12 @@ typedef struct ata_devdata { #define G1_DMA_TO_MEMORY 1 /* Macros to access the ATA registers */ -#define OUT32(addr, data) *((volatile uint32_t *)addr) = data -#define OUT16(addr, data) *((volatile uint16_t *)addr) = data -#define OUT8(addr, data) *((volatile uint8_t *)addr) = data -#define IN32(addr) *((volatile uint32_t *)addr) -#define IN16(addr) *((volatile uint16_t *)addr) -#define IN8(addr) *((volatile uint8_t *)addr) +#define OUT32(addr, data) *((volatile uint32_t *)(addr)) = data +#define OUT16(addr, data) *((volatile uint16_t *)(addr)) = data +#define OUT8(addr, data) *((volatile uint8_t *)(addr)) = data +#define IN32(addr) *((volatile uint32_t *)(addr)) +#define IN16(addr) *((volatile uint16_t *)(addr)) +#define IN8(addr) *((volatile uint8_t *)(addr)) static int initted = 0; static int devices = 0; diff --git a/kernel/arch/dreamcast/hardware/pvr/pvr_buffers.c b/kernel/arch/dreamcast/hardware/pvr/pvr_buffers.c index 18791f97..0c4d2dcb 100644 --- a/kernel/arch/dreamcast/hardware/pvr/pvr_buffers.c +++ b/kernel/arch/dreamcast/hardware/pvr/pvr_buffers.c @@ -28,7 +28,7 @@ #define IS_ALIGNED(x, m) ((x) % (m) == 0) -#define LIST_ENABLED(i) (pvr_state.lists_enabled & (1 << i)) +#define LIST_ENABLED(i) (pvr_state.lists_enabled & (1 << (i))) /* Fill Tile Matrix buffers. This function takes a base address and sets up diff --git a/kernel/arch/dreamcast/hardware/sd.c b/kernel/arch/dreamcast/hardware/sd.c index 43f05a87..ca6b8af8 100644 --- a/kernel/arch/dreamcast/hardware/sd.c +++ b/kernel/arch/dreamcast/hardware/sd.c @@ -24,7 +24,7 @@ #define READ_RETRIES 50000 #define WRITE_RETRIES 150000 -#define CMD(n) (n | 0x40) +#define CMD(n) ((n) | 0x40) static int byte_mode = 0; static int is_mmc = 0; diff --git a/kernel/arch/dreamcast/hardware/ubc.c b/kernel/arch/dreamcast/hardware/ubc.c index 8d66122b..01796808 100755 --- a/kernel/arch/dreamcast/hardware/ubc.c +++ b/kernel/arch/dreamcast/hardware/ubc.c @@ -16,10 +16,10 @@ #include <assert.h> /* Macros for accessing SFRs common to both channels by index */ -#define BAR(o) (*((vuint32 *)(uintptr_t)(SH4_REG_UBC_BARA + (unsigned)o * 0xc))) /* Address */ -#define BASR(o) (*((vuint8 *)(uintptr_t)(SH4_REG_UBC_BASRA + (unsigned)o * 0x4))) /* ASID */ -#define BAMR(o) (*((vuint8 *)(uintptr_t)(SH4_REG_UBC_BAMRA + (unsigned)o * 0xc))) /* Address Mask */ -#define BBR(o) (*((vuint16 *)(uintptr_t)(SH4_REG_UBC_BBRA + (unsigned)o * 0xc))) /* Bus Cycle */ +#define BAR(o) (*((vuint32 *)(uintptr_t)(SH4_REG_UBC_BARA + (unsigned)(o) * 0xc))) /* Address */ +#define BASR(o) (*((vuint8 *)(uintptr_t)(SH4_REG_UBC_BASRA + (unsigned)(o) * 0x4))) /* ASID */ +#define BAMR(o) (*((vuint8 *)(uintptr_t)(SH4_REG_UBC_BAMRA + (unsigned)(o) * 0xc))) /* Address Mask */ +#define BBR(o) (*((vuint16 *)(uintptr_t)(SH4_REG_UBC_BBRA + (unsigned)(o) * 0xc))) /* Bus Cycle */ /* Macros for accessing individual, channel-specific SFRs */ #define BARA (BAR(ubc_channel_a)) /**< Break Address A */ diff --git a/kernel/arch/dreamcast/include/arch/arch.h b/kernel/arch/dreamcast/include/arch/arch.h index 0db64c95..e16b4eec 100644 --- a/kernel/arch/dreamcast/include/arch/arch.h +++ b/kernel/arch/dreamcast/include/arch/arch.h @@ -370,7 +370,7 @@ const char *kos_get_authors(void); \param fptr The frame pointer to look at. \return The return address of the pointer. */ -#define arch_fptr_ret_addr(fptr) (*((uint32*)fptr)) +#define arch_fptr_ret_addr(fptr) (*((uint32*)(fptr))) /** \brief Pass in a frame pointer value to get the previous frame pointer for the given frame. @@ -379,7 +379,7 @@ const char *kos_get_authors(void); \param fptr The frame pointer to look at. \return The previous frame pointer. */ -#define arch_fptr_next(fptr) (*((uint32*)(fptr+4))) +#define arch_fptr_next(fptr) (*((uint32*)((fptr)+4))) /** \brief Returns true if the passed address is likely to be valid. Doesn't have to be exact, just a sort of general idea. diff --git a/kernel/arch/dreamcast/kernel/init.c b/kernel/arch/dreamcast/kernel/init.c index 72b23790..ee6ecf89 100644 --- a/kernel/arch/dreamcast/kernel/init.c +++ b/kernel/arch/dreamcast/kernel/init.c @@ -50,16 +50,11 @@ uint32 _fs_dclsocket_get_ip(void); /* We have to put this here so we can include plat-specific devices */ dbgio_handler_t * dbgio_handlers[] = { -#ifndef _arch_sub_naomi &dbgio_dcload, &dbgio_dcls, &dbgio_scif, &dbgio_null, &dbgio_fb -#else - &dbgio_null, - &dbgio_fb -#endif }; int dbgio_handler_cnt = sizeof(dbgio_handlers) / sizeof(dbgio_handler_t *); @@ -133,13 +128,11 @@ int __weak arch_auto_init(void) { ubc_init(); -#ifndef _arch_sub_naomi if(!(__kos_init_flags & INIT_NO_DCLOAD)) fs_dcload_init_console(); /* Init dc-load console, if applicable */ /* Init SCIF for debug stuff (maybe) */ scif_init(); -#endif /* Init debug IO */ dbgio_init(); @@ -183,12 +176,12 @@ int __weak arch_auto_init(void) { if(!KOS_INIT_FLAG_CALL(fs_romdisk_mount_builtin)) KOS_INIT_FLAG_CALL(fs_romdisk_mount_builtin_legacy); -#ifndef _arch_sub_naomi if(!(__kos_init_flags & INIT_NO_DCLOAD) && *DCLOADMAGICADDR == DCLOADMAGICVALUE) { dbglog(DBG_INFO, "dc-load console support enabled\n"); fs_dcload_init(); } +#ifndef _arch_sub_naomi fs_iso9660_init(); #endif @@ -211,8 +204,8 @@ int __weak arch_auto_init(void) { } void __weak arch_auto_shutdown(void) { -#ifndef _arch_sub_naomi fs_dclsocket_shutdown(); +#ifndef _arch_sub_naomi KOS_INIT_FLAG_CALL(net_shutdown); #endif @@ -222,9 +215,7 @@ void __weak arch_auto_shutdown(void) { hardware_shutdown(); pvr_shutdown(); library_shutdown(); -#ifndef _arch_sub_naomi fs_dcload_shutdown(); -#endif KOS_INIT_FLAG_CALL(vmu_fs_shutdown); #ifndef _arch_sub_naomi fs_iso9660_shutdown(); diff --git a/kernel/arch/dreamcast/kernel/wdt.c b/kernel/arch/dreamcast/kernel/wdt.c index bf874d9f..68f9c3d9 100644 --- a/kernel/arch/dreamcast/kernel/wdt.c +++ b/kernel/arch/dreamcast/kernel/wdt.c @@ -10,7 +10,7 @@ #include <arch/irq.h> /* Macros for accessing WDT registers */ -#define WDT(o, t) (*((volatile t *)(WDT_BASE + o))) +#define WDT(o, t) (*((volatile t *)(WDT_BASE + (o)))) #define WDT_READ(o) (WDT(o, uint8_t)) #define WDT_WRITE(o, v) (WDT(o, uint16_t) = ((o##_HIGH << 8) | ((v) & 0xff))) diff --git a/kernel/net/net_tcp.c b/kernel/net/net_tcp.c index 04bff2ff..4df7834a 100644 --- a/kernel/net/net_tcp.c +++ b/kernel/net/net_tcp.c @@ -240,7 +240,7 @@ static int thd_cb_id = 0; #define SEQ_GT(x, y) (((int32_t)((x) - (y))) > 0) #define SEQ_GE(x, y) (((int32_t)((x) - (y))) >= 0) -#define MAX(x, y) (x > y ? x : y) +#define MAX(x, y) ((x) > (y) ? (x) : (y)) /* Forward declarations */ static fs_socket_proto_t proto; hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: ljsebald <ljs...@us...> - 2024-02-01 19:34:24
|
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 04c4dfa47d060320d0cf8b46c96f5b97e5183884 (commit) via 27ec88675ad5690a62b69d6d5017734323d50c90 (commit) via 4a956b26718004faf2bbfb3b874fc2a471d8744c (commit) via b15e24291249af690addbae16479fcba6ceba2a2 (commit) from 489035c46024c93aa8a4daa4efa1eaa56fde29f0 (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 04c4dfa47d060320d0cf8b46c96f5b97e5183884 Merge: 27ec8867 4a956b26 Author: Lawrence Sebald <ljs...@us...> Date: Thu Feb 1 14:33:34 2024 -0500 Merge pull request #478 from KallistiOS/hostshared Allow for --enable-host-shared GCC option in dc-chain configs commit 27ec88675ad5690a62b69d6d5017734323d50c90 Merge: 489035c4 b15e2429 Author: Lawrence Sebald <ljs...@us...> Date: Thu Feb 1 14:32:48 2024 -0500 Merge pull request #477 from KallistiOS/new_binutils Bump binutils to 2.42 for dc-chain dev configurations commit 4a956b26718004faf2bbfb3b874fc2a471d8744c Author: darc <da...@pr...> Date: Mon Jan 29 18:07:43 2024 -0600 Allow for --enable-host-shared GCC option in dc-chain configs commit b15e24291249af690addbae16479fcba6ceba2a2 Author: darc <da...@pr...> Date: Mon Jan 29 16:57:24 2024 -0600 Bump binutils to 2.42 for dc-chain dev configurations ----------------------------------------------------------------------- Summary of changes: utils/dc-chain/config/config.mk.13.2.1-dev.sample | 6 +++--- utils/dc-chain/config/config.mk.14.0.1-dev.sample | 6 +++--- utils/dc-chain/scripts/init.mk | 6 ++++++ 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/utils/dc-chain/config/config.mk.13.2.1-dev.sample b/utils/dc-chain/config/config.mk.13.2.1-dev.sample index 2bb24e06..be251783 100644 --- a/utils/dc-chain/config/config.mk.13.2.1-dev.sample +++ b/utils/dc-chain/config/config.mk.13.2.1-dev.sample @@ -8,12 +8,12 @@ ############################################################################### ############################################################################### ### THIS CONFIG IS FOR AN EXPERIMENTAL VERSION OF GCC! -## THERE ARE NO KNOWN ISSUES BUILDING THIS VERSION as of 2024-01-04. +## THERE ARE NO KNOWN ISSUES BUILDING THIS VERSION as of 2024-01-29. ############################################################################### ############################################################################### # Toolchain versions for SH -sh_binutils_ver=2.41 +sh_binutils_ver=2.42 sh_gcc_ver=13.2.1 newlib_ver=4.4.0.20231231 gdb_ver=14.1 @@ -29,7 +29,7 @@ gdb_download_type=xz # Toolchain for ARM # The ARM version of gcc/binutils is separated as support for the ARM7DI core # used in the Dreamcast's AICA is not available in versions of GCC beyond 8.5.0. -arm_binutils_ver=2.41 +arm_binutils_ver=2.42 arm_gcc_ver=8.5.0 # Tarball extensions to download for ARM diff --git a/utils/dc-chain/config/config.mk.14.0.1-dev.sample b/utils/dc-chain/config/config.mk.14.0.1-dev.sample index a0ad4d41..1b61eb96 100644 --- a/utils/dc-chain/config/config.mk.14.0.1-dev.sample +++ b/utils/dc-chain/config/config.mk.14.0.1-dev.sample @@ -8,14 +8,14 @@ ############################################################################### ############################################################################### ### THIS CONFIG IS FOR AN EXPERIMENTAL VERSION OF GCC! -## THERE IS ONE KNOWN ISSUE BUILDING THIS VERSION as of 2024-01-04: +## THERE IS ONE KNOWN ISSUE BUILDING THIS VERSION as of 2024-01-29: ## 1. GCC 14.0.1 currently does not build with m4-single-only precision, which ## is the only officially supported KOS mode for floating-point precision. ############################################################################### ############################################################################### # Toolchain versions for SH -sh_binutils_ver=2.41 +sh_binutils_ver=2.42 sh_gcc_ver=14.0.1 newlib_ver=4.4.0.20231231 gdb_ver=14.1 @@ -31,7 +31,7 @@ gdb_download_type=xz # Toolchain for ARM # The ARM version of gcc/binutils is separated as support for the ARM7DI core # used in the Dreamcast's AICA is not available in versions of GCC beyond 8.5.0. -arm_binutils_ver=2.41 +arm_binutils_ver=2.42 arm_gcc_ver=8.5.0 # Tarball extensions to download for ARM diff --git a/utils/dc-chain/scripts/init.mk b/utils/dc-chain/scripts/init.mk index 7951d711..438f75d1 100644 --- a/utils/dc-chain/scripts/init.mk +++ b/utils/dc-chain/scripts/init.mk @@ -159,6 +159,12 @@ ifdef disable_nls endif endif +ifdef enable_host_shared + ifneq (0,$(enable_host_shared)) + extra_configure_args += --enable-host-shared + endif +endif + # Function to verify variable is not empty # Args: # 1 - Variable Name hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: falcovorbis <fal...@us...> - 2024-02-01 05:18:15
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via 489035c46024c93aa8a4daa4efa1eaa56fde29f0 (commit) via c1ce7faf29100891e49d98fe2b760ec793fe6256 (commit) via 6220f330c91a02f4def0126aa27c2abc972f73eb (commit) from 4db9950241c058af8b638506624976dd03a3dc13 (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 489035c46024c93aa8a4daa4efa1eaa56fde29f0 Author: Jason Rost <152...@us...> Date: Wed Jan 31 22:17:51 2024 -0700 1-31-24 - Modified Makefile to remove redundant -x in Make Run target. Cleaned up main.cpp unused var (#480) commit c1ce7faf29100891e49d98fe2b760ec793fe6256 Author: Jason Rost <152...@us...> Date: Wed Jan 31 09:35:22 2024 -0700 Fix for examples/dreamcast/video/multibuffer Makefile (#479) Fixed Makefile issue using spaces instead of tabs in for multibuffer in dreamcast/video commit 6220f330c91a02f4def0126aa27c2abc972f73eb Author: Donald Haase <qu...@ya...> Date: Mon Jan 29 17:59:16 2024 -0500 Small Fixes from DCPlaya's KOS branch (#476) * Prevent loading multiple drivers for one function * Prevent double init or uninitted shutdown of ramdisk * Shortcut boosting the currently running thread ----------------------------------------------------------------------- Summary of changes: examples/dreamcast/gldc/2D_tex_quad/Makefile | 2 +- examples/dreamcast/gldc/2D_tex_quad/main.cpp | 3 --- examples/dreamcast/video/multibuffer/Makefile | 12 ++++++------ kernel/arch/dreamcast/hardware/maple/maple_driver.c | 6 ++++++ kernel/fs/fs_ramdisk.c | 9 +++++++++ kernel/thread/thread.c | 4 ++++ 6 files changed, 26 insertions(+), 10 deletions(-) diff --git a/examples/dreamcast/gldc/2D_tex_quad/Makefile b/examples/dreamcast/gldc/2D_tex_quad/Makefile index 0d0fd51b..d2d0f908 100644 --- a/examples/dreamcast/gldc/2D_tex_quad/Makefile +++ b/examples/dreamcast/gldc/2D_tex_quad/Makefile @@ -38,4 +38,4 @@ rm-elf: -rm -f $(TARGET) run: $(TARGET) - $(KOS_LOADER) -x $(TARGET) + $(KOS_LOADER) $(TARGET) diff --git a/examples/dreamcast/gldc/2D_tex_quad/main.cpp b/examples/dreamcast/gldc/2D_tex_quad/main.cpp index 33c012bf..780a9113 100644 --- a/examples/dreamcast/gldc/2D_tex_quad/main.cpp +++ b/examples/dreamcast/gldc/2D_tex_quad/main.cpp @@ -162,9 +162,6 @@ int main(int argc, char **argv) { if(state->start) break; - int16_t x_axis = state->joyx; - int16_t y_axis = state->joyy; - //..:: Rotation on Triggers // Rotate CCW if(state->ltrig >= 255) { diff --git a/examples/dreamcast/video/multibuffer/Makefile b/examples/dreamcast/video/multibuffer/Makefile index 30b6b663..f1946edf 100644 --- a/examples/dreamcast/video/multibuffer/Makefile +++ b/examples/dreamcast/video/multibuffer/Makefile @@ -12,17 +12,17 @@ all: rm-elf $(TARGET) include $(KOS_BASE)/Makefile.rules clean: rm-elf - -rm -f $(OBJS) + -rm -f $(OBJS) rm-elf: - -rm -f $(TARGET) + -rm -f $(TARGET) $(TARGET): $(OBJS) - kos-cc -o $(TARGET) $(OBJS) + kos-cc -o $(TARGET) $(OBJS) run: $(TARGET) - $(KOS_LOADER) $(TARGET) + $(KOS_LOADER) $(TARGET) dist: $(TARGET) - -rm -f $(OBJS) - $(KOS_STRIP) $(TARGET) + -rm -f $(OBJS) + $(KOS_STRIP) $(TARGET) diff --git a/kernel/arch/dreamcast/hardware/maple/maple_driver.c b/kernel/arch/dreamcast/hardware/maple/maple_driver.c index 4bb44067..c91d3dbb 100644 --- a/kernel/arch/dreamcast/hardware/maple/maple_driver.c +++ b/kernel/arch/dreamcast/hardware/maple/maple_driver.c @@ -26,6 +26,12 @@ void maple_detach_callback(uint32 functions, maple_detach_callback_t cb) { /* Register a maple device driver; do this before maple_init() */ int maple_driver_reg(maple_driver_t *driver) { + /* Don't add two drivers for the same function */ + maple_driver_t *i; + LIST_FOREACH(i, &maple_state.driver_list, drv_list) + if(i->functions & driver->functions) + return -1; + /* Insert it into the device list */ LIST_INSERT_HEAD(&maple_state.driver_list, driver, drv_list); return 0; diff --git a/kernel/fs/fs_ramdisk.c b/kernel/fs/fs_ramdisk.c index c3cccefa..0628ec73 100644 --- a/kernel/fs/fs_ramdisk.c +++ b/kernel/fs/fs_ramdisk.c @@ -846,6 +846,10 @@ int fs_ramdisk_detach(const char * fn, void ** obj, size_t * size) { /* Initialize the file system */ int fs_ramdisk_init(void) { + /* Test if initted */ + if(rootdir != NULL) + return -1; + /* Create an empty root dir */ if(!(rootdir = (rd_dir_t *)malloc(sizeof(rd_dir_t)))) return -1; @@ -885,6 +889,11 @@ int fs_ramdisk_init(void) { /* De-init the file system */ int fs_ramdisk_shutdown(void) { rd_file_t *f1, *f2; + + /* Test if initted */ + if(rootdir == NULL) + return -1; + /* For now assume there's only the root dir, since mkdir and rmdir aren't even implemented... */ f1 = LIST_FIRST(rootdir); diff --git a/kernel/thread/thread.c b/kernel/thread/thread.c index 1b38f876..6addff22 100644 --- a/kernel/thread/thread.c +++ b/kernel/thread/thread.c @@ -708,6 +708,10 @@ void thd_schedule_next(kthread_t *thd) { if(!irq_inside_int()) return; + /* We're already running now! */ + if(thd == thd_current) + return; + /* Can't boost a blocked thread */ if(thd->state != STATE_READY) return; hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: ljsebald <ljs...@us...> - 2024-01-29 04:18: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 4db9950241c058af8b638506624976dd03a3dc13 (commit) via 9a69bf7996c660d0de16136c0894ad824283c357 (commit) via cc7941fde2be0fbf418894e17055e11ae82e8e46 (commit) from 42f4e9aee02c38aaeb6aa63688d1910f2b47853d (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 4db9950241c058af8b638506624976dd03a3dc13 Author: Falco Girgis <gyr...@gm...> Date: Sun Jan 28 22:18:05 2024 -0600 Fixed Newlib's getpid() and Implemented kill() (#457) * Fixed getpid() - Our implementation of getpid() for newlib was sketchily returning the current thread ID as the process ID - We're now using a signle constnant value, KOS_PID, as the single process ID for a KOS executable, which is returned by getpid() * Updated clock_getcpuclockid() to support new pid. * Addressing review feedback. commit 9a69bf7996c660d0de16136c0894ad824283c357 Author: Falco Girgis <gyr...@gm...> Date: Sun Jan 28 22:16:34 2024 -0600 Fixed libparallax bubbles and rotocube examples (#474) * Fixed libparallax bubbles and rotocube examples - Both required a libparallax update as well as minor changes - Neither were calling the new pvr_dr_finish() to relinquish SQ ownership when using direct rendering - Bubbles was interleaving pvr_prim() with direct rendering, which already took ownership over the SQs commit cc7941fde2be0fbf418894e17055e11ae82e8e46 Author: OniEnzeru <152...@us...> Date: Sun Jan 28 21:15:32 2024 -0700 2D Textured Quad w/PNGs via stb_image (#470) Created Textured Quad example for GLDC using stb_image loaded PNGs ----------------------------------------------------------------------- Summary of changes: examples/dreamcast/gldc/2D_tex_quad/Makefile | 41 ++++ examples/dreamcast/gldc/2D_tex_quad/main.cpp | 249 +++++++++++++++++++++ examples/dreamcast/gldc/2D_tex_quad/output.gif | Bin 0 -> 8683566 bytes .../dreamcast/gldc/2D_tex_quad/romdisk/crate.png | Bin 0 -> 9676 bytes examples/dreamcast/parallax/bubbles/bubbles.c | 10 +- examples/dreamcast/parallax/rotocube/rotocube.c | 2 + include/kos/thread.h | 11 +- kernel/libc/newlib/newlib_getpid.c | 7 +- kernel/libc/newlib/newlib_kill.c | 4 +- kernel/libc/posix/clock_gettime.c | 4 +- 10 files changed, 316 insertions(+), 12 deletions(-) create mode 100644 examples/dreamcast/gldc/2D_tex_quad/Makefile create mode 100644 examples/dreamcast/gldc/2D_tex_quad/main.cpp create mode 100644 examples/dreamcast/gldc/2D_tex_quad/output.gif create mode 100644 examples/dreamcast/gldc/2D_tex_quad/romdisk/crate.png diff --git a/examples/dreamcast/gldc/2D_tex_quad/Makefile b/examples/dreamcast/gldc/2D_tex_quad/Makefile new file mode 100644 index 00000000..0d0fd51b --- /dev/null +++ b/examples/dreamcast/gldc/2D_tex_quad/Makefile @@ -0,0 +1,41 @@ +# +# KallistiOS ##version## +# +# examples/dreamcast/gldc/2D_tex_quad/Makefile +# Copyright (C) 2024 Jason Rost (OniEnzeru) +# + + +# Directories +KOS_ROMDISK_DIR := romdisk + +# File aggregators +SRCS := main.cpp +OBJS := main.o romdisk.o + +# Compiler Flags +KOS_CPPSTD := -std=c++20 +LDLIBS := -lstb_image -lGL -lkmg -lkosutils -lm + +TARGET = 2D_tex_quad.elf + +.PHONY: all clean push + +all: rm-elf $(TARGET) +include $(KOS_BASE)/Makefile.rules + +clean: rm-elf + -rm -rf $(OBJS) romdisk.* + +$(TARGET): $(OBJS) + kos-c++ -o $(TARGET) $(OBJS) $(LDLIBS) + +dist: $(TARGET) + -rm -f $(OBJS) + $(KOS_STRIP) $(TARGET) + +rm-elf: + -rm -f $(TARGET) + +run: $(TARGET) + $(KOS_LOADER) -x $(TARGET) diff --git a/examples/dreamcast/gldc/2D_tex_quad/main.cpp b/examples/dreamcast/gldc/2D_tex_quad/main.cpp new file mode 100644 index 00000000..33c012bf --- /dev/null +++ b/examples/dreamcast/gldc/2D_tex_quad/main.cpp @@ -0,0 +1,249 @@ +/* + KallistiOS ##version## + examples/dreamcast/gldc/2D_tex_quad/main.cpp + Copyright (C) 2024 Jason Rost (Oni Enzeru) + + Example of 2D Orthographic perspective rendering + of a textured quad using PNGs and GLdc. +*/ + +#include <kos.h> +#include <kos/img.h> + +// ..:: GLdc ::.. +#include <GL/gl.h> +#include <GL/glu.h> +#include <GL/glext.h> +#include <GL/glkos.h> + +// ..:: STB_Image from KOS-Port +#include <stb_image/stb_image.h> + + +void GL_Init(uint16_t w, uint16_t h) { + // Set "background" color to light blue + glClearColor(0.10f, 0.5f, 1.0f, 1.0f); + glEnable(GL_TEXTURE_2D); + + // Expect Counter Clockwise vertex order + glFrontFace(GL_CCW); + + // Enable Transparancy + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + + //Depth test not needed for 2D + glDisable(GL_DEPTH_TEST); + + // Set Orthographic ( 2D ) Camera + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + + // Screen / Camera coords + // Left Right Bottom Top Near Far + glOrtho(0.0f, (float)w, 0.0f, (float)h, -1.0f, 1.0f); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); +} + +int main(int argc, char **argv) { + // Setup for Controller + maple_device_t *cont; + cont_state_t *state; + cont = maple_enum_type(0, MAPLE_FUNC_CONTROLLER); + + // Texture ID + GLuint texture; + + // Initialize KOS + dbglog_set_level(DBG_WARNING); + printf("\n..:: 2D Textured Quad Example - Start ::..\n"); + glKosInit(); + + // Set screen size and init GLDC + GL_Init(640, 480); + + // Generate a texture and link it to our ID + glGenTextures(1, &texture); + glBindTexture(GL_TEXTURE_2D, texture); + + // Set texture parameters best suited for Pixel Art ( Hard edge no repeat for scaling ) + // Prevents blur on scale. + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP ); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP ); + + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); // Scale down filter + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); // Scale up filter + + // Load PNG via stb_image + int width, height, nr_channels; + //stbi_set_flip_vertically_on_load(true); // Flip img onload due to GL expecting top left (0,0) + unsigned char *data = stbi_load("/rd/crate.png", &width, &height, &nr_channels, 0); + + // texture load debug + printf("..:: STB_IMAGE Data ::..\n"); + printf("nr_channels: %d\n", nr_channels); + printf("width: %d\n", width); + printf("height: %d\n", height); + + // If data is loaded, apply texture formats and assign the data + if(data) { + glTexImage2D(GL_TEXTURE_2D, + 0, + GL_RGBA, + width, + height, + 0, + GL_RGBA, + GL_UNSIGNED_BYTE, + data); + + // Currently REQUIRED for OpenGLdc w/PNGs on Dreamcast + glGenerateMipmapEXT(GL_TEXTURE_2D); + } + else { + printf("Failed to load texture!\n"); + } + + // Cleanup + stbi_image_free(data); + + // ..:: Output any GL Errors + GLenum error = glGetError(); + if(error != GL_NO_ERROR) { + printf("OpenGL error: %x\n", error); + } + // ..:: Vertex / UV Data setup + float uv[4][2] = { + // UVs are in reverse Y order to flip image + // GL expects 0,0 to be the bottom left corner of an image while + // real world coordinates are typically top left. + // alt- use: stbi_set_flip_vertically_on_load(true); before loading texture. + // X // Y + {0.0f, 0.0f}, + {1.0f, 0.0f}, + {1.0f, 1.0f}, + {0.0f, 1.0f} + }; + + float xyz[4][3] = { + // Remember these are Counter-clockwise + /* (-1,-1)-----( 0,-1)-----( 1,-1) + | | | + | | | + | | | + (-1, 0)-----( 0, 0)-----( 1, 0) + | | | + | | | + | | | + (-1, 1)-----( 0, 1)-----( 1, 1) + */ + // X Y Z + { -1.0f, 1.0f, 1.0f }, // Bottom Left + { 1.0f, 1.0f, 1.0f }, // Bottom Right + { 1.0f, -1.0f, 1.0f }, // Top Right + { -1.0f, -1.0f, 1.0f } // Top Left + }; + // ..:: Setup some variables to manipulate position and rotation of our quad + float pos_x = 320.0f; + float pos_y = 240.0f; + float rot = 0.0f; + + while(1) { + //..:: Check Controller Input + state = (cont_state_t *)maple_dev_status(cont); + + if(!state) { + printf("Error reading controller\n"); + break; + } + + // Close program on Start Button + if(state->start) + break; + + int16_t x_axis = state->joyx; + int16_t y_axis = state->joyy; + + //..:: Rotation on Triggers + // Rotate CCW + if(state->ltrig >= 255) { + rot += 4.0f; + } + + // Rotate CW + if(state->rtrig >= 255) { + rot -= 4.0f; + } + + //..:: Scale on Y / B + // Scale up + if(state->y) { + width = height += 4.0f; + } + + // Scale down + if(state->b) { + width = height -= 4.0f; + } + + // ..:: Begin GL Drawing + glClearColor(0.10f, 0.5f, 1.0f, 1.0f); // Sets background Color + glClear(GL_COLOR_BUFFER_BIT); // Clears screen to that color + + pos_x += state->joyx * 0.05; + pos_y -= state->joyy * 0.05; + + // Apply texture data to all draw calls until next bind + glBindTexture(GL_TEXTURE_2D, texture); + + glPushMatrix(); + + glLoadIdentity(); + + // Matrix transforms are applied in reverse order. + // Order should ALWAYS be: + // 1) Translate + // 2) Rotate + // 3) Scale + // Scaling "First" ( last in code ) allows all other transforms to be scaled as well. + + // Move quad to screen position + // X Y Z + glTranslatef(pos_x, pos_y, 0.0f); + // val X-axis Y-axis Z-axis + glRotatef(rot, 0.0f, 0.0f, 1.0f); // rotate only on enabled Axis (1.0f) + // tex_w tex_h Z doesn't change + glScalef(width, height, 0.0f ); + + glBegin(GL_QUADS); + // Remember these are Counter-clockwise + // Bottom Left + glTexCoord2fv(&uv[0][0]); + glVertex3f(xyz[0][0], xyz[0][1], xyz[0][2]); + + // Bottom Right + glTexCoord2fv(&uv[1][0]); + glVertex3f(xyz[1][0], xyz[1][1], xyz[1][2]); + + // Top Right + glTexCoord2fv(&uv[2][0]); + glVertex3f(xyz[2][0], xyz[2][1], xyz[2][2]); + + // Top Left + glTexCoord2fv(&uv[3][0]); + glVertex3f(xyz[3][0], xyz[3][1], xyz[3][2]); + + glEnd(); + + glPopMatrix(); + + // Finish the frame and flush to screen + glKosSwapBuffers(); + } + + // ..:: Cleanup Memory + glDeleteTextures(1, &texture); + + return 0; +} diff --git a/examples/dreamcast/gldc/2D_tex_quad/output.gif b/examples/dreamcast/gldc/2D_tex_quad/output.gif new file mode 100644 index 00000000..52a7c8ed Binary files /dev/null and b/examples/dreamcast/gldc/2D_tex_quad/output.gif differ diff --git a/examples/dreamcast/gldc/2D_tex_quad/romdisk/crate.png b/examples/dreamcast/gldc/2D_tex_quad/romdisk/crate.png new file mode 100644 index 00000000..65aaa542 Binary files /dev/null and b/examples/dreamcast/gldc/2D_tex_quad/romdisk/crate.png differ diff --git a/examples/dreamcast/parallax/bubbles/bubbles.c b/examples/dreamcast/parallax/bubbles/bubbles.c index 303ad907..5e4c54d4 100644 --- a/examples/dreamcast/parallax/bubbles/bubbles.c +++ b/examples/dreamcast/parallax/bubbles/bubbles.c @@ -27,7 +27,7 @@ the same, but it uses the Parallax functions instead of KGL. static float phase = 0.0f; static pvr_poly_cxt_t cxt; static pvr_poly_hdr_t hdr; -static pvr_dr_state_t dr_state; +static plx_dr_state_t dr_state; static void sphere(float radius, int slices, int stacks) { int i, j; float pitch, pitch2; @@ -37,6 +37,9 @@ static void sphere(float radius, int slices, int stacks) { /* Put our own polygon header */ pvr_prim(&hdr, sizeof(hdr)); + /* Setup our Direct Render state: pick a store queue and setup QACR0/1 */ + plx_dr_init(&dr_state); + /* Initialize xmtrx with the values from KGL */ plx_mat_identity(); plx_mat3d_apply(PLX_MAT_SCREENVIEW); @@ -84,6 +87,8 @@ static void sphere(float radius, int slices, int stacks) { } } } + + plx_dr_finish(); } #define SPHERE_CNT 12 @@ -98,9 +103,6 @@ static void sphere_frame_opaque(void) { pvr_scene_begin(); pvr_list_begin(PVR_LIST_OP_POLY); - /* Setup our Direct Render state: pick a store queue and setup QACR0/1 */ - pvr_dr_init(&dr_state); - plx_mat3d_identity(); plx_mat3d_translate(0.0f, 0.0f, -12.0f); plx_mat3d_rotate(r * 2, 0.75f, 1.0f, 0.5f); diff --git a/examples/dreamcast/parallax/rotocube/rotocube.c b/examples/dreamcast/parallax/rotocube/rotocube.c index 35427f40..347562f9 100644 --- a/examples/dreamcast/parallax/rotocube/rotocube.c +++ b/examples/dreamcast/parallax/rotocube/rotocube.c @@ -78,6 +78,8 @@ void drawcube(void) { plx_vert_indm3(&dr, PLX_VERT, -3, 3, 3, color); plx_vert_indm3(&dr, PLX_VERT, 3, 3, -3, color); plx_vert_indm3(&dr, PLX_VERT_EOS, 3, 3, 3, color); + + plx_dr_finish(); } // Draws the wave in the background (2D) diff --git a/include/kos/thread.h b/include/kos/thread.h index a8d2a903..6c09dd5a 100644 --- a/include/kos/thread.h +++ b/include/kos/thread.h @@ -66,14 +66,21 @@ __BEGIN_DECLS \sa semaphore_t, mutex_t, kthread_once_t, kthread_key_t, rw_semaphore_t */ -/** \brief Maximal thread priority. +/** \brief Process ID + + This macro defines the single process ID that encompasses all of KOS and the + running application along with all of its threads. +*/ +#define KOS_PID 1 + +/** \brief Maximal thread priority This macro defines the maximum value for a thread's priority. Note that the larger this number, the lower the priority of the thread. */ #define PRIO_MAX 4096 -/** \brief Default thread priority. +/** \brief Default thread priority Threads are created by default with the priority specified. */ diff --git a/kernel/libc/newlib/newlib_getpid.c b/kernel/libc/newlib/newlib_getpid.c index 677a7f32..244394cb 100644 --- a/kernel/libc/newlib/newlib_getpid.c +++ b/kernel/libc/newlib/newlib_getpid.c @@ -1,14 +1,15 @@ /* KallistiOS ##version## newlib_getpid.c - Copyright (C)2004 Megan Potter + Copyright (C) 2004 Megan Potter + Copyright (C) 2024 Falco Girgis */ #include <kos/thread.h> #include <sys/reent.h> -int _getpid_r(struct _reent * re) { +int _getpid_r(struct _reent *re) { (void)re; - return thd_current->tid; + return KOS_PID; } diff --git a/kernel/libc/newlib/newlib_kill.c b/kernel/libc/newlib/newlib_kill.c index 9c715bc7..5b5d026b 100644 --- a/kernel/libc/newlib/newlib_kill.c +++ b/kernel/libc/newlib/newlib_kill.c @@ -1,14 +1,14 @@ /* KallistiOS ##version## newlib_kill.c - Copyright (C)2004 Megan Potter + Copyright (C) 2004 Megan Potter */ #include <sys/reent.h> #include <errno.h> -int _kill_r(struct _reent * reent, int pid, int sig) { +int _kill_r(struct _reent *reent, int pid, int sig) { (void)pid; (void)sig; reent->_errno = EINVAL; diff --git a/kernel/libc/posix/clock_gettime.c b/kernel/libc/posix/clock_gettime.c index 0ec1ea06..16f952f6 100644 --- a/kernel/libc/posix/clock_gettime.c +++ b/kernel/libc/posix/clock_gettime.c @@ -4,6 +4,8 @@ Copyright (C) 2023, 2024 Falco Girgis */ +#include <kos/thread.h> + #include <arch/timer.h> #include <arch/rtc.h> @@ -17,7 +19,7 @@ int clock_getcpuclockid(pid_t pid, clockid_t *clock_id) { /* pid of 0 means the current process, and we only support a single process. */ - if(pid) + if(pid != 0 || pid != KOS_PID) return ESRCH; assert(clock_id); hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: ljsebald <ljs...@us...> - 2024-01-29 04:14:05
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "UNNAMED PROJECT". The branch, master has been updated via 1d75c9e421f3453cdbe16bf91a39366d5f0be972 (commit) from 81329435db6b2c747ee1bde2d3359e78344e0b63 (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 1d75c9e421f3453cdbe16bf91a39366d5f0be972 Author: Falco Girgis <gyr...@gm...> Date: Sun Jan 28 22:12:35 2024 -0600 Fixed Broken Direct Rendering Path (#1) * Update dr.h Fixed pvr_dr_init() to use new API changes for PVR direct rendering. Fixing direct rendering. Added wrapper around pvr_dr_finish() which is required to release the mutex held by plx_dr_init(). * Addressing review feedback. * Forgot a semicolon! * Apply suggestions from code review ----------------------------------------------------------------------- Summary of changes: include/dr.h | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/include/dr.h b/include/dr.h index 538e34b..1aebae3 100644 --- a/include/dr.h +++ b/include/dr.h @@ -3,6 +3,7 @@ dr.h Copyright (C) 2002 Megan Potter + Copyright (C) 2024 Falco Girgis */ @@ -27,11 +28,25 @@ typedef pvr_vertex_t plx_vertex_t; #define PLX_VERT PVR_CMD_VERTEX #define PLX_VERT_EOS PVR_CMD_VERTEX_EOL -#define plx_dr_init(a) pvr_dr_init(*a) -#define plx_dr_target(a) pvr_dr_target(*a) -#define plx_dr_commit(a) pvr_dr_commit(a) +static inline void plx_dr_init(plx_dr_state_t *state) { + pvr_dr_init((pvr_dr_state_t *)state); +} + +static inline plx_vertex_t *plx_dr_target(plx_dr_state_t *state) { + return (plx_vertex_t *)pvr_dr_target(*(pvr_dr_state_t*)state); +} + +static inline void plx_dr_commit(plx_vertex_t *vertex) { + pvr_dr_commit((pvr_vertex_t *)vertex); +} + +static inline void plx_dr_finish(void) { + pvr_dr_finish(); +} -#define plx_prim pvr_prim +static inline int plx_prim(void *data, int size) { + return pvr_prim(data, size); +} static inline void plx_scene_begin() { pvr_wait_ready(); hooks/post-receive -- UNNAMED PROJECT |
From: ljsebald <ljs...@us...> - 2024-01-29 02:22:03
|
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 42f4e9aee02c38aaeb6aa63688d1910f2b47853d (commit) from e309ccb1c6363de8cbe8206a1ed7f307b27bef2d (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 42f4e9aee02c38aaeb6aa63688d1910f2b47853d Author: Falco Girgis <gyr...@gm...> Date: Sun Jan 28 20:21:17 2024 -0600 UBC Driver Upgrade (#416) * Started implementation, register configuration - Added first pass at driver for validating configuration and selecting an available UBC channel (when there is one) - Started programming UBC registers based on breakpoints * More driver implementation work. * Old UBC driver removed * Added a WIP example/testbed. * UBC breakpoints working! - Driver actually works now, fixed a few bugs - Started on test app, which demonstrates a complex data breakpoint * Cleanup pass + lots of Doxygen documentation - Cleaned up the UBC driver header and source - Removed commented out legacy stub - Fixed initialization so that it happens without the user having to call ubc_init() manually - changed ubc_breakpoint_t::address from uintptr_t to void* - Ensured proper calls to ubc_wait() after programming UBC registers * Completed documentation, renamed a few things. * More test coverage - Added test coverage for super complex data watchpoint scenarios - Documented entirety of UBC driver - Reordered channel checking in the break IRQ handler to service channel B first, which is required for sequential breakpoints to work right. - Added logic to migrate non-data breakpoints from channel B to channel A if a breakpoint gets removed from channel A, so that B is available for a data watchpoint later. - All tests in the example/test suite are passing. - Still need to test for API error conditions - Still need to test channel B->A migrations * UBC driver, API, examples/tests - Finished commenting and fleshing out the example/test suite - Fixed a few bugs in corner cases after testing them all - Reorganized ubc_breakpoint_t inner structs and default values - wrote more detailed doxygen comments for ubc.h + detailed all potential "gotchas" when working with the API * Fixed Doxygen warnings. * Forgot to update the CHANGELOG... Oops. * Apply suggestions from code review ----------------------------------------------------------------------- Summary of changes: doc/CHANGELOG | 1 + examples/dreamcast/basic/Makefile | 5 +- .../basic/{threading/once => breaking}/Makefile | 12 +- examples/dreamcast/basic/breaking/breaking.c | 358 ++++++++++++++++++ include/kos/cdefs.h | 7 +- include/kos/iovec.h | 5 +- kernel/arch/dreamcast/hardware/Makefile | 2 +- kernel/arch/dreamcast/hardware/ubc.c | 406 +++++++++++++++++++++ kernel/arch/dreamcast/include/dc/ubc.h | 399 ++++++++++++++++---- kernel/arch/dreamcast/kernel/init.c | 10 +- 10 files changed, 1113 insertions(+), 92 deletions(-) copy examples/dreamcast/basic/{threading/once => breaking}/Makefile (57%) create mode 100644 examples/dreamcast/basic/breaking/breaking.c create mode 100755 kernel/arch/dreamcast/hardware/ubc.c diff --git a/doc/CHANGELOG b/doc/CHANGELOG index 5ebce19b..62cd90d8 100644 --- a/doc/CHANGELOG +++ b/doc/CHANGELOG @@ -218,6 +218,7 @@ KallistiOS version 2.1.0 ----------------------------------------------- - DC Created separate performance counter driver and enhanced API [FG] - *** Implemented _POSIX_CPUTIME in clock_gettime() using perf counter timer [FG] - *** Implemented scandir() and alphasort() POSIX functions from dirent.h [FG] +- DC Added new driver for the SH4's UBC + high-level breakpoint API [FG] KallistiOS version 2.0.0 ----------------------------------------------- - DC Broadband Adapter driver fixes [Megan Potter == MP] diff --git a/examples/dreamcast/basic/Makefile b/examples/dreamcast/basic/Makefile index 45715c80..8c9132b7 100644 --- a/examples/dreamcast/basic/Makefile +++ b/examples/dreamcast/basic/Makefile @@ -1,7 +1,7 @@ # KallistiOS ##version## # # examples/dreamcast/basic/Makefile -# (c)2002 Megan Potter +# Copyright (C) 2002 Megan Potter # all: @@ -14,6 +14,7 @@ all: $(KOS_MAKE) -C stackprotector $(KOS_MAKE) -C memtest32 $(KOS_MAKE) -C watchdog + $(KOS_MAKE) -C breaking clean: $(KOS_MAKE) -C exec clean @@ -25,6 +26,7 @@ clean: $(KOS_MAKE) -C stackprotector clean $(KOS_MAKE) -C memtest32 clean $(KOS_MAKE) -C watchdog clean + $(KOS_MAKE) -C breaking clean dist: $(KOS_MAKE) -C exec dist @@ -36,3 +38,4 @@ dist: $(KOS_MAKE) -C stackprotector dist $(KOS_MAKE) -C memtest32 dist $(KOS_MAKE) -C watchdog dist + $(KOS_MAKE) -C breaking dist diff --git a/examples/dreamcast/basic/threading/once/Makefile b/examples/dreamcast/basic/breaking/Makefile similarity index 57% copy from examples/dreamcast/basic/threading/once/Makefile copy to examples/dreamcast/basic/breaking/Makefile index 52d83b34..87f96037 100644 --- a/examples/dreamcast/basic/threading/once/Makefile +++ b/examples/dreamcast/basic/breaking/Makefile @@ -1,11 +1,12 @@ # KallistiOS ##version## # -# basic/threading/once/Makefile -# Copyright (C) 2009 Lawrence Sebald +# examples/dreamcast/basic/breaking/Makefile +# Copyright (c) 2024 Falco Girgis # -TARGET = once_test.elf -OBJS = once_test.o +TARGET = breaking.elf +OBJS = breaking.o +KOS_CFLAGS += -std=gnu2x -Wno-strict-aliasing all: rm-elf $(TARGET) @@ -18,7 +19,7 @@ rm-elf: -rm -f $(TARGET) $(TARGET): $(OBJS) - kos-cc -o $(TARGET) $(OBJS) + kos-cc -o $(TARGET) $(OBJS) -lm run: $(TARGET) $(KOS_LOADER) $(TARGET) @@ -26,4 +27,3 @@ run: $(TARGET) dist: $(TARGET) -rm -f $(OBJS) $(KOS_STRIP) $(TARGET) - diff --git a/examples/dreamcast/basic/breaking/breaking.c b/examples/dreamcast/basic/breaking/breaking.c new file mode 100644 index 00000000..7564bb15 --- /dev/null +++ b/examples/dreamcast/basic/breaking/breaking.c @@ -0,0 +1,358 @@ +/* KallistiOS ##version## + + breaking.c + Copyright (C) 2024 Falco Girgis + +*/ + +/* This program serves as an example for using the API around the SH4's "User + Break Controller" to create and manage breakpoints. It was also written to + serve as a series of automatable tests validating the implementation of the + driver in KOS. + + The following breakpoint configurations are tested: + - breaking on instructions + - breaking on reading from a region of memory + - breaking on writing a particular value with a particular sized access + to a memory location + - breaking on accessing a region of memory with a particular sized + access with a particular range of values + - sequential breaking on accessing an instruction followed by + accessing a region of memory with a particular sized access with a + particular range of values +*/ + +#include <dc/ubc.h> + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <stdalign.h> +#include <stdatomic.h> + +/* Convenience macro we use throughout the test suite to ensure our breakpoint + has or has not fired as expected at the given point in program execution. */ +#define VERIFY(expr) \ + do { \ + if(!(expr)) { \ + fprintf(stderr, "%s failed at %s:%d!\n", \ + #expr, __FUNCTION__, __LINE__); \ + return false; \ + } \ + } while(0); + +/* Atomic used to flag whether our breakpoint has been handled. */ +static atomic_bool handled = false; + +/* Callback function used to handle a breakpoint request. */ +static bool on_break(const ubc_breakpoint_t *bp, + const irq_context_t *ctx, + void *ud) { + /* Signal to the outside that the breakpoint has been handled. */ + handled = true; + + /* Print the location of the program counter when the breakpoint + IRQ was signaled (minus 2 if we're breaking AFTER instruction + execution!) */ + printf("\tBREAKPOINT HIT! [PC = %x]\n", (unsigned)CONTEXT_PC(*ctx) - 2); + + /* Userdata pointer used to hold a boolean used as the return value, which + dictates whether a breakpoint persists or is removed after being + handled. */ + return (bool)ud; +} + +/* Dummy test function used as breakpoint instruction target. */ +static __noinline int test_function(const char *str1, const char* str2) { + return strcmp(str1, str2); +} + +/* Configures and validates a generic breakpoint on an instruction address. */ +static bool break_on_instruction(void) { + /* Create a bare-minimal breakpoint which will break on any access to its + address. */ + const ubc_breakpoint_t bp = { + .address = test_function, /* Address of interest */ + }; + + /* Reset our breakpoint handler flag. */ + handled = false; + + printf("Breaking on instruction...\n"); + + /* Add the breakpoint with our handler and our userdata */ + VERIFY(ubc_add_breakpoint(&bp, on_break, (void *)true)); + + /* Call our test_function, which should trigger the breakpoint! */ + volatile int result = test_function("Sega", "Nintendo"); + (void)result; + + /* BREAKPOINT EXPECTED HERE! */ + + /* Verify our breakpoint was actually handled. */ + VERIFY(handled); + + printf("\tSUCCESS!\n"); + + return true; +} + +/* Configures and validates a read-only data watchpoint on a range of + addresses. */ +static bool break_on_data_region_read(void) { + char upper_boundary = 0; + alignas(1024) char vars[1024]; + char lower_boundary = 0; + + /* Creates a data breakpoint for anything that does a read from an address + that matches the upper 22 bits of "vars." */ + const ubc_breakpoint_t bp = { + /* Address of interest */ + .address = vars, + /* Low address bits to ignore, creating an address range */ + .address_mask = ubc_address_mask_10, + /* Operand/Data access only */ + .access = ubc_access_operand, + /* Operand-access breakpoint settings */ + .operand = { + /* Read-only */ + .rw = ubc_rw_read + } + }; + + handled = false; + + printf("Breaking on data region read...\n"); + + VERIFY(ubc_add_breakpoint(&bp, on_break, (void *)false)); + + /* Read from above the specified range. */ + volatile char temp; + temp = upper_boundary; (void)temp; + VERIFY(!handled); + + /* Read from below the specified range. */ + temp = lower_boundary; + VERIFY(!handled); + + /* Write to the specified range. */ + vars[512] = 1; + VERIFY(!handled); + + /* Read from the start of the specified range. */ + temp = vars[0]; + VERIFY(handled); + handled = false; + + /* Read from the middle of the specified range. */ + temp = vars[512]; + VERIFY(handled); + handled = false; + + /* Read from the end of the specified range. */ + temp = vars[1023]; + VERIFY(handled); + + VERIFY(ubc_remove_breakpoint(&bp)); + + printf("\tSUCCESS!\n"); + + return true; +} + +/* Configures and validates a data watchpoint looking for a particular value + to be written to a particular address as a particular size. */ +static bool break_on_sized_data_write_value(void) { + uint16_t var; + + /* Create a write-only data breakpoint on the address of "var," looking for + the value of `3` to be written. */ + const ubc_breakpoint_t bp = { + .address = &var, /* address to break on */ + .access = ubc_access_operand, /* instruction, operand, or both */ + .operand = { + .rw = ubc_rw_write, /* read, write, or both */ + .size = ubc_size_16bit, /* 8, 16, 32, 64-bit, or any */ + .data = { + .enabled = true, /* turn on data comparison */ + .value = 3 /* data to compare */ + } + } + }; + + handled = false; + + printf("Breaking on sized data write with value...\n"); + + VERIFY(ubc_add_breakpoint(&bp, on_break, (void *)true)); + + volatile uint16_t tmp; + tmp = var; (void)tmp; + VERIFY(!handled); /* We only did a read. */ + + var = 43; + VERIFY(!handled); /* We wrote the wrong value. */ + + *(uint8_t*)&var = 3; + VERIFY(!handled); /* We accessed it as the wrong size. */ + + var = 3; + /* BREAKPOINT SHOULD TRIGGER HERE! */ + VERIFY(handled); /* We wrote right value as the right size! */ + + printf("\tSUCCESS!\n"); + + return true; +} + +/* Watching for a read or write of a certain size, of a range of values, to or + from a region of memory. */ +static bool break_on_sized_operand_region_access_value_range(void) { + uint32_t upper_boundary = 0; + alignas(1024) uint32_t vars[1024 / sizeof(uint32_t)]; + uint32_t lower_boundary = 0; + + /* Create a read/write data breakpoint which looks for a sized operand + access to or from a range of addresses with a range of values. */ + const ubc_breakpoint_t bp = { + .address = vars, /* address to break on */ + .address_mask = ubc_address_mask_10, /* create address range */ + .access = ubc_access_operand, /* break on data access */ + .operand = { + .size = ubc_size_32bit, /* break on dword accesses */ + .data = { + .enabled = true, /* turn on data comparison */ + .value = 0x7ff, /* data to compare */ + .mask = 0x3 /* mask off 2 bits to create a value range */ + } + } + }; + + handled = false; + + printf("Breaking on sized operand region access with value range...\n"); + + VERIFY(ubc_add_breakpoint(&bp, on_break, (void *)false)); + + /* Read just above the region-of-interest. */ + volatile uint32_t tmp32; + tmp32 = upper_boundary; (void)tmp32; + VERIFY(!handled); + + /* Write just below the region-of-interest. */ + lower_boundary = tmp32; (void)lower_boundary; + VERIFY(!handled); + + /* Write to the region-of-interest as the wrong data size. */ + *(bool *)vars = 0x3; + VERIFY(!handled); + + /* Read from the region-of-interest as the wrong data size. */ + volatile uint16_t tmp16; (void)tmp16; + tmp16 = ((uint16_t *)vars)[1023 / sizeof(uint16_t)]; + VERIFY(!handled); + + /* Write to the region-of-interest an incorrect value. */ + vars[512 / sizeof(uint32_t)] = 0x8fd; + VERIFY(!handled); + + /* Write to the region-of-interest an incorrect value. */ + vars[512 / sizeof(uint32_t)] = 0x3; + VERIFY(!handled); + + /* Write to the region-of-interest an in-range value. */ + vars[512 / sizeof(uint32_t)] = 0x7ff; + VERIFY(handled); + handled = false; + + /* Write to the region-of-interest an in-range value. */ + vars[512 / sizeof(uint32_t)] = 0x7fd; + VERIFY(handled); + handled = false; + + /* Read from the region-of-interest an in-range value. */ + tmp32 = vars[512 / sizeof(uint32_t)]; + VERIFY(handled); + + VERIFY(ubc_remove_breakpoint(&bp)); + + printf("\tSUCCESS!\n"); + + return true; +} + +/* Configure and validate a sequential breakpoint. */ +bool break_on_sequence(void) { + alignas(1024) static uint32_t vars[1024 / sizeof(uint32_t)]; + + /* Create a sequential breakpoint on the conditions: + a. instruction - break on test_function + b. operand - break on writing value range to data range */ + VERIFY(ubc_add_breakpoint(&(static ubc_breakpoint_t) { + /* Address of first breakpoint */ + .address = test_function, + /* Second breakpoint in the sequence */ + .next = &(static ubc_breakpoint_t) { + .address = &vars, + .address_mask = ubc_address_mask_10, + .access = ubc_access_operand, + .operand = { + .rw = ubc_rw_write, + .size = ubc_size_32bit, + .data = { + .enabled = true, + .value = 0x7fc, + .mask = 0x3 + } + }, + } + }, + on_break, + (void *)true)); + + /* Reset whether we've been handled. */ + handled = false; + + printf("Breaking on sequence...\n"); + + vars[0] = 0xfc; + VERIFY(!handled); /* Wrote wrong value without condition A first */ + + test_function("Sega", "Sony"); + VERIFY(!handled); /* Hit condition A, but not B. */ + + *(uint16_t *)vars = 0x7fd; + VERIFY(!handled); /* Wrote wrong value as wrong sized type .*/ + + vars[512 / sizeof(uint32_t)] = 0xfc; + VERIFY(!handled); /* Wrote wrong value. */ + + vars[0] = 0x7fc; + VERIFY(handled); /* Wrote correct value, fulfilling condition B */ + + printf("\tSUCCESS!\n"); + + return true; +} + +/* Program entry point. */ +int main(int argc, char* argv[]) { + bool success = true; + + printf("Testing breakpoints...\n\n"); + + /* Run test cases and accumulate results. */ + success &= break_on_instruction(); + success &= break_on_data_region_read(); + success &= break_on_sized_data_write_value(); + success &= break_on_sized_operand_region_access_value_range(); + success &= break_on_sequence(); + + if(success) { + printf("\n***** Breakpoint Test: SUCCESS *****\n"); + return EXIT_SUCCESS; + } else { + fprintf(stderr, "\n***** Breakpoint Test: FAILURE *****\n"); + return EXIT_FAILURE; + } +} diff --git a/include/kos/cdefs.h b/include/kos/cdefs.h index 20407755..9e34f13a 100644 --- a/include/kos/cdefs.h +++ b/include/kos/cdefs.h @@ -155,10 +155,15 @@ #endif #ifndef __always_inline -/** \brief Ask the compiler to always inline a given function. */ +/** \brief Ask the compiler to \a always inline a given function. */ #define __always_inline inline __attribute__((__always_inline__)) #endif +#ifndef __no_inline +/** \brief Ask the compiler to \a never inline a given function. */ +#define __no_inline __attribute__((__noinline__)) +#endif + /* GCC macros for special cases */ /* #if __GNUC__ == */ diff --git a/include/kos/iovec.h b/include/kos/iovec.h index f3ac8244..64322f41 100644 --- a/include/kos/iovec.h +++ b/include/kos/iovec.h @@ -7,6 +7,7 @@ /** \file kos/iovec.h \brief Deprecated header file for I/O scatter/gather arrays. + \deprecated See <sys/uio.h> for what used to be here. */ @@ -16,7 +17,9 @@ #include <sys/uio.h> -/** \brief Compatibility typedef for old code. */ +/** \brief Compatibility typedef for old code. + \deprecated +*/ typedef struct iovec iovec_t; #endif /* __KOS_IOVEC_H */ diff --git a/kernel/arch/dreamcast/hardware/Makefile b/kernel/arch/dreamcast/hardware/Makefile index 460e6067..297c4493 100644 --- a/kernel/arch/dreamcast/hardware/Makefile +++ b/kernel/arch/dreamcast/hardware/Makefile @@ -25,7 +25,7 @@ OBJS += asic.o g2bus.o ...<truncated>... hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: ljsebald <ljs...@us...> - 2024-01-29 01:05: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 e309ccb1c6363de8cbe8206a1ed7f307b27bef2d (commit) from b4f08e249a11a45bc25f7c824ce7f8d341ec37ea (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 e309ccb1c6363de8cbe8206a1ed7f307b27bef2d Author: Donald Haase <qu...@ya...> Date: Sun Jan 28 20:04:59 2024 -0500 Refactor Multibuffered video modes (#419) * Update video.c to remove the multibuffer duplication. * Add an example of multibuffer use. * Initialize the FB array generically * Updates to style, comments, changelog, authors, and color-generation for multibuffer * Translate all vid_mode values to be consistently in decimal. * Do away with explicit FBPOS values. Instead fill vram with as many framebuffers as possible. * Remove 800x600 * Clear merge conflict * Clarifying the setting of BITMAP_Y * If CT_VGA VID_INTERLACE is always cleared, so it's pointless here * Remove magic, group blanking functions * Clean up example and add it to the video folder makefile * Fix comment. * Correct video.h comment * Clean up example makefile * Add various convenience functions and update function documentation related to multibuffers. * Ensure fb_size is always set, remove magic, fix comments. * Restore border clearing and remove unused variable. * Cleaning up to stdint types. * Set up pixel mode enum. * Clean up some comments, formatting, and stray old format vars. * Forgot to update the exports with the new functions. * Clarifying a comment * Tiny Doxygen fix. - A subgroup of related #defines became an enum. * Update vid_enabled/vid_disabled * Update types for 8-bit color values * Correct type references I had missed * Clean up includes. * Apply suggestions from code review ----------------------------------------------------------------------- Summary of changes: AUTHORS | 2 +- doc/CHANGELOG | 2 + examples/dreamcast/video/Makefile | 3 + examples/dreamcast/video/multibuffer/Makefile | 28 ++ examples/dreamcast/video/multibuffer/multibuffer.c | 60 +++ kernel/arch/dreamcast/exports-naomi.txt | 14 +- kernel/arch/dreamcast/exports-pristine.txt | 14 +- kernel/arch/dreamcast/hardware/biosfont.c | 1 - kernel/arch/dreamcast/hardware/pvr/pvr_irq.c | 3 - kernel/arch/dreamcast/hardware/video.c | 448 +++++++-------------- kernel/arch/dreamcast/include/dc/video.h | 184 +++++---- 11 files changed, 381 insertions(+), 378 deletions(-) create mode 100644 examples/dreamcast/video/multibuffer/Makefile create mode 100644 examples/dreamcast/video/multibuffer/multibuffer.c diff --git a/AUTHORS b/AUTHORS index 163b5384..65244f5b 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 +Donald Haase: 2008, 2014, 2023 Andrew Kieschnick: 2000, 2001, 2002, 2003 Jordan DeLong: 2000, 2001, 2002 Bero: 2002 diff --git a/doc/CHANGELOG b/doc/CHANGELOG index cc074cd6..5ebce19b 100644 --- a/doc/CHANGELOG +++ b/doc/CHANGELOG @@ -213,6 +213,8 @@ KallistiOS version 2.1.0 ----------------------------------------------- - DC Improved performance of IRQ context save / restore [PC] - DC Increased resolution of TMU timers + date/time functions [FG && PC] - *** Increased resolution of clock() and CLOCKS_PER_SEC to microseconds [FG] +- DC Added centralized header for Dreamcast Memory map (arch/memory.h) [DH] +- DC Refactored multibuffer video modes and added example of their use [DH] - DC Created separate performance counter driver and enhanced API [FG] - *** Implemented _POSIX_CPUTIME in clock_gettime() using perf counter timer [FG] - *** Implemented scandir() and alphasort() POSIX functions from dirent.h [FG] diff --git a/examples/dreamcast/video/Makefile b/examples/dreamcast/video/Makefile index 9fc9ac7f..27c19c24 100644 --- a/examples/dreamcast/video/Makefile +++ b/examples/dreamcast/video/Makefile @@ -8,13 +8,16 @@ all: $(KOS_MAKE) -C bfont $(KOS_MAKE) -C palmenu $(KOS_MAKE) -C minifont + $(KOS_MAKE) -C multibuffer clean: $(KOS_MAKE) -C bfont clean $(KOS_MAKE) -C palmenu clean $(KOS_MAKE) -C minifont clean + $(KOS_MAKE) -C multibuffer dist: $(KOS_MAKE) -C bfont dist $(KOS_MAKE) -C palmenu dist $(KOS_MAKE) -C minifont dist + $(KOS_MAKE) -C multibuffer diff --git a/examples/dreamcast/video/multibuffer/Makefile b/examples/dreamcast/video/multibuffer/Makefile new file mode 100644 index 00000000..30b6b663 --- /dev/null +++ b/examples/dreamcast/video/multibuffer/Makefile @@ -0,0 +1,28 @@ +# KallistiOS ##version## +# +# video/multibuffer/Makefile +# Copyright (C) 2023 Donald Haase +# + +TARGET = multibuffer.elf +OBJS = multibuffer.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 $(TARGET) $(OBJS) + +run: $(TARGET) + $(KOS_LOADER) $(TARGET) + +dist: $(TARGET) + -rm -f $(OBJS) + $(KOS_STRIP) $(TARGET) diff --git a/examples/dreamcast/video/multibuffer/multibuffer.c b/examples/dreamcast/video/multibuffer/multibuffer.c new file mode 100644 index 00000000..8cf08f8e --- /dev/null +++ b/examples/dreamcast/video/multibuffer/multibuffer.c @@ -0,0 +1,60 @@ +/* KallistiOS ##version## + + multibuffer.c + Copyright (C) 2023 Donald Haase + +*/ + +/* + This example is based off a combination of the libdream video examples and + the bfont examples. It draws out four distinct framebuffers then rotates + between them until stopped. + + */ + +#include <kos.h> + +int main(int argc, char **argv) { + unsigned short x, y, mb; + char text_buff [20]; + + /* Press all buttons to exit */ + cont_btn_callback(0, CONT_START | CONT_A | CONT_B | CONT_X | CONT_Y, + (cont_btn_callback_t)arch_exit); + + + /* Set the video mode */ + vid_set_mode(DM_640x480 | DM_MULTIBUFFER, PM_RGB565); + + /* Cycle through each frame buffer populating it with different + patterns and text labelling it. */ + for(mb = 0; mb < vid_mode->fb_count; mb++) { + + for(y = 0; y < 480; y++) { + for(x = 0; x < 640; x++) { + int c = (x ^ y) & 0xff; + vram_s[y * 640 + x] = ( ((c >> 3) << 12) + | ((c >> 2) << 5) + | ((c >> 3) << (mb % 5))) & 0xffff; + } + } + + snprintf(text_buff, 20, "This is FB %u", (mb + 1) % vid_mode->fb_count); + bfont_draw_str(vram_s + (640 * BFONT_HEIGHT) + (BFONT_THIN_WIDTH * 2), 640, 1, text_buff); + + /* This tells the pvr to move to the framebuffer we've been drawing to, + then adjusts the vram_* pointers to the next one. */ + vid_flip(-1); + } + + printf("\n\nPress all buttons simultaneously to exit.\n"); + fflush(stdout); + + /* Now flip through each frame until stopped, waiting a bit each time. */ + while(1) { + vid_flip(-1); + timer_spin_sleep(1500); + } + + return 0; +} diff --git a/kernel/arch/dreamcast/exports-naomi.txt b/kernel/arch/dreamcast/exports-naomi.txt index 181b33c3..74591a67 100644 --- a/kernel/arch/dreamcast/exports-naomi.txt +++ b/kernel/arch/dreamcast/exports-naomi.txt @@ -141,19 +141,25 @@ snd_pcm8_split snd_adpcm_split # Video -vid_check_cable +vid_mode vram_s vram_l -vid_mode -vid_set_mode -vid_set_mode_ex +vid_check_cable +vid_set_vram vid_set_start +vid_get_start +vid_set_fb vid_flip vid_border_color vid_clear vid_empty +vid_get_enabled +vid_set_enabled vid_waitvbl +vid_set_mode +vid_set_mode_ex vid_init +vid_shutdown # Maple cont_btn_callback diff --git a/kernel/arch/dreamcast/exports-pristine.txt b/kernel/arch/dreamcast/exports-pristine.txt index 6b880627..976ca49d 100644 --- a/kernel/arch/dreamcast/exports-pristine.txt +++ b/kernel/arch/dreamcast/exports-pristine.txt @@ -184,19 +184,25 @@ snd_pcm8_split snd_adpcm_split # Video -vid_check_cable +vid_mode vram_s vram_l -vid_mode -vid_set_mode -vid_set_mode_ex +vid_check_cable +vid_set_vram vid_set_start +vid_get_start +vid_set_fb vid_flip vid_border_color vid_clear vid_empty +vid_get_enabled +vid_set_enabled vid_waitvbl +vid_set_mode +vid_set_mode_ex vid_init +vid_shutdown # Maple cont_btn_callback diff --git a/kernel/arch/dreamcast/hardware/biosfont.c b/kernel/arch/dreamcast/hardware/biosfont.c index e10c61d8..a8b9c3c1 100644 --- a/kernel/arch/dreamcast/hardware/biosfont.c +++ b/kernel/arch/dreamcast/hardware/biosfont.c @@ -9,7 +9,6 @@ #include <assert.h> #include <dc/biosfont.h> -#include <dc/video.h> #include <kos/dbglog.h> /* diff --git a/kernel/arch/dreamcast/hardware/pvr/pvr_irq.c b/kernel/arch/dreamcast/hardware/pvr/pvr_irq.c index 9259bb5b..1873076b 100644 --- a/kernel/arch/dreamcast/hardware/pvr/pvr_irq.c +++ b/kernel/arch/dreamcast/hardware/pvr/pvr_irq.c @@ -7,7 +7,6 @@ #include <assert.h> #include <dc/pvr.h> -#include <dc/video.h> #include <dc/asic.h> #include <arch/cache.h> #include "pvr_internal.h" @@ -236,5 +235,3 @@ void pvr_int_handler(uint32 code) { dma_next_list(0); } } - - diff --git a/kernel/arch/dreamcast/hardware/video.c b/kernel/arch/dreamcast/hardware/video.c index af1e608a..73551fed 100644 --- a/kernel/arch/dreamcast/hardware/video.c +++ b/kernel/arch/dreamcast/hardware/video.c @@ -2,8 +2,9 @@ video.c - (c)2001 Anders Clerwall (scav) - Parts (c)2000-2001 Megan Potter + Copyright (C) 2001 Anders Clerwall (scav) + Copyright (C) 2000-2001 Megan Potter + Copyright (C) 2023-2024 Donald Haase */ #include <dc/video.h> @@ -12,14 +13,15 @@ #include <string.h> #include <stdio.h> -#define FBPOS(n) (n * 0x200000) +/* The size of the vram. TODO: This needs a better home */ +#define PVR_MEM_SIZE 0x800000 /*-----------------------------------------------------------------------------*/ /* This table is indexed w/ DM_* */ vid_mode_t vid_builtin[DM_MODE_COUNT] = { /* NULL mode.. */ /* DM_INVALID = 0 */ - { 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, { 0, 0, 0, 0 } }, + { 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0 }, /* 320x240 VGA 60Hz */ /* DM_320x240_VGA */ @@ -30,12 +32,11 @@ vid_mode_t vid_builtin[DM_MODE_COUNT] = { CT_VGA, 0, 262, 857, - 0xAC, 0x28, - 0x15, 0x104, + 172, 40, + 21, 260, 141, 843, 24, 263, - 0, 1, - { 0, 0, 0, 0 } + 0, 1, 0 }, /* 320x240 NTSC 60Hz */ @@ -47,12 +48,11 @@ vid_mode_t vid_builtin[DM_MODE_COUNT] = { CT_ANY, 0, 262, 857, - 0xA4, 0x18, - 0x15, 0x104, + 164, 24, + 21, 260, 141, 843, 24, 263, - 0, 1, - { 0, 0, 0, 0 } + 0, 1, 0 }, /* 640x480 VGA 60Hz */ @@ -60,16 +60,15 @@ vid_mode_t vid_builtin[DM_MODE_COUNT] = { { DM_640x480, 640, 480, - VID_INTERLACE, + 0, CT_VGA, 0, - 0x20C, 0x359, - 0xAC, 0x28, - 0x15, 0x104, - 0x7E, 0x345, - 0x24, 0x204, - 0, 1, - { 0, 0, 0, 0 } + 524, 857, + 172, 40, + 21, 260, + 126, 837, + 36, 516, + 0, 1, 0 }, /* 640x480 NTSC 60Hz IL */ @@ -80,13 +79,12 @@ vid_mode_t vid_builtin[DM_MODE_COUNT] = { VID_INTERLACE, CT_ANY, 0, - 0x20C, 0x359, - 0xA4, 0x12, - 0x15, 0x104, - 0x7E, 0x345, - 0x24, 0x204, - 0, 1, - { 0, 0, 0, 0 } + 524, 857, + 164, 18, + 21, 260, + 126, 837, + 36, 516, + 0, 1, 0 }, /* 640x480 PAL 50Hz IL */ @@ -97,13 +95,12 @@ vid_mode_t vid_builtin[DM_MODE_COUNT] = { VID_INTERLACE | VID_PAL, CT_ANY, 0, - 0x270, 0x35F, - 0xAE, 0x2D, - 0x15, 0x104, - 0x8D, 0x34B, - 0x2C, 0x26C, - 0, 1, - { 0, 0, 0, 0 } + 624, 863, + 174, 45, + 21, 260, + 141, 843, + 44, 620, + 0, 1, 0 }, /* 256x256 PAL 50Hz IL (seems to output the same w/o VID_PAL, ie. in NTSC IL mode) */ @@ -116,11 +113,10 @@ vid_mode_t vid_builtin[DM_MODE_COUNT] = { 0, 624, 863, 226, 37, - 0x15, 0x104, - 0x8D, 0x34B, - 0x2C, 0x26C, - 0, 1, - { 0, 0, 0, 0 } + 21, 260, + 141, 843, + 44, 620, + 0, 1, 0 }, /* 768x480 NTSC 60Hz IL (thanks DCGrendel) */ @@ -133,11 +129,10 @@ vid_mode_t vid_builtin[DM_MODE_COUNT] = { 0, 524, 857, 96, 18, - 0x15, 0x104, - 0x2e, 0x345, - 0x24, 0x204, - 0, 1, - { 0, 0, 0, 0 } + 21, 260, + 46, 837, + 36, 516, + 0, 1, 0 }, /* 768x576 PAL 50Hz IL (DCG) */ @@ -150,11 +145,10 @@ vid_mode_t vid_builtin[DM_MODE_COUNT] = { 0, 624, 863, 88, 16, - 0x18, 0x104, - 0x36, 0x34b, - 0x2c, 0x26c, - 0, 1, - { 0, 0, 0, 0 } + 24, 260, + 54, 843, + 44, 620, + 0, 1, 0 }, /* 768x480 PAL 50Hz IL */ @@ -167,11 +161,10 @@ vid_mode_t vid_builtin[DM_MODE_COUNT] = { 0, 624, 863, 88, 16, - 0x18, 0x104, - 0x36, 0x34b, - 0x2c, 0x26c, - 0, 1, - { 0, 0, 0, 0 } + 24, 260, + 54, 843, + 44, 620, + 0, 1, 0 }, /* 320x240 PAL 50Hz (thanks Marco Martins aka Mekanaizer) */ @@ -187,188 +180,12 @@ vid_mode_t vid_builtin[DM_MODE_COUNT] = { 21, 260, 141, 843, 44, 620, - 0, 1, - { 0, 0, 0, 0 } - }, - - /* All of the modes below this comment are exactly the same as the ones - above, other than that they support multiple framebuffers (in the current - case, 4). They're only particularly useful if you're doing a drawing by - directly writing to the framebuffer, and are not useful at all if you're - using the PVR to do your drawing. */ - /* 320x240 VGA 60Hz */ - /* DM_320x240_VGA_MB */ - { - DM_320x240 | DM_MULTIBUFFER, - 320, 240, - VID_PIXELDOUBLE | VID_LINEDOUBLE, - CT_VGA, - 0, - 262, 857, - 0xAC, 0x28, - 0x15, 0x104, - 141, 843, - 24, 263, - 0, VID_MAX_FB, - { FBPOS(0), FBPOS(1), FBPOS(2), FBPOS(3) } - }, - - /* 320x240 NTSC 60Hz */ - /* DM_320x240_NTSC_MB */ - { - DM_320x240 | DM_MULTIBUFFER, - 320, 240, - VID_PIXELDOUBLE | VID_LINEDOUBLE, - CT_ANY, - 0, - 262, 857, - 0xA4, 0x18, - 0x15, 0x104, - 141, 843, - 24, 263, - 0, VID_MAX_FB, - { FBPOS(0), FBPOS(1), FBPOS(2), FBPOS(3) } - }, - - /* 640x480 VGA 60Hz */ - /* DM_640x480_VGA_MB */ - { - DM_640x480 | DM_MULTIBUFFER, - 640, 480, - VID_INTERLACE, - CT_VGA, - 0, - 0x20C, 0x359, - 0xAC, 0x28, - 0x15, 0x104, ...<truncated>... hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: ljsebald <ljs...@us...> - 2024-01-29 00:42: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 b4f08e249a11a45bc25f7c824ce7f8d341ec37ea (commit) via 80890464370a53d81440d89d6a4f5a23657717f5 (commit) via ff85adae6f2f1078b5c3fbfe306adf6503f7395d (commit) via 78d530d389e8924a492b89fb522475465c8422b0 (commit) from 1162af57fab083584c7b6c0e553cbcb15723424a (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 b4f08e249a11a45bc25f7c824ce7f8d341ec37ea Author: Andy Barajas <and...@gm...> Date: Sun Jan 28 16:41:24 2024 -0800 Pull out sq fast path assembly to its own file (#475) * Pull out assembly function to its own file * Exit sq_cpy early if n is 0 * Removed use of extra register * One less cycle per loop commit 80890464370a53d81440d89d6a4f5a23657717f5 Author: Falco Girgis <gyr...@gm...> Date: Sun Jan 28 18:28:55 2024 -0600 Implement POSIX scandir() + alphasort() for dirent.h (#453) * Initial scandir implementation - Modified dirent.h to add RESTRICT keyword as in the standard, added declaration for alphasort(), made dirent::d_name[] a FAM, with DIR actually giving it a static size of NAME_MAX. - Modified readdir() to use the new FAM mechanism for dirent::d_name[] when copying over directory names - Added an initial implementation for POSIX scandir() and alphasort() * STILL TESTING AND WIP. * scandir() and alphasort() done and tested - added BSD/glibc dirent type #defines to dirent.h, so that we could stop using magic numbers within the source file - fixed a few issues with scandir() - documented scandir() and alphasort() - ensured proper error behavior for scandir() with directories that don't exist or non-directory file types - ensured no memory leaks via INIT_MALLOCSTATS - ensured scandir() handles out-of-memory errors gracefully, freeing resources, setting errno, and returning -1 correctly * Removed an unused include leftover from debugging. * Removed another leftover include from debugging. * Fixed doxygen comments on dirent.h types. commit ff85adae6f2f1078b5c3fbfe306adf6503f7395d Merge: 1162af57 78d530d3 Author: Lawrence Sebald <ljs...@us...> Date: Sun Jan 28 19:17:25 2024 -0500 Merge pull request #472 from KallistiOS/assert_doxygen Added doxygen category for assertion handlers commit 78d530d389e8924a492b89fb522475465c8422b0 Author: Falco Girgis <gyr...@gm...> Date: Sat Jan 27 02:19:29 2024 -0600 Added doxygen category for assertion handlers - Added custom assertion handling to the "Debugging" category under doxygen, because it's another useful thing users can do... ----------------------------------------------------------------------- Summary of changes: doc/CHANGELOG | 1 + include/assert.h | 24 +++- include/sys/dirent.h | 125 +++++++++++++++++---- kernel/arch/dreamcast/hardware/Makefile | 2 +- kernel/arch/dreamcast/hardware/sq.c | 43 ++----- kernel/arch/dreamcast/hardware/sq_fast_cpy.s | 46 ++++++++ kernel/arch/dreamcast/include/dc/sq.h | 33 +++++- kernel/libc/koslib/readdir.c | 14 +-- kernel/libc/koslib/scandir.c | 162 +++++++++++++++++++++++++-- 9 files changed, 363 insertions(+), 87 deletions(-) create mode 100644 kernel/arch/dreamcast/hardware/sq_fast_cpy.s diff --git a/doc/CHANGELOG b/doc/CHANGELOG index 07a3840a..cc074cd6 100644 --- a/doc/CHANGELOG +++ b/doc/CHANGELOG @@ -215,6 +215,7 @@ KallistiOS version 2.1.0 ----------------------------------------------- - *** Increased resolution of clock() and CLOCKS_PER_SEC to microseconds [FG] - DC Created separate performance counter driver and enhanced API [FG] - *** Implemented _POSIX_CPUTIME in clock_gettime() using perf counter timer [FG] +- *** Implemented scandir() and alphasort() POSIX functions from dirent.h [FG] KallistiOS version 2.0.0 ----------------------------------------------- - DC Broadband Adapter driver fixes [Megan Potter == MP] diff --git a/include/assert.h b/include/assert.h index a1c9dff7..fc7e78ec 100644 --- a/include/assert.h +++ b/include/assert.h @@ -1,7 +1,7 @@ /* KallistiOS ##version## assert.h - Copyright (C)2002,2004 Megan Potter + Copyright (C) 2002, 2004 Megan Potter */ @@ -12,8 +12,9 @@ __BEGIN_DECLS /** - \file assert.h - \brief Standard C Assertions + \file assert.h + \brief Standard C Assertions + \ingroup assertions This file contains the standard C assertions to raise an assertion or to change the assertion handler. @@ -21,10 +22,25 @@ __BEGIN_DECLS \author Megan Potter */ +/** \defgroup assertions Assertions + \brief assert() management and custom handlers + \ingroup debugging + + KOS maps the standard C assert() mechanism to a default implementation + which logs the failed expression as well as the source code context. + A secondary assertion mechanism, assert_msg() is also provided for adding + a cusom message. You may also override KOS's assertion handler and replace + it with your own via assert_set_handler(). + + @{ +*/ + /* This is nice and simple, modeled after the BSD one like most of KOS; the addition here is assert_msg(), which allows you to provide an error message. */ +/** \cond */ #define _assert(e) assert(e) +/** \endcond */ #ifdef NDEBUG # define assert(e) ((void)0) @@ -105,6 +121,8 @@ typedef void (*assert_handler_t)(const char * file, int line, const char * expr, */ assert_handler_t assert_set_handler(assert_handler_t hnd); +/** @} */ + __END_DECLS #endif /* __ASSERT_H */ diff --git a/include/sys/dirent.h b/include/sys/dirent.h index f9e208f1..ec4bedec 100644 --- a/include/sys/dirent.h +++ b/include/sys/dirent.h @@ -2,6 +2,7 @@ dirent.h Copyright (C) 2003 Megan Potter + Copyright (C) 2024 Falco Girgis */ @@ -12,6 +13,7 @@ This partially implements the standard POSIX dirent.h functionality. \author Megan Potter + \author Falco Girgis */ #ifndef __SYS_DIRENT_H @@ -22,13 +24,36 @@ __BEGIN_DECLS #include <unistd.h> -#include <arch/types.h> +#include <stdint.h> #include <kos/fs.h> +#include <kos/limits.h> /** \addtogroup vfs_posix @{ */ +/** \name Directory File Types + \brief POSIX file types for dirent::d_name + + \remark + These directory entry types are not part of the POSIX specifican per-se, + but are used by BSD and glibc. + + \todo Ensure each VFS driver maps its directory types accordingly + + @{ +*/ +#define DT_UNKNOWN 0 /**< \brief Unknown */ +#define DT_FIFO 1 /**< \brief Named Pipe or FIFO */ +#define DT_CHR 2 /**< \brief Character Device */ +#define DT_DIR 4 /**< \brief Directory */ +#define DT_BLK 6 /**< \brief Block Device */ +#define DT_REG 8 /**< \brief Regular File */ +#define DT_LNK 10 /**< \brief Symbolic Link */ +#define DT_SOCK 12 /**< \brief Local-Domain Socket */ +#define DT_WHT 14 /**< \brief Whiteout (ignored) */ +/** @} */ + /** \brief POSIX directory entry structure. This structure contains information about a single entry in a directory in @@ -37,11 +62,11 @@ __BEGIN_DECLS \headerfile sys/dirent.h */ struct dirent { - int d_ino; /**< \brief File unique identifier. */ - off_t d_off; /**< \brief File offset */ - uint16 d_reclen; /**< \brief Record length */ - uint8 d_type; /**< \brief File type */ - char d_name[256]; /**< \brief Filename */ + int d_ino; /**< \brief File unique identifier. */ + off_t d_off; /**< \brief File offset */ + uint16_t d_reclen; /**< \brief Record length */ + uint8_t d_type; /**< \brief File type */ + char d_name[]; /**< \brief Filename */ }; /** \brief Type representing a directory stream. @@ -55,8 +80,9 @@ struct dirent { \headerfile sys/dirent.h */ typedef struct { - file_t fd; /**< \brief File descriptor for the directory */ - struct dirent d_ent; /**< \brief Current directory entry */ + file_t fd; /**< \brief File descriptor for the directory */ + struct dirent d_ent; /**< \brief Current directory entry */ + char d_name[NAME_MAX]; /**< \brief Filename */ } DIR; // Standard UNIX dir functions. Not all of these are fully functional @@ -67,12 +93,14 @@ typedef struct { The directory specified is opened if it exists. A directory stream object is returned for accessing the entries of the directory. - \param name The name of the directory to open. - \return A directory stream object to be used with readdir() on - success, NULL on failure. Sets errno as appropriate. \note As with other functions for opening files on the VFS, relative paths are permitted for the name parameter of this function. + + \param name The name of the directory to open. + + \return A directory stream object to be used with readdir() on + success, NULL on failure. Sets errno as appropriate. \see closedir \see readdir */ @@ -85,6 +113,7 @@ DIR *opendir(const char *name); associated with the directory stream. \param dir The directory stream to close. + \return 0 on success. -1 on error, setting errno as appropriate. */ int closedir(DIR *dir); @@ -95,13 +124,14 @@ int closedir(DIR *dir); returning the directory entry associated with the next object in the directory. + \warning Do not free the returned dirent! + \param dir The directory stream to read from. + \return A pointer to the next directory entry in the directory or NULL if there are no other entries in the directory. If an error is incurred, NULL will be returned and errno set to indicate the error. - - \note Do not free the returned dirent! */ struct dirent *readdir(DIR *dir); @@ -110,13 +140,14 @@ struct dirent *readdir(DIR *dir); This function retrieves the file descriptor of a directory stream that was previously opened with opendir(). + \warning Do not close() the returned file descriptor. It will be + closed when closedir() is called on the directory + stream. + \param dirp The directory stream to retrieve the descriptor of. + \return The file descriptor from the directory stream on success or -1 on failure (sets errno as appropriate). - - \note Do not close() the returned file descriptor. It will be - closed when closedir() is called on the directory - stream. */ int dirfd(DIR *dirp); @@ -125,21 +156,71 @@ int dirfd(DIR *dirp); This function rewinds the directory stream so that the next call to the readdir() function will return the first entry in the directory. - \param dir The directory stream to rewind. - - \note Some filesystems do not support this call. Notably, none + \warning Some filesystems do not support this call. Notably, none of the dcload filesystems support it. Error values will be returned in errno (so set errno to 0, then check after calling the function to see if there was a problem anywhere). + + \param dir The directory stream to rewind. */ void rewinddir(DIR *dir); -/** \brief Not implemented */ -int scandir(const char *dir, struct dirent ***namelist, +/** \brief Scan, filter, and sort files within a directory. + + This function scans through all files within the directory located at the + path given by \p dir, calling \p filter on each entry. Entries for which + \p filter returns nonzero are stored within \p namelist and are sorted + using qsort() with the comparison function, \p compar. The resulting + directory entries are accumulated and stored witin \p namelist. + + \note + \p filter and \p compar may be NULL, if you do not wish to filter or sort + the files. + + \warning + The entries within \p namelist are each independently heap-allocated, then + the list itself heap allocated, so each entry must be freed within the list + followed by the list itself. + + \param dir The path to the directory to scan + \param namelist A pointer through which the list of entries will be + returned. + \param filter The callback used to filter each directory entry + (returning 1 for inclusion, 0 for exclusion). + \param compar The callback passed to qsort() to sort \p namelist by + + \retval >=0 On success, the number of directory entries within \p + namelist is returned + \retval -1 On failure, -1 is returned and errno is set + + \sa alphasort +*/ +int scandir(const char *__RESTRICT dir, struct dirent ***__RESTRICT namelist, int(*filter)(const struct dirent *), int(*compar)(const struct dirent **, const struct dirent **)); + +/** \brief Comparison function for sorting directory entries alphabetically + + Sorts two directory entries, \p a and \p b in alphabetical order. + + \note + This function can be used as the comparison callback passed to scandir(), + to sort the returned list of entries in alphabetical order. + + \param a The first directory entry to sort + \param b The second directory entry to sort + + \retval Returns an integer value greater than, equal to, or less than + zero, depending on whether the name of the directory entry + pointed to by \p a is lexically greater than, equal to, or + less than the directory entry pointed to by \p b. + + \sa scandir() +*/ +int alphasort(const struct dirent **a, const struct dirent **b); + /** \brief Not implemented */ void seekdir(DIR *dir, off_t offset); diff --git a/kernel/arch/dreamcast/hardware/Makefile b/kernel/arch/dreamcast/hardware/Makefile index bd4627a5..460e6067 100644 --- a/kernel/arch/dreamcast/hardware/Makefile +++ b/kernel/arch/dreamcast/hardware/Makefile @@ -25,7 +25,7 @@ OBJS += asic.o g2bus.o OBJS += video.o vblank.o # CPU-related -OBJS += sq.o scif.o +OBJS += sq.o sq_fast_cpy.o scif.o # SPI device support OBJS += scif-spi.o sd.o diff --git a/kernel/arch/dreamcast/hardware/sq.c b/kernel/arch/dreamcast/hardware/sq.c index d8ebfe95..23d047cb 100644 --- a/kernel/arch/dreamcast/hardware/sq.c +++ b/kernel/arch/dreamcast/hardware/sq.c @@ -60,16 +60,15 @@ __attribute__((noinline)) void *sq_cpy(void *dest, const void *src, size_t n) { uint32_t *d = SQ_MASK_DEST(dest); const uint32_t *s = src; - _Complex float ds; - _Complex float ds2; - _Complex float ds3; - _Complex float ds4; - - sq_lock(dest); - /* Fill/write queues as many times necessary */ n >>= 5; + /* Exit early if we dont have enough data to copy */ + if(n == 0) + return dest; + + sq_lock(dest); + /* If src is not 8-byte aligned, slow path */ if ((uintptr_t)src & 7) { while(n--) { @@ -86,35 +85,7 @@ __attribute__((noinline)) void *sq_cpy(void *dest, const void *src, size_t n) { d += 8; } } else { /* If src is 8-byte aligned, fast path */ - /* Moop algorithm; Using the fpu we can fill the queue faster before - firing it out off */ - __asm__ __volatile__ ( - "fschg\n\t" - "clrs\n" - ".align 2\n" - "1:\n\t" - /* *d++ = *s++ */ - "fmov.d @%[in]+, %[scratch]\n\t" - "fmov.d @%[in]+, %[scratch2]\n\t" - "fmov.d @%[in]+, %[scratch3]\n\t" - "fmov.d @%[in]+, %[scratch4]\n\t" - "add #32, %[out]\n\t" - "pref @%[in]\n\t" /* Prefetch 32 bytes for next loop */ - "dt %[size]\n\t" /* while(n--) */ - "fmov.d %[scratch4], @-%[out]\n\t" - "fmov.d %[scratch3], @-%[out]\n\t" - "fmov.d %[scratch2], @-%[out]\n\t" - "fmov.d %[scratch], @-%[out]\n\t" - "pref @%[out]\n\t" /* Fire off store queue */ - "bf.s 1b\n\t" - "add #32, %[out]\n\t" - "fschg\n" - : [in] "+&r" ((uint32_t)s), [out] "+&r" ((uint32_t)d), - [size] "+&r" (n), [scratch] "=&d" (ds), [scratch2] "=&d" (ds2), - [scratch3] "=&d" (ds3), [scratch4] "=&d" (ds4) /* outputs */ - : /* inputs */ - : "t", "memory" /* clobbers */ - ); + sq_fast_cpy(d, s, n); } sq_unlock(); diff --git a/kernel/arch/dreamcast/hardware/sq_fast_cpy.s b/kernel/arch/dreamcast/hardware/sq_fast_cpy.s new file mode 100644 index 00000000..134ee374 --- /dev/null +++ b/kernel/arch/dreamcast/hardware/sq_fast_cpy.s @@ -0,0 +1,46 @@ +! KallistiOS ##version## +! +! arch/dreamcast/hardware/sq_fast_path.s +! Copyright (C) 2024 Andy Barajas +! +! Optimized SH4 assembler function for copying 32 bytes of data +! (8 bytes at a time) using pair single-precision data transfer +! specifically for store queues. +! + +.globl _sq_fast_cpy + +! +! void *sq_fast_cpy(uint32_t *dest, uint32_t *src, size_t n); +! +! r4: dest (should be 32-byte aligned store queue address) +! r5: src (should be 8-byte aligned address) +! r6: n (how many 32-byte blocks of data you want to copy) +! + .align 2 +_sq_fast_cpy: + fschg ! Change to pair single-precision data + tst r6, r6 + bt/s .exit ! Exit if size is 0 + mov r4, r0 +1: + fmov.d @r5+, dr0 + mov r4, r1 + fmov.d @r5+, dr2 + add #32, r1 + fmov.d @r5+, dr4 + fmov.d @r5+, dr6 + pref @r5 ! Prefetch 32 bytes for next loop + dt r6 ! while(n--) + fmov.d dr6, @-r1 + fmov.d dr4, @-r1 + fmov.d dr2, @-r1 + fmov.d dr0, @-r1 + add #32, r4 + bf.s 1b + pref @r1 ! Fire off store queue + +.exit: + rts + fschg + diff --git a/kernel/arch/dreamcast/include/dc/sq.h b/kernel/arch/dreamcast/include/dc/sq.h index a2f25880..89ff18bf 100644 --- a/kernel/arch/dreamcast/include/dc/sq.h +++ b/kernel/arch/dreamcast/include/dc/sq.h @@ -3,8 +3,8 @@ kernel/arch/dreamcast/include/dc/sq.h Copyright (C) 2000-2001 Andrew Kieschnick Copyright (C) 2023 Falco Girgis - Copyright (C) 2023 Andy Barajas Copyright (C) 2023 Ruslan Rostovtsev + Copyright (C) 2023-2024 Andy Barajas */ /** \file dc/sq.h @@ -128,9 +128,30 @@ void sq_wait(void); \param n The number of bytes to copy (multiple of 32). \return The original value of dest. - \sa sq_cpy_pvr() + \sa sq_fast_cpy() */ -void * sq_cpy(void *dest, const void *src, size_t n); +void *sq_cpy(void *dest, const void *src, size_t n); + +/** \brief Copy a block of memory. + \ingroup store_queues + + This function is similar to sq_cpy() but expects the user to lock/unlock + the store queues before and after as well as having different requirements + for the params. + + \warning + The dest pointer must be at least 32-byte aligned that already has been + masked by SQ_MASK_DEST(), the src pointer must be at least 8-byte aligned, + and n must be the number of 32-byte blocks you want to copy. + + \param dest The store queue address to copy to (32-byte aligned). + \param src The address to copy from (8-byte aligned). + \param n The number of 32-byte blocks to copy. + \return The original value of dest. + + \sa sq_cpy() + */ +void *sq_fast_cpy(void *dest, const void *src, size_t n); /** \brief Set a block of memory to an 8-bit value. \ingroup store_queues @@ -149,7 +170,7 @@ void * sq_cpy(void *dest, const void *src, size_t n); \sa sq_set16(), sq_set32(), sq_set_pvr() */ -void * sq_set(void *dest, uint32_t c, size_t n); +void *sq_set(void *dest, uint32_t c, size_t n); /** \brief Set a block of memory to a 16-bit value. \ingroup store_queues @@ -168,7 +189,7 @@ void * sq_set(void *dest, uint32_t c, size_t n); \sa sq_set(), sq_set32(), sq_set_pvr() */ -void * sq_set16(void *dest, uint32_t c, size_t n); +void *sq_set16(void *dest, uint32_t c, size_t n); /** \brief Set a block of memory to a 32-bit value. \ingroup store_queues @@ -186,7 +207,7 @@ void * sq_set16(void *dest, uint32_t c, size_t n); \sa sq_set(), sq_set16(), sq_set_pvr() */ -void * sq_set32(void *dest, uint32_t c, size_t n); +void *sq_set32(void *dest, uint32_t c, size_t n); /** \brief Clear a block of memory. ...<truncated>... hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: ljsebald <ljs...@us...> - 2024-01-22 04:16:09
|
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 1162af57fab083584c7b6c0e553cbcb15723424a (commit) via 93bbc8f4a030346d06b22811eb9cdd83adb766e4 (commit) via 6da3ec5dc2c7f91f508b85f3622ae03c80926d52 (commit) via 79414bb344e0559121acab64e97a9d19a73d544b (commit) via ef77f10679d403acee22da15919558330a0adc94 (commit) via 02230d6009d180aa116561df37ed2a5625af8257 (commit) via 5b0f44de9cbf8141e6d06cf9cdc103f4a7586f6a (commit) from 0e0d8e2a3dc55550a59651735324fa718b23bb43 (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 1162af57fab083584c7b6c0e553cbcb15723424a Merge: 93bbc8f4 02230d60 Author: Lawrence Sebald <ljs...@us...> Date: Sun Jan 21 23:15:01 2024 -0500 Merge pull request #465 from KallistiOS/console_newlines Added Newlines Around main() Console Output commit 93bbc8f4a030346d06b22811eb9cdd83adb766e4 Merge: 6da3ec5d 79414bb3 Author: Lawrence Sebald <ljs...@us...> Date: Sun Jan 21 23:14:18 2024 -0500 Merge pull request #469 from OniEnzeru/master 1-20-24 - Fixed depth test issues and added color buffer clear to act⦠commit 6da3ec5dc2c7f91f508b85f3622ae03c80926d52 Merge: 0e0d8e2a ef77f106 Author: Lawrence Sebald <ljs...@us...> Date: Sun Jan 21 23:13:34 2024 -0500 Merge pull request #468 from KallistiOS/binutils_disable_nls Added --disable-nls Support to Binutils as Well commit 79414bb344e0559121acab64e97a9d19a73d544b Author: Jason Rost <jro...@gm...> Date: Sat Jan 20 17:35:55 2024 -0700 1-20-24 - Fixed depth test issues and added color buffer clear to actually set the background color in the Gltest Example for GLDC. commit ef77f10679d403acee22da15919558330a0adc94 Author: Falco Girgis <gyr...@gm...> Date: Sat Jan 20 03:22:14 2024 -0600 Added --disable-nls support to binutils as well - Forgot to add it when we added it to GCC pass 1 and 2. commit 02230d6009d180aa116561df37ed2a5625af8257 Merge: 5b0f44de 0e0d8e2a Author: Falco Girgis <gyr...@gm...> Date: Thu Jan 18 22:13:29 2024 -0600 Merge branch 'master' into console_newlines commit 5b0f44de9cbf8141e6d06cf9cdc103f4a7586f6a Author: Falco Girgis <gyr...@gm...> Date: Thu Jan 18 20:37:14 2024 -0600 Added newlines around main() console output - It was difficult to distinguish what was coming from main() and what was coming from KOS from stdout. - Added newline characters 1) right before app-level code gets called and 2) right after app-level code exits. - Adjusted the "hello" example which no longer needs padding. ----------------------------------------------------------------------- Summary of changes: examples/dreamcast/gldc/basic/gl/gltest.c | 3 +++ examples/dreamcast/hello/hello.c | 2 +- kernel/arch/dreamcast/kernel/init.c | 4 +++- utils/dc-chain/scripts/binutils.mk | 1 + utils/dc-chain/scripts/init.mk | 1 + 5 files changed, 9 insertions(+), 2 deletions(-) mode change 100644 => 100755 examples/dreamcast/gldc/basic/gl/gltest.c diff --git a/examples/dreamcast/gldc/basic/gl/gltest.c b/examples/dreamcast/gldc/basic/gl/gltest.c old mode 100644 new mode 100755 index 7585f3cd..eb6a24b5 --- a/examples/dreamcast/gldc/basic/gl/gltest.c +++ b/examples/dreamcast/gldc/basic/gl/gltest.c @@ -130,6 +130,7 @@ int main(int argc, char **argv) { gluPerspective(45.0f, 640.0f / 480.0f, 0.1f, 100.0f); glMatrixMode(GL_MODELVIEW); glEnable(GL_TEXTURE_2D); + glEnable(GL_DEPTH_TEST); /* Expect CW verts */ glFrontFace(GL_CW); @@ -146,6 +147,8 @@ int main(int argc, char **argv) { glClearColor(0.3f, 0.4f, 0.5f, 1.0f); while(1) { + glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); + /* Check key status */ cont = maple_enum_type(0, MAPLE_FUNC_CONTROLLER); diff --git a/examples/dreamcast/hello/hello.c b/examples/dreamcast/hello/hello.c index 7703d21d..65a63051 100644 --- a/examples/dreamcast/hello/hello.c +++ b/examples/dreamcast/hello/hello.c @@ -35,7 +35,7 @@ /* Your program's main entry point */ int main(int argc, char *argv[]) { /* The requisite line */ - printf("\nHello world!\n\n"); + printf("Hello world!\n"); return 0; } diff --git a/kernel/arch/dreamcast/kernel/init.c b/kernel/arch/dreamcast/kernel/init.c index df0f3443..dbe0c2de 100644 --- a/kernel/arch/dreamcast/kernel/init.c +++ b/kernel/arch/dreamcast/kernel/init.c @@ -270,6 +270,8 @@ void arch_main(void) { __verify_newlib_patch(); + dbglog(DBG_INFO, "\n"); + /* Run ctors */ _init(); @@ -333,7 +335,7 @@ void arch_exit(void) { /* Return point from newlib's _exit() (configurable) */ void arch_exit_handler(int ret_code) { - dbglog(DBG_INFO, "arch: exit return code %d\n", ret_code); + dbglog(DBG_INFO, "\narch: exit return code %d\n", ret_code); /* Shut down */ arch_shutdown(); diff --git a/utils/dc-chain/scripts/binutils.mk b/utils/dc-chain/scripts/binutils.mk index 639b5d94..4b1ddc1d 100644 --- a/utils/dc-chain/scripts/binutils.mk +++ b/utils/dc-chain/scripts/binutils.mk @@ -20,6 +20,7 @@ $(build_binutils): logdir --prefix=$(prefix) \ --disable-werror \ $(libbfd_install_flag) \ + $(binutils_extra_configure_args) \ CC="$(CC)" \ CXX="$(CXX)" \ $(static_flag) \ diff --git a/utils/dc-chain/scripts/init.mk b/utils/dc-chain/scripts/init.mk index 40705693..7951d711 100644 --- a/utils/dc-chain/scripts/init.mk +++ b/utils/dc-chain/scripts/init.mk @@ -155,6 +155,7 @@ endif ifdef disable_nls ifneq (0,$(disable_nls)) extra_configure_args += --disable-nls + binutils_extra_configure_args += --disable-nls endif endif hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: ljsebald <ljs...@us...> - 2024-01-19 04:13:16
|
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 0e0d8e2a3dc55550a59651735324fa718b23bb43 (commit) via 9910ca94fed3bab0553e39216701eb9b523edb00 (commit) via 279a305de3322e3b1e90b4a8a72b7a07819f01e7 (commit) via c8696f7c5e0ea25c49c2e496e56868e86583027d (commit) from c3be4a13e1585b1036987a36ba4d30dab7c608ac (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 0e0d8e2a3dc55550a59651735324fa718b23bb43 Author: Falco Girgis <gyr...@gm...> Date: Thu Jan 18 22:12:32 2024 -0600 Added Toolchain Config Variable for Disabling NLS. (#461) * Added toolchain config variable for disabling NLS. - Added "disable_nls" optional variable within the stable toolchain config file (defaulting to off) to disable GCC's native language support. * Add disable NLS option to all dc-chain config samples. --------- Co-authored-by: darc <da...@pr...> commit 9910ca94fed3bab0553e39216701eb9b523edb00 Merge: 279a305d c8696f7c Author: Lawrence Sebald <ljs...@us...> Date: Thu Jan 18 23:11:21 2024 -0500 Merge pull request #463 from KallistiOS/more_cmake CMake Toolchain Fixes for Library Link Order commit 279a305de3322e3b1e90b4a8a72b7a07819f01e7 Author: Falco Girgis <gyr...@gm...> Date: Thu Jan 18 22:10:10 2024 -0600 Added <dc/vmu_fb.h> to <kos.h> (#464) * Added <dc/vmu_fb.h> to <kos.h>. - It looks like we forgot to do this when we added the VMU framebuffer API. commit c8696f7c5e0ea25c49c2e496e56868e86583027d Author: Falco Girgis <gyr...@gm...> Date: Wed Jan 17 00:41:48 2024 -0600 CMake Toolchain fixes for library link order - The CMake toolchain was not properly handling the link order for libraries, so adding any new library that depended on the system libraries resulted in linker errors - Had to add a new custom C/CXX rule for manually adding system link libraries to the END of the linker statement ----------------------------------------------------------------------- Summary of changes: include/kos.h | 1 + utils/cmake/dreamcast.toolchain.cmake | 21 ++++++++++++++++----- utils/dc-chain/config/config.mk.10.5.0.sample | 5 +++++ utils/dc-chain/config/config.mk.11.4.0.sample | 5 +++++ utils/dc-chain/config/config.mk.12.3.0.sample | 5 +++++ utils/dc-chain/config/config.mk.13.2.1-dev.sample | 5 +++++ utils/dc-chain/config/config.mk.14.0.1-dev.sample | 5 +++++ utils/dc-chain/config/config.mk.4.7.4-legacy.sample | 5 +++++ utils/dc-chain/config/config.mk.9.3.0-legacy.sample | 5 +++++ utils/dc-chain/config/config.mk.9.5.0-winxp.sample | 5 +++++ utils/dc-chain/config/config.mk.stable.sample | 5 +++++ utils/dc-chain/doc/CONTRIBUTORS.md | 3 ++- utils/dc-chain/doc/changelog.txt | 2 ++ utils/dc-chain/scripts/build.mk | 2 +- utils/dc-chain/scripts/init.mk | 6 ++++++ 15 files changed, 73 insertions(+), 7 deletions(-) diff --git a/include/kos.h b/include/kos.h index d5d838fa..615b7862 100644 --- a/include/kos.h +++ b/include/kos.h @@ -112,6 +112,7 @@ __BEGIN_DECLS # include <dc/vblank.h> # include <dc/vec3f.h> # include <dc/video.h> +# include <dc/vmu_fb.h> # include <dc/vmu_pkg.h> # include <dc/vmufs.h> #else /* _arch_dreamcast */ diff --git a/utils/cmake/dreamcast.toolchain.cmake b/utils/cmake/dreamcast.toolchain.cmake index ea1e27b7..6c423eea 100644 --- a/utils/cmake/dreamcast.toolchain.cmake +++ b/utils/cmake/dreamcast.toolchain.cmake @@ -59,8 +59,12 @@ set(PLATFORM_DREAMCAST TRUE) ##### Configure Cross-Compiler ##### set(CMAKE_CROSSCOMPILING TRUE) -set(CMAKE_C_COMPILER ${KOS_CC_BASE}/bin/sh-elf-gcc) -set(CMAKE_CXX_COMPILER ${KOS_CC_BASE}/bin/sh-elf-g++) + +set(CMAKE_ASM_COMPILER ${KOS_CC_BASE}/bin/sh-elf-as) +set(CMAKE_C_COMPILER ${KOS_CC_BASE}/bin/sh-elf-gcc) +set(CMAKE_CXX_COMPILER ${KOS_CC_BASE}/bin/sh-elf-g++) +set(CMAKE_OBJC_COMPILER ${KOS_CC_BASE}/bin/sh-elf-gcc) +set(CMAKE_OBJCXX_COMPILER ${KOS_CC_BASE}/bin/sh-elf-g++) set(CMAKE_FIND_LIBRARY_SUFFIXES ".a") @@ -100,8 +104,8 @@ include_directories( $ENV{KOS_PORTS}/include ) -##### Configure Libraries ##### -set(CMAKE_SYSTEM_LIBRARY_PATH "${CMAKE_SYSTEM_LIBRARY_PATH} ${KOS_BASE}/addons/lib/dreamcast ${KOS_PORTS}/lib") +##### Configure Linker ##### +set(CMAKE_SYSTEM_LIBRARY_PATH "${CMAKE_SYSTEM_LIBRARY_PATH} ${KOS_BASE}/lib/dreamcast ${KOS_BASE}/addons/lib/dreamcast ${KOS_PORTS}/lib") if(${KOS_SUBARCH} MATCHES naomi) add_link_options(-Wl,-Ttext=0x8c020000 -T${KOS_BASE}/utils/ldscripts/shlelf-naomi.xc) @@ -118,6 +122,13 @@ link_directories( ) add_link_options(-L${KOS_BASE}/lib/dreamcast -L${KOS_BASE}/addons/lib/dreamcast -L${KOS_PORTS}/lib) -link_libraries(-Wl,--start-group -lstdc++ -lkallisti -lc -lgcc -Wl,--end-group -lm) + +##### Custom Build Rules ##### +set(CMAKE_C_LINK_EXECUTABLE + "<CMAKE_C_COMPILER> <FLAGS> <CMAKE_C_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES> \ + -lm -Wl,--start-group -lkallisti -lc -lgcc -Wl,--end-group") +set(CMAKE_CXX_LINK_EXECUTABLE + "<CMAKE_CXX_COMPILER> <FLAGS> <CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES> \ + -lm -Wl,--start-group -lstdc++ -lkallisti -lc -lgcc -Wl,--end-group") include("${KOS_BASE}/utils/cmake/dreamcast.cmake") diff --git a/utils/dc-chain/config/config.mk.10.5.0.sample b/utils/dc-chain/config/config.mk.10.5.0.sample index 937f35b4..a91da992 100644 --- a/utils/dc-chain/config/config.mk.10.5.0.sample +++ b/utils/dc-chain/config/config.mk.10.5.0.sample @@ -164,6 +164,11 @@ newlib_c99_formats=1 # performance. #newlib_opt_space=1 +# Disable GCC Native Language Support (1|0) +# By default, NLS allows GCC to output diagnostics in non-English languages. +# Set this variable to disable NLS, forcing GCC to output in American English. +#disable_nls=1 + # MinGW/MSYS # Standalone binaries (1|0) # Define this if you want a standalone, no dependency binaries (i.e. static) diff --git a/utils/dc-chain/config/config.mk.11.4.0.sample b/utils/dc-chain/config/config.mk.11.4.0.sample index 949e7186..9fcd42c7 100644 --- a/utils/dc-chain/config/config.mk.11.4.0.sample +++ b/utils/dc-chain/config/config.mk.11.4.0.sample @@ -164,6 +164,11 @@ newlib_c99_formats=1 # performance. #newlib_opt_space=1 +# Disable GCC Native Language Support (1|0) +# By default, NLS allows GCC to output diagnostics in non-English languages. +# Set this variable to disable NLS, forcing GCC to output in American English. +#disable_nls=1 + # MinGW/MSYS # Standalone binaries (1|0) # Define this if you want a standalone, no dependency binaries (i.e. static) diff --git a/utils/dc-chain/config/config.mk.12.3.0.sample b/utils/dc-chain/config/config.mk.12.3.0.sample index 1e1560e4..c33fe0d1 100644 --- a/utils/dc-chain/config/config.mk.12.3.0.sample +++ b/utils/dc-chain/config/config.mk.12.3.0.sample @@ -164,6 +164,11 @@ newlib_c99_formats=1 # performance. #newlib_opt_space=1 +# Disable GCC Native Language Support (1|0) +# By default, NLS allows GCC to output diagnostics in non-English languages. +# Set this variable to disable NLS, forcing GCC to output in American English. +#disable_nls=1 + # MinGW/MSYS # Standalone binaries (1|0) # Define this if you want a standalone, no dependency binaries (i.e. static) diff --git a/utils/dc-chain/config/config.mk.13.2.1-dev.sample b/utils/dc-chain/config/config.mk.13.2.1-dev.sample index 8bb10ba7..2bb24e06 100644 --- a/utils/dc-chain/config/config.mk.13.2.1-dev.sample +++ b/utils/dc-chain/config/config.mk.13.2.1-dev.sample @@ -173,6 +173,11 @@ newlib_c99_formats=1 # performance. #newlib_opt_space=1 +# Disable GCC Native Language Support (1|0) +# By default, NLS allows GCC to output diagnostics in non-English languages. +# Set this variable to disable NLS, forcing GCC to output in American English. +#disable_nls=1 + # MinGW/MSYS # Standalone binaries (1|0) # Define this if you want a standalone, no dependency binaries (i.e. static) diff --git a/utils/dc-chain/config/config.mk.14.0.1-dev.sample b/utils/dc-chain/config/config.mk.14.0.1-dev.sample index 1d11597e..a0ad4d41 100644 --- a/utils/dc-chain/config/config.mk.14.0.1-dev.sample +++ b/utils/dc-chain/config/config.mk.14.0.1-dev.sample @@ -176,6 +176,11 @@ newlib_c99_formats=1 # performance. #newlib_opt_space=1 +# Disable GCC Native Language Support (1|0) +# By default, NLS allows GCC to output diagnostics in non-English languages. +# Set this variable to disable NLS, forcing GCC to output in American English. +#disable_nls=1 + # MinGW/MSYS # Standalone binaries (1|0) # Define this if you want a standalone, no dependency binaries (i.e. static) diff --git a/utils/dc-chain/config/config.mk.4.7.4-legacy.sample b/utils/dc-chain/config/config.mk.4.7.4-legacy.sample index dcc4d519..01e7729c 100644 --- a/utils/dc-chain/config/config.mk.4.7.4-legacy.sample +++ b/utils/dc-chain/config/config.mk.4.7.4-legacy.sample @@ -164,6 +164,11 @@ newlib_c99_formats=1 # performance. #newlib_opt_space=1 +# Disable GCC Native Language Support (1|0) +# By default, NLS allows GCC to output diagnostics in non-English languages. +# Set this variable to disable NLS, forcing GCC to output in American English. +#disable_nls=1 + # MinGW/MSYS # Standalone binaries (1|0) # Define this if you want a standalone, no dependency binaries (i.e. static) diff --git a/utils/dc-chain/config/config.mk.9.3.0-legacy.sample b/utils/dc-chain/config/config.mk.9.3.0-legacy.sample index 8458c683..97565dc0 100644 --- a/utils/dc-chain/config/config.mk.9.3.0-legacy.sample +++ b/utils/dc-chain/config/config.mk.9.3.0-legacy.sample @@ -164,6 +164,11 @@ newlib_c99_formats=1 # performance. #newlib_opt_space=1 +# Disable GCC Native Language Support (1|0) +# By default, NLS allows GCC to output diagnostics in non-English languages. +# Set this variable to disable NLS, forcing GCC to output in American English. +#disable_nls=1 + # MinGW/MSYS # Standalone binaries (1|0) # Define this if you want a standalone, no dependency binaries (i.e. static) diff --git a/utils/dc-chain/config/config.mk.9.5.0-winxp.sample b/utils/dc-chain/config/config.mk.9.5.0-winxp.sample index 9e7c5fc6..75024821 100644 --- a/utils/dc-chain/config/config.mk.9.5.0-winxp.sample +++ b/utils/dc-chain/config/config.mk.9.5.0-winxp.sample @@ -164,6 +164,11 @@ newlib_c99_formats=1 # performance. #newlib_opt_space=1 +# Disable GCC Native Language Support (1|0) +# By default, NLS allows GCC to output diagnostics in non-English languages. +# Set this variable to disable NLS, forcing GCC to output in American English. +#disable_nls=1 + # MinGW/MSYS # Standalone binaries (1|0) # Define this if you want a standalone, no dependency binaries (i.e. static) diff --git a/utils/dc-chain/config/config.mk.stable.sample b/utils/dc-chain/config/config.mk.stable.sample index f7b3bc73..6e5b932c 100644 --- a/utils/dc-chain/config/config.mk.stable.sample +++ b/utils/dc-chain/config/config.mk.stable.sample @@ -164,6 +164,11 @@ newlib_c99_formats=1 # performance. #newlib_opt_space=1 +# Disable GCC Native Language Support (1|0) +# By default, NLS allows GCC to output diagnostics in non-English languages. +# Set this variable to disable NLS, forcing GCC to output in American English. +#disable_nls=1 + # MinGW/MSYS # Standalone binaries (1|0) # Define this if you want a standalone, no dependency binaries (i.e. static) diff --git a/utils/dc-chain/doc/CONTRIBUTORS.md b/utils/dc-chain/doc/CONTRIBUTORS.md index bbc6ce38..fcf7eece 100644 --- a/utils/dc-chain/doc/CONTRIBUTORS.md +++ b/utils/dc-chain/doc/CONTRIBUTORS.md @@ -18,4 +18,5 @@ * 2020 [Ben Baron](https://github.com/einsteinx2) * 2020 [Jon Daniel](https://github.com/jopadan) * 2023 [Colton Pawielski](https://github.com/cepawiel) -* 2023 [Eric Fradella](https://github.com/darcagn) +* 2023, 2024 [Eric Fradella](https://github.com/darcagn) +* 2023, 2024 [Falco Girgis](https://github.com/gyrovorbis) diff --git a/utils/dc-chain/doc/changelog.txt b/utils/dc-chain/doc/changelog.txt index aa685d87..5ba1e808 100644 --- a/utils/dc-chain/doc/changelog.txt +++ b/utils/dc-chain/doc/changelog.txt @@ -1,3 +1,5 @@ +2024-01-14: Added config option for disabling native language support (NLS) in GCC. + (Falco Girgis) 2024-01-06: Update documentations (Mickaël Cardoso) 2023-07-31: Update Binutils to 2.41. Verified no regressions in KOS examples compared to current stable GCC 9.3.0, so promoting GCC 13.2.0 configuration to stable. diff --git a/utils/dc-chain/scripts/build.mk b/utils/dc-chain/scripts/build.mk index bc4d4a67..5875217e 100644 --- a/utils/dc-chain/scripts/build.mk +++ b/utils/dc-chain/scripts/build.mk @@ -35,7 +35,7 @@ build_arm_targets = build-arm-binutils build-arm-gcc build-arm-gcc-pass1 # Available targets for SH $(build_sh4_targets): prefix = $(sh_prefix) $(build_sh4_targets): target = $(sh_target) -$(build_sh4_targets): extra_configure_args = --with-multilib-list=$(precision_modes) --with-endian=little --with-cpu=$(default_precision) +$(build_sh4_targets): extra_configure_args += --with-multilib-list=$(precision_modes) --with-endian=little --with-cpu=$(default_precision) $(build_sh4_targets): gcc_ver = $(sh_gcc_ver) $(build_sh4_targets): binutils_ver = $(sh_binutils_ver) diff --git a/utils/dc-chain/scripts/init.mk b/utils/dc-chain/scripts/init.mk index d4145869..40705693 100644 --- a/utils/dc-chain/scripts/init.mk +++ b/utils/dc-chain/scripts/init.mk @@ -152,6 +152,12 @@ ifdef newlib_multibyte endif endif +ifdef disable_nls + ifneq (0,$(disable_nls)) + extra_configure_args += --disable-nls + endif +endif + # Function to verify variable is not empty # Args: # 1 - Variable Name hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: darcagn <da...@us...> - 2024-01-15 07:14: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 c3be4a13e1585b1036987a36ba4d30dab7c608ac (commit) via 6b3c40e59f992e2dc84617da8542415611672796 (commit) from 21bd0321caafefd7c56daecc4dcfffdd41289de0 (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 c3be4a13e1585b1036987a36ba4d30dab7c608ac Merge: 21bd0321 6b3c40e5 Author: darcagn <da...@pr...> Date: Mon Jan 15 01:12:54 2024 -0600 Merge pull request #462 from KallistiOS/cmake_bugfix Fixed romdisks and bin2o in Cmake toolchain commit 6b3c40e59f992e2dc84617da8542415611672796 Author: Falco Girgis <gyr...@gm...> Date: Mon Jan 15 01:05:01 2024 -0600 Fixed romdisks and bin2o in Cmake toolchain - They were failing to compile for others, because I had tested with absolute paths, while others were expecting source-relative paths. - Changed input paths to be source-relative, changed intermediate output to be in the binary directory. ----------------------------------------------------------------------- Summary of changes: utils/cmake/dreamcast.cmake | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/utils/cmake/dreamcast.cmake b/utils/cmake/dreamcast.cmake index 97d8ffd1..f700cdf1 100644 --- a/utils/cmake/dreamcast.cmake +++ b/utils/cmake/dreamcast.cmake @@ -18,8 +18,8 @@ function(kos_bin2o inFile symbol) endfunction() function(kos_add_binary target inFile symbol) - set(outFile ${CMAKE_BINARY_DIR}/${symbol}.o) - kos_bin2o(${inFile} ${symbol} ${outFile}) + set(outFile ${CMAKE_CURRENT_BINARY_DIR}/${symbol}.o) + kos_bin2o(${CMAKE_CURRENT_SOURCE_DIR}/${inFile} ${symbol} ${outFile}) target_sources(${target} PRIVATE ${outFile}) endfunction() @@ -32,6 +32,8 @@ function(kos_add_romdisk target romdiskPath) set(romdiskName ${ARGN}) endif() + set(romdiskPath ${CMAKE_CURRENT_SOURCE_DIR}/${romdiskPath}) + set(obj ${CMAKE_CURRENT_BINARY_DIR}/${romdiskName}.o) set(obj_tmp ${CMAKE_CURRENT_BINARY_DIR}/${romdiskName}_tmp.o) set(img ${CMAKE_CURRENT_BINARY_DIR}/${romdiskName}.img) hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: ljsebald <ljs...@us...> - 2024-01-12 04:06:46
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via 21bd0321caafefd7c56daecc4dcfffdd41289de0 (commit) from 5de19ac63011e4bdb45da7b6c6bbd329f330b3dd (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 21bd0321caafefd7c56daecc4dcfffdd41289de0 Author: Falco Girgis <gyr...@gm...> Date: Thu Jan 11 22:06:35 2024 -0600 Added CLOCK_PROCESS_CPUTIME_ID + clock_getcpuclockid() (#427) * CLOCK_PROCESS_CPUTIME_ID + clock_getcpuclockid() - Removed some unecessary defines from time.h for different clock types, apparently defining the correct POSIX support makes Newlib do it for you. - Removed support for CLOCK_THREAD_CPUTIME_ID, because it was a lie. We don't support that. - Made CLOCK_PROCESS_CPUTIME_ID actually measure real active CPU time now, by using the performance counters (which don't run during sleep), when they're configured properly - added clock_getcpuclockid(), which gets the CPU click ID for the given process ID. Yes, we're single-process, but the standard actually states it should then work with just pid 0 (current) and fail for any other pid. * Updated include path for <dc/perfctr.h> - We moved it from arch/ to dc/ when the driver update got commited. * Updated copyright dates, CHANGELOG, docs * Addressed code review feedback. - ENOSYS swapped to ESRCH for when an invalid pid_t is supplied to clock_getcpuclockid(). ----------------------------------------------------------------------- Summary of changes: AUTHORS | 2 +- doc/CHANGELOG | 1 + include/kos/time.h | 25 ++++++++++++-------- kernel/libc/posix/clock_gettime.c | 48 +++++++++++++++++++++++++++++++++++---- 4 files changed, 60 insertions(+), 16 deletions(-) diff --git a/AUTHORS b/AUTHORS index 0110f61e..163b5384 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 -Falco Girgis: 2023 +Falco Girgis: 2023, 2024 Ruslan Rostovtsev: 2014, 2016, 2023 Colton Pawielski: 2023 Andy Barajas: 2023, 2024 diff --git a/doc/CHANGELOG b/doc/CHANGELOG index 4597f56f..07a3840a 100644 --- a/doc/CHANGELOG +++ b/doc/CHANGELOG @@ -214,6 +214,7 @@ KallistiOS version 2.1.0 ----------------------------------------------- - DC Increased resolution of TMU timers + date/time functions [FG && PC] - *** Increased resolution of clock() and CLOCKS_PER_SEC to microseconds [FG] - DC Created separate performance counter driver and enhanced API [FG] +- *** Implemented _POSIX_CPUTIME in clock_gettime() using perf counter timer [FG] KallistiOS version 2.0.0 ----------------------------------------------- - DC Broadband Adapter driver fixes [Megan Potter == MP] diff --git a/include/kos/time.h b/include/kos/time.h index 5ebc30ae..67f28d4a 100644 --- a/include/kos/time.h +++ b/include/kos/time.h @@ -2,18 +2,21 @@ kos/time.h Copyright (C) 2023 Lawrence Sebald + Copyright (C) 2024 Falco Girgis */ /** \file kos/time.h - \brief KOS-implementation of select POSIX extensions + \brief KOS-implementation of select C11 and POSIX extensions - Add select POSIX extensions to time.h which are not present within Newlib. + Add select POSIX extensions and C11 functionality to time.h which are not + present within Newlib. \remark This will probably go away at some point in the future, if/when Newlib gets an implementation of this function. But for now, it's here. \author Lawrence Sebald + \author Falco Girgis */ @@ -42,22 +45,24 @@ extern int timespec_get(struct timespec *ts, int base); #if !defined(__STRICT_ANSI__) || (_POSIX_C_SOURCE >= 199309L) +/* We do not support POSIX timers! #ifndef _POSIX_TIMERS #define _POSIX_TIMERS 1 -#endif -#ifdef _POSIX_MONOTONIC_CLOCK +#endif */ + +#ifndef _POSIX_MONOTONIC_CLOCK #define _POSIX_MONOTONIC_CLOCK 1 #endif -#ifdef _POSIX_CPUTIME + +#ifndef _POSIX_CPUTIME #define _POSIX_CPUTIME 1 #endif -#ifdef _POSIX_THREAD_CPU_TIME + +/* We do NOT support thread-specific CPU time! +#ifndef _POSIX_THREAD_CPU_TIME #define _POSIX_THREAD_CPUTIME 1 #endif - -#define CLOCK_MONOTONIC (CLOCK_REALTIME + 1) -#define CLOCK_PROCESS_CPUTIME_ID (CLOCK_REALTIME + 2) -#define CLOCK_THREAD_CPUTIME_ID (CLOCK_REALTIME + 3) +*/ #endif /* !defined(__STRICT_ANSI__) || (_POSIX_C_SOURCE >= 199309L) */ diff --git a/kernel/libc/posix/clock_gettime.c b/kernel/libc/posix/clock_gettime.c index a9cdbdda..0ec1ea06 100644 --- a/kernel/libc/posix/clock_gettime.c +++ b/kernel/libc/posix/clock_gettime.c @@ -1,24 +1,42 @@ /* KallistiOS ##version## clock_gettime.c - Copyright (C) 2023 Falco Girgis + Copyright (C) 2023, 2024 Falco Girgis */ -#include <time.h> #include <arch/timer.h> #include <arch/rtc.h> + +#include <dc/perfctr.h> + +#include <time.h> #include <errno.h> +#include <assert.h> +#include <stdlib.h> + +int clock_getcpuclockid(pid_t pid, clockid_t *clock_id) { + /* pid of 0 means the current process, + and we only support a single process. */ + if(pid) + return ESRCH; + + assert(clock_id); + + *clock_id = CLOCK_PROCESS_CPUTIME_ID; + + return 0; +} int clock_getres(clockid_t clk_id, struct timespec *ts) { switch(clk_id) { case CLOCK_REALTIME: case CLOCK_MONOTONIC: case CLOCK_PROCESS_CPUTIME_ID: - case CLOCK_THREAD_CPUTIME_ID: if(!ts) { errno = EFAULT; return -1; } + ts->tv_sec = 0; ts->tv_nsec = 1; return 0; @@ -30,6 +48,8 @@ int clock_getres(clockid_t clk_id, struct timespec *ts) { } int clock_gettime(clockid_t clk_id, struct timespec *ts) { + lldiv_t div_result; + uint64_t ns64; uint32_t secs, nsecs; if(!ts) { @@ -38,17 +58,34 @@ int clock_gettime(clockid_t clk_id, struct timespec *ts) { } switch(clk_id) { + /* Use C11's nanosecond-resolution timestamp */ case CLOCK_REALTIME: return timespec_get(ts, TIME_UTC) == TIME_UTC ? 0 : -1; + /* Use the nanosecond resolution boot time */ case CLOCK_MONOTONIC: - case CLOCK_PROCESS_CPUTIME_ID: - case CLOCK_THREAD_CPUTIME_ID: timer_ns_gettime(&secs, &nsecs); ts->tv_sec = secs; ts->tv_nsec = nsecs; return 0; + /* Use the performance counters */ + case CLOCK_PROCESS_CPUTIME_ID: + /* Check whether they are configured properly + as an interval timer. */ + if(!perf_cntr_timer_enabled()) { + errno = EINVAL; + return -1; + } + + ns64 = perf_cntr_timer_ns(); + div_result = lldiv(ns64, 1000000000); + ts->tv_sec = div_result.quot; + ts->tv_nsec = div_result.rem; + return 0; + + /* Fail out for any other unsupported CPU type */ + /* case CLOCK_THREAD_CPUTIME_ID: */ default: errno = EINVAL; return -1; @@ -62,6 +99,7 @@ int clock_settime(clockid_t clk_id, const struct timespec *ts) { errno = EFAULT; return -1; } + return rtc_set_unix_secs(ts->tv_sec); default: hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: ljsebald <ljs...@us...> - 2024-01-12 04:03:36
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via 5de19ac63011e4bdb45da7b6c6bbd329f330b3dd (commit) from 76c6da9946e995f7d99133d8628fc5f87cd4b2a8 (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 5de19ac63011e4bdb45da7b6c6bbd329f330b3dd Author: Falco Girgis <gyr...@gm...> Date: Thu Jan 11 21:59:06 2024 -0600 Fixed build issue with -Og for inode.c (#454) - When using debug optimization level, inode.c:1270 was issuing a warning about "dent" being used without being initialized. This warning was treated as an error. - Initialized "dent" to NULL at the beginning of the function. ----------------------------------------------------------------------- Summary of changes: addons/libkosext2fs/inode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/libkosext2fs/inode.c b/addons/libkosext2fs/inode.c index 72193cd9..6056e32c 100644 --- a/addons/libkosext2fs/inode.c +++ b/addons/libkosext2fs/inode.c @@ -1042,7 +1042,7 @@ int ext2_inode_by_path(ext2_fs_t *fs, const char *path, ext2_inode_t **rv, int blocks, i, block_size; uint8_t *buf; uint32_t *ib; - ext2_dirent_t *dent; + ext2_dirent_t *dent = NULL; int err = 0; size_t tmp_sz; char *symbuf; hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: ljsebald <ljs...@us...> - 2024-01-12 03:58:18
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via 76c6da9946e995f7d99133d8628fc5f87cd4b2a8 (commit) from af86ae57218ec25e374581d0a13e84382ed22d71 (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 76c6da9946e995f7d99133d8628fc5f87cd4b2a8 Author: Falco Girgis <gyr...@gm...> Date: Thu Jan 11 21:57:50 2024 -0600 Hello Example Cleanup and Update (#459) * Cleaned up and updated hello example ----------------------------------------------------------------------- Summary of changes: examples/dreamcast/hello/Makefile | 27 +++++++++++++++----------- examples/dreamcast/hello/hello.c | 33 ++++++++++++++++++++++---------- examples/dreamcast/hello/romdisk/.keepme | 0 3 files changed, 39 insertions(+), 21 deletions(-) delete mode 100644 examples/dreamcast/hello/romdisk/.keepme diff --git a/examples/dreamcast/hello/Makefile b/examples/dreamcast/hello/Makefile index a33d1085..909fc481 100644 --- a/examples/dreamcast/hello/Makefile +++ b/examples/dreamcast/hello/Makefile @@ -1,37 +1,42 @@ # # Basic KallistiOS skeleton / test program -# Copyright (C)2001-2004 Megan Potter +# Copyright (C) 2001-2004 Megan Potter +# Copyright (C) 2024 Falco Girgis # # Put the filename of the output binary here TARGET = hello.elf -# List all of your C files here, but change the extension to ".o" -# Include "romdisk.o" if you want a rom disk. -OBJS = hello.o romdisk.o +# List all of your C or C++ files here, but change the extension to ".o" +OBJS = hello.o -# If you define this, the Makefile.rules will create a romdisk.o for you -# from the named dir. -KOS_ROMDISK_DIR = romdisk +# Optional path to a directory of resources to bundle within your ELF binary. +# Its contents are accessible via the "/rd/" virtual directory at runtime. +#KOS_ROMDISK_DIR = romdisk -# The rm-elf step is to remove the target before building, to force the -# re-creation of the rom disk. +# Main rule which forces our ELF binary to be built all: rm-elf $(TARGET) +# Include the common KOS Makefile rules and configuration include $(KOS_BASE)/Makefile.rules +# Cleans the binary ELF file plus the intermediate .o files clean: rm-elf -rm -f $(OBJS) +# Removes the binary ELF file rm-elf: - -rm -f $(TARGET) romdisk.* + -rm -f $(TARGET) +# Invokes the compiler to build the target from our object files $(TARGET): $(OBJS) kos-cc -o $(TARGET) $(OBJS) +# Attempts to run the target using the configured loader application run: $(TARGET) $(KOS_LOADER) $(TARGET) +# Creates a distributable/release ELF which strips away its debug symbols dist: $(TARGET) - -rm -f $(OBJS) romdisk.img + -rm -f $(OBJS) $(KOS_STRIP) $(TARGET) diff --git a/examples/dreamcast/hello/hello.c b/examples/dreamcast/hello/hello.c index c1da1c68..7703d21d 100644 --- a/examples/dreamcast/hello/hello.c +++ b/examples/dreamcast/hello/hello.c @@ -2,25 +2,38 @@ hello.c Copyright (C) 2001 Megan Potter + Copyright (C) 2024 Falco Girgis */ -#include <kos.h> +#include <stdio.h> -/* These macros tell KOS how to initialize itself. All of this initialization - happens before main() gets called, and the shutdown happens afterwards. So - you need to set any flags you want here. Here are some possibilities: +/* #include <kos.h> + KOS_INIT_FLAGS(INIT_DEFAULT); +*/ + +/* KOS_INIT_FLAGS() tells KOS how to initialize itself and which drivers to + pull into your executable. All of this initialization happens before main() + gets called, and the shutdown happens afterwards. + + Here are some possible flags to pass to KOS_INIT_FLAGS(): - INIT_NONE -- don't do any auto init - INIT_IRQ -- Enable IRQs + INIT_DEFAULT -- do a normal init with the most common settings + INIT_IRQ -- Enable IRQs (implied by INIT_DEFAULT) INIT_NET -- Enable networking (including sockets) INIT_MALLOCSTATS -- Enable a call to malloc_stats() right before shutdown + INIT_NONE -- don't do any auto init (you must manually init hardware) - You can OR any or all of those together. If you want to start out with - the current KOS defaults, use INIT_DEFAULT (or leave it out entirely). */ -KOS_INIT_FLAGS(INIT_DEFAULT | INIT_MALLOCSTATS); + Refer to kos/init.h and arch/init_flags.h for the full list of flags. + You can OR any or all of these together. + + If you wish to use the default initialization settings, specify + INIT_DEFAULT in your KOS_INIT_FLAGS(). You may also omit KOS_INIT_FLAGS() + from your program (as we are doing here since the above code is commented + out), which will automatically use the default initialization settings. +*/ /* Your program's main entry point */ -int main(int argc, char **argv) { +int main(int argc, char *argv[]) { /* The requisite line */ printf("\nHello world!\n\n"); diff --git a/examples/dreamcast/hello/romdisk/.keepme b/examples/dreamcast/hello/romdisk/.keepme deleted file mode 100644 index e69de29b..00000000 hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: ljsebald <ljs...@us...> - 2024-01-11 23:14:24
|
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 af86ae57218ec25e374581d0a13e84382ed22d71 (commit) from 1d95eff07fa77034e006d5eb4cc6c26925ce8ef8 (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 af86ae57218ec25e374581d0a13e84382ed22d71 Author: darcagn <da...@pr...> Date: Thu Jan 11 17:13:25 2024 -0600 Add environ variable for SH4 floating point precision configuration (#460) * Add environ variable for SH4 floating point precision configuration * Remove extraneous whitespace from environ.sh.sample * Use more stern language for SH4 precision setting ----------------------------------------------------------------------- Summary of changes: doc/environ.sh.sample | 57 ++++++++++++++++++++++++++++++++------------------- environ_dreamcast.sh | 13 ++++++++---- 2 files changed, 45 insertions(+), 25 deletions(-) diff --git a/doc/environ.sh.sample b/doc/environ.sh.sample index 958a6b9..17fc83a 100644 --- a/doc/environ.sh.sample +++ b/doc/environ.sh.sample @@ -2,22 +2,22 @@ # # This is a sample script for configuring and customizing your # KOS build environment. Modify it to suit your setup. Several -# settings may be enabled optionally or are provided with +# settings may be enabled optionally or are provided with # alternative values. # -# This script is typically sourced in your current shell environment +# This script is typically sourced in your current shell environment # (probably by .bashrc, .bash_profile, or something similar), so that # the KOS environment is set up automatically for each shell session. # -# Build Architecture +# Build Architecture # # Set the major architecture you'll be building for. # The only option here is "dreamcast" as of KOS 2.0.0. # export KOS_ARCH="dreamcast" -# Build Sub-Architecture +# Build Sub-Architecture # # Defines the sub architecture your configuration # is targeting or uses an existing value that @@ -47,15 +47,15 @@ export KOS_PORTS="${KOS_BASE}/../kos-ports" # SH Compiler Prefixes # -# Specifies the path to and prefix for the main SH +# Specifies the path to and prefix for the main SH # GCC toolchain used to target the Dreamcast's SH4 CPU. # -export KOS_CC_BASE="/opt/toolchains/dc/sh-elf" +export KOS_CC_BASE="/opt/toolchains/dc/sh-elf" export KOS_CC_PREFIX="sh-elf" # ARM Compiler Prefixes # -# Specifies the path to and prefix for the additional ARM +# Specifies the path to and prefix for the additional ARM # GCC toolchain used to target the Dreamcast's AICA SPU. # export DC_ARM_BASE="/opt/toolchains/dc/arm-eabi" @@ -78,8 +78,8 @@ export KOS_GENROMFS="${KOS_BASE}/utils/genromfs/genromfs" # Make Utility # # Configures the tool to be used as the main "make" utility -# for building GNU Makefiles. On a platform such as BSD, -# the default can be changed to "gmake," for the GNU +# for building GNU Makefiles. On a platform such as BSD, +# the default can be changed to "gmake," for the GNU # implementation. # export KOS_MAKE="make" @@ -93,9 +93,9 @@ export KOS_MAKE="make" # or dc-tool-serial configuration, remembering to change the values # for the Dreamcast's IP address or the serial port interface. # -export KOS_LOADER="dc-tool -x" +export KOS_LOADER="dc-tool -x" #export KOS_LOADER="dc-tool-ip -t 192.168.1.100 -x" -#export KOS_LOADER="dc-tool-ser -t /dev/ttyS0 -x" +#export KOS_LOADER="dc-tool-ser -t /dev/ttyS0 -x" # Default Compiler Flags # @@ -109,19 +109,19 @@ export KOS_LDFLAGS="" export KOS_AFLAGS="" export DC_ARM_LDFLAGS="" -# Optimization Level +# Optimization Level # -# Controls the baseline optimization level to use when building. +# Controls the baseline optimization level to use when building. # Typically this is -Og (debugging), -O0, -01, -02, or -03. -# NOTE: For our target, -O4 is a valid optimization level that has +# NOTE: For our target, -O4 is a valid optimization level that has # been seen to have some performance impact as well. # export KOS_CFLAGS="${KOS_CFLAGS} -O2" # Additional Optimizations # -# Uncomment this to enable what has been found empirically to be -# the optimal set of additional flags for release build performance +# Uncomment this to enable what has been found empirically to be +# the optimal set of additional flags for release build performance # on the current stable toolchain. NOTE: Certain KOS-ports and examples # do not work properly with "-flto=auto"! # @@ -130,18 +130,18 @@ export KOS_CFLAGS="${KOS_CFLAGS} -O2" # Frame Pointers # # Controls whether frame pointers are emitted or not. Disabled by -# default. Enable them if you plan to use GDB for debugging. +# default. Enable them if you plan to use GDB for debugging. # export KOS_CFLAGS="${KOS_CFLAGS} -fomit-frame-pointer" #export KOS_CFLAGS="${KOS_CFLAGS} -fno-omit-frame-pointer -DFRAME_POINTERS" # GCC Builtin Functions # -# Comment out this line to enable GCC to use its own builtin implementations of +# Comment out this line to enable GCC to use its own builtin implementations of # certain standard library functions. Under certain conditions, this can allow # compiler-optimized implementations to replace standard function invocations. # The downside of this is that it COULD interfere with Newlib or KOS implementations -# of these functions, and it has not been tested thoroughly to ensure compatibility. +# of these functions, and it has not been tested thoroughly to ensure compatibility. # export KOS_CFLAGS="${KOS_CFLAGS} -fno-builtin" @@ -155,6 +155,20 @@ export KOS_CFLAGS="${KOS_CFLAGS} -fno-builtin" # # export KOS_CFLAGS="${KOS_CFLAGS} -ffast-math -ffp-contract=fast -mfsrra -mfsca" +# SH4 Floating Point Arithmetic Precision +# +# KallistiOS only officially supports the single-precision-only floating-point +# arithmetic mode (-m4-single-only), but double precision default (-m4) or +# double precision, single default (-m4-single) 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! +# +export KOS_SH4_PRECISION="-m4-single-only" + # Additional Tools Path # # If not already set, add "bin" directory to PATH variable, which is where @@ -167,8 +181,9 @@ fi # Shared Compiler Configuration # -# Include sub architecture-independent configuration file for shared -# environment settings. If you want to configure additional compiler +# Include sub architecture-independent configuration file for shared +# environment settings. If you want to configure additional compiler # options or see where other build flags are set, look at this file. # . ${KOS_BASE}/environ_base.sh + diff --git a/environ_dreamcast.sh b/environ_dreamcast.sh index cb092da..7108f2c 100644 --- a/environ_dreamcast.sh +++ b/environ_dreamcast.sh @@ -1,14 +1,19 @@ # KallistiOS environment variable settings. These are the shared pieces # for the Dreamcast(tm) platform. -export KOS_CFLAGS="${KOS_CFLAGS} -ml -m4-single-only -ffunction-sections -fdata-sections -matomic-model=soft-imask -ftls-model=local-exec" +# Default the SH4 floating point precision if it isn't already set. +if [ -z "${KOS_SH4_PRECISION}" ] ; then + export KOS_SH4_PRECISION="-m4-single-only" +fi + +export KOS_CFLAGS="${KOS_CFLAGS} ${KOS_SH4_PRECISION} -ml -ffunction-sections -fdata-sections -matomic-model=soft-imask -ftls-model=local-exec" export KOS_AFLAGS="${KOS_AFLAGS} -little" if [ x${KOS_SUBARCH} = xnaomi ]; then - export KOS_LDFLAGS="${KOS_LDFLAGS} -ml -m4-single-only -Wl,-Ttext=0x8c020000 -Wl,--gc-sections" + 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" else - export KOS_LDFLAGS="${KOS_LDFLAGS} -ml -m4-single-only -Wl,-Ttext=0x8c010000 -Wl,--gc-sections" + 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 @@ -25,5 +30,5 @@ if [ x${KOS_ARCH} = xdreamcast ]; then export DC_ARM_START="${KOS_ARCH_DIR}/sound/arm/crt0.s" export DC_ARM_LDFLAGS="${DC_ARM_LDFLAGS} -Wl,-Ttext=0x00000000,-N -nostartfiles -nostdlib -e reset" export DC_ARM_LIB_PATHS="" - export DC_ARM_LIBS="-Wl,--start-group -lgcc -Wl,--end-group" + export DC_ARM_LIBS="-Wl,--start-group -lgcc -Wl,--end-group" fi hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: ljsebald <ljs...@us...> - 2024-01-11 04:41:58
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via 1d95eff07fa77034e006d5eb4cc6c26925ce8ef8 (commit) via 87460c89342c52c567c45304c19356407321462f (commit) via b5370b75ec8d7cf7c90b5f9f7ee99414f064e64c (commit) via f9e296e6071e9cf63dbb25abc682d4e8bf18b2d5 (commit) via fc3392e7e26e987670f2309b9e815d2348dd567b (commit) via 37072da716aefcbe89bbf26985c71cfffd0068bb (commit) via 0018443b3dfd30ce451130bca0ad17a382797637 (commit) via f3e3e213ca0cbecc01875340b5cd72b244c93dc2 (commit) via 9e47264c7fe2f34f81945c58ea6e2d1ec6d9ee6d (commit) from 95a16abc543b202cdbe3597883df441e93c06ab4 (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 1d95eff07fa77034e006d5eb4cc6c26925ce8ef8 Merge: 87460c8 f3e3e21 Author: Lawrence Sebald <ljs...@us...> Date: Wed Jan 10 23:40:59 2024 -0500 Merge pull request #451 from KallistiOS/chain-upgrades dc-chain: Allow fp precision adjustments; update configurations commit 87460c89342c52c567c45304c19356407321462f Merge: b5370b7 37072da Author: Lawrence Sebald <ljs...@us...> Date: Wed Jan 10 23:39:43 2024 -0500 Merge pull request #458 from KallistiOS/cmake_update Fixed Romdisks and Added Bin2Object Support to CMake Toolchain commit b5370b75ec8d7cf7c90b5f9f7ee99414f064e64c Merge: f9e296e 0018443 Author: Lawrence Sebald <ljs...@us...> Date: Wed Jan 10 23:38:35 2024 -0500 Merge pull request #455 from KallistiOS/abort_retval Changed abort() to call arch_abort() commit f9e296e6071e9cf63dbb25abc682d4e8bf18b2d5 Merge: fc3392e 9e47264 Author: Lawrence Sebald <ljs...@us...> Date: Wed Jan 10 23:37:45 2024 -0500 Merge pull request #449 from KallistiOS/newnewlib Add support for Newlib 4.4.0 commit fc3392e7e26e987670f2309b9e815d2348dd567b Author: Andy Barajas <and...@gm...> Date: Wed Jan 10 20:36:30 2024 -0800 Fix serpent_dma example (#448) * Update sq usage in example commit 37072da716aefcbe89bbf26985c71cfffd0068bb Author: Falco Girgis <gyr...@gm...> Date: Wed Jan 10 15:50:53 2024 -0600 CMake Toolchain Update - Toolchain now supports the new romdisk model - Toolchain automatically includes the CMake utility file containing other functions - All functions are namespace scoped by kos_ - genromfs is no longer accessed via the environment variable, so only KOS_BASE needs to be set in the toolchain as an external env variable - kos_add_binary() was added as a wrapper around bin2o which adds the resulting object file to the target automatically commit 0018443b3dfd30ce451130bca0ad17a382797637 Author: Falco Girgis <gyr...@gm...> Date: Tue Jan 9 01:35:11 2024 -0600 Changed abort() to call arch_abort() - abort() should 1) not return a successful result code 2) should not invoke the atexit() finalizers upon being called, both of which were happening - Changed abort() to call arch_abort(), which is a hasty shutdown without calling atexit() finalizers that will also return EXIT_FAILURE. commit f3e3e213ca0cbecc01875340b5cd72b244c93dc2 Author: darc <da...@pr...> Date: Thu Jan 4 15:47:41 2024 -0600 dc-chain: Allow fp precision adjustments; update configurations commit 9e47264c7fe2f34f81945c58ea6e2d1ec6d9ee6d Author: darc <da...@pr...> Date: Wed Jan 3 22:44:06 2024 -0600 Add support for Newlib 4.4.0 ----------------------------------------------------------------------- Summary of changes: AUTHORS | 4 +- examples/dreamcast/parallax/serpent_dma/serpent.c | 7 ++- kernel/libc/koslib/abort.c | 10 ++-- kernel/libc/newlib/newlib_getentropy.c | 8 +++ utils/cmake/dreamcast.cmake | 58 +++++++++++++++++----- utils/cmake/dreamcast.toolchain.cmake | 20 +++----- utils/dc-chain/config/README.md | 14 +++--- utils/dc-chain/config/config.mk.10.5.0.sample | 23 +++++++-- utils/dc-chain/config/config.mk.11.4.0.sample | 23 +++++++-- utils/dc-chain/config/config.mk.12.3.0.sample | 23 +++++++-- ...mk.devel.sample => config.mk.13.2.1-dev.sample} | 42 ++++++++++------ ...mk.devel.sample => config.mk.14.0.1-dev.sample} | 31 +++++++++--- ...legacy.sample => config.mk.4.7.4-legacy.sample} | 23 +++++++-- ....9.3.0.sample => config.mk.9.3.0-legacy.sample} | 23 +++++++-- ...-latest.sample => config.mk.9.5.0-winxp.sample} | 23 +++++++-- utils/dc-chain/config/config.mk.stable.sample | 23 +++++++-- utils/dc-chain/docker/Dockerfile | 2 +- .../{gcc-devel-kos.diff => gcc-13.2.1-kos.diff} | 50 +++++++++---------- .../{gcc-devel-kos.diff => gcc-14.0.1-kos.diff} | 56 ++++++++++----------- ...120-kos.diff => newlib-4.4.0.20231231-kos.diff} | 42 ++++++++-------- utils/dc-chain/scripts/build.mk | 2 +- 21 files changed, 332 insertions(+), 175 deletions(-) copy utils/dc-chain/config/{config.mk.devel.sample => config.mk.13.2.1-dev.sample} (84%) rename utils/dc-chain/config/{config.mk.devel.sample => config.mk.14.0.1-dev.sample} (86%) rename utils/dc-chain/config/{config.mk.legacy.sample => config.mk.4.7.4-legacy.sample} (89%) rename utils/dc-chain/config/{config.mk.9.3.0.sample => config.mk.9.3.0-legacy.sample} (89%) rename utils/dc-chain/config/{config.mk.winxp-latest.sample => config.mk.9.5.0-winxp.sample} (89%) copy utils/dc-chain/patches/{gcc-devel-kos.diff => gcc-13.2.1-kos.diff} (70%) rename utils/dc-chain/patches/{gcc-devel-kos.diff => gcc-14.0.1-kos.diff} (69%) copy utils/dc-chain/patches/{newlib-4.3.0.20230120-kos.diff => newlib-4.4.0.20231231-kos.diff} (80%) diff --git a/AUTHORS b/AUTHORS index 8e8923d..0110f61 100644 --- a/AUTHORS +++ b/AUTHORS @@ -42,11 +42,11 @@ Josh Pearson: 2013, 2014, 2015, 2016 Joe Fenton: 2016 Stefan Galowicz: 2016, 2017 Luke Benstead: 2020, 2021, 2022, 2023 -Eric Fradella: 2023 +Eric Fradella: 2023, 2024 Falco Girgis: 2023 Ruslan Rostovtsev: 2014, 2016, 2023 Colton Pawielski: 2023 -Andy Barajas: 2023 +Andy Barajas: 2023, 2024 Paul Cercueil: 2023 Files with Specific licenses: diff --git a/examples/dreamcast/parallax/serpent_dma/serpent.c b/examples/dreamcast/parallax/serpent_dma/serpent.c index 0a2736d..741513f 100644 --- a/examples/dreamcast/parallax/serpent_dma/serpent.c +++ b/examples/dreamcast/parallax/serpent_dma/serpent.c @@ -129,10 +129,8 @@ static void draw_sphere(sphere_t *s, int list) { /* Transform and write vertices to the TA via the store queues */ vd = (pvr_vertex_t *)pvr_vertbuf_tail(list); - QACR0 = ((((uint32)vd) >> 26) << 2) & 0x1c; - QACR1 = ((((uint32)vd) >> 26) << 2) & 0x1c; - sqd = (void *) - (0xe0000000 | (((uint32)vd) & 0x03ffffe0)); + sq_lock(vd); + sqd = (void *) SQ_MASK_DEST_ADDR(vd); /* { int o = irq_disable(); printf("transforming to %p, len %d\n", @@ -141,6 +139,7 @@ static void draw_sphere(sphere_t *s, int list) { } */ mat_transform_sq(v, sqd, s->stacks * (s->slices + 2)); + sq_unlock(); pvr_vertbuf_written(list, 32 * s->stacks * (s->slices + 2)); diff --git a/kernel/libc/koslib/abort.c b/kernel/libc/koslib/abort.c index d7cab16..da46bfd 100644 --- a/kernel/libc/koslib/abort.c +++ b/kernel/libc/koslib/abort.c @@ -1,15 +1,17 @@ /* KallistiOS ##version## abort.c - (c)2001 Megan Potter - + Copyright (C) 2001 Megan Potter + Copyright (C) 2024 Falco Girgis */ #include <stdlib.h> #include <arch/arch.h> -/* This is probably the closest mapping we've got for abort() */ +/* abort() causes abnormal/erroneous program termination + WITHOUT calling the atexit() handlers. This will eventually + return EXIT_FAILURE as the program's return code. */ __used void abort(void) { - arch_exit(); + arch_abort(); } diff --git a/kernel/libc/newlib/newlib_getentropy.c b/kernel/libc/newlib/newlib_getentropy.c index 5345182..add21b4 100644 --- a/kernel/libc/newlib/newlib_getentropy.c +++ b/kernel/libc/newlib/newlib_getentropy.c @@ -12,7 +12,15 @@ #include <arch/arch.h> +/* We provide getentropy() if using Newlib < 4.4.0 */ +#if __NEWLIB__ < 4 || (__NEWLIB__ == 4 && __NEWLIB_MINOR__ < 4) int getentropy(void *ptr, size_t len) { +#else +/* getentropy() is provided by Newlib >= 4.4.0, + but we must provide _getentropy_r() */ +int _getentropy_r(void *re, void *ptr, size_t len) { + (void)re; +#endif const int block_size = 128; struct timeval tv; uint8_t *src = ((uint8_t *)_arch_mem_top); diff --git a/utils/cmake/dreamcast.cmake b/utils/cmake/dreamcast.cmake index 8095511..97d8ffd 100644 --- a/utils/cmake/dreamcast.cmake +++ b/utils/cmake/dreamcast.cmake @@ -1,9 +1,40 @@ cmake_minimum_required(VERSION 3.23) +### Helper Function for Bin2Object ### +function(kos_bin2o inFile symbol) + # outFile is optional and defaults to the symbol name in the build directory + if(NOT ${ARGC} EQUAL 3) + set(outFile ${CMAKE_CURRENT_BINARY_DIR}/${symbol}.o) + else() + set(outFile ${ARGN}) + endif() + + # Custom Command to generate romdisk object file from image + add_custom_command( + OUTPUT ${outFile} + DEPENDS ${inFile} + COMMAND $ENV{KOS_BASE}/utils/bin2o/bin2o ${inFile} ${symbol} ${outFile} + ) +endfunction() + +function(kos_add_binary target inFile symbol) + set(outFile ${CMAKE_BINARY_DIR}/${symbol}.o) + kos_bin2o(${inFile} ${symbol} ${outFile}) + target_sources(${target} PRIVATE ${outFile}) +endfunction() + ### Helper Function for Generating Romdisk ### -function(generate_romdisk target romdiskName romdiskPath) - set(obj ${CMAKE_CURRENT_BINARY_DIR}/${romdiskName}.o) - set(img ${CMAKE_CURRENT_BINARY_DIR}/${romdiskName}.img) +function(kos_add_romdisk target romdiskPath) + # Name is optional and defaults to "romdisk" + if(NOT ${ARGC} EQUAL 3) + set(romdiskName romdisk) + else() + set(romdiskName ${ARGN}) + endif() + + set(obj ${CMAKE_CURRENT_BINARY_DIR}/${romdiskName}.o) + set(obj_tmp ${CMAKE_CURRENT_BINARY_DIR}/${romdiskName}_tmp.o) + set(img ${CMAKE_CURRENT_BINARY_DIR}/${romdiskName}.img) # Variable holding all files in the romdiskPath folder # CONFIGURE_DEPENDS causes the folder to always be rechecked @@ -16,16 +47,19 @@ function(generate_romdisk target romdiskName romdiskPath) # Only run when folder contents have changed by depending on # the romdiskFiles variable add_custom_command( - OUTPUT ${img} - COMMAND $ENV{KOS_GENROMFS} -f ${img} -d ${romdiskPath} -v + OUTPUT ${img} DEPENDS ${romdiskFiles} -) + COMMAND $ENV{KOS_BASE}/utils/genromfs/genromfs -f ${img} -d ${romdiskPath} -v + ) + + kos_bin2o(${img} ${romdiskName} ${obj_tmp}) - # Custom Command to generate romdisk object file from image -add_custom_command( - OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${romdiskName}.o - COMMAND $ENV{KOS_BASE}/utils/bin2o/bin2o ${img} ${romdiskName} ${obj} - DEPENDS ${img} + # Custom Command to generate romdisk object file from image + add_custom_command( + OUTPUT ${obj} + DEPENDS ${obj_tmp} + COMMAND ${CMAKE_C_COMPILER} -o ${obj} -r ${obj_tmp} -L${KOS_BASE}/lib/dreamcast -Wl,--whole-archive -lromdiskbase + COMMAND rm ${obj_tmp} ) # Append romdisk object to target @@ -33,7 +67,7 @@ add_custom_command( endfunction() ### Function to Enable SH4 Math Optimizations ### -function(enable_sh4_math) +function(kos_enable_sh4_math) if(NOT ${PLATFORM_DREAMCAST}) message(WARN " PLATFORM_DREAMCAST not set, skipping SH4 Math flags") return() diff --git a/utils/cmake/dreamcast.toolchain.cmake b/utils/cmake/dreamcast.toolchain.cmake index 08fbb0c..ea1e27b 100644 --- a/utils/cmake/dreamcast.toolchain.cmake +++ b/utils/cmake/dreamcast.toolchain.cmake @@ -68,18 +68,12 @@ set(CMAKE_FIND_LIBRARY_SUFFIXES ".a") set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) ##### Add Platform-Specific #defines ##### -ADD_DEFINITIONS( - -D__DREAMCAST__ - -D_arch_dreamcast -) +add_compile_definitions(__DREAMCAST__ _arch_dreamcast) if(${KOS_SUBARCH} MATCHES naomi) - ADD_DEFINITIONS( - -D__NAOMI__ - -D_arch_sub_naomi - ) + add_compile_definitions(__NAOMI__ _arch_sub_naomi) else() - ADD_DEFINITIONS(-D_arch_sub_pristine) + add_compile_definitions(_arch_sub_pristine) endif() ##### Configure Build Flags ##### @@ -99,7 +93,7 @@ set(CMAKE_ASM_FLAGS_RELEASE "") ##### Configure Include Directories ##### set(CMAKE_SYSTEM_INCLUDE_PATH "${CMAKE_SYSTEM_INCLUDE_PATH} ${KOS_BASE}/include ${KOS_BASE}/kernel/arch/dreamcast/include ${KOS_BASE}/addons/include ${KOS_PORTS}/include") -INCLUDE_DIRECTORIES( +include_directories( $ENV{KOS_BASE}/include $ENV{KOS_BASE}/kernel/arch/dreamcast/include $ENV{KOS_BASE}/addons/include @@ -117,11 +111,13 @@ endif() add_link_options(-ml -m4-single-only -Wl,--gc-sections -nodefaultlibs) -LINK_DIRECTORIES( +link_directories( ${KOS_BASE}/lib/dreamcast ${KOS_BASE}/addons/lib/dreamcast ${KOS_PORTS}/lib ) add_link_options(-L${KOS_BASE}/lib/dreamcast -L${KOS_BASE}/addons/lib/dreamcast -L${KOS_PORTS}/lib) -LINK_LIBRARIES(-Wl,--start-group -lstdc++ -lkallisti -lc -lgcc -Wl,--end-group m) +link_libraries(-Wl,--start-group -lstdc++ -lkallisti -lc -lgcc -Wl,--end-group -lm) + +include("${KOS_BASE}/utils/cmake/dreamcast.cmake") diff --git a/utils/dc-chain/config/README.md b/utils/dc-chain/config/README.md index 8674b15..14356e7 100644 --- a/utils/dc-chain/config/README.md +++ b/utils/dc-chain/config/README.md @@ -2,16 +2,16 @@ The available templates include the following configurations: | filename | sh4 gcc | newlib | sh4 binutils | arm gcc | arm binutils | notes | |---------:|:-------:|:----------:|:------------:|:-------:|:----------------:|:------| -| config.mk.legacy.sample | 4.7.4 | 2.0.0 | 2.34 | 4.7.4 | 2.34 | older toolchain based on GCC 4<br />former "stable" / "legacy" configuration<br /> [some issues may happen in C++](https://dcemulation.org/phpBB/viewtopic.php?f=29&t=104724) | -| config.mk.9.3.0.sample | 9.3.0 | 3.3.0 | 2.34 | 8.4.0 | 2.34 | older toolchain based on GCC 9<br />former "stable" configuration | -| config.mk.winxp-latest.sample | 9.5.0 | 4.3.0 | 2.34 | 8.5.0 | 2.34 | latest WinXP-compatible toolchain with GCC 9 | +| config.mk.4.7.4-legacy.sample | 4.7.4 | 2.0.0 | 2.34 | 4.7.4 | 2.34 | older toolchain based on GCC 4<br />former "stable" / "legacy" configuration<br /> [some issues may happen in C++](https://dcemulation.org/phpBB/viewtopic.php?f=29&t=104724) | +| config.mk.9.3.0-legacy.sample | 9.3.0 | 3.3.0 | 2.34 | 8.4.0 | 2.34 | older toolchain based on GCC 9<br />former "stable" configuration | +| config.mk.9.5.0-winxp.sample | 9.5.0 | 4.3.0 | 2.34 | 8.5.0 | 2.34 | latest WinXP-compatible toolchain with GCC 9 | | config.mk.10.5.0.sample | 10.5.0 | 4.3.0 | 2.41 | 8.5.0 | 2.41 | modern toolchain with GCC 10 | | config.mk.11.4.0.sample | 11.4.0 | 4.3.0 | 2.41 | 8.5.0 | 2.41 | modern toolchain with GCC 11 | | config.mk.12.3.0.sample | 12.3.0 | 4.3.0 | 2.41 | 8.5.0 | 2.41 | modern toolchain with GCC 12 | -| **config.mk.stable.sample** | **13.2.0** | **4.3.0** | **2.41** | **8.5.0** | **2.41** | **modern toolchain with GCC 13**<br />**current "stable" configuration** | -| config.mk.testing.sample | X | X | X | X | X | most recent GCC release<br />currently none in testing | -| config.mk.devel.sample | git | 4.3.0 | 2.41 | 8.5.0 | 2.41 | latest dev version from git<br />builds as of 2023-07-30 | +| **config.mk.stable.sample** | **13.2.0** | **4.3.0** | **2.41** | **8.5.0** | **2.41** | **modern toolchain with GCC 13.2.0 release**<br />**current "stable" configuration** | +| config.mk.13.2.1-dev.sample | 13.2.1 (git) | 4.4.0 | 2.41 | 8.5.0 | 2.41 | latest GCC 13 development version from git<br />known to build without issues | +| config.mk.14.0.1-dev.sample | 14.0.1 (git) | 4.4.0 | 2.41 | 8.5.0 | 2.41 | latest GCC 14 development version from git<br />builds with caveats, see sample file for more info | -The **stable** configuration is the primary, widely tested target for KallistiOS, and is the most recent toolchain configuration known to work with all example programs. The **testing** configuration contains the most recent release of GCC that builds KallistiOS and the 2ndmix example, and is without any known major issues. The **legacy** configuration contains an older version of the toolchain that may be useful in compiling older software. The alternative configurations are maintained at a low priority and are not guaranteed to build, but feel free to open a bug report if issues are encountered building one of these configurations. +The **stable** configuration is the primary, widely tested target for KallistiOS, and is the most recent toolchain configuration known to work with all example programs. The **legacy** configurations contain an older versions of the toolchain that may be useful in compiling older software. The non-"stable" alternative configurations 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 configurations. Please note that if you choose to install an older version of the GCC compiler, you may be required to use older versions of some of the prerequisites in certain configurations. For instance, building GCC `4.7.4` may require an older version of the `flex` tool be installed. If you receive errors about tools you have installed, check your system's package manager for an older version of that tool. Depending on availability, it may not be possible to build older versions of the toolchain on your platform. diff --git a/utils/dc-chain/config/config.mk.10.5.0.sample b/utils/dc-chain/config/config.mk.10.5.0.sample index c5805b8..937f35b 100644 --- a/utils/dc-chain/config/config.mk.10.5.0.sample +++ b/utils/dc-chain/config/config.mk.10.5.0.sample @@ -112,17 +112,30 @@ makejobs=-j2 # hard drive space. pass2_languages=c,c++,objc,obj-c++ +# Floating point precision support (m4|m4-single|m4-single-only) +# Build support for various SH4 floating-point operation ABIs. KallistiOS only +# officially supports single-precision-only mode. Add m4 (double precision) or +# m4-single (single precision) to build experimental support for those ABIs. +precision_modes=m4-single-only +#precision_modes=m4,m4-single,m4-single-only + +# Default floating point mode (m4|m4-single|m4-single-only) +# Choose the default floating point precision ABI used when GCC is invoked. This +# can be overridden by using passing -m4, -m4-single, or -m4-single-only to GCC. +# KallistiOS currently only supports m4-single-only, so that is the default. +default_precision=m4-single-only + # GCC threading model (single|kos|posix*) -# With GCC 4.x versions and up, the patches provide a 'kos' thread model, so you -# should use it. If you really don't want threading support for C++ (or -# Objective C/Objective C++), you can set this to 'single'. With GCC 3.x, you +# With GCC 4.x versions and up, the patches provide a 'kos' thread model, so you +# should use it. If you really don't want threading support for C++ (or +# Objective C/Objective C++), you can set this to 'single'. With GCC 3.x, you # probably want 'posix' here; but this mode is deprecated as the GCC 3.x branch # is not anymore supported. thread_model=kos # Automatic patching for KOS (1|0) -# Uncomment this if you want to disable applying KOS patches to the toolchain -# source files before building. This will disable usage of the 'kos' thread model. +# Uncomment this if you want to disable applying KOS patches to the toolchain +# source files before building. This will disable usage of the 'kos' thread model. #use_kos_patches=0 # Automatic fixup SH-4 Newlib (1|0) diff --git a/utils/dc-chain/config/config.mk.11.4.0.sample b/utils/dc-chain/config/config.mk.11.4.0.sample index b3d2892..949e718 100644 --- a/utils/dc-chain/config/config.mk.11.4.0.sample +++ b/utils/dc-chain/config/config.mk.11.4.0.sample @@ -112,17 +112,30 @@ makejobs=-j2 # hard drive space. pass2_languages=c,c++,objc,obj-c++ +# Floating point precision support (m4|m4-single|m4-single-only) +# Build support for various SH4 floating-point operation ABIs. KallistiOS only +# officially supports single-precision-only mode. Add m4 (double precision) or +# m4-single (single precision) to build experimental support for those ABIs. +precision_modes=m4-single-only +#precision_modes=m4,m4-single,m4-single-only + +# Default floating point mode (m4|m4-single|m4-single-only) +# Choose the default floating point precision ABI used when GCC is invoked. This +# can be overridden by using passing -m4, -m4-single, or -m4-single-only to GCC. +# KallistiOS currently only supports m4-single-only, so that is the default. +default_precision=m4-single-only + # GCC threading model (single|kos|posix*) -# With GCC 4.x versions and up, the patches provide a 'kos' thread model, so you -# should use it. If you really don't want threading support for C++ (or -# Objective C/Objective C++), you can set this to 'single'. With GCC 3.x, you +# With GCC 4.x versions and up, the patches provide a 'kos' thread model, so you +# should use it. If you really don't want threading support for C++ (or +# Objective C/Objective C++), you can set this to 'single'. With GCC 3.x, you # probably want 'posix' here; but this mode is deprecated as the GCC 3.x branch # is not anymore supported. thread_model=kos # Automatic patching for KOS (1|0) -# Uncomment this if you want to disable applying KOS patches to the toolchain -# source files before building. This will disable usage of the 'kos' thread model. +# Uncomment this if you want to disable applying KOS patches to the toolchain +# source files before building. This will disable usage of the 'kos' thread model. #use_kos_patches=0 # Automatic fixup SH-4 Newlib (1|0) diff --git a/utils/dc-chain/config/config.mk.12.3.0.sample b/utils/dc-chain/config/config.mk.12.3.0.sample index ef590d2..1e1560e 100644 --- a/utils/dc-chain/config/config.mk.12.3.0.sample +++ b/utils/dc-chain/config/config.mk.12.3.0.sample @@ -112,17 +112,30 @@ makejobs=-j2 # hard drive space. pass2_languages=c,c++,objc,obj-c++ +# Floating point precision support (m4|m4-single|m4-single-only) +# Build support for various SH4 floating-point operation ABIs. KallistiOS only +# officially supports single-precision-only mode. Add m4 (double precision) or +# m4-single (single precision) to build experimental support for those ABIs. +precision_modes=m4-single-only +#precision_modes=m4,m4-single,m4-single-only + +# Default floating point mode (m4|m4-single|m4-single-only) +# Choose the default floating point precision ABI used when GCC is invoked. This +# can be overridden by using passing -m4, -m4-single, or -m4-single-only to GCC. +# KallistiOS currently only supports m4-single-only, so that is the default. +default_precision=m4-single-only + # GCC threading model (single|kos|posix*) -# With GCC 4.x versions and up, the patches provide a 'kos' thread model, so you -# should use it. If you really don't want threading support for C++ (or -# Objective C/Objective C++), you can set this to 'single'. With GCC 3.x, you +# With GCC 4.x versions and up, the patches provide a 'kos' thread model, so you +# should use it. If you really don't want threading support for C++ (or +# Objective C/Objective C++), you can set this to 'single'. With GCC 3.x, you # probably want 'posix' here; but this mode is deprecated as the GCC 3.x branch # is not anymore supported. thread_model=kos # Automatic patching for KOS (1|0) -# Uncomment this if you want to disable applying KOS patches to the toolchain -# source files before building. This will disable usage of the 'kos' thread model. +# Uncomment this if you want to disable applying KOS patches to the toolchain +# source files before building. This will disable usage of the 'kos' thread model. #use_kos_patches=0 # Automatic fixup SH-4 Newlib (1|0) diff --git a/utils/dc-chain/config/config.mk.devel.sample b/utils/dc-chain/config/config.mk.13.2.1-dev.sample similarity index 84% copy from utils/dc-chain/config/config.mk.devel.sample copy to utils/dc-chain/config/config.mk.13.2.1-dev.sample index 6ca25e9..8bb10ba 100644 --- a/utils/dc-chain/config/config.mk.devel.sample +++ b/utils/dc-chain/config/config.mk.13.2.1-dev.sample @@ -8,21 +8,21 @@ ############################################################################### ############################################################################### ### THIS CONFIG IS FOR AN EXPERIMENTAL VERSION OF GCC! -## THERE ARE NO KNOWN ISSUES BUILDING THIS VERSION as of 2023-07-30. +## THERE ARE NO KNOWN ISSUES BUILDING THIS VERSION as of 2024-01-04. ############################################################################### ############################################################################### # Toolchain versions for SH sh_binutils_ver=2.41 -sh_gcc_ver=devel -newlib_ver=4.3.0.20230120 +sh_gcc_ver=13.2.1 +newlib_ver=4.4.0.20231231 gdb_ver=14.1 # Tarball extensions to download for SH sh_binutils_download_type=xz sh_gcc_download_type=git sh_gcc_git_repo=git://gcc.gnu.org/git/gcc.git -sh_gcc_git_branch=master +sh_gcc_git_branch=releases/gcc-13 newlib_download_type=gz gdb_download_type=xz @@ -114,25 +114,37 @@ install_mode=install-strip # detected on some OS. makejobs=-j2 -# Languages (c|c++|objc|obj-c++|rust) +# Languages (c|c++|objc|obj-c++) # Set the languages to build for pass 2 of building gcc for sh-elf. The default -# here is to build C, C++, Objective-C, Objective-C++, and Rust. You may want -# to take out some languages if you're not worried about them and/or you're -# short on hard drive space. Only C is required to build KallistiOS, but some -# included examples use other languages. -pass2_languages=c,c++,objc,obj-c++,rust +# here is to build C, C++, Objective C, and Objective C++. You may want to take +# out the latter two if you're not worried about them and/or you're short on +# hard drive space. +pass2_languages=c,c++,objc,obj-c++ + +# Floating point precision support (m4|m4-single|m4-single-only) +# Build support for various SH4 floating-point operation ABIs. KallistiOS only +# officially supports single-precision-only mode. Add m4 (double precision) or +# m4-single (single precision) to build experimental support for those ABIs. +precision_modes=m4-single-only +#precision_modes=m4,m4-single,m4-single-only + +# Default floating point mode (m4|m4-single|m4-single-only) +# Choose the default floating point precision ABI used when GCC is invoked. This +# can be overridden by using passing -m4, -m4-single, or -m4-single-only to GCC. +# KallistiOS currently only supports m4-single-only, so that is the default. +default_precision=m4-single-only # GCC threading model (single|kos|posix*) -# With GCC 4.x versions and up, the patches provide a 'kos' thread model, so you -# should use it. If you really don't want threading support for C++ (or -# Objective C/Objective C++), you can set this to 'single'. With GCC 3.x, you +# With GCC 4.x versions and up, the patches provide a 'kos' thread model, so you +# should use it. If you really don't want threading support for C++ (or +# Objective C/Objective C++), you can set this to 'single'. With GCC 3.x, you # probably want 'posix' here; but this mode is deprecated as the GCC 3.x branch # is not anymore supported. thread_model=kos # Automatic patching for KOS (1|0) -# Uncomment this if you want to disable applying KOS patches to the toolchain -# source files before building. This will disable usage of the 'kos' thread model. +# Uncomment this if you want to disable applying KOS patches to the toolchain +# source files before building. This will disable usage of the 'kos' thread model. #use_kos_patches=0 # Automatic fixup SH-4 Newlib (1|0) diff --git a/utils/dc-chain/config/config.mk.devel.sample b/utils/dc-chain/config/config.mk.14.0.1-dev.sample similarity index 86% rename from utils/dc-chain/config/config.mk.devel.sample rename to utils/dc-chain/config/config.mk.14.0.1-dev.sample index 6ca25e9..1d11597 100644 --- a/utils/dc-chain/config/config.mk.devel.sample +++ b/utils/dc-chain/config/config.mk.14.0.1-dev.sample @@ -8,14 +8,16 @@ ############################################################################### ############################################################################### ### THIS CONFIG IS FOR AN EXPERIMENTAL VERSION OF GCC! -## THERE ARE NO KNOWN ISSUES BUILDING THIS VERSION as of 2023-07-30. +## THERE IS ONE KNOWN ISSUE BUILDING THIS VERSION as of 2024-01-04: +## 1. GCC 14.0.1 currently does not build with m4-single-only precision, which +## is the only officially supported KOS mode for floating-point precision. ############################################################################### ############################################################################### # Toolchain versions for SH sh_binutils_ver=2.41 -sh_gcc_ver=devel -newlib_ver=4.3.0.20230120 +sh_gcc_ver=14.0.1 +newlib_ver=4.4.0.20231231 gdb_ver=14.1 ...<truncated>... hooks/post-receive -- A pseudo Operating System for the Dreamcast. |