Did some more testing stuff
This commit is contained in:
parent
f90c6420eb
commit
02c2b586b7
13 changed files with 162 additions and 9 deletions
BIN
.do.sh.kate-swp
BIN
.do.sh.kate-swp
Binary file not shown.
|
@ -22,7 +22,7 @@ struct FIRM_header {
|
|||
char magic[4]; //! Magic "FIRM" string (not-null terminated)
|
||||
int version; //! Version. Currently 1
|
||||
void(*entrypoint)(void**); //! Address where the processor jumps to after loading
|
||||
void * arm11entry;
|
||||
void (*arm11entry)(void**);
|
||||
unsigned int reserved[0xC];
|
||||
struct FIRM_sect sections[4]; //! The four internal sections
|
||||
unsigned char RSA2048[0x100]; //! Currently unused
|
||||
|
@ -38,6 +38,8 @@ void init() {
|
|||
FATFS fs;
|
||||
FIL firm;
|
||||
f_mount(&fs, "0:", 0);
|
||||
arm9modtable[0]=0;
|
||||
arm11modtable[0]=0;
|
||||
if(f_open(&firm, "mtgos.firm", FA_READ | FA_OPEN_EXISTING) == FR_OK) {
|
||||
DIAGPXL(1);
|
||||
unsigned int br;
|
||||
|
@ -50,16 +52,17 @@ void init() {
|
|||
if(hdr.sections[i].size==0)
|
||||
continue;
|
||||
f_lseek(&firm, hdr.sections[i].offset);
|
||||
char oldval=*((char*)hdr.sections[i].physical);
|
||||
*((char*)hdr.sections[i].physical)=0xFF;
|
||||
char oldval=0xFF;
|
||||
f_read(&firm, (void*)hdr.sections[i].physical, hdr.sections[i].size, &br);
|
||||
if(oldval!=*((char*)hdr.sections[i].physical))
|
||||
DIAGPXL(i+4);
|
||||
DIAGPXL(i+8);
|
||||
}
|
||||
DIAGPXL(12);
|
||||
void(**a11fpointer)(void**)=(void(**)(void**))0x1FFFFFF8;
|
||||
*a11fpointer=hdr.arm11entry;
|
||||
hdr.entrypoint(0); //Jump to kernel
|
||||
}
|
||||
DIAGPXL(13);
|
||||
arm9modtable[0]=0;
|
||||
arm11modtable[0]=0;
|
||||
for(;;);
|
||||
}
|
2
do.sh
2
do.sh
|
@ -7,7 +7,7 @@ mv kernel/mtgos.elf .
|
|||
objcopy -O binary mtgos.elf mtgos.bin
|
||||
gmake -C kernel subvar=11
|
||||
objcopy -O binary kernel/mtgos.elf kernel/mtgos.bin
|
||||
firmlink -O 8000000 -O 1FF80000 -E $(nm mtgos.elf | egrep ' _start$' | awk '{print $1}') -e $(nm kernel/mtgos.elf | egrep ' _start$' | awk '{print $1}') -o mtgos.firm mtgos.bin kernel/mtgos.bin
|
||||
firmlink -O 08000000 -O 1FF80000 -E $(nm mtgos.elf | egrep ' _start$' | awk '{print $1}') -e $(nm kernel/mtgos.elf | egrep ' _start$' | awk '{print $1}') -o mtgos.firm mtgos.bin kernel/mtgos.bin
|
||||
rm mtgos.bin kernel/mtgos.*
|
||||
sudo mount_msdosfs /dev/da3s1 mount
|
||||
sudo rm mount/{arm9loaderhax.bin,mtgos.firm}
|
||||
|
|
1
firmlink
1
firmlink
|
@ -1,4 +1,3 @@
|
|||
#!/usr/bin/env bash
|
||||
echo Entry point: $(nm mtgos.elf | egrep ' _start$' | awk '{print $1}')
|
||||
firmlink -O 200000 -E $(nm mtgos.elf | egrep ' _start$' | awk '{print $1}') -o $1.firm $1.bin
|
||||
firmlink -O 1FF80000 -E $(nm mtgos.elf | egrep ' _start$' | awk '{print $1}') -o 3ds-$1.firm $1.bin
|
|
@ -8,7 +8,7 @@ LD = $(PREFIX)g++
|
|||
|
||||
CFLAGS += -Wall -fno-stack-protector -nostdinc -Ic_include/ -I../c_include -ffreestanding -std=c11 -fno-builtin -Werror -nostdlib -g -fpie
|
||||
CPPFLAGS += -Wall -fno-stack-protector -nostdinc -std=c++14 -Iinclude/ -Ic_include/ -I../c_include -I../include -fno-rtti -fno-exceptions -ffreestanding -fno-builtin -Werror -nostdlib -fno-use-cxa-atexit -Wextra -Wno-unused -g -fno-pie -Wno-reorder -fdump-class-hierarchy
|
||||
LDFLAGS += -nostdlib -nodefaultlibs -nostdlib -fno-builtin -T loader.ld
|
||||
LDFLAGS += -nostdlib -nodefaultlibs -nostdlib -fno-builtin -T loader-$(arch)-$(subvar).ld
|
||||
all: $(OBJS)
|
||||
$(LD) $(LDFLAGS) -o mtgos.elf $(OBJS) -lgcc
|
||||
%.o: %.cpp
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
#define Elf_Ehdr Elf32_Ehdr
|
||||
#define Elf_Phdr Elf32_Phdr
|
||||
#endif
|
||||
char *lfb=(char*)0x18300000;
|
||||
#define DIAGPXL(i) (lfb[6*(i)]=lfb[6*(i)+1]=lfb[6*(i)+2]=0xFF)
|
||||
/** \brief beginning of constructor table */
|
||||
extern "C" void(*start_ctors)();
|
||||
/** \brief end of constructor table */
|
||||
|
@ -44,6 +46,7 @@ MTGos::Base::Output out;
|
|||
* \brief Initializes the kernel
|
||||
*/
|
||||
extern "C" void _start(void ** modtable) {
|
||||
DIAGPXL(13);
|
||||
//for(void(**i)()=&start_ctors;i<&end_ctors;i++)
|
||||
// (*i)(); //Calling constructors
|
||||
for(int i=0;i<1024;i++) {
|
||||
|
|
28
kernel/loader-3ds-11.ld
Normal file
28
kernel/loader-3ds-11.ld
Normal file
|
@ -0,0 +1,28 @@
|
|||
ENTRY(_start)
|
||||
SECTIONS
|
||||
{
|
||||
. = 0x1FF80000;
|
||||
kernel_start = .;
|
||||
.text : {
|
||||
*(.text)
|
||||
}
|
||||
.data : {
|
||||
start_ctors = .;
|
||||
KEEP(*( .init_array ));
|
||||
KEEP(*(SORT_BY_INIT_PRIORITY( .init_array.* )));
|
||||
*(.ctors)
|
||||
end_ctors = .;
|
||||
start_dtors = .;
|
||||
*(.dtors)
|
||||
end_dtors = .;
|
||||
*(.data)
|
||||
}
|
||||
.rodata : {
|
||||
*(.rodata)
|
||||
}
|
||||
.bss : {
|
||||
*(.bss)
|
||||
*(COMMON)
|
||||
}
|
||||
kernel_end = .;
|
||||
}
|
28
kernel/loader-3ds-9.ld
Normal file
28
kernel/loader-3ds-9.ld
Normal file
|
@ -0,0 +1,28 @@
|
|||
ENTRY(_start)
|
||||
SECTIONS
|
||||
{
|
||||
. = 0x08000000;
|
||||
kernel_start = .;
|
||||
.text : {
|
||||
*(.text)
|
||||
}
|
||||
.data : {
|
||||
start_ctors = .;
|
||||
KEEP(*( .init_array ));
|
||||
KEEP(*(SORT_BY_INIT_PRIORITY( .init_array.* )));
|
||||
*(.ctors)
|
||||
end_ctors = .;
|
||||
start_dtors = .;
|
||||
*(.dtors)
|
||||
end_dtors = .;
|
||||
*(.data)
|
||||
}
|
||||
.rodata : {
|
||||
*(.rodata)
|
||||
}
|
||||
.bss : {
|
||||
*(.bss)
|
||||
*(COMMON)
|
||||
}
|
||||
kernel_end = .;
|
||||
}
|
28
kernel/loader-x86-9.ld
Normal file
28
kernel/loader-x86-9.ld
Normal file
|
@ -0,0 +1,28 @@
|
|||
ENTRY(_start)
|
||||
SECTIONS
|
||||
{
|
||||
. = 0x200000;
|
||||
kernel_start = .;
|
||||
.text : {
|
||||
*(.text)
|
||||
}
|
||||
.data : {
|
||||
start_ctors = .;
|
||||
KEEP(*( .init_array ));
|
||||
KEEP(*(SORT_BY_INIT_PRIORITY( .init_array.* )));
|
||||
*(.ctors)
|
||||
end_ctors = .;
|
||||
start_dtors = .;
|
||||
*(.dtors)
|
||||
end_dtors = .;
|
||||
*(.data)
|
||||
}
|
||||
.rodata : {
|
||||
*(.rodata)
|
||||
}
|
||||
.bss : {
|
||||
*(.bss)
|
||||
*(COMMON)
|
||||
}
|
||||
kernel_end = .;
|
||||
}
|
28
kernel/loader-x86_64-9.ld
Normal file
28
kernel/loader-x86_64-9.ld
Normal file
|
@ -0,0 +1,28 @@
|
|||
ENTRY(_start)
|
||||
SECTIONS
|
||||
{
|
||||
. = 0x200000;
|
||||
kernel_start = .;
|
||||
.text : {
|
||||
*(.text)
|
||||
}
|
||||
.data : {
|
||||
start_ctors = .;
|
||||
KEEP(*( .init_array ));
|
||||
KEEP(*(SORT_BY_INIT_PRIORITY( .init_array.* )));
|
||||
*(.ctors)
|
||||
end_ctors = .;
|
||||
start_dtors = .;
|
||||
*(.dtors)
|
||||
end_dtors = .;
|
||||
*(.data)
|
||||
}
|
||||
.rodata : {
|
||||
*(.rodata)
|
||||
}
|
||||
.bss : {
|
||||
*(.bss)
|
||||
*(COMMON)
|
||||
}
|
||||
kernel_end = .;
|
||||
}
|
5
modules/3ds/Makefile
Normal file
5
modules/3ds/Makefile
Normal file
|
@ -0,0 +1,5 @@
|
|||
SUBDIRS = dsp
|
||||
all:
|
||||
for dir in $(SUBDIRS); do \
|
||||
$(MAKE) -C $$dir; \
|
||||
done
|
5
modules/3ds/dsp/Makefile
Normal file
5
modules/3ds/dsp/Makefile
Normal file
|
@ -0,0 +1,5 @@
|
|||
SUBDIRS = txt
|
||||
all:
|
||||
for dir in $(SUBDIRS); do \
|
||||
$(MAKE) -C $$dir; \
|
||||
done
|
26
modules/3ds/link.ld
Normal file
26
modules/3ds/link.ld
Normal file
|
@ -0,0 +1,26 @@
|
|||
ENTRY(getTable)
|
||||
OUTPUT_FORMAT(elf32-littlearm)
|
||||
OUTPUT_ARCH(arm)
|
||||
SECTIONS
|
||||
{
|
||||
. = 0x20000000;
|
||||
module_start = .;
|
||||
.text : {
|
||||
*(.text)
|
||||
*(.text.*)
|
||||
start_ctors = .;
|
||||
KEEP(*( .init_array ));
|
||||
KEEP(*(SORT_BY_INIT_PRIORITY( .init_array.* )));
|
||||
*(.ctors)
|
||||
end_ctors = .;
|
||||
start_dtors = .;
|
||||
*(.dtors)
|
||||
end_dtors = .;
|
||||
*(.data)
|
||||
*(.data.*)
|
||||
*(.rodata)
|
||||
*(.bss)
|
||||
*(COMMON)
|
||||
}
|
||||
module_end = .;
|
||||
}
|
Loading…
Reference in a new issue