xref: /csrg-svn/sys/tahoe/align/Acasel.c (revision 45760)
1*45760Sbostic /*-
2*45760Sbostic  * Copyright (c) 1986 The Regents of the University of California.
3*45760Sbostic  * All rights reserved.
4*45760Sbostic  *
5*45760Sbostic  * This code is derived from software contributed to Berkeley by
6*45760Sbostic  * Computer Consoles Inc.
7*45760Sbostic  *
8*45760Sbostic  * %sccs.include.redist.c%
9*45760Sbostic  *
10*45760Sbostic  *	@(#)Acasel.c	7.1 (Berkeley) 12/06/90
11*45760Sbostic  */
1229594Ssam 
1345699Sbostic #include "align.h"
casel(infop)1429594Ssam casel(infop)	process_info *infop;
1529594Ssam /*
1629594Ssam /*	Case (longword).
1729594Ssam /*	Can't use real HW opcode, don't want to branch out !
1829594Ssam /*
1929594Ssam /***********************************/
2029594Ssam {
2129594Ssam 	register long selector, base;
2229594Ssam 	register unsigned temporary, limit;
2329594Ssam 
2429594Ssam 	selector = operand(infop,0)->data;
2529594Ssam 	base = operand(infop,1)->data;
2629594Ssam 	limit = operand(infop,2)->data;
2729594Ssam 	if (pc & 1) pc += 1;	/* Displacements are aligned ! */
2829594Ssam 	temporary = selector - base;
2929594Ssam 	if (temporary <= limit)
3029594Ssam 		pc = pc + get_word (infop, (char *)(pc + 2*temporary) );
3129594Ssam 	else pc = pc + limit*2 + 2;
3229594Ssam }
33