removed kernel9 from main tree

This commit is contained in:
Morten Delenk 2017-07-29 12:07:16 +01:00
parent 9cee98801e
commit f60de0c6a7
13 changed files with 10 additions and 244 deletions

View file

@ -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 &&

View file

@ -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

View file

@ -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}")

View file

@ -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 = .;
}

View file

@ -1,25 +0,0 @@
#include "../../../hw/3ds9/picafb/picafb.hpp"
#include "../../../hw/3ds9/vectorinit/vectorinit.hpp"
#include <base.hpp>
#include <config.h>
#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;
}

View file

@ -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:

View file

@ -1 +1 @@
config["SYSTEM"] = get_from_list("System", ["3ds9","3ds11", "raspi2"])
config["SYSTEM"] = get_from_list("System", ["3ds11", "raspi2"])

View file

@ -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

View file

@ -1,13 +0,0 @@
#include "picafb.hpp"
#include <config.h>
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;
}
}

View file

@ -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();
};

View file

@ -1,57 +0,0 @@
#include "vectorinit.hpp"
#include <base.hpp>
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<<number);
}
void IRQ_IO::unmask(int number) {
*((volatile int*)0x10001004)|=1<<number;
}
static IRQ_IO irq;
__attribute__((constructor))
static void init_irq() {
irqs = (IRQ*)&irq;
}

View file

@ -1,11 +0,0 @@
#pragma once
#include <stdint.h>
#include <irq.hpp>
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);
};