From: falcovorbis <fal...@us...> - 2023-12-04 04:01: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 15ade8d666d0c167fd5a5d53fefbc7569ac05ae4 (commit) via 5f74069609be239f356be7b38dfff54d493ada07 (commit) from a644e345e6f3ff226afec097296f5f7b79698fc2 (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 15ade8d666d0c167fd5a5d53fefbc7569ac05ae4 Author: Falco Girgis <gyr...@gm...> Date: Sun Dec 3 21:52:34 2023 -0600 Added link to Source Code to Doxygen Navigator Bar (#395) * Added link to Source Code to Doxygen Navigator Bar - Required redoing the heading levels in the main README.md to bump everything up by 1 - Added pages/DoxygenLayout.xml with a link to the GitHub commit 5f74069609be239f356be7b38dfff54d493ada07 Author: Falco Girgis <gyr...@gm...> Date: Sun Dec 3 21:47:00 2023 -0600 Revert "Thread Switch copy speed up" (#398) * Revert "Thread Switch copy speed up" * Update thread.h Removed redundant <stdint.h> include. ----------------------------------------------------------------------- Summary of changes: README.md | 22 +- doc/Doxyfile | 2 +- doc/pages/DoxygenLayout.xml | 241 +++++++++++++ kernel/arch/dreamcast/include/arch/irq.h | 34 +- kernel/arch/dreamcast/kernel/entry.s | 581 ++++++++++++++++--------------- kernel/arch/dreamcast/kernel/irq.c | 18 +- kernel/arch/dreamcast/kernel/thdswitch.s | 169 ++++----- 7 files changed, 672 insertions(+), 395 deletions(-) create mode 100644 doc/pages/DoxygenLayout.xml diff --git a/README.md b/README.md index 64d7106..2eeac26 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ <!-- PROJECT LOGO --> <br /> <div align="center"> - <h1 align="center">KallistiOS</h1> + <h1 align="center"><strong>KallistiOS</strong></h1> <p align="center"> Independent SDK for the Sega Dreamcast @@ -11,7 +11,7 @@ </p> </div> -## Overview +# Overview KOS is an unofficial development kit for the SEGA Dreamcast game console with some support for the NAOMI and NAOMI 2 arcade boards. @@ -19,15 +19,15 @@ KOS was developed from scratch over the internet by a group of free software dev Despite the console's age, KOS offers an extremely modern, programmer-friendly development environment. Using the latest GCC toolchain, it supports the entirety of C17 and C++20 including their standard libraries, along with support for portions of C23, C++23, Objective-C, and various POSIX APIs. Additionally, KOS-ports offers a rich set of add-on libraries such as SDL, OpenGL, OpenAL, and Lua for the platform. -## Features -### Core Functionality +# Features +## Core Functionality * Concurrency with Kernel Threads, C11 Threads, C++11 `std::thread`, POSIX threads * Virtual Filesystem Abstraction * IPv4/IPv6 Network Stack * Dynamically Loaded Libraries and Modules * GDB Debugger Support -### Dreamcast Hardware Support +## Dreamcast Hardware Support * GD-ROM Optical Drive * Low-level 3D PowerVR Graphics * SH4 ASM-Optimized Math Routines @@ -41,7 +41,7 @@ Despite the console's age, KOS offers an extremely modern, programmer-friendly d * MMU Management * BIOS Font Rendering -### Peripherals and Accessory Support +## Peripherals and Accessory Support * Controller, ASCII Pad * Arcade Stick, Twin Stick, Mission Stick * Keyboard @@ -61,15 +61,15 @@ Despite the console's age, KOS offers an extremely modern, programmer-friendly d * VGA Adapter * SD Card Reader -### Hardware Modification Support +## Hardware Modification Support * IDE Hard Drive * 32MB RAM Upgrade * Custom BIOS Flashroms -## Getting Started +# Getting Started A beginner's guide to development for the Sega Dreamcast along with detailed instructions for installing KOS and the required toolchains can be found on the [Dreamcast Wiki](https://dreamcast.wiki/Getting_Started_with_Dreamcast_development). Additional documentation can be found in the docs folder. -## Examples +# Examples Once you've set up the environment and are ready to begin developing, a good place to start learning is the examples directory, which provides demos for the various KOS APIs and for interacting with the Dreamcast's hardware. Examples include: - Hello World - Console Input/Output @@ -95,9 +95,9 @@ Once you've set up the environment and are ready to begin developing, a good pla - Testing 32MB RAM hardware mod - Interactive Lua interpreter terminal -## Resources -[DCEmulation Forums](http://dcemulation.org/phpBB/viewforum.php?f=29): Goldmine of Dreamcast development information and history +# Resources [Dreamcast Wiki](http://dreamcast.wiki): Large collection of tutorials and articles for beginners [Simulant Discord Chat](https://discord.gg/bpDZHT78PA): Home to the official Discord channel of KOS +[DCEmulation Forums](http://dcemulation.org/phpBB/viewforum.php?f=29): Goldmine of Dreamcast development information and history IRC Channel: irc.libera.chat `#dreamcastdev` diff --git a/doc/Doxyfile b/doc/Doxyfile index 21baf29..2f7c77a 100644 --- a/doc/Doxyfile +++ b/doc/Doxyfile @@ -786,7 +786,7 @@ FILE_VERSION_FILTER = # DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE # tag is left empty. -LAYOUT_FILE = +LAYOUT_FILE = pages/DoxygenLayout.xml # The CITE_BIB_FILES tag can be used to specify one or more bib files containing # the reference definitions. This must be a list of .bib files. The .bib diff --git a/doc/pages/DoxygenLayout.xml b/doc/pages/DoxygenLayout.xml new file mode 100644 index 0000000..5421b63 --- /dev/null +++ b/doc/pages/DoxygenLayout.xml @@ -0,0 +1,241 @@ +<doxygenlayout version="1.0"> + <!-- Generated by doxygen 1.9.7 --> + <!-- Navigation index tabs for HTML output --> + <navindex> + <tab type="mainpage" visible="yes" title=""/> + <tab type="user" url="https://github.com/KallistiOS/KallistiOS" title="Source Code"/> + <tab type="pages" visible="yes" title="" intro=""/> + <tab type="modules" visible="yes" title="Topics" intro=""/> + <tab type="namespaces" visible="yes" title=""> + <tab type="namespacelist" visible="yes" title="" intro=""/> + <tab type="namespacemembers" visible="yes" title="" intro=""/> + </tab> + <tab type="concepts" visible="yes" title=""> + </tab> + <tab type="interfaces" visible="yes" title=""> + <tab type="interfacelist" visible="yes" title="" intro=""/> + <tab type="interfaceindex" visible="$ALPHABETICAL_INDEX" title=""/> + <tab type="interfacehierarchy" visible="yes" title="" intro=""/> + </tab> + <tab type="classes" visible="yes" title=""> + <tab type="classlist" visible="yes" title="" intro=""/> + <tab type="classindex" visible="$ALPHABETICAL_INDEX" title=""/> + <tab type="hierarchy" visible="yes" title="" intro=""/> + <tab type="classmembers" visible="yes" title="" intro=""/> + </tab> + <tab type="structs" visible="yes" title=""> + <tab type="structlist" visible="yes" title="" intro=""/> + <tab type="structindex" visible="$ALPHABETICAL_INDEX" title=""/> + </tab> + <tab type="exceptions" visible="yes" title=""> + <tab type="exceptionlist" visible="yes" title="" intro=""/> + <tab type="exceptionindex" visible="$ALPHABETICAL_INDEX" title=""/> + <tab type="exceptionhierarchy" visible="yes" title="" intro=""/> + </tab> + <tab type="files" visible="yes" title=""> + <tab type="filelist" visible="yes" title="" intro=""/> + <tab type="globals" visible="yes" title="" intro=""/> + </tab> + <tab type="examples" visible="yes" title="" intro=""/> + </navindex> + + <!-- Layout definition for a class page --> + <class> + <briefdescription visible="yes"/> + <includes visible="$SHOW_HEADERFILE"/> + <inheritancegraph visible="$CLASS_GRAPH"/> + <collaborationgraph visible="$COLLABORATION_GRAPH"/> + <memberdecl> + <nestedclasses visible="yes" title=""/> + <publictypes title=""/> + <services title=""/> + <interfaces title=""/> + <publicslots title=""/> + <signals title=""/> + <publicmethods title=""/> + <publicstaticmethods title=""/> + <publicattributes title=""/> + <publicstaticattributes title=""/> + <protectedtypes title=""/> + <protectedslots title=""/> + <protectedmethods title=""/> + <protectedstaticmethods title=""/> + <protectedattributes title=""/> + <protectedstaticattributes title=""/> + <packagetypes title=""/> + <packagemethods title=""/> + <packagestaticmethods title=""/> + <packageattributes title=""/> + <packagestaticattributes title=""/> + <properties title=""/> + <events title=""/> + <privatetypes title=""/> + <privateslots title=""/> + <privatemethods title=""/> + <privatestaticmethods title=""/> + <privateattributes title=""/> + <privatestaticattributes title=""/> + <friends title=""/> + <related title="" subtitle=""/> + <membergroups visible="yes"/> + </memberdecl> + <detaileddescription title=""/> + <memberdef> + <inlineclasses title=""/> + <typedefs title=""/> + <enums title=""/> + <services title=""/> + <interfaces title=""/> + <constructors title=""/> + <functions title=""/> + <related title=""/> + <variables title=""/> + <properties title=""/> + <events title=""/> + </memberdef> + <allmemberslink visible="yes"/> + <usedfiles visible="$SHOW_USED_FILES"/> + <authorsection visible="yes"/> + </class> + + <!-- Layout definition for a namespace page --> + <namespace> + <briefdescription visible="yes"/> + <memberdecl> + <nestednamespaces visible="yes" title=""/> + <constantgroups visible="yes" title=""/> + <interfaces visible="yes" title=""/> + <classes visible="yes" title=""/> + <concepts visible="yes" title=""/> + <structs visible="yes" title=""/> + <exceptions visible="yes" title=""/> + <typedefs title=""/> + <sequences title=""/> + <dictionaries title=""/> + <enums title=""/> + <functions title=""/> + <variables title=""/> + <membergroups visible="yes"/> + </memberdecl> + <detaileddescription title=""/> + <memberdef> + <inlineclasses title=""/> + <typedefs title=""/> + <sequences title=""/> + <dictionaries title=""/> + <enums title=""/> + <functions title=""/> + <variables title=""/> + </memberdef> + <authorsection visible="yes"/> + </namespace> + + <!-- Layout definition for a concept page --> + <concept> + <briefdescription visible="yes"/> + <includes visible="$SHOW_HEADERFILE"/> + <definition visible="yes" title=""/> + <detaileddescription title=""/> + <authorsection visible="yes"/> + </concept> + + <!-- Layout definition for a file page --> + <file> + <briefdescription visible="yes"/> + <includes visible="$SHOW_INCLUDE_FILES"/> + <includegraph visible="$INCLUDE_GRAPH"/> + <includedbygraph visible="$INCLUDED_BY_GRAPH"/> + <sourcelink visible="yes"/> + <memberdecl> + <interfaces visible="yes" title=""/> + <classes visible="yes" title=""/> + <structs visible="yes" title=""/> + <exceptions visible="yes" title=""/> + <namespaces visible="yes" title=""/> + <concepts visible="yes" title=""/> + <constantgroups visible="yes" title=""/> + <defines title=""/> + <typedefs title=""/> + <sequences title=""/> + <dictionaries title=""/> + <enums title=""/> + <functions title=""/> + <variables title=""/> + <membergroups visible="yes"/> + </memberdecl> + <detaileddescription title=""/> + <memberdef> + <inlineclasses title=""/> + <defines title=""/> + <typedefs title=""/> + <sequences title=""/> + <dictionaries title=""/> + <enums title=""/> + <functions title=""/> + <variables title=""/> + </memberdef> + <authorsection/> + </file> + + <!-- Layout definition for a group page --> + <group> + <briefdescription visible="yes"/> + <groupgraph visible="$GROUP_GRAPHS"/> + <memberdecl> + <nestedgroups visible="yes" title=""/> + <dirs visible="yes" title=""/> + <files visible="yes" title=""/> + <namespaces visible="yes" title=""/> + <concepts visible="yes" title=""/> + <classes visible="yes" title=""/> + <defines title=""/> + <typedefs title=""/> + <sequences title=""/> + <dictionaries title=""/> + <enums title=""/> + <enumvalues title=""/> + <functions title=""/> + <variables title=""/> + <signals title=""/> + <publicslots title=""/> + <protectedslots title=""/> + <privateslots title=""/> + <events title=""/> + <properties title=""/> + <friends title=""/> + <membergroups visible="yes"/> + </memberdecl> + <detaileddescription title=""/> + <memberdef> + <pagedocs/> + <inlineclasses title=""/> + <defines title=""/> + <typedefs title=""/> + <sequences title=""/> + <dictionaries title=""/> + <enums title=""/> + <enumvalues title=""/> + <functions title=""/> + <variables title=""/> + <signals title=""/> + <publicslots title=""/> + <protectedslots title=""/> + <privateslots title=""/> + <events title=""/> + <properties title=""/> + <friends title=""/> + </memberdef> + <authorsection visible="yes"/> + </group> + + <!-- Layout definition for a directory page --> + <directory> + <briefdescription visible="yes"/> + <directorygraph visible="yes"/> + <memberdecl> + <dirs visible="yes"/> + <files visible="yes"/> + </memberdecl> + <detaileddescription title=""/> + </directory> +</doxygenlayout> diff --git a/kernel/arch/dreamcast/include/arch/irq.h b/kernel/arch/dreamcast/include/arch/irq.h index 2f782ee..de70c60 100644 --- a/kernel/arch/dreamcast/include/arch/irq.h +++ b/kernel/arch/dreamcast/include/arch/irq.h @@ -20,7 +20,6 @@ #ifndef __ARCH_IRQ_H #define __ARCH_IRQ_H -#include <stdint.h> #include <sys/cdefs.h> __BEGIN_DECLS @@ -45,20 +44,19 @@ __BEGIN_DECLS \headerfile arch/irq.h */ typedef struct irq_context { - uint32_t r[16]; /**< \brief 16 general purpose (integer) registers */ - uint32_t pc; /**< \brief Program counter */ - uint32_t pr; /**< \brief Procedure register (aka return address) */ - uint32_t gbr; /**< \brief Global base register */ - uint32_t vbr; /**< \brief Vector base register */ - uint32_t mach; /**< \brief Multiply-and-accumulate register (high) */ - uint32_t macl; /**< \brief Multiply-and-accumulate register (low) */ - uint32_t sr; /**< \brief Status register */ - uint32_t fpul; /**< \brief Floating-point communication register */ - uint32_t frbank[16]; /**< \brief Secondary floating poing registers */ - uint32_t fr[16]; /**< \brief Primary floating point registers */ - uint32_t fpscr; /**< \brief Floating-point status/control register */ - uint8_t padding[28]; /**< \brief Padding to make the struct size 256 bytes */ -} irq_context_t __attribute((aligned(32))); + uint32 r[16]; /**< \brief 16 general purpose (integer) registers */ + uint32 pc; /**< \brief Program counter */ + uint32 pr; /**< \brief Procedure register (aka return address) */ + uint32 gbr; /**< \brief Global base register */ + uint32 vbr; /**< \brief Vector base register */ + uint32 mach; /**< \brief Multiply-and-accumulate register (high) */ + uint32 macl; /**< \brief Multiply-and-accumulate register (low) */ + uint32 sr; /**< \brief Status register */ + uint32 frbank[16]; /**< \brief Secondary floating poing registers */ + uint32 fr[16]; /**< \brief Primary floating point registers */ + uint32 fpscr; /**< \brief Floating-point status/control register */ + uint32 fpul; /**< \brief Floatint-point communication register */ +} irq_context_t; /* A couple of architecture independent access macros */ /** \brief Fetch the program counter from an irq_context_t. @@ -234,7 +232,7 @@ typedef struct irq_context { #define TIMER_IRQ EXC_TMU0_TUNI0 /** \brief The type of an interrupt identifier */ -typedef uint32_t irq_t; +typedef uint32 irq_t; /** \brief The type of an IRQ handler \param source The IRQ that caused the handler to be called. @@ -332,8 +330,8 @@ irq_context_t *irq_get_context(void); to the architecture maximum. \param usermode 1 to run the routine in user mode, 0 for supervisor. */ -void irq_create_context(irq_context_t *context, uint32_t stack_pointer, - uint32_t routine, uint32_t *args, int usermode); +void irq_create_context(irq_context_t *context, uint32 stack_pointer, + uint32 routine, uint32 *args, int usermode); /* Enable/Disable interrupts */ /** \brief Disable interrupts. diff --git a/kernel/arch/dreamcast/kernel/entry.s b/kernel/arch/dreamcast/kernel/entry.s index ddf330b..5624fb6 100644 --- a/kernel/arch/dreamcast/kernel/entry.s +++ b/kernel/arch/dreamcast/kernel/entry.s @@ -1,8 +1,7 @@ ! KallistiOS ##version## ! ! arch/dreamcast/kernel/entry.s -! Copyright (C) 2003 Megan Potter -! Copyright (C) 2023 Colton Pawielski +! (c)2000-2001 Megan Potter ! ! Assembler code for entry and exit to/from the kernel via exceptions ! @@ -15,12 +14,12 @@ ! for a context switcher (or especially a timer! =) but it can ! be optimized later. - .text - .align 2 - .globl _irq_srt_addr - .globl _irq_handle_exception - .globl _irq_save_regs - .globl _irq_force_return + .text + .align 2 + .globl _irq_srt_addr + .globl _irq_handle_exception + .globl _irq_save_regs + .globl _irq_force_return ! Static kernel-mode stack; we can get away with this because in our ! tiny microkernel, only one thread will ever actually be sitting inside @@ -30,170 +29,200 @@ ! mis-mapped user-mode stack pointers, etc. It also opens the door for ! hard real-time interrupts and exceptions that interrupt the kernel ! itself. - .space 4096 ! One page + .space 4096 ! One page krn_stack: ! All exception vectors lead to Rome (i.e., this label). - .align 2 _irq_save_regs: ! On the SH4, an exception triggers a toggle of RB in SR. So all ! the R0-R7 registers were convienently saved for us. - mov.l _irq_srt_addr, r0 ! Grab the location of the reg store - add #0x20, r0 ! Start at the top of the BANK regs - stc.l r7_bank, @-r0 ! Save R7 - stc.l r6_bank, @-r0 ! Save R6 - stc.l r5_bank, @-r0 ! Save R5 - stc.l r4_bank, @-r0 ! Save R4 - stc.l r3_bank, @-r0 ! Save R3 - stc.l r2_bank, @-r0 ! Save R2 - stc.l r1_bank, @-r0 ! Save R1 - stc.l r0_bank, @-r0 ! Save R0 - - mov.l r8,@(0x20,r0) ! save R8 - mov.l r9,@(0x24,r0) ! save R9 - mov.l r10,@(0x28,r0) ! save R10 - mov.l r11,@(0x2c,r0) ! save R11 - mov.l r12,@(0x30,r0) ! save R12 - mov.l r13,@(0x34,r0) ! save R13 - mov.l r14,@(0x38,r0) ! save R14 - mov.l r15,@(0x3c,r0) ! save R15 (SP) - add #0x5c, r0 ! readjust register pointer - stc.l ssr, @-r0 ! save SSR 0x58 - sts.l macl, @-r0 ! save MACL 0x54 - sts.l mach, @-r0 ! save MACH 0x50 - stc.l vbr, @-r0 ! save VBR 0x4c - stc.l gbr, @-r0 ! save GBR 0x48 - sts.l pr, @-r0 ! save PR 0x44 - stc.l spc, @-r0 ! save PC 0x40 - - add #0xA4, r0 ! readjust register pointer - sts.l fpscr, @-r0 ! save FPSCR 0xdc - mov #0, r2 ! Set known FP flags - lds r2, fpscr - fschg ! Switch to pair FP moves - fmov.d dr14, @-r0 ! save FR14 & FR15 - fmov.d dr12, @-r0 ! save FR12 & FR13 - fmov.d dr10, @-r0 ! save FR10 & FR11 - fmov.d dr8, @-r0 ! save FR8 & FR9 - fmov.d dr6, @-r0 ! save FR6 & FR7 - fmov.d dr4, @-r0 ! save FR4 & FR5 - fmov.d dr2, @-r0 ! save FR2 & FR3 - fmov.d dr0, @-r0 ! save FR0 & FR1 - frchg ! Second FP bank - fmov.d dr14, @-r0 ! save FR14 & FR15 - fmov.d dr12, @-r0 ! save FR12 & FR13 - fmov.d dr10, @-r0 ! save FR10 & FR11 - fmov.d dr8, @-r0 ! save FR8 & FR9 - fmov.d dr6, @-r0 ! save FR6 & FR7 - fmov.d dr4, @-r0 ! save FR4 & FR5 - fmov.d dr2, @-r0 ! save FR2 & FR3 ...<truncated>... hooks/post-receive -- A pseudo Operating System for the Dreamcast. |