Fermer2
FarewellLe 11/07/2009 à 22:12
Je fais un saut d'un programme à une lib.

Le programme :
_main:	clr.l	-(%sp)			|push function & version
	bsr.s	Push			|push &libname on the stack, shorter than using lea
	.asciz	"pxclb"			|name of the lib
Push:	jsr	kernel__LibsExec	|exec the main part which has it's own routine to quit properly
	.long	kernel__Exec		|data needed, its adress is on the stack

Et la lib :
pxclb__0000:
	movea.l	(%sp)+,%a0				|&Data of the loader
	movea.l	(%sp)+,%a1				|return adress of the loader
	move.w	(%sp)+,%d3				|ARGC
	movea.l	(%sp),%a2				|ARGV

D'après moi, une fois arrivé à pxclb__0000, je devrais avoir :

(sp) == adresse du .long kernel__Exec
donc ((sp)) == kernel::exec et (-4(sp)) == kernel::LibsExec

Et pourtant, quand j'arrive à pxclib__0000, j'ai (sp) == $21AF9C, 4(sp) == $21B1E0.
Ca pointe donc dans la ROM, quelque part dans le linker probablement, vu que kernel::exec == $21B1A4 et kernel::LibsExec == $21AF3A

Alors que si je comprends bien la doc, c'est l'adresse de kernel::exec que je devrais trouver !
RamCalls.txt, PreOS.

35-kernel::LibsExec(char *lib_name, WORD function, BYTE version, ...) (Preos only)

The parameters are pushed on the stack.
It calls the function without modifying the registers, and it pops its argument
during the call (LIB_DESCRIPTOR, function, and version)
.


Où est-ce que je déconne ?