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

/* 
 * 
 * ******
 *
 * PLEASE NOTE:
 * 
 * This file is designed to be run through the C preprocessor before
 * being passed to the assembler.  
 * 
 * *****
 * 
 * This is the code that breaks a link to ClassEntry routines
 * and sets it to the set of routines given by the information
 * pointed to by the first parameter.  That structure contains the 
 * information needed to locate a module and verify that the module
 * is the correct version along with some other infomation about the
 * module.
 *
 * Each ClassEntry routine must provide a way to get an index indicating
 * which entry was called.  On the RT this is done by placing the index in
 * the static data block that is passed to the procedure in R0.  For other
 * machines this would be done by having each entry point set a register
 * to the index and then branching to the main body of this code.
 *
 * The main body of the code then does the following:
 * -- Calls the class_Lookup procedure passing in the structure
 *    pointed to by the first parameter.
 * -- class_Lookup returns the base address of the procedure table
 *    for the module.
 * -- Use the index provided by the ClassEntry to look up the routine.
 * -- Reset the stack to the state it was in before the call to this code.
 * -- Make any adjustments to the stack, registers, etc. to make the
 *    called routine think that it was called directly.
 * -- Branch (NOT a subroutine jump) to the real routine.  This may be
 *    done differently for some new machine.
 *
 * NOTE1: There are currently 150 entry points.  This was an arbitrary choice
 * and can be changed as appropriate.  If it is changed, definitions
 * in class.h must also be changed.
 */

/* 
 * Data section.  Only used here to get access to class_ErrorReturnValue.
 */
	.data
	.globl	_class_ErrorReturnValue	/* external used to get class_Lookup status */


/*
 * All the entry points come to this label.  When they get
 * here the stack is intact and EAX contains the index.
 */
	.text
	.globl _class_Lookup		/* used to dynamically load and bind code */
L000:

/*
 * While in this routine (after the first few instructions) the stack 
 * looks like this:
 * 
 * EBP + 0x28		parm...		<-- EBP points here at entry time
 * EBP + 0x24		parm4
 * EBP + 0x20		parm3
 * EBP + 0x1C		parm2
 * EBP + 0x08		parm1		(pointer to header)
 * EBP + 0x04		return address
 * EBP + 0x00		saved EBP	<-- EBP during execution
 * EBP - 0x04		passed parm	(passed index)
 * EBP - 0x08		passed parm	(pointer to header)
 * 
 */

	/* start of code...set up stack, etc. */
	pushl	%ebp
	movl	%esp, %ebp

	/* set up registers and call to class_Lookup */
	pushl	%eax			/* index */
	pushl	0x08(%ebp)		/* pointer to header */
	call	_class_Lookup

	/* back from class_Lookup */
	cmpl	$0, %eax		/* lookup failed? */
	je	ErrorExit		/* yes, return class_ErrorReturnValue */
				/* no, jump to the proper class routine */

	/* non-zero value from class_Lookup is base of proc table */
	movl	-0x04(%ebp), %edx	/* get back index */
	movl	(%eax, %edx, 4), %eax	/* get routine address in %eax using the funky addr modes */
	leave				/* fix up stack */
	jmp	*%eax			/* jump to the routine */

ErrorExit:
	/* return the value in class_ErrorReturnValue */
	movl	_class_ErrorReturnValue, %eax	/* get return value in correct place */
	leave				/* restore stack */
	ret				/* and return to caller */


/*
 * and now come the entry points.
 */
	.globl	_ClassEntry0
_ClassEntry0:
	movl	$0, %eax
	jmp	L000

	.globl	_ClassEntry1
_ClassEntry1:
	movl	$1, %eax
	jmp	L000

	.globl	_ClassEntry2
_ClassEntry2:
	movl	$2, %eax
	jmp	L000

	.globl	_ClassEntry3
_ClassEntry3:
	movl	$3, %eax
	jmp	L000

	.globl	_ClassEntry4
