Skip to content

Commit

Permalink
clang-format
Browse files Browse the repository at this point in the history
  • Loading branch information
AKuHAK committed Mar 21, 2022
1 parent 7ae6951 commit b6cfac0
Show file tree
Hide file tree
Showing 34 changed files with 4,380 additions and 4,297 deletions.
136 changes: 68 additions & 68 deletions kpatch/README.txt
Original file line number Diff line number Diff line change
@@ -1,68 +1,68 @@
OSDSYS patch for ROM v1.0x - 2018/01/29
--------------------------------------------
This package contains the source code for clones of the OSDSYS patches, meant for ROM v1.00 and v1.01.
As with the OSD update files, these files were meant to be encapsulated as KELFs. But I will not cover that here.
The first PlayStation 2 consoles (SCPH-10000 & SCPH-15000) had a considerably different boot ROM from the expansion-bay consoles.
Other than having the earliest-possible IOP and EE kernels, their OSDSYS programs were coded rather differently and had a design flaw that prevented arguments from being passed to memory-card updates.
These are the original update files and their descriptions:
Model ROM Update File Description
SCPH-10000 0100JC20000117 osdsys.elf OSDSYS patch (patch0100).
SCPH-10000/SCPH-15000 0101JC20000217 osd110.elf System Driver Update + OSDSYS patch (patch0101).
SCPH-18000 0120JC20001027 osd130.elf System Driver Update + OSDSYS patch (patch0101). Exactly the same in content as osd110.elf.
The OSDSYS patch will copy a ROM image that contains a replacement EELOAD program, into kernel memory (0x80030000).
It will then patch the EE kernel to scan 0x80030000-0x80040000 for the EELOAD, instead of the boot ROM.
The System Driver Update attempts to boot the HDD-based update from the HDD unit.
While the SCPH-18000 contained a modern ROM that did not have the same deficiencies as its predecessors,
it is incapable of supporting the CXD9566R PCMCIA controller of the SCPH-18000. As a result, it needed extra help to boot updates from the HDD unit.
osd110.elf and osd130.elf are the system driver update main executables, which also contain a patch that is similar to the code within osdsys.elf, which install a replacement EELOAD program that will replace rom0:EELOAD.
This patch targets OSDSYS from ROM v1.01J, and does nothing for other ROM versions.
As a result, its patches are also different from the ones that osdsys.elf applies (see below).
This EELOAD replacement will wait for a request that boots rom0:OSDSYS, before loading rom0:OSDSYS and applying a few fixes to it:
1. Patch the memory card update dispatcher to pass arguments.
2. patch0100 only: Overwrite the Japanese message (DVDプレーヤーが起動できませんでした。), which says that that the DVD Player could not be started.
3. patch0100 only: Replaces update filenames and commands.
Once the OSDSYS-patching code within EELOAD is run, its effects are binding until the console is hard-reset or powered off.
Modifications for FMCB, which this package has:
-----------------------------------------------
FMCB sits in for the system driver update. To save space, I made osd110.elf similar to osdsys.elf; instead of being a full system driver update, it will patch OSDSYS to boot osd130.elf.
The osdsys.elf patch was also made to boot osd130.elf directly, hence allowing only one copy of the system driver update to exist.
Official path of execution:
ROM v1.00J: osdsys.elf -> osd110.elf -> HDD update
ROM v1.01J: osd110.elf -> HDD update
ROM v1.20J: osd130.elf -> HDD update
New (unofficial) path of execution:
ROM v1.00J: osdsys.elf -> osd130.elf -> HDD update
ROM v1.01J: osd110.elf -> osd130.elf -> HDD update
ROM v1.20J: osd130.elf -> HDD update
Notes for compilation:
----------------------
These patches are split into two parts: The main program and an ROM image that contains EELOAD.
It is possible to build the patch without rebuilding EELOAD, by just entering "make".
The EELOAD module is a binary file, built to be loaded at 0x00082000. To build a ROM image, you need a tool (i.e. ROMIMG).
If you wish to rebuild EELOAD, you need to:
1. Build EELOAD, by entering "make" from within the EELOAD folder.
2. Convert it into a binary file. You can do that with ee-objdump.
3. Generate a new ROM image named 'EELOAD.img', that contains EELOAD.
4. Rebuild the patch.
Other trivia:
-------------
Within the comments of the ROM images, the EELOAD images are known as "eeload.rom".
Their original paths were as follows:
osdsys.elf: horikawa@phoenix/ee/src/kernel/patch0100/kpatch
osd110.elf: horikawa@phoenix/ee/src/kernel/patch0101/kpatch
OSDSYS patch for ROM v1.0x - 2018/01/29
--------------------------------------------

This package contains the source code for clones of the OSDSYS patches, meant for ROM v1.00 and v1.01.
As with the OSD update files, these files were meant to be encapsulated as KELFs. But I will not cover that here.

