-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 0eaa91f
Showing
50 changed files
with
23,902 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# _____ ___ ____ ___ ____ | ||
# ____| | ____| | | |____| | ||
# | ___| |____ ___| ____| | \ PS2DEV Open Source Project. | ||
#----------------------------------------------------------------------- | ||
# (c) 2020 Francisco Javier Trujillo Mata <[email protected]> | ||
# Licenced under Academic Free License version 2.0 | ||
# Review ps2sdk README & LICENSE files for further details. | ||
|
||
### Adjust these three, for PS2Link compatibility tests | ||
### Old LaunchELF used LA=0x90000, SA=0xB0000, SS=0x08000 | ||
LOADADDR = 0x90000 | ||
STACKADDR = 0xA8000 | ||
STACKSIZE = 0x04000 | ||
|
||
ifeq ($(DEBUG),1) | ||
LOADADDR = 0x1700000 | ||
STACKADDR = 0x1720000 | ||
STACKSIZE = 0x08000 | ||
endif | ||
|
||
LDPARAMS := -Wl,--defsym -Wl,_stack_size=$(STACKSIZE) -Wl,--defsym -Wl,_stack=$(STACKADDR) | ||
|
||
EE_LDFLAGS += -Wl,-Ttext -Wl,$(LOADADDR) -s $(LDPARAMS) | ||
|
||
EE_BIN = loader.elf | ||
|
||
EE_OBJS = loader.o | ||
|
||
EE_LIBS = | ||
ifeq ($(DEBUG),1) | ||
EE_LIBS += -ldebug | ||
endif | ||
|
||
all: $(EE_BIN) | ||
|
||
clean: | ||
rm -f -r $(EE_OBJS) $(EE_BIN) | ||
|
||
include $(PS2SDKSRC)/Defs.make | ||
include Rules.make |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
# _____ ___ ____ ___ ____ | ||
# ____| | ____| | | |____| | ||
# | ___| |____ ___| ____| | \ PS2DEV Open Source Project. | ||
#----------------------------------------------------------------------- | ||
# Copyright 2001-2004, ps2dev - http://www.ps2dev.org | ||
# Licenced under Academic Free License version 2.0 | ||
# Review ps2sdk README & LICENSE files for further details. | ||
|
||
EE_CC_VERSION := $(shell $(EE_CC) -dumpversion) | ||
|
||
EE_SRC_DIR ?= src/ | ||
EE_INC_DIR ?= include/ | ||
|
||
# Include directories | ||
EE_INCS := $(EE_INCS) -I$(EE_SRC_DIR) -I$(EE_SRC_DIR)include -I$(EE_INC_DIR) -I$(PS2SDKSRC)/ee/kernel/include -I$(PS2SDKSRC)/common/include -I$(PS2SDKSRC)/ee/libc/include -I$(PS2SDKSRC)/ee/erl/include | ||
|
||
# C compiler flags | ||
EE_CFLAGS := -D_EE -O2 -G0 -Wall -Werror $(EE_CFLAGS) | ||
|
||
# C++ compiler flags | ||
EE_CXXFLAGS := -D_EE -O2 -G0 -Wall -Werror $(EE_CXXFLAGS) | ||
|
||
# Linker flags | ||
EE_LDFLAGS := -L$(PS2SDK)/ee/lib -L$(PS2DEV)/ee/ee/lib $(EE_LDFLAGS) -lc -lkernel | ||
|
||
# Assembler flags | ||
EE_ASFLAGS := -G0 $(EE_ASFLAGS) | ||
|
||
# Externally defined variables: EE_BIN, EE_OBJS, EE_LIB | ||
|
||
# _____ ___ ____ ___ ____ | ||
# ____| | ____| | | |____| | ||
# | ___| |____ ___| ____| | \ PS2DEV Open Source Project. | ||
#----------------------------------------------------------------------- | ||
# (c) 2020 Francisco Javier Trujillo Mata <[email protected]> | ||
# Licenced under Academic Free License version 2.0 | ||
# Review ps2sdk README & LICENSE files for further details. | ||
|
||
# These macros can be used to simplify certain build rules. | ||
EE_C_COMPILE = $(EE_CC) $(EE_CFLAGS) $(EE_INCS) | ||
EE_CXX_COMPILE = $(EE_CXX) $(EE_CXXFLAGS) $(EE_INCS) | ||
|
||
%.o: %.c | ||
$(EE_CC) $(EE_CFLAGS) $(EE_INCS) -c $< -o $@ | ||
|
||
%.o: %.cc | ||
$(EE_CXX) $(EE_CXXFLAGS) $(EE_INCS) -c $< -o $@ | ||
|
||
%.o: %.cpp | ||
$(EE_CXX) $(EE_CXXFLAGS) $(EE_INCS) -c $< -o $@ | ||
|
||
%.o: %.S | ||
$(EE_CC) $(EE_CFLAGS) $(EE_INCS) -c $< -o $@ | ||
|
||
%.o: %.s | ||
$(EE_AS) $(EE_ASFLAGS) $< -o $@ | ||
|
||
$(EE_BIN): $(EE_OBJS) | ||
$(EE_CC) $(EE_CFLAGS) -o $(EE_BIN) $(EE_OBJS) $(EE_LDFLAGS) $(EE_LIBS) | ||
|
||
$(EE_ERL): $(EE_OBJS) | ||
$(EE_CC) -o $(EE_ERL) $(EE_OBJS) $(EE_CFLAGS) $(EE_LDFLAGS) -Wl,-r -Wl,-d | ||
$(EE_STRIP) --strip-unneeded -R .mdebug.eabi64 -R .reginfo -R .comment $(EE_ERL) | ||
|
||
$(EE_LIB): $(EE_OBJS) | ||
$(EE_AR) cru $(EE_LIB) $(EE_OBJS) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
/* | ||
# _____ ___ ____ ___ ____ | ||
# ____| | ____| | | |____| | ||
# | ___| |____ ___| ____| | \ PS2DEV Open Source Project. | ||
#----------------------------------------------------------------------- | ||
# (c) 2020 Francisco Javier Trujillo Mata <[email protected]> | ||
# Licenced under Academic Free License version 2.0 | ||
# Review ps2sdk README & LICENSE files for further details. | ||
*/ | ||
|
||
#include <kernel.h> | ||
#include <loadfile.h> | ||
#include <sifrpc.h> | ||
#include <errno.h> | ||
|
||
//-------------------------------------------------------------- | ||
//Start of function code: | ||
//-------------------------------------------------------------- | ||
// Clear user memory | ||
// PS2Link (C) 2003 Tord Lindstrom ([email protected]) | ||
// (C) 2003 adresd ([email protected]) | ||
//-------------------------------------------------------------- | ||
static void wipeUserMem(void) | ||
{ | ||
int i; | ||
for (i = 0x100000; i < GetMemorySize(); i += 64) { | ||
asm volatile( | ||
"\tsq $0, 0(%0) \n" | ||
"\tsq $0, 16(%0) \n" | ||
"\tsq $0, 32(%0) \n" | ||
"\tsq $0, 48(%0) \n" ::"r"(i)); | ||
} | ||
} | ||
|
||
//-------------------------------------------------------------- | ||
//End of func: void wipeUserMem(void) | ||
//-------------------------------------------------------------- | ||
// *** MAIN *** | ||
//-------------------------------------------------------------- | ||
int main(int argc, char *argv[]) | ||
{ | ||
static t_ExecData elfdata; | ||
int ret; | ||
|
||
if (argc < 1) { // arg1=path to ELF | ||
return -EINVAL; | ||
} | ||
|
||
// Initialize | ||
SifInitRpc(0); | ||
wipeUserMem(); | ||
|
||
//Writeback data cache before loading ELF. | ||
FlushCache(0); | ||
ret = SifLoadElf(argv[0], &elfdata); | ||
if (ret == 0) { | ||
SifExitRpc(); | ||
FlushCache(0); | ||
FlushCache(2); | ||
|
||
// Following the standard the first parameter of a argv is the executable itself | ||
return ExecPS2((void *)elfdata.epc, (void *)elfdata.gp, argc, argv); | ||
} else { | ||
SifExitRpc(); | ||
return -ENOENT; | ||
} | ||
} | ||
|
||
//-------------------------------------------------------------- | ||
//End of func: int main(int argc, char *argv[]) | ||
//-------------------------------------------------------------- | ||
//End of file: loader.c | ||
//-------------------------------------------------------------- |
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
SUBMAKE = $(MAKE) -C | ||
|
||
LOADADDR = 0x100000 | ||
EE_TARGET=mbr | ||
EE_BIN = $(EE_TARGET).elf | ||
EE_BIN_STRIPPED = $(EE_TARGET)-stripped.elf | ||
EE_BIN_RAW = $(EE_TARGET).bin | ||
EE_LZMA=lzma.a | ||
|
||
EE_OBJS= main.o lzma-stub.o payload.o | ||
|
||
|
||
EE_CFLAGS = -G0 -I $(PS2SDK)/ee/include -I $(PS2SDK)/common/include -I . -I common/lzma -D_EE -O3 -Wall -DDO_EXECPS2 | ||
EE_LDFLAGS = -L lzma -L $(PS2SDK)/ee/lib -Wl,--gc-sections -nostartfiles -Wl,-Ttext -Wl,$(LOADADDR) | ||
EE_LIBS = -lc -lkernel -lzma -ldebug | ||
|
||
|
||
|
||
all: $(EE_LZMA) $(EE_BIN_RAW) | ||
../kelftool/kelftool.elf encrypt mbr $(EE_BIN_RAW) ../../SoftDev2Installer/INSTALL/SYSTEM/MBR.XLF | ||
|
||
|
||
|
||
$(EE_BIN_STRIPPED): $(EE_BIN) | ||
$(EE_STRIP) -s -R .comment -R .gnu.version --strip-unneeded -o $@ $< | ||
|
||
|
||
|
||
|
||
$(EE_BIN_RAW): $(EE_BIN_STRIPPED) | ||
ee-objcopy -O binary -v $< $@ | ||
|
||
|
||
$(EE_LZMA): | ||
$(SUBMAKE) lzma | ||
|
||
|
||
payload.s: | ||
$(SUBMAKE) ../payload | ||
bin2s ../payload/payload.bin payload.s payload | ||
|
||
|
||
|
||
clean: | ||
rm -f *.o *.elf payload.s $(EE_TARGET).bin | ||
$(SUBMAKE) lzma clean | ||
$(SUBMAKE) ../payload clean | ||
|
||
|
||
|
||
|
||
|
||
|
||
include $(PS2SDK)/samples/Makefile.pref | ||
include $(PS2SDK)/samples/Makefile.eeglobal |
Oops, something went wrong.