_ClassEntry4:
	movl	$4, %eax
	jmp	L000

	.globl	_ClassEntry5
_ClassEntry5:
	movl	$5, %eax
	jmp	L000

	.globl	_ClassEntry6
_ClassEntry6:
	movl	$6, %eax
	jmp	L000

	.globl	_ClassEntry7
_ClassEntry7:
	movl	$7, %eax
	jmp	L000

	.globl	_ClassEntry8
_ClassEntry8:
	movl	$8, %eax
	jmp	L000

	.globl	_ClassEntry9
_ClassEntry9:
	movl	$9, %eax
	jmp	L000

	.globl	_ClassEntry10
_ClassEntry10:
	movl	$10, %eax
	jmp	L000

	.globl	_ClassEntry11
_ClassEntry11:
	movl	$11, %eax
	jmp	L000

	.globl	_ClassEntry12
_ClassEntry12:
	movl	$12, %eax
	jmp	L000

	.globl	_ClassEntry13
_ClassEntry13:
	movl	$13, %eax
	jmp	L000

	.globl	_ClassEntry14
_ClassEntry14:
	movl	$14, %eax
	jmp	L000

	.globl	_ClassEntry15
_ClassEntry15:
	movl	$15, %eax
	jmp	L000

	.globl	_ClassEntry16
_ClassEntry16:
	movl	$16, %eax
	jmp	L000

	.globl	_ClassEntry17
_ClassEntry17:
	movl	$17, %eax
	jmp	L000

	.globl	_ClassEntry18
_ClassEntry18:
	movl	$18, %eax
	jmp	L000

	.globl	_ClassEntry19
_ClassEntry19:
	movl	$19, %eax
	jmp	L000

	.globl	_ClassEntry20
_ClassEntry20:
	movl	$20, %eax
	jmp	L000

	.globl	_ClassEntry21
_ClassEntry21:
	movl	$21, %eax
	jmp	L000

	.globl	_ClassEntry22
_ClassEntry22:
	movl	$22, %eax
	jmp	L000

	.globl	_ClassEntry23
_ClassEntry23:
	movl	$23, %eax
	jmp	L000

	.globl	_ClassEntry24
_ClassEntry24:
	movl	$24, %eax
	jmp	L000

	.globl	_ClassEntry25
_ClassEntry25:
	movl	$25, %eax
	jmp	L000

	.globl	_ClassEntry26
_ClassEntry26:
	movl	$26, %eax
	jmp	L000

	.globl	_ClassEntry27
_ClassEntry27:
	movl	$27, %eax
	jmp	L000

	.globl	_ClassEntry28
_ClassEntry28:
	movl	$28, %eax
	jmp	L000

	.globl	_ClassEntry29
_ClassEntry29:
	movl	$29, %eax
	jmp	L000

	.globl	_ClassEntry30
_ClassEntry30:
	movl	$30, %eax
	jmp	L000

	.globl	_ClassEntry31
_ClassEntry31:
	movl	$31, %eax
	jmp	L000

	.globl	_ClassEntry32
_ClassEntry32:
	movl	$32, %eax
	jmp	L000

	.globl	_ClassEntry33
_ClassEntry33:
	movl	$33, %eax
	jmp	L000

	.globl	_ClassEntry34
_ClassEntry34:
	movl	$34, %eax
	jmp	L000

	.globl	_ClassEntry35
_ClassEntry35:
	movl	$35, %eax
	jmp	L000

	.globl	_ClassEntry36
_ClassEntry36:
	movl	$36, %eax
	jmp	L000

	.globl	_ClassEntry37
_ClassEntry37:
	movl	$37, %eax
	jmp	L000

	.globl	_ClassEntry38
_ClassEntry38:
	movl	$38, %eax
	jmp	L000

	.globl	_ClassEntry39
_ClassEntry39:
	movl	$39, %eax
	jmp	L000

	.globl	_ClassEntry40
_ClassEntry40:
	movl	$40, %eax
	jmp	L000

	.globl	_ClassEntry41