The first PlayStation 2 consoles (SCPH-10000 & SCPH-15000) had a considerably different boot ROM from the expansion-bay consoles.
Other than having the earliest-possible IOP and EE kernels, their OSDSYS programs were coded rather differently and had a design flaw that prevented arguments from being passed to memory-card updates.

These are the original update files and their descriptions:

Model ROM Update File Description
SCPH-10000 0100JC20000117 osdsys.elf OSDSYS patch (patch0100).
SCPH-10000/SCPH-15000 0101JC20000217 osd110.elf System Driver Update + OSDSYS patch (patch0101).
SCPH-18000 0120JC20001027 osd130.elf System Driver Update + OSDSYS patch (patch0101). Exactly the same in content as osd110.elf.

The OSDSYS patch will copy a ROM image that contains a replacement EELOAD program, into kernel memory (0x80030000).
It will then patch the EE kernel to scan 0x80030000-0x80040000 for the EELOAD, instead of the boot ROM.

The System Driver Update attempts to boot the HDD-based update from the HDD unit.
While the SCPH-18000 contained a modern ROM that did not have the same deficiencies as its predecessors,
it is incapable of supporting the CXD9566R PCMCIA controller of the SCPH-18000. As a result, it needed extra help to boot updates from the HDD unit.

osd110.elf and osd130.elf are the system driver update main executables, which also contain a patch that is similar to the code within osdsys.elf, which install a replacement EELOAD program that will replace rom0:EELOAD.
This patch targets OSDSYS from ROM v1.01J, and does nothing for other ROM versions.
As a result, its patches are also different from the ones that osdsys.elf applies (see below).

This EELOAD replacement will wait for a request that boots rom0:OSDSYS, before loading rom0:OSDSYS and applying a few fixes to it:
1. Patch the memory card update dispatcher to pass arguments.
2. patch0100 only: Overwrite the Japanese message (DVDプレーヤーが起動できませんでした。), which says that that the DVD Player could not be started.
3. patch0100 only: Replaces update filenames and commands.

Once the OSDSYS-patching code within EELOAD is run, its effects are binding until the console is hard-reset or powered off.

Modifications for FMCB, which this package has:
-----------------------------------------------
FMCB sits in for the system driver update. To save space, I made osd110.elf similar to osdsys.elf; instead of being a full system driver update, it will patch OSDSYS to boot osd130.elf.
The osdsys.elf patch was also made to boot osd130.elf directly, hence allowing only one copy of the system driver update to exist.

Official path of execution:
ROM v1.00J: osdsys.elf -> osd110.elf -> HDD update
ROM v1.01J: osd110.elf -> HDD update
ROM v1.20J: osd130.elf -> HDD update

New (unofficial) path of execution:
ROM v1.00J: osdsys.elf -> osd130.elf -> HDD update
ROM v1.01J: osd110.elf -> osd130.elf -> HDD update
ROM v1.20J: osd130.elf -> HDD update

Notes for compilation:
----------------------
These patches are split into two parts: The main program and an ROM image that contains EELOAD.
It is possible to build the patch without rebuilding EELOAD, by just entering "make".

The EELOAD module is a binary file, built to be loaded at 0x00082000. To build a ROM image, you need a tool (i.e. ROMIMG).
If you wish to rebuild EELOAD, you need to:
1. Build EELOAD, by entering "make" from within the EELOAD folder.
2. Convert it into a binary file. You can do that with ee-objdump.
3. Generate a new ROM image named 'EELOAD.img', that contains EELOAD.
4. Rebuild the patch.

Other trivia:
-------------
Within the comments of the ROM images, the EELOAD images are known as "eeload.rom".
Their original paths were as follows:
osdsys.elf: horikawa@phoenix/ee/src/kernel/patch0100/kpatch
osd110.elf: horikawa@phoenix/ee/src/kernel/patch0101/kpatch

