[PATCH 5/16] hypervisor functions for Celleb

Arnd Bergmann arnd at arndb.de
Sat Nov 18 20:08:53 EST 2006


On Friday 17 November 2006 06:21, Anton Blanchard wrote:
> > Just make another one (or a set of them like the phyp calls) and  
> > define then in assembly.
> > Certainly a bl to a function will be negligible to the hcall its self.
> 
> Agreed. And I thought the phyp hcall code was ugly :)
> 
> Any ideas why its so different? Just NIH?
> 
Yeah, mostly that. The hcall functions were developed separately in
each company, and the Sony/Toshiba calling conventions seem to be
too different from the phyp ones to easily adapt those, at least
the version before your latest cleanup.

I wonder if we now should just do something as simple as the code
below.

---------------

#define PS3_HCALL_BUFSIZE 6
#define BEAT_HCALL_BUFSIZE 6
long ps3_hcall(unsigned long opcode, unsigned long *retbuf, ...);
long beat_hcall(unsigned long opcode, unsigned long *retbuf, ...);

----------------

_GLOBAL(beat_hcall)
_GLOBAL(ps3_hcall)
	HMT_MEDIUM

	mfcr	r0
	stw	r0,8(r1)

	HCALL_INST_PRECALL

	std     r4,STK_PARM(r4)(r1)     /* Save ret buffer */

	mr	r11,r3
	mr	r3,r5
	mr	r4,r6
	mr	r5,r7
	mr	r6,r8
	mr	r7,r9
	mr	r8,r10
	ld	r9,STK_PARM(r11)(r1)	 /* put arg7 in r9 */

	HVSC				/* invoke the hypervisor */

	ld	r12,STK_PARM(r4)(r1)
	std	r4,   0(r12)
	std	r5,   8(r12)
	std	r6,  16(r12)
	std	r7,  24(r12)
	std	r8,  32(r12)
	std	r9,  40(r12)

	HCALL_INST_POSTCALL

	lwz	r0,8(r1)
	mtcrf	0xff,r0

	blr				/* return r3 = status */

_





More information about the Linuxppc-dev mailing list