From: quzar <qu...@us...> - 2024-12-04 19:16:25
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via bae7adbde177c04560de31577932ace50988b238 (commit) via 968f4ac212387d0353c863670a578059a03cbafa (commit) via 6f10c0e34b9654546bd00a8cb4ada9516717061b (commit) via 0544b0ad66c620c065565155bd8dbc33fc85858b (commit) from e1d7e5b49431ff043652f09cbd81e8bb414b0b5b (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 bae7adbde177c04560de31577932ace50988b238 Author: Donald Haase <qu...@ya...> Date: Wed Dec 4 14:15:10 2024 -0500 Reverse the order of searching the genwait queue. (#820) This should provide an optimization for the more common scenario of new entries waiting longer than old. commit 968f4ac212387d0353c863670a578059a03cbafa Author: Donald Haase <qu...@ya...> Date: Wed Dec 4 14:14:27 2024 -0500 Correct out-of-memory test in scandir (#853) The test after realloc was improperly testing 'list' for NULL rather than '*list'. commit 6f10c0e34b9654546bd00a8cb4ada9516717061b Author: Donald Haase <qu...@ya...> Date: Wed Dec 4 14:01:12 2024 -0500 Fix wide character support. (#857) The previous cleanup of bfont.h accidentally used the size of a thin char to calculate the offsets for all the wide chars. The impact was visible in the bfont example where instead of printing the start button icon, a JISX-0208 character was printed. commit 0544b0ad66c620c065565155bd8dbc33fc85858b Author: Donald Haase <qu...@ya...> Date: Wed Dec 4 13:57:52 2024 -0500 Update byteorder to not rely on arch types (#855) byteorder.h was including <sys/_types.h> taking advantage of an old workaround that exports our internal types through that header and into stdio. This was the only file relying on that workaround in the KOS codebase and adjusting it is needed for #840 ----------------------------------------------------------------------- Summary of changes: kernel/arch/dreamcast/include/arch/byteorder.h | 6 ++---- kernel/arch/dreamcast/include/dc/biosfont.h | 12 +++++++----- kernel/libc/koslib/scandir.c | 2 +- kernel/thread/genwait.c | 10 +++++----- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/kernel/arch/dreamcast/include/arch/byteorder.h b/kernel/arch/dreamcast/include/arch/byteorder.h index 2585f247..f21aa92a 100644 --- a/kernel/arch/dreamcast/include/arch/byteorder.h +++ b/kernel/arch/dreamcast/include/arch/byteorder.h @@ -25,8 +25,6 @@ #include <sys/cdefs.h> __BEGIN_DECLS -#include <sys/_types.h> - #ifdef BYTE_ORDER /* If we've included <arch/types.h>, this might already be defined... */ #undef BYTE_ORDER @@ -52,7 +50,7 @@ __BEGIN_DECLS \return The swapped value. */ #define arch_swap16(x) ({ \ - uint16 __x = (x); \ + uint16_t __x = (x); \ __asm__ __volatile__("swap.b %0, %0" : "=r" (__x) : "0" (__x)); \ __x; \ }) @@ -67,7 +65,7 @@ __BEGIN_DECLS \return The swapped value. */ #define arch_swap32(x) ({ \ - uint32 __x = (x); \ + uint32_t __x = (x); \ __asm__ __volatile__("swap.b %0, %0\n\t" \ "swap.w %0, %0\n\t" \ "swap.b %0, %0\n\t" : "=r"(__x) : "0" (__x)); \ diff --git a/kernel/arch/dreamcast/include/dc/biosfont.h b/kernel/arch/dreamcast/include/dc/biosfont.h index b2a77cb3..f4be15f9 100644 --- a/kernel/arch/dreamcast/include/dc/biosfont.h +++ b/kernel/arch/dreamcast/include/dc/biosfont.h @@ -55,6 +55,7 @@ __BEGIN_DECLS /** \brief Number of bytes to represent a single character within the BIOS font. */ #define BFONT_BYTES_PER_CHAR (BFONT_THIN_WIDTH * BFONT_HEIGHT / 8) +#define BFONT_BYTES_PER_WIDE_CHAR (BFONT_WIDE_WIDTH * BFONT_HEIGHT / 8) /** \defgroup bfont_indicies Structure \brief Structure of the Bios Font @@ -76,14 +77,15 @@ __BEGIN_DECLS /** \brief Start of JISX-0208 Rows 1-7 in Font Block */ #define BFONT_JISX_0208_ROW1 BFONT_WIDE_START /** \brief Start of JISX-0208 Row 16-47 (Start of Level 1) in Font Block */ -#define BFONT_JISX_0208_ROW16 (BFONT_WIDE_START + (658 * BFONT_BYTES_PER_CHAR)) +#define BFONT_JISX_0208_ROW16 (BFONT_WIDE_START + (658 * BFONT_BYTES_PER_WIDE_CHAR)) /** \brief JISX-0208 Row 48-84 (Start of Level 2) in Font Block */ -#define BFONT_JISX_0208_ROW48 (BFONT_JISX_0208_ROW16 + ((32 * JISX_0208_ROW_SIZE) * BFONT_BYTES_PER_CHAR)) +#define BFONT_JISX_0208_ROW48 (BFONT_JISX_0208_ROW16 + ((32 * JISX_0208_ROW_SIZE) * BFONT_BYTES_PER_WIDE_CHAR)) /** \brief Start of DC Specific Characters in Font Block */ -#define BFONT_DREAMCAST_SPECIFIC (BFONT_WIDE_START + (7056 * BFONT_BYTES_PER_CHAR)) +#define BFONT_DREAMCAST_SPECIFIC (BFONT_WIDE_START + (7056 * BFONT_BYTES_PER_WIDE_CHAR)) + /** \brief Takes a DC-specific icon index and returns a character offset. */ -#define BFONT_DC_ICON(offset) (BFONT_DREAMCAST_SPECIFIC + ((offset) * BFONT_BYTES_PER_CHAR)) +#define BFONT_DC_ICON(offset) (BFONT_DREAMCAST_SPECIFIC + ((offset) * BFONT_BYTES_PER_WIDE_CHAR)) /** \defgroup bfont_dc_indices Dreamcast-Specific \brief Dreamcast-specific BIOS icon offsets. @@ -114,7 +116,7 @@ __BEGIN_DECLS /** @} */ #define BFONT_ICON_DIMEN 32 /**< \brief Dimension of vmu icons */ -#define BFONT_VMU_DREAMCAST_SPECIFIC (BFONT_DREAMCAST_SPECIFIC+(22 * BFONT_BYTES_PER_CHAR)) +#define BFONT_VMU_DREAMCAST_SPECIFIC (BFONT_DREAMCAST_SPECIFIC+(22 * BFONT_BYTES_PER_WIDE_CHAR)) /** @} */ /** \brief Builtin VMU Icons diff --git a/kernel/libc/koslib/scandir.c b/kernel/libc/koslib/scandir.c index c81106e5..bff4b488 100644 --- a/kernel/libc/koslib/scandir.c +++ b/kernel/libc/koslib/scandir.c @@ -48,7 +48,7 @@ static int push_back(struct dirent ***list, int *size, int *capacity, *list = realloc(*list, *capacity * sizeof(struct dirent*)); /* Handle out-of-memory in case realloc() failed. */ - if(!list) + if(!*list) goto out_of_memory; else list_tmp = list; diff --git a/kernel/thread/genwait.c b/kernel/thread/genwait.c index b5c8fa4f..11e40fa2 100644 --- a/kernel/thread/genwait.c +++ b/kernel/thread/genwait.c @@ -45,15 +45,15 @@ static void tq_insert(kthread_t * thd) { /* Search for its place; note that new threads will be placed at the end of a group with the same timeout. */ - TAILQ_FOREACH(t, &timer_queue, timerq) { - if(thd->wait_timeout < t->wait_timeout) { - TAILQ_INSERT_BEFORE(t, thd, timerq); + TAILQ_FOREACH_REVERSE(t, &timer_queue, slpquehead, timerq) { + if(thd->wait_timeout >= t->wait_timeout) { + TAILQ_INSERT_AFTER(&timer_queue, t, thd, timerq); return; } } - /* Couldn't find anything scheduled later, put this at the end. */ - TAILQ_INSERT_TAIL(&timer_queue, thd, timerq); + /* Couldn't find anything scheduled earlier, put this at the start. */ + TAILQ_INSERT_HEAD(&timer_queue, thd, timerq); } /* Internal function to remove a thread from the timer queue. */ hooks/post-receive -- A pseudo Operating System for the Dreamcast. |