_ClassEntry41:
	movl	$41, %eax
	jmp	L000

	.globl	_ClassEntry42
_ClassEntry42:
	movl	$42, %eax
	jmp	L000

	.globl	_ClassEntry43
_ClassEntry43:
	movl	$43, %eax
	jmp	L000

	.globl	_ClassEntry44
_ClassEntry44:
	movl	$44, %eax
	jmp	L000

	.globl	_ClassEntry45
_ClassEntry45:
	movl	$45, %eax
	jmp	L000

	.globl	_ClassEntry46
_ClassEntry46:
	movl	$46, %eax
	jmp	L000

	.globl	_ClassEntry47
_ClassEntry47:
	movl	$47, %eax
	jmp	L000

	.globl	_ClassEntry48
_ClassEntry48:
	movl	$48, %eax
	jmp	L000

	.globl	_ClassEntry49
_ClassEntry49:
	movl	$49, %eax
	jmp	L000

	.globl	_ClassEntry50
_ClassEntry50:
	movl	$50, %eax
	jmp	L000

	.globl	_ClassEntry51
_ClassEntry51:
	movl	$51, %eax
	jmp	L000

	.globl	_ClassEntry52
_ClassEntry52:
	movl	$52, %eax
	jmp	L000

	.globl	_ClassEntry53
_ClassEntry53:
	movl	$53, %eax
	jmp	L000

	.globl	_ClassEntry54
_ClassEntry54:
	movl	$54, %eax
	jmp	L000

	.globl	_ClassEntry55
_ClassEntry55:
	movl	$55, %eax
	jmp	L000

	.globl	_ClassEntry56
_ClassEntry56:
	movl	$56, %eax
	jmp	L000

	.globl	_ClassEntry57
_ClassEntry57:
	movl	$57, %eax
	jmp	L000

	.globl	_ClassEntry58
_ClassEntry58:
	movl	$58, %eax
	jmp	L000

	.globl	_ClassEntry59
_ClassEntry59:
	movl	$59, %eax
	jmp	L000

	.globl	_ClassEntry60
_ClassEntry60:
	movl	$60, %eax
	jmp	L000

	.globl	_ClassEntry61
_ClassEntry61:
	movl	$61, %eax
	jmp	L000

	.globl	_ClassEntry62
_ClassEntry62:
	movl	$62, %eax
	jmp	L000

	.globl	_ClassEntry63
_ClassEntry63:
	movl	$63, %eax
	jmp	L000

	.globl	_ClassEntry64
_ClassEntry64:
	movl	$64, %eax
	jmp	L000

	.globl	_ClassEntry65
_ClassEntry65:
	movl	$65, %eax
	jmp	L000

	.globl	_ClassEntry66
_ClassEntry66:
	movl	$66, %eax
	jmp	L000

	.globl	_ClassEntry67
_ClassEntry67:
	movl	$67, %eax
	jmp	L000

	.globl	_ClassEntry68
_ClassEntry68:
	movl	$68, %eax
	jmp	L000

	.globl	_ClassEntry69
_ClassEntry69:
	movl	$69, %eax
	jmp	L000

	.globl	_ClassEntry70
_ClassEntry70:
	movl	$70, %eax
	jmp	L000

	.globl	_ClassEntry71
_ClassEntry71:
	movl	$71, %eax
	jmp	L000

	.globl	_ClassEntry72
_ClassEntry72:
	movl	$72, %eax
	jmp	L000

	.globl	_ClassEntry73
_ClassEntry73:
	movl	$73, %eax
	jmp	L000

	.globl	_ClassEntry74
_ClassEntry74:
	movl	$74, %eax
	jmp	L000

	.globl	_ClassEntry75
_ClassEntry75:
	movl	$75, %eax
	jmp	L000

	.globl	_ClassEntry76
_ClassEntry76:
	movl	$76, %eax
	jmp	L000

	.globl	_ClassEntry77
