|
From: darcagn <da...@us...> - 2024-06-05 18:30: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 "A pseudo Operating System for the Dreamcast.".
The branch, master has been updated
via 8430b8571f0510733e1a7ed0f17aa2c25be68e63 (commit)
via 5fc21196104b589ccf4e32222ea1f9650a5612f5 (commit)
via 90097309419e9a6fc2c9fd095ec8df7aad209ef9 (commit)
via 92b4ca2550b298303e74e9e494de2e8736c07227 (commit)
via 3552b8579c11fb9a47d8b8d62dab299c20af5c66 (commit)
via 66777dacbeb62b259807b6cb565a08f71d52a6df (commit)
via 5fc1d90b03f27f18143cf5ff708d0bcc74fc0c76 (commit)
from 8a8b56a03bade40fffb3fc36e9c0d4ff971a20d5 (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 8430b8571f0510733e1a7ed0f17aa2c25be68e63
Author: Falco Girgis <gyr...@gm...>
Date: Wed Jun 5 13:28:53 2024 -0500
Fixed warnings when compiling with builtins. (#610)
- First warning was about using the string-length of the source of a
strncpy() operation as its length... but its a bullshit, because we
were correctly doing a range check afterwards... oh well, using
strnlen() for the length seemed to appese the gumpy compiler.
- Second warning was legit. _exit(int) without building with
INIT_SHUTDOWN was still returning from a function maked __noreturn.
Added code following the conditional regular shutdown path for when it's
not present to simply log a warning then return back to the BIOS menu.
commit 5fc21196104b589ccf4e32222ea1f9650a5612f5
Merge: 90097309 66777dac
Author: Lawrence Sebald <ljs...@us...>
Date: Tue Jun 4 23:40:46 2024 -0400
Merge pull request #591 from KallistiOS/mingccver
Add Makefile rule to check minimum GCC version
commit 90097309419e9a6fc2c9fd095ec8df7aad209ef9
Author: Donald Haase <qu...@ya...>
Date: Tue Jun 4 23:03:19 2024 -0400
Some cleanups in Maple (#551)
* Standardize maple locking. Don't force status_valid for devices that don't have statuses.
* Refactor driver double registration check.
* Don't truncate devinfo strings, just notify dbglog of the max length of the string
* Change debug level of 'final stats' report to debug
* Standardize polling functions. Invert frame device check logic. Mouse to stdint.
* Add vmu button cond dummy data to normalize the verification of the response size
* Fix corruption in maple frame queue
* Remove message saying that remove inside TAILQ_FOREACH is safe
commit 92b4ca2550b298303e74e9e494de2e8736c07227
Author: Donald Haase <qu...@ya...>
Date: Tue Jun 4 22:51:40 2024 -0400
Malloc leak and debug fixes (#599)
* Cleanups to malloc_debug to get it building and address some warnings.
* Set current thread tid to 0 if threading hasn't been initialized yet
* Ensure that all thread data is freed on shutdown and threads are entirely removed.
* Use LIST_FOREACH_SAFE in places where the items are being removed/freed
* Swap vsprintf for vsnprintf to ensure we don't overrun our buffers. Don't try to output if it failed.
* Correct failure checking on vsnprintf
* Replace debug printfs for dblog. Additionally create static allocations for the function name strings.
* Remove redirect to fs_write(1, str) as that just redirects to the same thing anyways
* Prevent leaking root name
* Free the file table at shutdown even if the user was bad and didn't. Encode the pty exception from fs_write here too.
* Clean up comment about fh exceptions in fs_fdtbl_destroy
* Adjusting dcload type detection to only malloc if needed
* Replace printf in malloc with malloc-less dbgio
* Reduce scope of variable
* Apply suggestions from code review
commit 3552b8579c11fb9a47d8b8d62dab299c20af5c66
Author: Falco Girgis <gyr...@gm...>
Date: Tue Jun 4 18:17:44 2024 -0500
Updated OS-Level TLS Example (#603)
* Updated tls_test.c example.
- Wrote it in a manner so that it can be used for automated testing in
the future with proper exit success/failure codes.
- Spawning way the hell more threads.
- Doing way more with the TLS data to exercise it.
- Actually validating the expected values and correctness rather than
just printing what it should be.
* Addressed review feedback.
commit 66777dacbeb62b259807b6cb565a08f71d52a6df
Author: Falco Girgis <gyr...@gm...>
Date: Thu May 23 19:33:11 2024 -0500
Added a bunch of GCC version checks to examples.
1) UBC "Breaking" example
2) FPU Exception example
3) Stack Protector example
4) C++20 Concurrency example
commit 5fc1d90b03f27f18143cf5ff708d0bcc74fc0c76
Author: darcagn <da...@pr...>
Date: Thu May 23 18:17:47 2024 -0600
Add Makefile rule to check minimum GCC version
-----------------------------------------------------------------------
Summary of changes:
Makefile.rules | 21 +-
examples/dreamcast/basic/breaking/Makefile | 1 +
examples/dreamcast/basic/fpu/exc/Makefile | 6 +-
examples/dreamcast/basic/stackprotector/Makefile | 17 +-
examples/dreamcast/basic/threading/tls/tls_test.c | 116 ++++++--
examples/dreamcast/cpp/concurrency/Makefile | 7 +-
kernel/arch/dreamcast/fs/fs_dcload.c | 23 +-
kernel/arch/dreamcast/hardware/maple/controller.c | 55 ++--
kernel/arch/dreamcast/hardware/maple/dreameye.c | 3 +-
kernel/arch/dreamcast/hardware/maple/keyboard.c | 21 +-
kernel/arch/dreamcast/hardware/maple/lightgun.c | 11 +-
.../arch/dreamcast/hardware/maple/maple_driver.c | 6 +-
kernel/arch/dreamcast/hardware/maple/maple_enum.c | 4 +-
.../dreamcast/hardware/maple/maple_init_shutdown.c | 4 +-
kernel/arch/dreamcast/hardware/maple/maple_irq.c | 6 +-
kernel/arch/dreamcast/hardware/maple/mouse.c | 31 +--
kernel/arch/dreamcast/hardware/maple/purupuru.c | 17 +-
kernel/arch/dreamcast/hardware/maple/sip.c | 18 +-
kernel/arch/dreamcast/hardware/maple/vmu.c | 75 +++--
kernel/arch/dreamcast/hardware/pvr/pvr_mem.c | 4 +-
kernel/arch/dreamcast/include/dc/maple.h | 2 +
kernel/arch/dreamcast/include/dc/maple/mouse.h | 20 +-
kernel/arch/dreamcast/include/dc/maple/vmu.h | 5 +-
kernel/debug/dbgio.c | 5 +-
kernel/exports/nmmgr.c | 4 +-
kernel/fs/fs.c | 5 +-
kernel/fs/fs_ramdisk.c | 1 +
kernel/libc/koslib/dbglog.c | 7 +-
kernel/libc/koslib/malloc.c | 307 +++++++++------------
kernel/libc/koslib/readdir.c | 4 +-
kernel/libc/newlib/newlib_exit.c | 10 +-
kernel/mm/malloc_debug.c | 29 +-
kernel/thread/thread.c | 19 +-
kernel/thread/tls.c | 4 +-
34 files changed, 454 insertions(+), 414 deletions(-)
diff --git a/Makefile.rules b/Makefile.rules
index aafeb9bf..329413f3 100644
--- a/Makefile.rules
+++ b/Makefile.rules
@@ -1,7 +1,8 @@
# KallistiOS ##version##
#
# Makefile.rules
-# (c)2000-2001 Megan Potter
+# Copyright (c) 2000, 2001 Megan Potter
+# Copyright (c) 2024 Eric Fradella
#
# Global KallistiOS Makefile include
@@ -74,3 +75,21 @@ romdisk.o: romdisk.img
$(KOS_CC) -o romdisk.o -r romdisk_tmp.o $(KOS_LIB_PATHS) -Wl,--whole-archive -lromdiskbase
rm romdisk_tmp.o
endif
+
+# Define KOS_GCCVER_MIN in your Makefile if you want to enforce a minimum GCC version.
+ifdef KOS_GCCVER_MIN
+ ifeq ($(shell \
+ awk 'BEGIN { \
+ split("$(KOS_GCCVER_MIN)", min, "."); \
+ split("$(KOS_GCCVER)", cur, "."); \
+ if (cur[1] > min[1] || \
+ (cur[1] == min[1] && cur[2] > min[2]) || \
+ (cur[1] == min[1] && cur[2] == min[2] && cur[3] >= min[3])) { \
+ print 1; \
+ } else { \
+ print 0; \
+ } \
+ }'), 0)
+ $(error A minimum GCC version of $(KOS_GCCVER_MIN) is required, but $(KOS_GCCVER) is currently in use.)
+ endif
+endif
diff --git a/examples/dreamcast/basic/breaking/Makefile b/examples/dreamcast/basic/breaking/Makefile
index 7dfd29be..362230d6 100644
--- a/examples/dreamcast/basic/breaking/Makefile
+++ b/examples/dreamcast/basic/breaking/Makefile
@@ -7,6 +7,7 @@
TARGET = breaking.elf
OBJS = breaking.o
KOS_CFLAGS += -std=gnu2x -Wno-strict-aliasing
+KOS_GCCVER_MIN = 13.0.0
all: rm-elf $(TARGET)
diff --git a/examples/dreamcast/basic/fpu/exc/Makefile b/examples/dreamcast/basic/fpu/exc/Makefile
index c8d46ad9..f6bbb8e7 100644
--- a/examples/dreamcast/basic/fpu/exc/Makefile
+++ b/examples/dreamcast/basic/fpu/exc/Makefile
@@ -1,10 +1,12 @@
#
# FPU Exception Tests
-# (c)2002 Megan Potter
-#
+# Copyright (C) 2002 Megan Potter
+# Copyright (C) 2024 Falco Girgis
+#
TARGET = fpu_exc.elf
OBJS = fpu_exc.o
+KOS_GCCVER_MIN = 5.0.0
all: rm-elf $(TARGET)
diff --git a/examples/dreamcast/basic/stackprotector/Makefile b/examples/dreamcast/basic/stackprotector/Makefile
index 6e4ec0e7..a898d5d2 100644
--- a/examples/dreamcast/basic/stackprotector/Makefile
+++ b/examples/dreamcast/basic/stackprotector/Makefile
@@ -1,15 +1,13 @@
+#
+# Stack Protector Test/Example
+# Copyright (C) 2021 Lawrence Sebald
+# Copyright (C) 2024 Falco Girgis
+#
+
TARGET = stackprotector.elf
OBJS = stackprotector.o
KOS_CFLAGS += -fstack-protector-all
-
-GCC_MAJOR = $(basename $(basename $(KOS_GCCVER)))
-
-ifeq ($(GCC_MAJOR), 4)
-
-all dist clean:
- $(warning GCC4 missing stackprotector patch, skipping)
-
-else
+KOS_GCCVER_MIN = 4.0.0
all: rm-elf $(TARGET)
@@ -34,4 +32,3 @@ dist: $(TARGET)
.PHONY: run dist clean rm-elf
-endif
diff --git a/examples/dreamcast/basic/threading/tls/tls_test.c b/examples/dreamcast/basic/threading/tls/tls_test.c
index 2bf89976..e4db75ec 100644
--- a/examples/dreamcast/basic/threading/tls/tls_test.c
+++ b/examples/dreamcast/basic/threading/tls/tls_test.c
@@ -2,6 +2,7 @@
tls_test.c
Copyright (C) 2009 Lawrence Sebald
+ Copyright (C) 2024 Falco Girgis
*/
@@ -9,6 +10,12 @@
#include <stdio.h>
#include <stdlib.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdatomic.h>
+#include <errno.h>
+#include <string.h>
+
#include <kos/thread.h>
#include <kos/once.h>
#include <kos/tls.h>
@@ -17,38 +24,53 @@
#include <dc/maple.h>
#include <dc/maple/controller.h>
+#define THREAD_COUNT 100
+
#define UNUSED __attribute__((unused))
-kthread_once_t once = KTHREAD_ONCE_INIT;
-kthread_key_t key1, key2;
+static kthread_once_t once = KTHREAD_ONCE_INIT;
+static kthread_key_t key1, key2;
+static atomic_uint dtor_counter;
-void destructor(void *data) {
+static void destructor(void *data) {
printf("Destroying %d\n", (int)data);
+ ++dtor_counter;
}
-void once_func(void) {
+static void once_func(void) {
if(kthread_key_create(&key2, &destructor)) {
- printf("Error in calling kthread_key_create\n");
+ fprintf(stderr, "Error in calling kthread_key_create\n");
}
}
-void *thd_func(void *param UNUSED) {
+static void *thd_func(void *param UNUSED) {
kthread_t *cur = thd_get_current();
void *data;
+ int retval;
printf("Thd %d: Reading key 1\n", cur->tid);
data = kthread_getspecific(key1);
+
printf("Thd %d: kthread_getspecific returned %p (should be NULL)\n",
cur->tid, data);
+ if(data) {
+ fprintf(stderr, "Unexpected key 1 value: %p\n", data);
+ thd_exit((void *)false);
+ }
+
printf("Thd %d: Will create key 2, if its not created\n", cur->tid);
- kthread_once(&once, &once_func);
+
+ if((retval = kthread_once(&once, &once_func))) {
+ fprintf(stderr, "kthread_once failed with %s!\n", strerror(errno));
+ thd_exit((void *)false);
+ }
printf("Thd %d: Writing to key 2\n", cur->tid);
if(kthread_setspecific(key2, (void *)cur->tid)) {
- printf("Error in kthread_setspecific!!!\n");
- thd_exit(NULL);
+ fprintf(stderr, "Error in kthread_setspecific!!!\n");
+ thd_exit((void *)false);
}
if(cur->tid & 0x01) {
@@ -60,49 +82,93 @@ void *thd_func(void *param UNUSED) {
data = kthread_getspecific(key2);
printf("Thd %d: kthread_getspecific returned %d (should be %d)\n", cur->tid,
(int)data, cur->tid);
- return NULL;
+
+ if((int)data != cur->tid) {
+ fprintf(stderr, "Invalid value for key2: %p\n", data);
+ thd_exit((void *)false);
+ }
+
+ return (void *)true;
}
-KOS_INIT_FLAGS(INIT_DEFAULT);
+KOS_INIT_FLAGS(INIT_DEFAULT | INIT_MALLOCSTATS);
int main(int argc, char *argv[]) {
- kthread_t *thds[2];
+ kthread_t *thds[THREAD_COUNT];
void *data;
+ bool success = true;
+ int retval;
cont_btn_callback(0, CONT_START | CONT_A | CONT_B | CONT_X | CONT_Y,
(cont_btn_callback_t)arch_exit);
- printf("KallistiOS TLS test program\n");
+ printf("KallistiOS TLS test program\n\n");
printf("Main thread: Creating key 1\n");
if(kthread_key_create(&key1, NULL)) {
- printf("Error in creating key 1\n");
- exit(-1);
+ fprintf(stderr, "Error in creating key 1\n");
+ exit(EXIT_FAILURE);
}
printf("Main thread: Setting key 1 to 0xDEADBEEF\n");
- kthread_setspecific(key1, (void *)0xDEADBEEF);
+
+ if((retval = kthread_setspecific(key1, (void *)0xDEADBEEF))) {
+ fprintf(stderr, "kthread_setspecific() failed: %d\n", retval);
+ exit(EXIT_FAILURE);
+ }
+
data = kthread_getspecific(key1);
printf("Main thread: Key 1 value: %p\n", data);
+ if(data != (void *)0xDEADBEEF) {
+ fprintf(stderr, "Unexpected kthread_getspecific() value: %p\n", data);
+ exit(EXIT_FAILURE);
+ }
+
/* Create the threads. */
- printf("Main therad: Creating 2 threads\n");
- thds[0] = thd_create(0, &thd_func, NULL);
- thds[1] = thd_create(0, &thd_func, NULL);
+ printf("Main thread: Creating %d threads\n", THREAD_COUNT);
+ for(int t = 0; t < THREAD_COUNT; ++t)
+ thds[t] = thd_create(0, &thd_func, NULL);
printf("Main thread: Waiting for the threads to finish\n");
- thd_join(thds[0], NULL);
- thd_join(thds[1], NULL);
+ for(int t = 0; t < THREAD_COUNT; ++t) {
+ thd_join(thds[t], &data);
+ success &= (bool)data;
+ }
+
+ if(!success) {
+ fprintf(stderr, "Test failed!\n");
+ exit(EXIT_FAILURE);
+ }
+
+ if(dtor_counter != THREAD_COUNT) {
+ fprintf(stderr, "Incorrect destructor counter value: %u\n",
+ dtor_counter);
+ exit(EXIT_FAILURE);
+ } else {
+ printf("Correct destructor counter value: %u\n", dtor_counter);
+ }
data = kthread_getspecific(key1);
printf("Main thread: Key 1 value: %p\n", data);
+ if(data != (void *)0xDEADBEEF) {
+ fprintf(stderr, "Unexpected final kthread_getspecific() value: %p\n", data);
+ exit(EXIT_FAILURE);
+ }
+
printf("Main thread: Removing keys\n");
- kthread_key_delete(key1);
- kthread_key_delete(key2);
- printf("Test finished\n");
+ success &= !kthread_key_delete(key1);
+ success &= !kthread_key_delete(key2);
+
+ if(!success) {
+ fprintf(stderr, "Failed to delete kthread keys!\n");
+ exit(EXIT_FAILURE);
+ }
+
+ printf("\n===== TLS TEST SUCCESS =====\n");
- return 0;
+ return EXIT_SUCCESS;
}
diff --git a/examples/dreamcast/cpp/concurrency/Makefile b/examples/dreamcast/cpp/concurrency/Makefile
index 36ab65b0..16eac365 100644
--- a/examples/dreamcast/cpp/concurrency/Makefile
+++ b/examples/dreamcast/cpp/concurrency/Makefile
@@ -1,11 +1,12 @@
#
# C++ Concurrency Test/Example
-# (c) 2023 Falco Girgis
-#
+# Copyright (C) 2023, 2024 Falco Girgis
+#
TARGET = concurrency.elf
OBJS = concurrency.o
-KOS_CPPFLAGS += -std=c++20
+KOS_CPPFLAGS += -std=c++20
+KOS_GCCVER_MIN = 12.0.0
all: rm-elf $(TARGET)
diff --git a/kernel/arch/dreamcast/fs/fs_dcload.c b/kernel/arch/dreamcast/fs/fs_dcload.c
index f43b2082..a937f125 100644
--- a/kernel/arch/dreamcast/fs/fs_dcload.c
+++ b/kernel/arch/dreamcast/fs/fs_dcload.c
@@ -513,17 +513,20 @@ void fs_dcload_init_console(void) {
if(*DCLOADMAGICADDR != DCLOADMAGICVALUE)
return;
- /* Give dcload the 64k it needs to compress data (if on serial) */
- dcload_wrkmem = malloc(65536);
- if(dcload_wrkmem) {
- if(dclsc(DCLOAD_ASSIGNWRKMEM, dcload_wrkmem) == -1) {
- free(dcload_wrkmem);
- dcload_type = DCLOAD_TYPE_IP;
- dcload_wrkmem = NULL;
- }
- else {
- dcload_type = DCLOAD_TYPE_SER;
+ /* dcload IP will always return -1 here. Serial will return 0 and make
+ no change since it already holds 0 as 'no mem assigned */
+ if(dclsc(DCLOAD_ASSIGNWRKMEM, 0) == -1) {
+ dcload_type = DCLOAD_TYPE_IP;
+ }
+ else {
+ dcload_type = DCLOAD_TYPE_SER;
+
+ /* Give dcload the 64k it needs to compress data (if on serial) */
+ dcload_wrkmem = malloc(65536);
+ if(dcload_wrkmem) {
+ if(dclsc(DCLOAD_ASSIGNWRKMEM, dcload_wrkmem) == -1)
+ free(dcload_wrkmem);
}
}
}
diff --git a/kernel/arch/dreamcast/hardware/maple/controller.c b/kernel/arch/dreamcast/hardware/maple/controller.c
index 1db9bfa0..02139d9a 100644
--- a/kernel/arch/dreamcast/hardware/maple/controller.c
+++ b/kernel/arch/dreamcast/hardware/maple/controller.c
@@ -71,32 +71,32 @@ static void cont_reply(maple_state_t *st, maple_frame_t *frm) {
if(respbuf[0] != MAPLE_FUNC_CONTROLLER)
return;
- /* Update the status area from the response */
- if(frm->dev) {
- /* Verify the size of the frame and grab a pointer to it */
- assert(sizeof(cont_cond_t) == ((resp->data_len - 1) * sizeof(uint32_t)));
- raw = (cont_cond_t *)(respbuf + 1);
-
- /* Fill the "nice" struct from the raw data */
- cooked = (cont_state_t *)(frm->dev->status);
- cooked->buttons = (~raw->buttons) & 0xffff;
- cooked->ltrig = raw->ltrig;
- cooked->rtrig = raw->rtrig;
- cooked->joyx = ((int)raw->joyx) - 128;
- cooked->joyy = ((int)raw->joyy) - 128;
- cooked->joy2x = ((int)raw->joy2x) - 128;
- cooked->joy2y = ((int)raw->joy2y) - 128;
- frm->dev->status_valid = 1;
-
- /* Check for magic button sequences */
- if(btn_callback) {
- if(!btn_callback_addr ||
- (btn_callback_addr &&
- btn_callback_addr == maple_addr(frm->dev->port, frm->dev->unit))) {
- if((cooked->buttons & btn_callback_btns) == btn_callback_btns) {
- btn_callback(maple_addr(frm->dev->port, frm->dev->unit),
- cooked->buttons);
- }
+ if(!frm->dev)
+ return;
+
+ /* Verify the size of the frame and grab a pointer to it */
+ assert(sizeof(cont_cond_t) == ((resp->data_len - 1) * sizeof(uint32_t)));
+ raw = (cont_cond_t *)(respbuf + 1);
+
+ /* Fill the "nice" struct from the raw data */
+ cooked = (cont_state_t *)(frm->dev->status);
+ cooked->buttons = (~raw->buttons) & 0xffff;
+ cooked->ltrig = raw->ltrig;
+ cooked->rtrig = raw->rtrig;
+ cooked->joyx = ((int)raw->joyx) - 128;
+ cooked->joyy = ((int)raw->joyy) - 128;
+ cooked->joy2x = ((int)raw->joy2x) - 128;
+ cooked->joy2y = ((int)raw->joy2y) - 128;
+ frm->dev->status_valid = 1;
+
+ /* Check for magic button sequences */
+ if(btn_callback) {
+ if(!btn_callback_addr ||
+ (btn_callback_addr &&
+ btn_callback_addr == maple_addr(frm->dev->port, frm->dev->unit))) {
+ if((cooked->buttons & btn_callback_btns) == btn_callback_btns) {
+ btn_callback(maple_addr(frm->dev->port, frm->dev->unit),
+ cooked->buttons);
}
}
}
@@ -137,8 +137,7 @@ static maple_driver_t controller_drv = {
/* Add the controller to the driver chain */
void cont_init(void) {
- if(!controller_drv.drv_list.le_prev)
- maple_driver_reg(&controller_drv);
+ maple_driver_reg(&controller_drv);
}
void cont_shutdown(void) {
diff --git a/kernel/arch/dreamcast/hardware/maple/dreameye.c b/kernel/arch/dreamcast/hardware/maple/dreameye.c
index 94c9cde8..41363ff6 100644
--- a/kernel/arch/dreamcast/hardware/maple/dreameye.c
+++ b/kernel/arch/dreamcast/hardware/maple/dreameye.c
@@ -439,8 +439,7 @@ static maple_driver_t dreameye_drv = {
/* Add the Dreameye to the driver chain */
void dreameye_init(void) {
- if(!dreameye_drv.drv_list.le_prev)
- maple_driver_reg(&dreameye_drv);
+ maple_driver_reg(&dreameye_drv);
}
void dreameye_shutdown(void) {
diff --git a/kernel/arch/dreamcast/hardware/maple/keyboard.c b/kernel/arch/dreamcast/hardware/maple/keyboard.c
index 9fdb04aa..6ee49dc3 100644
--- a/kernel/arch/dreamcast/hardware/maple/keyboard.c
+++ b/kernel/arch/dreamcast/hardware/maple/keyboard.c
@@ -602,14 +602,18 @@ static void kbd_reply(maple_state_t *st, maple_frame_t *frm) {
if(respbuf[0] != MAPLE_FUNC_KEYBOARD)
return;
+ if(!frm->dev)
+ return;
+
+ /* Verify the size of the frame */
+ assert(sizeof(kbd_cond_t) == ((resp->data_len - 1) * sizeof(uint32_t)));
+
/* Update the status area from the response */
- if(frm->dev) {
- state = (kbd_state_t *)frm->dev->status;
- cond = (kbd_cond_t *)&state->cond;
- memcpy(cond, respbuf + 1, (resp->data_len - 1) * sizeof(*respbuf));
- frm->dev->status_valid = 1;
- kbd_check_poll(frm);
- }
+ state = (kbd_state_t *)frm->dev->status;
+ cond = (kbd_cond_t *)&state->cond;
+ memcpy(cond, respbuf + 1, (resp->data_len - 1) * sizeof(uint32_t));
+ frm->dev->status_valid = 1;
+ kbd_check_poll(frm);
}
static int kbd_poll_intern(maple_device_t *dev) {
@@ -674,8 +678,7 @@ static maple_driver_t kbd_drv = {
/* Add the keyboard to the driver chain */
void kbd_init(void) {
- if(!kbd_drv.drv_list.le_prev)
- maple_driver_reg(&kbd_drv);
+ maple_driver_reg(&kbd_drv);
...<truncated>...
hooks/post-receive
--
A pseudo Operating System for the Dreamcast.
|