From f60de0c6a703000fd55ab8e2c6d65df1ce8ee877 Mon Sep 17 00:00:00 2001 From: Morten Delenk Date: Sat, 29 Jul 2017 12:07:16 +0100 Subject: [PATCH] removed kernel9 from main tree --- do_all.sh | 17 ++++--- kernel/arch/arm/3ds9/config.py | 5 -- kernel/arch/arm/3ds9/flags.cmake | 3 -- kernel/arch/arm/3ds9/layout.ld | 37 -------------- kernel/arch/arm/3ds9/start.cpp | 25 --------- kernel/arch/arm/3ds9/start.s | 64 ------------------------ kernel/arch/arm/config.py | 2 +- kernel/cpu/arm/arm946e-s/config.py | 0 kernel/hw/3ds9/config.py | 7 --- kernel/hw/3ds9/picafb/picafb.cpp | 13 ----- kernel/hw/3ds9/picafb/picafb.hpp | 13 ----- kernel/hw/3ds9/vectorinit/vectorinit.cpp | 57 --------------------- kernel/hw/3ds9/vectorinit/vectorinit.hpp | 11 ---- 13 files changed, 10 insertions(+), 244 deletions(-) delete mode 100644 kernel/arch/arm/3ds9/config.py delete mode 100644 kernel/arch/arm/3ds9/flags.cmake delete mode 100644 kernel/arch/arm/3ds9/layout.ld delete mode 100644 kernel/arch/arm/3ds9/start.cpp delete mode 100644 kernel/arch/arm/3ds9/start.s delete mode 100644 kernel/cpu/arm/arm946e-s/config.py delete mode 100644 kernel/hw/3ds9/config.py delete mode 100644 kernel/hw/3ds9/picafb/picafb.cpp delete mode 100644 kernel/hw/3ds9/picafb/picafb.hpp delete mode 100644 kernel/hw/3ds9/vectorinit/vectorinit.cpp delete mode 100644 kernel/hw/3ds9/vectorinit/vectorinit.hpp diff --git a/do_all.sh b/do_all.sh index e3c7cac..8f00403 100755 --- a/do_all.sh +++ b/do_all.sh @@ -34,23 +34,24 @@ mv bootable.iso out/x86_64-pc.iso && cp build/kernel/kernel out/x86_64-pc.elf #arm-3ds9 config -{ - echo 2 #arm - echo 0 #3ds9 - yes '' -} | ./config.py && +builddir && +pushd build && +git clone https://github.com/MTGos/mtgos-3ds9 && +pushd mtgos-3ds9 && builddir && pushd build && cmake -DCMAKE_TOOLCHAIN_FILE=../toolchains/arm-none-eabi.cmake .. && make -j$(nproc) && popd && -mv build/kernel/kernel kernel9 && +mv build/kernel/kernel ../../kernel9 +popd && +popd && cp -v kernel9 out/arm9loaderhax.elf #arm-3ds11 config { echo 2 #arm - echo 1 #3ds11 + echo 0 #3ds11 yes '' } | ./config.py && builddir && @@ -65,7 +66,7 @@ cp -v build/kernel/kernel out/arm11loaderhax.elf { echo 2 - echo 2 + echo 1 yes '' } | ./config.py && builddir && diff --git a/kernel/arch/arm/3ds9/config.py b/kernel/arch/arm/3ds9/config.py deleted file mode 100644 index 59e3c1d..0000000 --- a/kernel/arch/arm/3ds9/config.py +++ /dev/null @@ -1,5 +0,0 @@ -config["LOWEST_CPU"] = "arm946e-s" -config["ENABLE_THUMB"] = get_yes_no("Enable Thumb", True) -import sys -sys.argv=["","kernel/mmaps/3ds9.mc"] -from buildtools import mmapcomp diff --git a/kernel/arch/arm/3ds9/flags.cmake b/kernel/arch/arm/3ds9/flags.cmake deleted file mode 100644 index ab52dcb..0000000 --- a/kernel/arch/arm/3ds9/flags.cmake +++ /dev/null @@ -1,3 +0,0 @@ -SET(PLATFORM_C_FLAGS "-I../../kernel/arch/arm/3ds9/include -mcpu=arm946e-s -march=armv5te -mthumb-interwork -marm -Os") -SET(PLATFORM_CXX_FLAGS "${PLATFORM_C_FLAGS}") -SET(PLATFORM_ASM_FLAGS "${PLATFORM_C_FLAGS}") diff --git a/kernel/arch/arm/3ds9/layout.ld b/kernel/arch/arm/3ds9/layout.ld deleted file mode 100644 index e61eb33..0000000 --- a/kernel/arch/arm/3ds9/layout.ld +++ /dev/null @@ -1,37 +0,0 @@ -ENTRY(_start) -SECTIONS { - . = 0x08000100; - kernel_start = .; - .text : { - KEEP(*(.text.boot)); - *(.text) - } - .data : { - start_ctors = .; - KEEP(*(.init_array)); - KEEP(*(SORT_BY_INIT_PRIORITY(.init_array.*))); - KEEP(*(.ctors)); - end_ctors = .; - start_dtors = .; - KEEP(*(.fini_array)); - KEEP(*(.fini_array.*)); - KEEP(*(.dtors)); - end_dtors = .; - start_eh_frame = .; - KEEP(*(.eh_frame)); - KEEP(*(.eh_frame.*)); - QUAD(0); - KEEP(*(.gcc_except_table)); - KEEP(*(.gcc_except_table.*)); - *(.data) - } - .rodata : { - *(.rodata) - } - .bss : { - *(.bss) - *(.bss.*) - *(COMMON) - } - kernel_end = .; -} diff --git a/kernel/arch/arm/3ds9/start.cpp b/kernel/arch/arm/3ds9/start.cpp deleted file mode 100644 index 5ca3341..0000000 --- a/kernel/arch/arm/3ds9/start.cpp +++ /dev/null @@ -1,25 +0,0 @@ -#include "../../../hw/3ds9/picafb/picafb.hpp" -#include "../../../hw/3ds9/vectorinit/vectorinit.hpp" -#include -#include -#include "../../../mmaps/3ds9.mh" -#include "../../../hw/pmm/pmm.hpp" - -PICAfb term; -PMM_MMAP lpmm; -void main(); -extern "C" void enable_irqs(); -extern "C" void start() { main(); - for(;;); -} -void drivers_init() { - pmm=(PMM*)(&lpmm); - setMainTTY(&term); - --term; - //Init 1000Hz timer - enable_irqs(); - *((volatile uint16_t*)0x10003002)=0; - *((volatile uint16_t*)0x10003000)=65; - *((volatile uint16_t*)0x10003002)=0b11000000; - *((volatile uint32_t*)0x10001000)|=1<<8; -} diff --git a/kernel/arch/arm/3ds9/start.s b/kernel/arch/arm/3ds9/start.s deleted file mode 100644 index ef754c2..0000000 --- a/kernel/arch/arm/3ds9/start.s +++ /dev/null @@ -1,64 +0,0 @@ -.align 4 -.global _start -.extern start -.section .text.boot -_start: - mrs r0, cpsr - orr r0, r0, #0b111000000 - msr cpsr_c, r0 //Disable IRQs - - ldr sp, =kernel_stack //set stack - //Set other stacks - mrs r0, cpsr - bic r2, r0, #0x1F - mov r1, r2 - orr r1, #0b10001 //FIQ - msr cpsr, r1 - ldr sp, =fiq_stack - mov r1, r2 - orr r1, #0b10010 //IRQ - msr cpsr, r1 - ldr sp, =irq_stack - mov r1, r2 - orr r1, #0b10111 //Abort - msr cpsr, r1 - ldr sp, =abt_stack - mov r1, r2 - orr r1, #0b11011 //Undefined - msr cpsr, r1 - ldr sp, =und_stack - mov r1, r2 - orr r1, #0b10011 //SVC - msr cpsr, r1 - ldr sp, =svc_stack - orr r1, #0b11111 //SYS - msr cpsr, r1 - ldr sp, =kernel_stack - - //Certain bootloaders put the interrupt vectors in ITCM. - //We don't want to mess with ITCM, so we put it back - mrc p15, 0, r0, c1, c0, 0 - orr r0, #(1<<13) - mcr p15, 0, r0, c1, c0, 0 - //Start start - blx start -.global enable_irqs -enable_irqs: - mrs r0, cpsr - bic r0, #0b111000000 - msr cpsr, r0 - bx lr -.section .bss -.align 16 -.space 4096 -fiq_stack: -.space 4096 -irq_stack: -.space 4096 -abt_stack: -.space 4096 -und_stack: -.space 4096 -svc_stack: -.space 4096 -kernel_stack: diff --git a/kernel/arch/arm/config.py b/kernel/arch/arm/config.py index 3ed636a..fc767e8 100644 --- a/kernel/arch/arm/config.py +++ b/kernel/arch/arm/config.py @@ -1 +1 @@ -config["SYSTEM"] = get_from_list("System", ["3ds9","3ds11", "raspi2"]) +config["SYSTEM"] = get_from_list("System", ["3ds11", "raspi2"]) diff --git a/kernel/cpu/arm/arm946e-s/config.py b/kernel/cpu/arm/arm946e-s/config.py deleted file mode 100644 index e69de29..0000000 diff --git a/kernel/hw/3ds9/config.py b/kernel/hw/3ds9/config.py deleted file mode 100644 index 897273f..0000000 --- a/kernel/hw/3ds9/config.py +++ /dev/null @@ -1,7 +0,0 @@ -config["ENABLE_EXTRA_MEMORY"] = get_yes_no("Enable 512KB of memory on n3DS", True) -add_driver(True, "framebuffer") -add_driver(False, "picafb") -add_driver(False, "vectorinit") -add_driver(True, "pmm") -print("Enable complete Unicode font: NO (because of the size)") -config["ENABLE_FRAMEBUFFER_UNICODE"] = False diff --git a/kernel/hw/3ds9/picafb/picafb.cpp b/kernel/hw/3ds9/picafb/picafb.cpp deleted file mode 100644 index c738eb8..0000000 --- a/kernel/hw/3ds9/picafb/picafb.cpp +++ /dev/null @@ -1,13 +0,0 @@ -#include "picafb.hpp" -#include -PICAfb::PICAfb() : Framebuffer(40, 15) {} -PICAfb::~PICAfb() {} -auto PICAfb::plotPixel(int x, int y, int col) -> void { - unsigned char *lfb = (unsigned char *)0x18300000 + 0x46500; - y=240-y-1; - int off = (x * 240 + y) * 3; - for (int i = 0; i < 3; i++) { - lfb[off++] = col; - col >>= 8; - } -} diff --git a/kernel/hw/3ds9/picafb/picafb.hpp b/kernel/hw/3ds9/picafb/picafb.hpp deleted file mode 100644 index 068999b..0000000 --- a/kernel/hw/3ds9/picafb/picafb.hpp +++ /dev/null @@ -1,13 +0,0 @@ -#pragma once -#include "../../framebuffer/framebuffer.hpp" -/** - * Framebuffer for the 3ds - */ -class PICAfb : public Framebuffer { - protected: - virtual auto plotPixel(int x, int y, int col) -> void; - - public: - PICAfb(); - virtual ~PICAfb(); -}; diff --git a/kernel/hw/3ds9/vectorinit/vectorinit.cpp b/kernel/hw/3ds9/vectorinit/vectorinit.cpp deleted file mode 100644 index e4fed9d..0000000 --- a/kernel/hw/3ds9/vectorinit/vectorinit.cpp +++ /dev/null @@ -1,57 +0,0 @@ -#include "vectorinit.hpp" -#include -extern "C" { -extern uintptr_t branch_macro; -void data_abort(); -void fast_irq(); -void normal_irq(); -void prefetch_abort(); -void svc_call(); -void undefined_op(); -void flushAll(); -} -void initVectors() { - uintptr_t *vectors = (uintptr_t *)0x08000000; - // branch_macro is a ldr pc, [pc,#-4], meaning it reads the following word as PC - vectors[0] = branch_macro; - vectors[1] = (uintptr_t)&normal_irq; - vectors[2] = branch_macro; - vectors[3] = (uintptr_t)&fast_irq; - vectors[4] = branch_macro; - vectors[5] = (uintptr_t)&svc_call; - vectors[6] = branch_macro; - vectors[7] = (uintptr_t)&undefined_op; - vectors[8] = branch_macro; - vectors[9] = (uintptr_t)&prefetch_abort; - vectors[10] = branch_macro; - vectors[11] = (uintptr_t)&data_abort; - flushAll(); -} -IRQ_IO::IRQ_IO() { - initVectors(); - *((volatile uint32_t*)0x10001000)=~0; - *((volatile uint32_t*)0x10001004)=~0; -} -IRQ_IO::~IRQ_IO() {} - -void* IRQ_IO::handleIRQ(void *data) { - //Call IRQ handlers until all IRQs are done. - int bit; - while(bit=__builtin_ffs(*((volatile int*)0x10001004))) { - data = handlers[bit-1](data); - *((volatile int*)0x10001004)=(1<<(bit-1)); - } - return data; -} - -void IRQ_IO::mask(int number) { - *((volatile int*)0x10001004)&=~(1< -#include -void initVectors(); -struct IRQ_IO: IRQ { - IRQ_IO(); - virtual ~IRQ_IO(); - virtual void* handleIRQ(void *data); - virtual void mask(int number); - virtual void unmask(int number); -};