Resumen del libro "hacia el lenguaje"
The PS2 BIOS is a collection of files packed into a single file. A file called ROMDIR contains the name and size of each file in the archive. The first file in the archive is called RESET and contains …ver más…
It does this by modifying the import table and changing the j $31 to a j imm instruction where imm is the relative address of the exported function.
The LOADCORE code that actually does the linking is in fix_imports() and is shown below: int fix_imports(struct import *imp, struct export *exp){ func *ef; struct func_stub *fs; int count=0;
for (ef=exp->func; *ef; ef++){ count++; //count number of exported functions } for (fs=imp->func; fs->jr_ra; fs++) { int ordinal = fs->addiu0 & 0xFFFF; if (ordinal < count) { fs->jr_ra=(((u32)exp->func[ordinal]>>2) & 0x3FFFFFF) | INS_J; } else { fs->jr_ra=INS_JR_RA; } } imp->flags |=FLAG_IMPORT_QUEUED; return 0;
}
Module loading
The first 2 modules loaded are SYSMEM and LOADCORE. After these have been successfully loaded, the remaining modules are loaded in the order specified in iopload.c. The IRX dynamic linking mechanism is very simple and does not account for forward references, so this list must be carefully ordered. Details of the individual modules follow.
The Exception Manager (EXCEPMAN – version 1.1)
The exception manager is the 3rd module loaded and as the name suggests is responsible for managing the exception handling code. It does not actually implement any of the exception