From: ljsebald <ljs...@us...> - 2024-04-26 03:32:02
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via 04c59b4b3ff9a5a0b42bd203a3603f609dded7f0 (commit) via 9e2e9a6957ce3fd65d2d30ece8d85e3824b04369 (commit) via 3312ee367ac9fd8085fe82972b690c31b416de62 (commit) via 48f726bca52a2236b9fd4eedc3213d932ee976fa (commit) via bf7522237785aeadf9db36c60dac5a7e7e76729f (commit) via f2a190712b6ad193e2fe1036ec5012d3aa72186d (commit) via 620b446751285932f4213266599f55f1de79a90a (commit) via 316c185a868bac317d8127248db20bc7908f74ed (commit) via 4e17691a9baa48081ec650eecfe49ff57050e081 (commit) via cf95ea3d84565d65d6e0e6ecf3f70d13badf117a (commit) via e0989c9d3d157ba0f7f9834c130206376ec00aa2 (commit) via 84d935187fd8ceccda9e7313467d99f5755d50e7 (commit) via b0c09b2bec4756a87a355764ac00c0ec76a83b35 (commit) via 8e103815db2de84d171be9a0b92e854359ac4601 (commit) via 3a5ea762b0f257180bd980a435eb17ada53026e9 (commit) via 842a0c489904997f6872725a18919557dda1e919 (commit) from 1ff6f043444446a09d55e464fd9a73be5307c740 (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 04c59b4b3ff9a5a0b42bd203a3603f609dded7f0 Author: Falco Girgis <gyr...@gm...> Date: Thu Apr 25 22:27:18 2024 -0500 Increased Timing Resolution of pvr_stats_t (#471) * Increased timing resolution of pvr_stats_t. - Now that the TMU driver has been upgraded, this can all be bumped up from millisecond to nanosecond resolution. * Addressed review feedback. - Noted the pvr_stats_t precision upgrade in the CHANGELOG. - The size of the rendered farme time bars in serpent_dma had to be adjusted for the new resolution. * Addressed review feedback 1) pvr_stats_t timestamps are now stored as uint64_t 2) pvr_stats_t struct was reorganized for optimal packing 3) PVR vblank events are no longer grabbing timestamps for no reason 4) PVR stats formatting in serpent_dma example was fixed * Added units to render stats text commit 9e2e9a6957ce3fd65d2d30ece8d85e3824b04369 Merge: 3312ee36 cf95ea3d Author: Lawrence Sebald <ljs...@us...> Date: Thu Apr 25 23:21:02 2024 -0400 Merge pull request #493 from KallistiOS/No_u_dev Allow /dev/ to exist independently of /dev/random commit 3312ee367ac9fd8085fe82972b690c31b416de62 Merge: 48f726bc 620b4467 Author: Lawrence Sebald <ljs...@us...> Date: Thu Apr 25 23:11:19 2024 -0400 Merge pull request #519 from KallistiOS/warnings_fixes Fixed Release Build Warnings from Defining NDEBUG. commit 48f726bca52a2236b9fd4eedc3213d932ee976fa Merge: 1ff6f043 bf752223 Author: Lawrence Sebald <ljs...@us...> Date: Thu Apr 25 23:09:17 2024 -0400 Merge pull request #524 from KallistiOS/kbd_atomics_fix Fixed kbd build issues due to <stdatomic> in C++ commit bf7522237785aeadf9db36c60dac5a7e7e76729f Author: Falco Girgis <gyr...@gm...> Date: Wed Apr 24 23:37:30 2024 -0500 Addressing review feedback. commit f2a190712b6ad193e2fe1036ec5012d3aa72186d Author: Falco Girgis <gyr...@gm...> Date: Wed Apr 24 21:29:59 2024 -0500 Fixed kbd build issues due to <stdatomic> in C++. - keyboard.h's reliance on <stdatomic.h> was breaking C++ builds, since stupid C++ didn't implement compatibilty with this header until C++23. - Made the atomic kbd_state_t::queue_len just a volatile integer - Modifed all code touching queue_len to do so with interrupts disabled, to essentially emulate atomic behavior. commit cf95ea3d84565d65d6e0e6ecf3f70d13badf117a Author: Donald Haase <qu...@ya...> Date: Fri Apr 12 23:38:50 2024 -0400 Clean up formatting From @andressbarajas' suggestions. Co-authored-by: Andy Barajas <and...@gm...> commit e0989c9d3d157ba0f7f9834c130206376ec00aa2 Merge: 84d93518 33acd8ae Author: Donald Haase <qu...@ya...> Date: Sun Mar 24 22:01:19 2024 -0400 Merge branch 'master' into No_u_dev commit 84d935187fd8ceccda9e7313467d99f5755d50e7 Author: QuzarDC <qu...@co...> Date: Tue Mar 5 09:02:13 2024 -0500 Add /dev/null commit b0c09b2bec4756a87a355764ac00c0ec76a83b35 Author: QuzarDC <qu...@co...> Date: Tue Mar 5 07:09:36 2024 -0500 Reimplement aliases commit 8e103815db2de84d171be9a0b92e854359ac4601 Author: QuzarDC <qu...@co...> Date: Tue Mar 5 01:50:08 2024 -0500 Add rewinddir and test it commit 3a5ea762b0f257180bd980a435eb17ada53026e9 Author: QuzarDC <qu...@co...> Date: Tue Mar 5 01:00:00 2024 -0500 Clean up whitespace commit 842a0c489904997f6872725a18919557dda1e919 Author: QuzarDC <qu...@co...> Date: Tue Mar 5 00:47:12 2024 -0500 Rebuild /dev/ to accept other devs ----------------------------------------------------------------------- Summary of changes: doc/CHANGELOG | 1 + examples/dreamcast/{libdream => dev}/Makefile | 5 +- .../dreamcast/{random => dev/devroot}/Makefile | 6 +- examples/dreamcast/dev/devroot/devroot.c | 62 ++++ examples/dreamcast/{ => dev}/random/Makefile | 0 examples/dreamcast/{ => dev}/random/random.c | 0 .../dreamcast/parallax/serpent_dma/perfmeter.c | 10 +- examples/dreamcast/parallax/serpent_dma/serpent.c | 12 +- include/kos/fs_dev.h | 20 +- include/kos/fs_null.h | 44 +++ include/kos/{fs_dev.h => fs_random.h} | 20 +- include/kos/nmmgr.h | 27 +- include/sys/dirent.h | 10 +- kernel/arch/dreamcast/hardware/maple/keyboard.c | 19 +- kernel/arch/dreamcast/hardware/modem/mdata.c | 1 + kernel/arch/dreamcast/hardware/pvr/pvr_internal.h | 26 +- kernel/arch/dreamcast/hardware/pvr/pvr_misc.c | 75 +++-- kernel/arch/dreamcast/include/dc/maple/keyboard.h | 4 +- kernel/arch/dreamcast/include/dc/matrix.h | 7 +- .../dreamcast/include/dc/net/broadband_adapter.h | 2 +- kernel/arch/dreamcast/include/dc/pvr.h | 20 +- kernel/arch/dreamcast/include/dc/sq.h | 2 - kernel/arch/dreamcast/include/dc/video.h | 2 +- kernel/arch/dreamcast/kernel/init.c | 8 +- kernel/arch/dreamcast/kernel/initall_hdrs.h | 2 + kernel/arch/dreamcast/sound/snd_stream.c | 1 + kernel/exports/nmmgr.c | 7 +- kernel/fs/Makefile | 3 +- kernel/fs/fs.c | 3 + kernel/fs/fs_dev.c | 326 +++++---------------- kernel/fs/fs_null.c | 272 +++++++++++++++++ kernel/fs/{fs_dev.c => fs_random.c} | 174 ++++++----- kernel/libc/koslib/readdir.c | 2 +- kernel/libc/koslib/realpath.c | 5 + kernel/thread/sem.c | 1 + 35 files changed, 722 insertions(+), 457 deletions(-) copy examples/dreamcast/{libdream => dev}/Makefile (86%) copy examples/dreamcast/{random => dev/devroot}/Makefile (90%) create mode 100644 examples/dreamcast/dev/devroot/devroot.c rename examples/dreamcast/{ => dev}/random/Makefile (100%) rename examples/dreamcast/{ => dev}/random/random.c (100%) create mode 100644 include/kos/fs_null.h copy include/kos/{fs_dev.h => fs_random.h} (75%) create mode 100644 kernel/fs/fs_null.c copy kernel/fs/{fs_dev.c => fs_random.c} (60%) diff --git a/doc/CHANGELOG b/doc/CHANGELOG index d4801fa1..0850517e 100644 --- a/doc/CHANGELOG +++ b/doc/CHANGELOG @@ -220,6 +220,7 @@ KallistiOS version 2.1.0 ----------------------------------------------- - *** Implemented scandir() and alphasort() POSIX functions from dirent.h [FG] - DC Added new driver for the SH4's UBC + high-level breakpoint API [FG] - DC Add support for French AZERTY keyboards [PC] +- DC Increased the resolution of pvr_stats_t from milli to nanoseconds [FG] KallistiOS version 2.0.0 ----------------------------------------------- - DC Broadband Adapter driver fixes [Megan Potter == MP] diff --git a/examples/dreamcast/libdream/Makefile b/examples/dreamcast/dev/Makefile similarity index 86% copy from examples/dreamcast/libdream/Makefile copy to examples/dreamcast/dev/Makefile index b32976d1..6e2aafa0 100644 --- a/examples/dreamcast/libdream/Makefile +++ b/examples/dreamcast/dev/Makefile @@ -1,10 +1,7 @@ # This will make all the examples, leaving only the elf files. # If you want to clean everything, use 'clean'. -SUBDIRS = 320x240 640x480 rgb888 ta -SUBDIRS += cdfs -SUBDIRS += spu -SUBDIRS += keyboard mouse lcd vmu +SUBDIRS = devroot random all: $(patsubst %, _dir_%, $(SUBDIRS)) diff --git a/examples/dreamcast/random/Makefile b/examples/dreamcast/dev/devroot/Makefile similarity index 90% copy from examples/dreamcast/random/Makefile copy to examples/dreamcast/dev/devroot/Makefile index 251e4da8..9dca03e6 100644 --- a/examples/dreamcast/random/Makefile +++ b/examples/dreamcast/dev/devroot/Makefile @@ -4,12 +4,10 @@ # # Put the filename of the output binary here -TARGET = random.elf +TARGET = devroot.elf # List all of your C files here, but change the extension to ".o" -OBJS = random.o - -KOS_CFLAGS += -std=c99 +OBJS = devroot.o # The rm-elf step is to remove the target before building, to force the # re-creation of the rom disk. diff --git a/examples/dreamcast/dev/devroot/devroot.c b/examples/dreamcast/dev/devroot/devroot.c new file mode 100644 index 00000000..8e4ea5e1 --- /dev/null +++ b/examples/dreamcast/dev/devroot/devroot.c @@ -0,0 +1,62 @@ +/* KallistiOS ##version## + + devroot.c + Copyright (C) 2024 Donald Haase + + This example demonstrates the expected behavior of reading from the + / and /dev dirs, as well as attempting to open a non-existant device + for the same. +*/ + +#include <kos.h> +#include <errno.h> +#include <dirent.h> + +KOS_INIT_FLAGS(INIT_DEFAULT); + +/* This tests readdir and rewinddir by printing a list of all entries, +then rewinding and counting that the same number of entries are present */ +void printdir(char* fn) { + DIR *d; + struct dirent *entry; + int cnt1 = 0, cnt2 = 0; + + if(!(d = opendir(fn))) { + printf("Could not open %s: %s\n", fn, strerror(errno)); + } + else { + printf("Opened %s and found these: \n", fn); + while((entry = readdir(d))) { + printf(" %s\n", entry->d_name); + cnt1++; + } + + printf("Rewinding %s to loop again.\n", fn); + rewinddir(d); + + while((entry = readdir(d))) { + cnt2++; + } + + if(cnt1 == cnt2) { + printf("PASS: Counted %i entries both times.\n", cnt1); + } + else + printf("FAIL: Counted %i entries the first time and %i the second.\n", cnt1, cnt2); + } +} + +int main(int argc, char **argv) { + + /* Open the root of dev's filesystem and list the contents. */ + /* This should *not* show /dev subdirs */ + printdir("/"); + + /* Now do the same with /dev. This should list out the devices under it. */ + printdir("/dev"); + + /* Now try the same with a fake dev. It should fail */ + printdir("/dev/quzar"); + + return 0; +} diff --git a/examples/dreamcast/random/Makefile b/examples/dreamcast/dev/random/Makefile similarity index 100% rename from examples/dreamcast/random/Makefile rename to examples/dreamcast/dev/random/Makefile diff --git a/examples/dreamcast/random/random.c b/examples/dreamcast/dev/random/random.c similarity index 100% rename from examples/dreamcast/random/random.c rename to examples/dreamcast/dev/random/random.c diff --git a/examples/dreamcast/parallax/serpent_dma/perfmeter.c b/examples/dreamcast/parallax/serpent_dma/perfmeter.c index c85bb1d7..8eeca655 100644 --- a/examples/dreamcast/parallax/serpent_dma/perfmeter.c +++ b/examples/dreamcast/parallax/serpent_dma/perfmeter.c @@ -47,7 +47,7 @@ void pm_draw(void) { pvr_list_begin(PVR_LIST_TR_POLY); // Make a nice stat display - sprintf(str, "fps %.2f buf %d reg %d rnd %d", + sprintf(str, "fps: %.2f buf: %lluns reg: %lluns rnd: %lluns", (double)stats.frame_rate, stats.buf_last_time, stats.reg_last_time, @@ -59,7 +59,7 @@ void pm_draw(void) { plx_fcxt_draw(fcxt, str); plx_fcxt_end(fcxt); - sprintf(str, "avg fps %.2f", + sprintf(str, "avg fps: %.2f", (double)(60.0 * stats.frame_count / stats.vbl_count)); plx_fcxt_setpos(fcxt, posx, posy + 16.0f, posz); plx_fcxt_begin(fcxt); @@ -72,15 +72,15 @@ void pm_draw(void) { posy += -40.0f; - pct = ((float)stats.buf_last_time) * 60.0f / 1000.0f; + pct = ((float)stats.buf_last_time) * 60.0f / 1000000000.0f; pm_drawbar(pct, posx, posy, posz, 0xff00c0c0, 0xff007070); - pct = ((float)stats.reg_last_time) * 60.0f / 1000.0f; + pct = ((float)stats.reg_last_time) * 60.0f / 1000000000.0f; posy += 8.0f; pm_drawbar(pct, posx, posy, posz, 0xff00c000, 0xff007000); // Draw a bargraph for rendering time - pct = ((float)stats.rnd_last_time) * 60.0f / 1000.0f; + pct = ((float)stats.rnd_last_time) * 60.0f / 1000000000.0f; posy += 8.0f; pm_drawbar(pct, posx, posy, posz, 0xffc0c000, 0xff707000); diff --git a/examples/dreamcast/parallax/serpent_dma/serpent.c b/examples/dreamcast/parallax/serpent_dma/serpent.c index 741513f3..4d3fa65a 100644 --- a/examples/dreamcast/parallax/serpent_dma/serpent.c +++ b/examples/dreamcast/parallax/serpent_dma/serpent.c @@ -2,13 +2,14 @@ KallistiOS ##version## serpent.c - Copyright (C)2002,2004 Megan Potter - Copyright (C)2004 Jim Ursetto + Copyright (C) 2002,2004 Megan Potter + Copyright (C) 2004 Jim Ursetto */ #include <kos.h> #include <math.h> #include <assert.h> +#include <stdlib.h> #include <plx/matrix.h> #include <plx/prim.h> #include <plx/context.h> @@ -274,9 +275,6 @@ int main(int argc, char **argv) { pvr_set_vertbuf(PVR_LIST_OP_POLY, dmabuffers[0], 4 * 1024 * 1024); pvr_set_vertbuf(PVR_LIST_TR_POLY, dmabuffers[1], 4 * 1024 * 1024); - // Escape hatch - cont_btn_callback(0, CONT_START | CONT_A, (cont_btn_callback_t)arch_exit); - /* Init matrices */ plx_mat3d_init(); plx_mat3d_mode(PLX_MAT_PROJECTION); @@ -292,8 +290,8 @@ int main(int argc, char **argv) { do_sphere_test(); pvr_get_stats(&stats); - dbglog(DBG_DEBUG, "3D Stats: %ld vblanks, frame rate ~%f fps, max vertex used %d bytes\n", - stats.vbl_count, (double)stats.frame_rate, stats.vtx_buffer_used_max); + dbglog(DBG_DEBUG, "3D Stats: %u vblanks, frame rate ~%f fps, max vertex used %u bytes\n", + stats.vbl_count, stats.frame_rate, stats.vtx_buffer_used_max); return 0; } diff --git a/include/kos/fs_dev.h b/include/kos/fs_dev.h index a0ec062a..09ce4ad0 100644 --- a/include/kos/fs_dev.h +++ b/include/kos/fs_dev.h @@ -1,25 +1,19 @@ /* KallistiOS ##version## kos/fs_dev.h - (c)2023 - Luke Benstead + Copyright (C) 2024 Donald Haase */ /** \file kos/fs_dev.h - \brief Driver for /dev/random and /dev/urandom. + \brief Container for /dev. \ingroup vfs_dev - This filesystem driver provides implementations of /dev/random - and /dev/urandom for portability. It seeds randomness from - uninitialized memory, and the clock. Obviously we - are limited in how we can provide sufficient entropy on an - embedded platform like the Dreamcast so the randomness from - this driver will not win any awards but it should be sufficiently - good for most purposes. + This is a thin filesystem that allows the /dev folder + and its contents to be read/listed as well new devices + to be added under it. - /dev/random is an alias to /dev/urandom for now. - - \author Luke Benstead + \author Donald Haase */ #ifndef __DC_FS_DEV_H @@ -31,7 +25,7 @@ __BEGIN_DECLS #include <kos/fs.h> /** \defgroup vfs_dev Dev - \brief VFS driver for /dev/random and /dev/urandom + \brief VFS driver for /dev \ingroup vfs @{ diff --git a/include/kos/fs_null.h b/include/kos/fs_null.h new file mode 100644 index 00000000..5151f64e --- /dev/null +++ b/include/kos/fs_null.h @@ -0,0 +1,44 @@ +/* KallistiOS ##version## + + kos/fs_null.h + Copyright (C) 2024 Donald Haase + +*/ + +/** \file kos/fs_null.h + \brief /dev/null, a black hole. + \ingroup vfs_dev + + This is a IEEE Std 1003.1-2017 POSIX standard + 'empty data source and infinite data sink' + + \author Donald Haase +*/ + +#ifndef __DC_FS_NULL_H +#define __DC_FS_NULL_H + +#include <sys/cdefs.h> +__BEGIN_DECLS + +#include <kos/fs.h> + +/** \defgroup vfs_null /dev/null + \brief VFS driver for /dev/null + \ingroup vfs + + @{ +*/ + +/* \cond */ +/* Initialization */ +int fs_null_init(void); +int fs_null_shutdown(void); +/* \endcond */ + +/** @} */ + +__END_DECLS + +#endif /* __DC_FS_NULL_H */ + diff --git a/include/kos/fs_dev.h b/include/kos/fs_random.h similarity index 75% copy from include/kos/fs_dev.h copy to include/kos/fs_random.h index a0ec062a..e06b1017 100644 --- a/include/kos/fs_dev.h +++ b/include/kos/fs_random.h @@ -1,13 +1,13 @@ /* KallistiOS ##version## - kos/fs_dev.h - (c)2023 - Luke Benstead + kos/fs_random.h + Copyright (C) 2023 Luke Benstead */ -/** \file kos/fs_dev.h +/** \file kos/fs_random.h \brief Driver for /dev/random and /dev/urandom. - \ingroup vfs_dev + \ingroup vfs_rnd This filesystem driver provides implementations of /dev/random and /dev/urandom for portability. It seeds randomness from @@ -22,15 +22,15 @@ \author Luke Benstead */ -#ifndef __DC_FS_DEV_H -#define __DC_FS_DEV_H +#ifndef __DC_FS_RANDOM_H +#define __DC_FS_RANDOM_H #include <sys/cdefs.h> __BEGIN_DECLS #include <kos/fs.h> -/** \defgroup vfs_dev Dev +/** \defgroup vfs_rnd Random \brief VFS driver for /dev/random and /dev/urandom \ingroup vfs @@ -39,13 +39,13 @@ __BEGIN_DECLS /* \cond */ /* Initialization */ -int fs_dev_init(void); -int fs_dev_shutdown(void); +int fs_rnd_init(void); +int fs_rnd_shutdown(void); /* \endcond */ /** @} */ __END_DECLS -#endif /* __DC_FS_DEV_H */ +#endif /* __DC_FS_RANDOM_H */ diff --git a/include/kos/nmmgr.h b/include/kos/nmmgr.h index 9373444a..5e512f6e 100644 --- a/include/kos/nmmgr.h +++ b/include/kos/nmmgr.h @@ -60,13 +60,28 @@ typedef LIST_HEAD(nmmgr_list, nmmgr_handler) nmmgr_list_t; */ typedef struct nmmgr_handler { char pathname[NAME_MAX]; /* Path name */ - int pid; /* Process table ID for handler (0 == static) */ + int pid; /* Process table ID for handler (0 == static) */ uint32 version; /* Version code */ uint32 flags; /* Bitmask of flags */ uint32 type; /* Type of handler */ LIST_ENTRY(nmmgr_handler) list_ent; /* Linked list entry */ } nmmgr_handler_t; +/** \brief Alias handler interface. + \ingroup system_namemgr + + The smallest possible extension of name handler, it has its own name + but holds a pointer to a full handler of the appropriate type. This + prevents the need to duplicate large vfs structures. + +*/ +typedef struct alias_handler { + /** \brief Name manager handler header */ + nmmgr_handler_t nmmgr; + + nmmgr_handler_t *alias; +} alias_handler_t; + /* Version codes ('version') have two pieces: a major and minor revision. A major revision (top 16 bits) means that the interfaces are totally incompatible. A minor revision (lower 16 bits) diffrentiates between @@ -78,6 +93,16 @@ typedef struct nmmgr_handler { */ #define NMMGR_FLAGS_NEEDSFREE 0x00000001 +/** \brief This structure maps into /dev/. + \ingroup system_namemgr +*/ +#define NMMGR_FLAGS_INDEV 0x00000002 + +/** \brief This structure aliases another. + \ingroup system_namemgr +*/ +#define NMMGR_FLAGS_ALIAS 0x00000004 + /** \defgroup nmmgr_types Handler Types \brief Name handler types \ingroup system_namemgr diff --git a/include/sys/dirent.h b/include/sys/dirent.h index 77595bd4..7951c390 100644 --- a/include/sys/dirent.h +++ b/include/sys/dirent.h @@ -62,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_t d_reclen; /**< \brief Record length */ - uint8_t d_type; /**< \brief File type */ - char d_name[0]; /**< \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[0]; /**< \brief Filename */ }; /** \brief Type representing a directory stream. diff --git a/kernel/arch/dreamcast/hardware/maple/keyboard.c b/kernel/arch/dreamcast/hardware/maple/keyboard.c index 9137ecc8..1162c6db 100644 --- a/kernel/arch/dreamcast/hardware/maple/keyboard.c +++ b/kernel/arch/dreamcast/hardware/maple/keyboard.c @@ -379,7 +379,10 @@ void kbd_set_queue(int active) { } /* Take a key scancode, encode it appropriately, and place it on the - keyboard queue. At the moment we assume no key overflows. */ + keyboard queue. At the moment we assume no key overflows. + + NOTE: We are only calling this within an IRQ context, so operations on + kbd_state::queue_size are essentially atomic. */ static int kbd_enqueue(kbd_state_t *state, uint8 keycode, int mods) { static char keymap_noshift[] = { /*0*/ 0, 0, 0, 0, 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', @@ -410,10 +413,10 @@ static int kbd_enqueue(kbd_state_t *state, uint8 keycode, int mods) { return 0; /* Queue the key up on the device-specific queue. */ - if(atomic_load(&state->queue_len) < KBD_QUEUE_SIZE) { + if(state->queue_len < KBD_QUEUE_SIZE) { state->key_queue[state->queue_head] = keycode | (mods << 8); state->queue_head = (state->queue_head + 1) & (KBD_QUEUE_SIZE - 1); - atomic_fetch_add(&state->queue_len, 1); + ++state->queue_len; ...<truncated>... hooks/post-receive -- A pseudo Operating System for the Dreamcast. |