_ClassEntry77:
	movl	$77, %eax
	jmp	L000

	.globl	_ClassEntry78
_ClassEntry78:
	movl	$78, %eax
	jmp	L000

	.globl	_ClassEntry79
_ClassEntry79:
	movl	$79, %eax
	jmp	L000

	.globl	_ClassEntry80
_ClassEntry80:
	movl	$80, %eax
	jmp	L000

	.globl	_ClassEntry81
_ClassEntry81:
	movl	$81, %eax
	jmp	L000

	.globl	_ClassEntry82
_ClassEntry82:
	movl	$82, %eax
	jmp	L000

	.globl	_ClassEntry83
_ClassEntry83:
	movl	$83, %eax
	jmp	L000

	.globl	_ClassEntry84
_ClassEntry84:
	movl	$84, %eax
	jmp	L000

	.globl	_ClassEntry85
_ClassEntry85:
	movl	$85, %eax
	jmp	L000

	.globl	_ClassEntry86
_ClassEntry86:
	movl	$86, %eax
	jmp	L000

	.globl	_ClassEntry87
_ClassEntry87:
	movl	$87, %eax
	jmp	L000

	.globl	_ClassEntry88
_ClassEntry88:
	movl	$88, %eax
	jmp	L000

	.globl	_ClassEntry89
_ClassEntry89:
	movl	$89, %eax
	jmp	L000

	.globl	_ClassEntry90
_ClassEntry90:
	movl	$90, %eax
	jmp	L000

	.globl	_ClassEntry91
_ClassEntry91:
	movl	$91, %eax
	jmp	L000

	.globl	_ClassEntry92
_ClassEntry92:
	movl	$92, %eax
	jmp	L000

	.globl	_ClassEntry93
_ClassEntry93:
	movl	$93, %eax
	jmp	L000

	.globl	_ClassEntry94
_ClassEntry94:
	movl	$94, %eax
	jmp	L000

	.globl	_ClassEntry95
_ClassEntry95:
	movl	$95, %eax
	jmp	L000

	.globl	_ClassEntry96
_ClassEntry96:
	movl	$96, %eax
	jmp	L000

	.globl	_ClassEntry97
_ClassEntry97:
	movl	$97, %eax
	jmp	L000

	.globl	_ClassEntry98
_ClassEntry98:
	movl	$98, %eax
	jmp	L000

	.globl	_ClassEntry99
_ClassEntry99:
	movl	$99, %eax
	jmp	L000

	.globl	_ClassEntry100
_ClassEntry100:
	movl	$100, %eax
	jmp	L000

	.globl	_ClassEntry101
_ClassEntry101:
	movl	$101, %eax
	jmp	L000

	.globl	_ClassEntry102
_ClassEntry102:
	movl	$102, %eax
	jmp	L000

	.globl	_ClassEntry103
_ClassEntry103:
	movl	$103, %eax
	jmp	L000

	.globl	_ClassEntry104
_ClassEntry104:
	movl	$104, %eax
	jmp	L000

	.globl	_ClassEntry105
_ClassEntry105:
	movl	$105, %eax
	jmp	L000

	.globl	_ClassEntry106
_ClassEntry106:
	movl	$106, %eax
	jmp	L000

	.globl	_ClassEntry107
_ClassEntry107:
	movl	$107, %eax
	jmp	L000

	.globl	_ClassEntry108
_ClassEntry108:
	movl	$108, %eax
	jmp	L000

	.globl	_ClassEntry109
_ClassEntry109:
	movl	$109, %eax
	jmp	L000

	.globl	_ClassEntry110
_ClassEntry110:
	movl	$110, %eax
	jmp	L000

	.globl	_ClassEntry111
_ClassEntry111:
	movl	$111, %eax
	jmp	L000

	.globl	_ClassEntry112
_ClassEntry112:
	movl	$112, %eax
	jmp	L000

	.globl	_ClassEntry113
