use external exception handler

This commit is contained in:
Dave Murphy 2017-09-21 21:29:19 +01:00
parent 2730d9b044
commit 7d23ac2345
5 changed files with 21 additions and 10 deletions

5
.gitmodules vendored
View File

@ -1,3 +1,8 @@
[submodule "bootloader"]
path = bootloader
url = git@github.com:devkitPro/nds-bootloader.git
branch = master
[submodule "nds-exception-stub"]
path = nds-exception-stub
url = git@github.com:devkitPro/nds-exception-stub.git
branch = master

View File

@ -78,7 +78,7 @@ CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
PNGFILES := $(foreach dir,$(GRAPHICS),$(notdir $(wildcard $(dir)/*.png)))
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
BINFILES := load.bin bootstub.bin
BINFILES := load.bin bootstub.bin exceptionstub.bin
#---------------------------------------------------------------------------------
# use CXX for linking C++ projects, CC for standard C
@ -114,9 +114,9 @@ else
endif
endif
.PHONY: bootloader bootstub BootStrap $(BUILD) clean
.PHONY: bootloader bootstub BootStrap exceptionstub $(BUILD) clean
all: bootloader bootstub $(BUILD) BootStrap
all: bootloader bootstub exceptionstub $(BUILD) BootStrap
dist: all
@rm -fr hbmenu
@ -146,6 +146,9 @@ data:
bootloader: data
@$(MAKE) -C bootloader LOADBIN=$(CURDIR)/data/load.bin
exceptionstub: data
@$(MAKE) -C nds-exception-stub STUBBIN=$(CURDIR)/data/exceptionstub.bin
bootstub: data
@$(MAKE) -C bootstub

1
nds-exception-stub Submodule

@ -0,0 +1 @@
Subproject commit ef5f397d1b844eaae4df3ac939010fef3d703386

View File

@ -51,12 +51,6 @@ char filePath[PATH_MAX];
int main(int argc, char **argv) {
//---------------------------------------------------------------------------------
// overwrite reboot stub identifier
extern u64 *fake_heap_end;
*fake_heap_end = 0;
defaultExceptionHandler();
int pathLen;
std::string filename;

View File

@ -31,6 +31,7 @@
#ifndef _NO_BOOTSTUB_
#include "bootstub_bin.h"
#include "exceptionstub_bin.h"
#endif
#include "nds_loader_arm9.h"
@ -403,6 +404,9 @@ dldiOffset:
dsiSD:
.word 0
*/
void(*exceptionstub)(void) = (void(*)(void))0x2ffa000;
bool installBootStub(bool havedsiSD) {
#ifndef _NO_BOOTSTUB_
extern char *fake_heap_end;
@ -424,7 +428,11 @@ bool installBootStub(bool havedsiSD) {
bootstub->arm9reboot = (VoidFn)(((u32)bootstub->arm9reboot)+fake_heap_end);
bootstub->arm7reboot = (VoidFn)(((u32)bootstub->arm7reboot)+fake_heap_end);
bootstub->bootsize = load_bin_size;
memcpy(exceptionstub,exceptionstub_bin,exceptionstub_bin_size);
exceptionstub();
DC_FlushAll();
return ret;