/* ********************************************************************** *\
 *         Copyright IBM Corporation 1988,1991 - All Rights Reserved      *
 *        For full copyright information see:'andrew/config/COPYRITE'     *
\* ********************************************************************** */

/*
	$Disclaimer: 
* Permission to use, copy, modify, and distribute this software and its 
* documentation for any purpose is hereby granted without fee, 
* provided that the above copyright notice appear in all copies and that 
* both that copyright notice, this permission notice, and the following 
* disclaimer appear in supporting documentation, and that the names of 
* IBM, Carnegie Mellon University, and other copyright holders, not be 
* used in advertising or publicity pertaining to distribution of the software 
* without specific, written prior permission.
* 
* IBM, CARNEGIE MELLON UNIVERSITY, AND THE OTHER COPYRIGHT HOLDERS 
* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING 
* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.  IN NO EVENT 
* SHALL IBM, CARNEGIE MELLON UNIVERSITY, OR ANY OTHER COPYRIGHT HOLDER 
* BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY 
* DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, 
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS 
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
* OF THIS SOFTWARE.
*  $
*/


	.globl	_class_Lookup
	.data
	.globl	_class_ErrorReturnValue
	.text

#include <sun4/asm_linkage.h>

L000:
	save	%sp,-SA(MINFRAME),%sp	! buy a stack frame
	sll	%g1, 2, %l0		! save the class entry index
! Do we really need the following instruction???
	mov	%g1, %o1		! index is second paramater(???)
	call	_class_Lookup		! call class_Lookup ...
	mov	%i0, %o0		! ... copying first parameter

	tst	%o0			! test return value
	bnz,a	L001			! if zero, error
	ld	[%o0 + %l0], %g1	! if not, get address of function

	sethi	%hi(_class_ErrorReturnValue), %l0
	ld	[%lo(_class_ErrorReturnValue) + %l0], %l0
	ret				! so return with error code
	restore	%l0, %g0, %o0

L001:
	jmp	%g1			! go there and
	restore				! pop the stack frame

#ifdef __STDC__
#define ClassEntry(n) \
	.globl	_ClassEntry ## n ;\
_ClassEntry ## n: ;\
	ba	L000 ;\
	mov	n,%g1
#else
#define ClassEntry(n) \
	.globl	_ClassEntry/**/n ;\
_ClassEntry/**/n: ;\
	ba	L000 ;\
	mov	n,%g1
#endif

#include <../common/entrydefs.h>
