Home | History | Annotate | Download | only in gen
      1 /*
      2  * CDDL HEADER START
      3  *
      4  * The contents of this file are subject to the terms of the
      5  * Common Development and Distribution License (the "License").
      6  * You may not use this file except in compliance with the License.
      7  *
      8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
      9  * or http://www.opensolaris.org/os/licensing.
     10  * See the License for the specific language governing permissions
     11  * and limitations under the License.
     12  *
     13  * When distributing Covered Code, include this CDDL HEADER in each
     14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
     15  * If applicable, add the following below this CDDL HEADER, with the
     16  * fields enclosed by brackets "[]" replaced with your own identifying
     17  * information: Portions Copyright [yyyy] [name of copyright owner]
     18  *
     19  * CDDL HEADER END
     20  */
     21 /*
     22  * Copyright (c) 1995-1997, by Sun Microsystems, Inc.
     23  * All rights reserved.
     24  */
     25 
     26 	.file	"sync_instruction_memory.s"
     27 
     28 #include <sys/asm_linkage.h>
     29 
     30 /*
     31  * void sync_instruction_memory(caddr_t addr, int len)
     32  *
     33  * Make the memory at {addr, addr+len} valid for instruction execution.
     34  */
     35 
     36 #ifdef lint
     37 #define	nop
     38 void
     39 sync_instruction_memory(caddr_t addr, size_t len)
     40 {
     41 	caddr_t end = addr + len;
     42 	caddr_t start = addr & ~7;
     43 	for (; start < end; start += 8)
     44 		flush(start);
     45 	nop; nop; nop; nop; nop;
     46 	return;
     47 }
     48 #else
     49 	ENTRY(sync_instruction_memory)
     50 	add	%o0, %o1, %o2
     51 	andn	%o0, 7, %o0
     52 
     53 	cmp	%o0, %o2
     54 	bgeu,pn	%xcc, 2f
     55 	nop
     56 	flush	%o0
     57 1:
     58 	add	%o0, 8, %o0
     59 	cmp	%o0, %o2
     60 	blu,a,pt %xcc, 1b
     61 	flush	%o0
     62 2:
     63 	retl
     64 	clr	%o0
     65 	SET_SIZE(sync_instruction_memory)
     66 
     67 	ENTRY(nop)
     68 	retl
     69 	nop
     70 	SET_SIZE(nop)
     71 #endif
     72