From: root Date: Tue, 31 May 2016 05:49:26 +0000 (-0400) Subject: Remove external modules, due to broken-ness. Someday, someday... X-Git-Tag: stable-1~31 X-Git-Url: https://chaos.moe/g/?a=commitdiff_plain;h=8c81870c166b3972bc340a7da4e5c3f5919eb63f;p=corbenik%2Fcorbenik.git Remove external modules, due to broken-ness. Someday, someday... --- diff --git a/Makefile b/Makefile index 8c3d8ee..67a14d1 100644 --- a/Makefile +++ b/Makefile @@ -29,23 +29,17 @@ objects_cfw = $(patsubst $(dir_source)/%.s, $(dir_build)/%.o, \ $(call rwildcard, $(dir_source), *.s *.c))) .PHONY: all -all: a9lh modules external +all: a9lh external .PHONY: full full: host/langemu.conf all -.PHONY: modules -modules: - make -C modules - .PHONY: external external: make -C external .PHONY: a9lh a9lh: $(dir_out)/arm9loaderhax.bin - echo "Generating symbol table" - ./host/symtab.sh > modules/template/src/symtab.h .PHONY: reformat reformat: @@ -60,7 +54,6 @@ host/langemu.conf: .PHONY: clean clean: rm -f host/langemu.conf - make -C modules clean make -C external clean rm -rf $(dir_out) $(dir_build) diff --git a/copy.sh b/host/copy.sh old mode 100644 new mode 100755 similarity index 100% rename from copy.sh rename to host/copy.sh diff --git a/modules/Makefile b/modules/Makefile deleted file mode 100644 index 4a85dfd..0000000 --- a/modules/Makefile +++ /dev/null @@ -1,16 +0,0 @@ -.PHONY: all copyout -all: template - mkdir -p ../out/corbenik/bin - cp template/out/patch.vco ../out/corbenik/bin/example.vco - -.PHONY: clean -clean: clean_template - rm -rf ../out/corbenik/bin - -.PHONY: template -template: - make -C template - -.PHONY: clean_template -clean_template: - make -C template clean diff --git a/modules/README.txt b/modules/README.txt deleted file mode 100644 index 8ca7465..0000000 --- a/modules/README.txt +++ /dev/null @@ -1,44 +0,0 @@ -Corbenik patch binaries ----------------------------------- - -This directory contains the source for vco files - the patcher executables. - -You're probably wondering what the heck corbenik does differently from cakes, -considering it seems similar in many ways. - -Patches are actually code for whatever processor they're intended to run on, -be it ARM9 or ARM11. They're loaded to a static offset in memory, and executed -from there with relocations to corbenik's internal functions. This keeps patches -relatively small, and allows complete control over behavior. - -Patches should have a declaration of this sort somewhere in them: - { 0xc0, 0x9b, 0xe5, 0x1c } -Followed by a table large enough to fill with all usable functions. - -The loader is subject to change at any moment's notice; the ABI is not yet -stable. It may become an ELF loader at some point. I don't know. - -You may want to consult src/loader.c to see what functions are exported, or -simply base your code on the generic example in the 'template' folder instead. - -There's some key differences here, obviously, from running just arm9loader code. Namely: - - 1) Patches must not clobber the previous state. Meaning; start does nothing but - chain to main. - - 2) Patches must properly return, and also return a value. Return code 0 is - success; keep this in mind. Corbenik will attempt to reset after a non- - zero return code. If you don't know how to return; you're looking for - 'bx lr'. - - 3) Patches must have a symbol table with the appropriate magic. - No symbol table? No load. This might be relaxed in future versions - to allow patches to be marked static, but IDK. - - 4) Don't code a patch that does too fancy stuff. Patches are not intended to - be 65k binaries. Seriously. - - 5) _start must be at offset 0x24400000. This is where you are in memory. - -You can implement shit yourself, but it's an utter waste of memory. Try to use -the linker exports unless you have a good reason not to. diff --git a/modules/template/Makefile b/modules/template/Makefile deleted file mode 100644 index 6cebdc4..0000000 --- a/modules/template/Makefile +++ /dev/null @@ -1,60 +0,0 @@ -rwildcard = $(foreach d, $(wildcard $1*), $(filter $(subst *, %, $2), $d) $(call rwildcard, $d/, $2)) - -PATH := $(PATH):$(DEVKITARM)/bin - -HOST_CC := gcc - -CC := arm-none-eabi-gcc -AS := arm-none-eabi-as -LD := arm-none-eabi-ld -OC := arm-none-eabi-objcopy - -dir_source := src -dir_build := build -dir_out := out - -ASFLAGS := -mlittle-endian -mcpu=arm946e-s -march=armv5te -CFLAGS := -MMD -MP -Wall -Wextra -Werror -Os -fno-omit-frame-pointer $(ASFLAGS) -fno-builtin -std=c11 -FLAGS := dir_out=$(abspath $(dir_out)) --no-print-directory -LDFLAGS := -nostdlib -Wl,-z,defs -lgcc - -objects_cfw = $(patsubst $(dir_source)/%.s, $(dir_build)/%.o, \ - $(patsubst $(dir_source)/%.c, $(dir_build)/%.o, \ - $(call rwildcard, $(dir_source), *.s *.c))) - -.PHONY: all -all: patchbin - -.PHONY: patchbin -patchbin: tool $(dir_out)/patch.bin - ./compile_header - -.PHONY: tool -tool: - $(HOST_CC) -o compile_header ../../host/compile_header.c - - -.PHONY: clean -clean: - rm -rf $(dir_out) $(dir_build) compile_header - -.PHONY: $(dir_out)/patch.bin -$(dir_out)/patch.bin: $(dir_build)/main.bin - @mkdir -p "$(dir_out)" - @cp -av $< $@ - -$(dir_build)/main.bin: $(dir_build)/main.elf - $(OC) -S -O binary $< $@ - -$(dir_build)/main.elf: $(objects_cfw) - $(CC) -T linker.ld $(OUTPUT_OPTION) $^ $(LDFLAGS) - -$(dir_build)/%.o: $(dir_source)/%.c - @mkdir -p "$(@D)" - $(COMPILE.c) $(OUTPUT_OPTION) $< - -$(dir_build)/%.o: $(dir_source)/%.s - @mkdir -p "$(@D)" - $(COMPILE.s) $(OUTPUT_OPTION) $< - -include $(call rwildcard, $(dir_build), *.d) diff --git a/modules/template/linker.ld b/modules/template/linker.ld deleted file mode 100644 index b8eb07e..0000000 --- a/modules/template/linker.ld +++ /dev/null @@ -1,37 +0,0 @@ -ENTRY(main) -SECTIONS -{ - . = 0x24400000; - - START_SECTION = .; - .text.start : { - *(.text.start) - } - START_SECTION_END = .; - - TEXT_SECTION = .; - .text : { - *(.text) - } - TEXT_SECTION_END = .; - - DATA_SECTION = .; - .data : { - *(.data) - } - DATA_SECTION_END = .; - - BSS_SECTION = .; - .bss : { - *(.bss COMMON) - } - BSS_SECTION_END = .; - - RODATA_SECTION = .; - .rodata : { - *(.rodata) - } - RODATA_SECTION_END = .; - - . = ALIGN(4); -} diff --git a/modules/template/meta/cfw_version b/modules/template/meta/cfw_version deleted file mode 100644 index 573541a..0000000 --- a/modules/template/meta/cfw_version +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/modules/template/meta/deps b/modules/template/meta/deps deleted file mode 100644 index b0047fa..0000000 --- a/modules/template/meta/deps +++ /dev/null @@ -1 +0,0 @@ -None diff --git a/modules/template/meta/desc b/modules/template/meta/desc deleted file mode 100644 index adf29f1..0000000 --- a/modules/template/meta/desc +++ /dev/null @@ -1 +0,0 @@ -Prints "Hello World!" diff --git a/modules/template/meta/name b/modules/template/meta/name deleted file mode 100644 index e3dac2c..0000000 --- a/modules/template/meta/name +++ /dev/null @@ -1 +0,0 @@ -Example Patch diff --git a/modules/template/meta/patch_version b/modules/template/meta/patch_version deleted file mode 100644 index d00491f..0000000 --- a/modules/template/meta/patch_version +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/modules/template/meta/title b/modules/template/meta/title deleted file mode 100644 index 8380236..0000000 --- a/modules/template/meta/title +++ /dev/null @@ -1 +0,0 @@ -Native diff --git a/modules/template/meta/uuid b/modules/template/meta/uuid deleted file mode 100644 index d00491f..0000000 --- a/modules/template/meta/uuid +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/modules/template/src/exported.h b/modules/template/src/exported.h deleted file mode 100644 index 13e6f3a..0000000 --- a/modules/template/src/exported.h +++ /dev/null @@ -1,30 +0,0 @@ -#ifndef EXPORTED_H -#define EXPORTED_H - -#include "symtab.h" - -#include "headers.h" - -#define stdout ((void*)0) -#define stderr ((void*)2) - -int (*strlen)(const char *string) = strlen_offset; -int (*isprint)(char c) = isprint_offset; -void (*memcpy)(void *dest, const void *src, size_t size) = memcpy_offset; -void (*memmove)(void *dest, const void *src, size_t size) = memmove_offset; -void (*memset)(void *dest, const int filler, size_t size) = memset_offset; -int (*memcmp)(const void *buf1, const void *buf2, const size_t size) = memcmp_offset; -void (*strncpy)(void *dest, const void *src, const size_t size) = strncpy_offset; -int (*strncmp)(const void *buf1, const void *buf2, const size_t size) = strncmp_offset; -int (*atoi)(const char *str) = atoi_offset; -uint8_t* (*memfind)(uint8_t *string, uint32_t stringlen, uint8_t *pat, uint32_t patlen) = memfind_offset; - -void (*putc)(void* buf, const int c) = putc_offset; -void (*puts)(void* buf, const char *string) = puts_offset; -void (*fprintf)(void* channel, const char* format, ...) = fprintf_offset; - -exefs_h* (*get_firm_proc9_exefs)() = get_firm_proc9_exefs_offset; -exefs_h* (*get_agb_proc9_exefs)() = get_agb_proc9_exefs_offset; -exefs_h* (*get_twl_proc9_exefs)() = get_twl_proc9_exefs_offset; - -#endif diff --git a/modules/template/src/headers.h b/modules/template/src/headers.h deleted file mode 120000 index 0214d8a..0000000 --- a/modules/template/src/headers.h +++ /dev/null @@ -1 +0,0 @@ -../../../source/firm/headers.h \ No newline at end of file diff --git a/modules/template/src/main.c b/modules/template/src/main.c deleted file mode 100644 index 75ec056..0000000 --- a/modules/template/src/main.c +++ /dev/null @@ -1,9 +0,0 @@ -#include -#include -#include "exported.h" - -int main() { - fprintf(stderr, "Hi!\n"); - - return 0; -} diff --git a/source/firm/fcram.h b/source/firm/fcram.h index 783326d..5bd78ef 100644 --- a/source/firm/fcram.h +++ b/source/firm/fcram.h @@ -17,13 +17,18 @@ extern void* fcram_temp; #define FCRAM_START 0x24000000 // firm.c +// 24 #define FCRAM_FIRM_LOC FCRAM_START +// 241 #define FCRAM_TWL_FIRM_LOC (FCRAM_START + FCRAM_SPACING) // Double size +// 242 #define FCRAM_AGB_FIRM_LOC (FCRAM_START + FCRAM_SPACING * 3) +// 243 // patch.c #define FCRAM_PATCHBIN_EXEC_LOC (FCRAM_START + FCRAM_SPACING * 4) +// 244 // Throwaway temporary space. Don't expect it to stay sane. #define FCRAM_JUNK_LOCATION (FCRAM_START + FCRAM_SPACING * 5) diff --git a/source/patcher.c b/source/patcher.c index 713500f..f33151a 100644 --- a/source/patcher.c +++ b/source/patcher.c @@ -31,11 +31,6 @@ wait() int patch_firm_all() { - // FIXME - Linker is bork at the moment. - execp(PATH_PATCHES "/example.vco"); - - // wait(); - // Use builtin signature patcher? if (config.options[OPTION_SIGPATCH]) {