220 changes: 110 additions & 110 deletions kpatch/linkfile-eeload
Original file line number Diff line number Diff line change
@@ -1,110 +1,110 @@
/*
# _____ ___ ____ ___ ____
# ____| | ____| | | |____|
# | ___| |____ ___| ____| | \ 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.
#
# $Id$
# Linkfile script for ee-ld
*/
ENTRY(_start);
SECTIONS {
.text 0x00082000: {
_ftext = . ;
*(.start)
*(.text)
*(.text.*)
*(.gnu.linkonce.t*)
KEEP(*(.init))
KEEP(*(.fini))
QUAD(0)
}
PROVIDE(_etext = .);
PROVIDE(etext = .);
.reginfo : { *(.reginfo) }
/* Global/static constructors and deconstructors. */
.ctors ALIGN(16): {
KEEP(*crtbegin*.o(.ctors))
KEEP(*(EXCLUDE_FILE(*crtend*.o) .ctors))
KEEP(*(SORT(.ctors.*)))
KEEP(*(.ctors))
}
.dtors ALIGN(16): {
KEEP(*crtbegin*.o(.dtors))
KEEP(*(EXCLUDE_FILE(*crtend*.o) .dtors))
KEEP(*(SORT(.dtors.*)))
KEEP(*(.dtors))
}
/* Static data. */
.rodata ALIGN(128): {
*(.rodata)
*(.rodata.*)
*(.gnu.linkonce.r*)
}
.data ALIGN(128): {
_fdata = . ;
*(.data)
*(.data.*)
*(.gnu.linkonce.d*)
SORT(CONSTRUCTORS)
}
.rdata ALIGN(128): { *(.rdata) }
.gcc_except_table ALIGN(128): { *(.gcc_except_table) }
_gp = ALIGN(128) + 0x7ff0;
.lit4 ALIGN(128): { *(.lit4) }
.lit8 ALIGN(128): { *(.lit8) }
.sdata ALIGN(128): {
*(.sdata)
*(.sdata.*)
*(.gnu.linkonce.s*)
}
_edata = .;
PROVIDE(edata = .);
/* Uninitialized data. */
.sbss ALIGN(128) : {
_fbss = . ;
*(.sbss)
*(.sbss.*)
*(.gnu.linkonce.sb*)
*(.scommon)
}
.bss ALIGN(128) : {
*(.bss)
*(.bss.*)
*(.gnu.linkonce.b*)
*(COMMON)
}
_end_bss = .;
/* Symbols needed by crt0.s. */
PROVIDE(_heap_size = 0x2000);
PROVIDE(_stack_size = 0x2000);
_stack = ALIGN(128);
PROVIDE(_stack = .);
. = _stack + _stack_size;
_end = .;
PROVIDE(end = .);
/* Unwanted stuff */
/DISCARD/ : {
* ( .MIPS.abiflags )
}
}
/*
# _____ ___ ____ ___ ____
# ____| | ____| | | |____|
# | ___| |____ ___| ____| | \ 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.
#
# $Id$
# Linkfile script for ee-ld
*/

ENTRY(_start);

SECTIONS {
.text 0x00082000: {
_ftext = . ;
*(.start)
*(.text)
*(.text.*)
*(.gnu.linkonce.t*)
KEEP(*(.init))
KEEP(*(.fini))
QUAD(0)
}

PROVIDE(_etext = .);
PROVIDE(etext = .);

.reginfo : { *(.reginfo) }

/* Global/static constructors and deconstructors. */
.ctors ALIGN(16): {
KEEP(*crtbegin*.o(.ctors))
KEEP(*(EXCLUDE_FILE(*crtend*.o) .ctors))
KEEP(*(SORT(.ctors.*)))
KEEP(*(.ctors))
}
.dtors ALIGN(16): {
KEEP(*crtbegin*.o(.dtors))
KEEP(*(EXCLUDE_FILE(*crtend*.o) .dtors))
KEEP(*(SORT(.dtors.*)))
KEEP(*(.dtors))
}

/* Static data. */
.rodata ALIGN(128): {
*(.rodata)
*(.rodata.*)
*(.gnu.linkonce.r*)
}

.data ALIGN(128): {
_fdata = . ;
*(.data)
*(.data.*)
*(.gnu.linkonce.d*)
SORT(CONSTRUCTORS)
}

.rdata ALIGN(128): { *(.rdata) }
.gcc_except_table ALIGN(128): { *(.gcc_except_table) }

_gp = ALIGN(128) + 0x7ff0;
.lit4 ALIGN(128): { *(.lit4) }
.lit8 ALIGN(128): { *(.lit8) }

.sdata ALIGN(128): {
*(.sdata)
*(.sdata.*)
*(.gnu.linkonce.s*)
}

_edata = .;
PROVIDE(edata = .);

/* Uninitialized data. */
.sbss ALIGN(128) : {
_fbss = . ;
*(.sbss)
*(.sbss.*)
*(.gnu.linkonce.sb*)
*(.scommon)
}

.bss ALIGN(128) : {
*(.bss)
*(.bss.*)
*(.gnu.linkonce.b*)
*(COMMON)
}
_end_bss = .;

/* Symbols needed by crt0.s. */
PROVIDE(_heap_size = 0x2000);
PROVIDE(_stack_size = 0x2000);

_stack = ALIGN(128);
PROVIDE(_stack = .);
. = _stack + _stack_size;

_end = .;
PROVIDE(end = .);

/* Unwanted stuff */
/DISCARD/ : {
* ( .MIPS.abiflags )
}
}
Loading

0 comments on commit b6cfac0

Please sign in to comment.