as described in the module tutorial from Anissian every prx containt a module info
When i generate a S file from a helloworld c file i've got this
Code: Select all
.globl module_info
.section .rodata.sceModuleInfo,"a",@progbits
.align 4
.type module_info, @object
.size module_info, 52
module_info:
.half 0
.byte 1
.byte 1
.ascii "Hello world\000"
.space 15
.byte 0
.word _gp
.word __lib_ent_top
.word __lib_ent_bottom
.word __lib_stub_top
.word __lib_stub_bottom
.set push
.section .lib.ent.top, "a", @progbits
.align 2
.word 0
etc.....
is the name sceModuleInfo specific to the sdk or is it spectific to the psp prx loader
is the _gp sybmol related to this or is it another specific psp thing
Gp-Relative Addressing
A consequence of the way the MIPS instruction set is crammed into 32-bit
operations is that accesses to compiled-in locations usually require at least two
instructions, for example:
lw $2, addr => lui at, %hi(addr)
lw $2, %lo(addr)(at)
In programs that make a lot of use of global or static data, this can make the
compiled code significantly fatter and slower.
Early MIPS compilers introduced a fix for this, which has been carried into
most MIPS toolchains. It’s usually called gp-relative addressing. This technique
requires the cooperation of the compiler, assembler, linker, and start-up code to
pool all of the “small” variables and constants into a single memory region; then
it sets register $28 (known as the global pointer or gp register) to point to the
middle of this region. (The linker creates a special symbol, gp, whose address
is the middle of this region. The address of gpmust then be loaded into the gp
register by the start-up code, before any load or store instructions are used.) So
long as all the variables together take up no more than 64 KB of space, all the
data items are now within 32 KB of the midpoint, so a load turns into:
lw $2, addr => lw $2, addr - _gp(at)
The problem is that the compiler and assembler must decide which variables
can be accessed via gp at the time the individual modules are compiled.
The usual test is to include all objects of less than a certain size (eight bytes
is the usual default). This limit can usually be controlled by the “-G n” compiler/
assembler option; specifying “-G 0”will switch this optimization off altogether.
While it is a useful trick, there are some pitfalls to watch out for. You must
take special care when writing assembly code to declare global data items consistently
and correctly:
does someone have a working hello world in asm for a kernel 3.x
minifire is for kernel 1.x ou 1.5 only
if i want to use a sceKernelExitGame is this declaration correct ?
would the nid resolver patch (in memory )correctly a code declared with this 2 macros ?
IMPORT_START "LoadExecForKernel",0x00010000
IMPORT_FUNC "LoadExecForKernel",0x05572A5F,sceKernelExitGame
called with this
Code: Select all
jal sceKernelExitGame
nop