_ClassEntry113:
	movl	$113, %eax
	jmp	L000

	.globl	_ClassEntry114
_ClassEntry114:
	movl	$114, %eax
	jmp	L000

	.globl	_ClassEntry115
_ClassEntry115:
	movl	$115, %eax
	jmp	L000

	.globl	_ClassEntry116
_ClassEntry116:
	movl	$116, %eax
	jmp	L000

	.globl	_ClassEntry117
_ClassEntry117:
	movl	$117, %eax
	jmp	L000

	.globl	_ClassEntry118
_ClassEntry118:
	movl	$118, %eax
	jmp	L000

	.globl	_ClassEntry119
_ClassEntry119:
	movl	$119, %eax
	jmp	L000

	.globl	_ClassEntry120
_ClassEntry120:
	movl	$120, %eax
	jmp	L000

	.globl	_ClassEntry121
_ClassEntry121:
	movl	$121, %eax
	jmp	L000

	.globl	_ClassEntry122
_ClassEntry122:
	movl	$122, %eax
	jmp	L000

	.globl	_ClassEntry123
_ClassEntry123:
	movl	$123, %eax
	jmp	L000

	.globl	_ClassEntry124
_ClassEntry124:
	movl	$124, %eax
	jmp	L000

	.globl	_ClassEntry125
_ClassEntry125:
	movl	$125, %eax
	jmp	L000

	.globl	_ClassEntry126
_ClassEntry126:
	movl	$126, %eax
	jmp	L000

	.globl	_ClassEntry127
_ClassEntry127:
	movl	$127, %eax
	jmp	L000

	.globl	_ClassEntry128
_ClassEntry128:
	movl	$128, %eax
	jmp	L000

	.globl	_ClassEntry129
_ClassEntry129:
	movl	$129, %eax
	jmp	L000

	.globl	_ClassEntry130
_ClassEntry130:
	movl	$130, %eax
	jmp	L000

	.globl	_ClassEntry131
_ClassEntry131:
	movl	$131, %eax
	jmp	L000

	.globl	_ClassEntry132
_ClassEntry132:
	movl	$132, %eax
	jmp	L000

	.globl	_ClassEntry133
_ClassEntry133:
	movl	$133, %eax
	jmp	L000

	.globl	_ClassEntry134
_ClassEntry134:
	movl	$134, %eax
	jmp	L000

	.globl	_ClassEntry135
_ClassEntry135:
	movl	$135, %eax
	jmp	L000

	.globl	_ClassEntry136
_ClassEntry136:
	movl	$136, %eax
	jmp	L000

	.globl	_ClassEntry137
_ClassEntry137:
	movl	$137, %eax
	jmp	L000

	.globl	_ClassEntry138
_ClassEntry138:
	movl	$138, %eax
	jmp	L000

	.globl	_ClassEntry139
_ClassEntry139:
	movl	$139, %eax
	jmp	L000

	.globl	_ClassEntry140
_ClassEntry140:
	movl	$140, %eax
	jmp	L000

	.globl	_ClassEntry141
_ClassEntry141:
	movl	$141, %eax
	jmp	L000

	.globl	_ClassEntry142
_ClassEntry142:
	movl	$142, %eax
	jmp	L000

	.globl	_ClassEntry143
_ClassEntry143:
	movl	$143, %eax
	jmp	L000

	.globl	_ClassEntry144
_ClassEntry144:
	movl	$144, %eax
	jmp	L000

	.globl	_ClassEntry145
_ClassEntry145:
	movl	$145, %eax
	jmp	L000

	.globl	_ClassEntry146
_ClassEntry146:
	movl	$146, %eax
	jmp	L000

	.globl	_ClassEntry147
_ClassEntry147:
	movl	$147, %eax
	jmp	L000

	.globl	_ClassEntry148
_ClassEntry148:
	movl	$148, %eax
	jmp	L000

	.globl	_ClassEntry149
_ClassEntry149:
	movl	$149, %eax
	jmp	L000


