|
From: kosmirror <kos...@us...> - 2025-09-05 19:22: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 d77b00786bec441e4e08dfadbc2fa1b46ff086af (commit)
from 3dcb6c7507d2c1a6a0e07dbe9841c000354b70f0 (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 d77b00786bec441e4e08dfadbc2fa1b46ff086af
Author: darc <da...@pr...>
Date: Tue Aug 19 12:28:41 2025 -0500
Move banner, license, author, uname functions from arch
- Create kos/banner.h header for banner, license, author functions
- Move banner/authors generation scripts from arch/dreamcast/kernel/ to kernel/
- Add arch/subarch description to the banner
- Add ARCH_NAME define, representing an arch's full name, to arch.h
- Move arch/dreamcast/kernel/uname.c to kernel/libc/koslib/
-----------------------------------------------------------------------
Summary of changes:
include/kos/banner.h | 66 ++++++++++++++++++++++
kernel/Makefile | 18 +++++-
kernel/arch/dreamcast/include/arch/arch.h | 53 ++++-------------
kernel/arch/dreamcast/kernel/Makefile | 21 +------
kernel/arch/dreamcast/kernel/init.c | 1 +
kernel/{arch/dreamcast/kernel => }/banner.c | 0
kernel/libc/koslib/Makefile | 2 +-
.../{arch/dreamcast/kernel => libc/koslib}/uname.c | 6 +-
.../{arch/dreamcast/kernel => }/make_authors.awk | 0
kernel/{arch/dreamcast/kernel => }/make_banner.sh | 6 ++
10 files changed, 106 insertions(+), 67 deletions(-)
create mode 100644 include/kos/banner.h
rename kernel/{arch/dreamcast/kernel => }/banner.c (100%)
rename kernel/{arch/dreamcast/kernel => libc/koslib}/uname.c (84%)
rename kernel/{arch/dreamcast/kernel => }/make_authors.awk (100%)
rename kernel/{arch/dreamcast/kernel => }/make_banner.sh (89%)
diff --git a/include/kos/banner.h b/include/kos/banner.h
new file mode 100644
index 00000000..659d74e6
--- /dev/null
+++ b/include/kos/banner.h
@@ -0,0 +1,66 @@
+/* KallistiOS ##version##
+
+ kos/banner.h
+ Copyright (C) 2013 Lawrence Sebald
+ Copyright (C) 2025 Eric Fradella
+*/
+
+#ifndef __KOS_BANNER_H
+#define __KOS_BANNER_H
+
+#include <kos/cdefs.h>
+__BEGIN_DECLS
+
+/** \file kos/banner.h
+ \defgroup attribution Attribution
+ \brief KOS banner, license, and authors
+
+ This API can be used to query for and display information
+ on KOS, its license, and its authors at runtime.
+
+ \remark
+ The authors list can be used for credits screens in games
+ and applications to acknowledge KOS and its contributors. :)
+*/
+
+/** \brief Retrieve the banner printed at program initialization.
+ \ingroup attribution
+
+ This function retrieves the banner string that is printed at initialization
+ time by the kernel. This contains the version of KOS in use and basic
+ information about the environment in which it was compiled.
+
+ \return A pointer to the banner string.
+*/
+const char * __pure2 kos_get_banner(void);
+
+/** \brief Retrieve the license information for the compiled copy of KOS.
+ \ingroup attribution
+
+ This function retrieves a string containing the license terms that the
+ version of KOS in use is distributed under. This can be used to easily add
+ information to your program to be displayed at runtime.
+
+ \return A pointer to the license terms.
+*/
+const char * __pure2 kos_get_license(void);
+
+/** \brief Retrieve a list of authors and the dates of their contributions.
+ \ingroup attribution
+
+ This function retrieves the copyright information for the version of KOS in
+ use. This function can be used to add such information to the credits of
+ programs using KOS to give the appropriate credit to those that have worked
+ on KOS.
+
+ \remark
+ Remember, you do need to give credit where credit is due, and this is an
+ easy way to do so. ;-)
+
+ \return A pointer to the authors' copyright information.
+*/
+const char *__pure2 kos_get_authors(void);
+
+__END_DECLS
+
+#endif /* !__KOS_BANNER_H */
diff --git a/kernel/Makefile b/kernel/Makefile
index 85902e32..252ac663 100644
--- a/kernel/Makefile
+++ b/kernel/Makefile
@@ -5,18 +5,29 @@
# Copyright (C) 2024 Falco Girgis
#
-OBJS = version.o
+OBJS = banner.o version.o
SUBDIRS = arch debug fs thread net libc exports romdisk
STUBS = stubs/kernel_export_stubs.o stubs/arch_export_stubs.o
# Everything from here up should be plain old C.
KOS_CFLAGS += $(KOS_CSTD)
-all: defaultall $(STUBS)
+all: banner.h defaultall $(STUBS)
rm -f $(KOS_BASE)/lib/$(KOS_ARCH)/libkallisti.a
kos-ar rcs $(KOS_BASE)/lib/$(KOS_ARCH)/libromdiskbase.a romdisk/*.o
kos-ar rcs $(KOS_BASE)/lib/$(KOS_ARCH)/libkallisti.a build/*.o
kos-ar rcs $(KOS_BASE)/lib/$(KOS_ARCH)/libkallisti_exports.a stubs/*.o
+ rm -f authors.h banner.h
+
+authors.h: make_authors.awk
+ awk -f make_authors.awk < ../AUTHORS > authors.h
+
+banner.o: banner.c
+
+banner.c: banner.h authors.h
+
+banner.h: make_banner.sh
+ ./make_banner.sh
stubs/kernel_export_stubs.c: exports.txt
$(KOS_BASE)/utils/genexports/genexportstubs.sh $< stubs/kernel_export_stubs.c
@@ -31,5 +42,8 @@ clean: defaultclean
rm -f build/libc/*.o
rm -f romdisk/*.o
rm -f stubs/*.o stubs/kernel_export_stubs.c stubs/arch_export_stubs.c
+ rm -f banner.h authors.h
run:
+
+.PHONY: banner.h authors.h
diff --git a/kernel/arch/dreamcast/include/arch/arch.h b/kernel/arch/dreamcast/include/arch/arch.h
index dd51f245..2fd7981e 100644
--- a/kernel/arch/dreamcast/include/arch/arch.h
+++ b/kernel/arch/dreamcast/include/arch/arch.h
@@ -85,6 +85,9 @@ unsigned HZ __depr("Please use the new THD_SCHED_HZ macro.") = THD_SCHED_HZ;
/** \brief Length of global symbol prefix in ELF files. */
#define ELF_SYM_PREFIX_LEN 1
+/** \brief Standard name for this arch. */
+#define ARCH_NAME "Dreamcast"
+
/** \brief ELF class for this architecture. */
#define ARCH_ELFCLASS ELFCLASS32
@@ -300,47 +303,6 @@ void hardware_shutdown(void);
*/
int hardware_sys_mode(int *region);
-/* These three aught to be in their own header file at some point, but for now,
- they'll stay here. */
-
-/** \brief Retrieve the banner printed at program initialization.
- \ingroup attribution
-
- This function retrieves the banner string that is printed at initialization
- time by the kernel. This contains the version of KOS in use and basic
- information about the environment in which it was compiled.
-
- \return A pointer to the banner string.
-*/
-const char * __pure2 kos_get_banner(void);
-
-/** \brief Retrieve the license information for the compiled copy of KOS.
- \ingroup attribution
-
- This function retrieves a string containing the license terms that the
- version of KOS in use is distributed under. This can be used to easily add
- information to your program to be displayed at runtime.
-
- \return A pointer to the license terms.
-*/
-const char * __pure2 kos_get_license(void);
-
-/** \brief Retrieve a list of authors and the dates of their contributions.
- \ingroup attribution
-
- This function retrieves the copyright information for the version of KOS in
- use. This function can be used to add such information to the credits of
- programs using KOS to give the appropriate credit to those that have worked
- on KOS.
-
- \remark
- Remember, you do need to give credit where credit is due, and this is an
- easy way to do so. ;-)
-
- \return A pointer to the authors' copyright information.
-*/
-const char *__pure2 kos_get_authors(void);
-
/** \brief Dreamcast specific sleep mode function.
\ingroup arch
*/
@@ -370,6 +332,15 @@ static inline bool arch_valid_text_address(uintptr_t ptr) {
return ptr >= (uintptr_t)&_executable_start && ptr < (uintptr_t)&_etext;
}
+/* The following functions are moved out of this header and are only provided for
+ compatibility reasons. Including any of them via this header is deprecated.
+*/
+
+/* Moved to <kos/banner.h> */
+const char * __pure2 kos_get_banner(void);
+const char * __pure2 kos_get_license(void);
+const char *__pure2 kos_get_authors(void);
+
__END_DECLS
#endif /* __ARCH_ARCH_H */
diff --git a/kernel/arch/dreamcast/kernel/Makefile b/kernel/arch/dreamcast/kernel/Makefile
index d6c3da9f..018752ed 100644
--- a/kernel/arch/dreamcast/kernel/Makefile
+++ b/kernel/arch/dreamcast/kernel/Makefile
@@ -9,45 +9,26 @@
# target processor. Other routines may be present as well, but
# that minimum set must be present.
-COPYOBJS = banner.o cache.o entry.o irq.o init.o mm.o panic.o
+COPYOBJS = cache.o entry.o irq.o init.o mm.o panic.o
COPYOBJS += rtc.o timer.o perfctr.o perf_monitor.o
COPYOBJS += init_flags_default.o
COPYOBJS += mmu.o itlb.o
COPYOBJS += exec.o execasm.o stack.o gdb_stub.o thdswitch.o tls_static.o arch_exports.o
-COPYOBJS += uname.o
OBJS = $(COPYOBJS) startup.o
SUBDIRS =
myall: $(OBJS)
-cp $(COPYOBJS) $(KOS_BASE)/kernel/build/
-cp startup.o $(KOS_BASE)/lib/$(KOS_ARCH)/_kos_startup.o
- -rm banner.h authors.h banner.o uname.o
include $(KOS_BASE)/Makefile.prefab
-uname.o: uname.c
-
-uname.c: banner.h
-
-banner.o: banner.c
-
-banner.c: banner.h authors.h
-
-banner.h: make_banner.sh
- ./make_banner.sh
-
-authors.h: make_authors.awk
- awk -f make_authors.awk < ../../../../AUTHORS > authors.h
-
arch_exports.o: arch_exports.c
arch_exports.c: ../exports-$(KOS_SUBARCH).txt
$(KOS_BASE)/utils/genexports/genexports.sh ../exports-$(KOS_SUBARCH).txt arch_exports.c arch_symtab
clean:
- -rm -f banner.h authors.h
-rm -f $(OBJS)
-rm -f arch_exports.c
-rm -f arch_exports.c
-
-.PHONY: banner.h authors.h
diff --git a/kernel/arch/dreamcast/kernel/init.c b/kernel/arch/dreamcast/kernel/init.c
index 4c05733f..d80385a4 100644
--- a/kernel/arch/dreamcast/kernel/init.c
+++ b/kernel/arch/dreamcast/kernel/init.c
@@ -10,6 +10,7 @@
#include <string.h>
#include <stdbool.h>
#include <stdlib.h>
+#include <kos/banner.h>
#include <kos/dbgio.h>
#include <kos/dbglog.h>
#include <kos/init.h>
diff --git a/kernel/arch/dreamcast/kernel/banner.c b/kernel/banner.c
similarity index 100%
rename from kernel/arch/dreamcast/kernel/banner.c
rename to kernel/banner.c
diff --git a/kernel/libc/koslib/Makefile b/kernel/libc/koslib/Makefile
index 1b39491d..625beae2 100644
--- a/kernel/libc/koslib/Makefile
+++ b/kernel/libc/koslib/Makefile
@@ -14,6 +14,6 @@ OBJS = abort.o memset2.o memset4.o memcpy2.o memcpy4.o \
creat.o sleep.o rmdir.o rename.o inet_pton.o inet_ntop.o \
inet_ntoa.o inet_aton.o poll.o select.o symlink.o readlink.o \
gethostbyname.o getaddrinfo.o dirfd.o nanosleep.o basename.o dirname.o \
- sched_yield.o dup.o dup2.o pipe.o
+ sched_yield.o dup.o dup2.o pipe.o uname.o
include $(KOS_BASE)/Makefile.prefab
diff --git a/kernel/arch/dreamcast/kernel/uname.c b/kernel/libc/koslib/uname.c
similarity index 84%
rename from kernel/arch/dreamcast/kernel/uname.c
rename to kernel/libc/koslib/uname.c
index aa0ef75b..2a2c9e0d 100644
--- a/kernel/arch/dreamcast/kernel/uname.c
+++ b/kernel/libc/koslib/uname.c
@@ -10,10 +10,10 @@
#include <string.h>
#include <sys/utsname.h>
-#include "banner.h"
+#include <arch/arch.h>
+#include "../../banner.h"
#define UNAME_KERNEL "KallistiOS"
-#define UNAME_MACHINE "Dreamcast"
int uname(struct utsname *n) {
if(!n) {
@@ -25,7 +25,7 @@ int uname(struct utsname *n) {
strcpy(n->sysname, UNAME_KERNEL);
strcpy(n->release, kern_version);
snprintf(n->version, 64, "%s %s", UNAME_KERNEL, kern_version);
- strcpy(n->machine, UNAME_MACHINE);
+ strcpy(n->machine, ARCH_NAME);
return 0;
}
diff --git a/kernel/arch/dreamcast/kernel/make_authors.awk b/kernel/make_authors.awk
similarity index 100%
rename from kernel/arch/dreamcast/kernel/make_authors.awk
rename to kernel/make_authors.awk
diff --git a/kernel/arch/dreamcast/kernel/make_banner.sh b/kernel/make_banner.sh
similarity index 89%
rename from kernel/arch/dreamcast/kernel/make_banner.sh
rename to kernel/make_banner.sh
index 4bc60754..cf9b5620 100755
--- a/kernel/arch/dreamcast/kernel/make_banner.sh
+++ b/kernel/make_banner.sh
@@ -9,6 +9,11 @@ relver="$KOS_VERSION"
printf '"KallistiOS ' >> banner.h
printf "v$relver" >> banner.h
+printf ' [' >> banner.h
+printf "$KOS_ARCH" >> banner.h
+printf '/' >> banner.h
+printf "$KOS_SUBARCH" >> banner.h
+printf ']' >> banner.h
printf '\\n"\n' >> banner.h
if [ -d "$KOS_BASE/.git" ]; then
printf '" Git revision: ' >> banner.h
@@ -54,3 +59,4 @@ else
fi
printf '";\n' >> banner.h
+
hooks/post-receive
--
A pseudo Operating System for the Dreamcast.
|