2N/A/*
2N/A * CDDL HEADER START
2N/A *
2N/A * The contents of this file are subject to the terms of the
2N/A * Common Development and Distribution License (the "License").
2N/A * You may not use this file except in compliance with the License.
2N/A *
2N/A * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
2N/A * or http://www.opensolaris.org/os/licensing.
2N/A * See the License for the specific language governing permissions
2N/A * and limitations under the License.
2N/A *
2N/A * When distributing Covered Code, include this CDDL HEADER in each
2N/A * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
2N/A * If applicable, add the following below this CDDL HEADER, with the
2N/A * fields enclosed by brackets "[]" replaced with your own identifying
2N/A * information: Portions Copyright [yyyy] [name of copyright owner]
2N/A *
2N/A * CDDL HEADER END
2N/A */
2N/A/*
2N/A * Copyright (c) 1995-1997, by Sun Microsystems, Inc.
2N/A * All rights reserved.
2N/A */
2N/A
2N/A .file "sync_instruction_memory.s"
2N/A
2N/A#include <sys/asm_linkage.h>
2N/A
2N/A/*
2N/A * void sync_instruction_memory(caddr_t addr, int len)
2N/A *
2N/A * Make the memory at {addr, addr+len} valid for instruction execution.
2N/A */
2N/A
2N/A#ifdef lint
2N/A#define nop
2N/Avoid
2N/Async_instruction_memory(caddr_t addr, int len)
2N/A{
2N/A caddr_t end = addr + len;
2N/A caddr_t start = addr & ~7;
2N/A for (; start < end; start += 8)
2N/A flush(start);
2N/A nop; nop; nop; nop; nop;
2N/A return;
2N/A}
2N/A#else
2N/A ENTRY(sync_instruction_memory)
2N/A add %o0, %o1, %o2
2N/A andn %o0, 7, %o0
2N/A
2N/A cmp %o0, %o2
2N/A bgeu 2f
2N/A nop
2N/A flush %o0
2N/A1:
2N/A add %o0, 8, %o0
2N/A cmp %o0, %o2
2N/A blu,a 1b
2N/A flush %o0
2N/A !
2N/A ! when we get here, we have executed 3 instructions after the
2N/A ! last flush; SPARC V8 requires 2 more for flush to be visible
2N/A ! The retl;nop pair will do it.
2N/A !
2N/A2:
2N/A retl
2N/A clr %o0
2N/A SET_SIZE(sync_instruction_memory)
2N/A
2N/A ENTRY(nop)
2N/A retl
2N/A nop
2N/A SET_SIZE(nop)
2N/A#endif