11.5Sriastrad/*	$NetBSD: sljit_machdep.h,v 1.5 2024/05/05 15:18:10 riastradh Exp $	*/
21.1Srjs
31.1Srjs/*-
41.1Srjs * Copyright (c) 2014 Alexander Nasonov.
51.1Srjs * All rights reserved.
61.1Srjs *
71.1Srjs * Redistribution and use in source and binary forms, with or without
81.1Srjs * modification, are permitted provided that the following conditions
91.1Srjs * are met:
101.1Srjs * 1. Redistributions of source code must retain the above copyright
111.1Srjs *    notice, this list of conditions and the following disclaimer.
121.1Srjs * 2. Redistributions in binary form must reproduce the above copyright
131.1Srjs *    notice, this list of conditions and the following disclaimer in the
141.1Srjs *    documentation and/or other materials provided with the distribution.
151.1Srjs *
161.1Srjs * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
171.1Srjs * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
181.1Srjs * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
191.1Srjs * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
201.1Srjs * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
211.1Srjs * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
221.1Srjs * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
231.1Srjs * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
241.1Srjs * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
251.1Srjs * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
261.1Srjs * POSSIBILITY OF SUCH DAMAGE.
271.1Srjs */
281.1Srjs
291.1Srjs#ifndef _AARCH64_SLJITARCH_H
301.1Srjs#define _AARCH64_SLJITARCH_H
311.1Srjs
321.5Sriastrad#ifndef __aarch64__		/* compat32 */
331.5Sriastrad
341.5Sriastrad#include <arm/sljit_machdep.h>
351.5Sriastrad
361.5Sriastrad#else  /* __aarch64__ */
371.5Sriastrad
381.1Srjs#include <sys/cdefs.h>
391.1Srjs
401.1Srjs#ifdef _KERNEL
411.1Srjs#include <machine/types.h>
421.3Sskrll
431.3Sskrll#include <arm/cpufunc.h>
441.1Srjs#else
451.1Srjs#include <stddef.h>
461.1Srjs#include <stdint.h>
471.1Srjs#include <aarch64/sysarch.h>
481.1Srjs#endif
491.1Srjs
501.1Srjs#define SLJIT_CONFIG_ARM_64 1
511.1Srjs
521.4Sriastrad#ifdef _HARDKERNEL
531.4Sriastrad/*
541.4Sriastrad * XXX Currently sys/rump/include/machine/cpu.h doesn't have
551.4Sriastrad * ci_cpufuncs for cpu_icache_sync_range, so we do this only for
561.4Sriastrad * non-rump kernels for now.
571.4Sriastrad */
581.1Srjs#define SLJIT_CACHE_FLUSH(from, to) \
591.1Srjs	cpu_icache_sync_range((vaddr_t)(from), (vsize_t)((to) - (from)))
601.1Srjs#else
611.1Srjs#define SLJIT_CACHE_FLUSH(from, to) \
621.2Salnsn	(void)__builtin___clear_cache((char *)(from), (char *)(to))
631.1Srjs#endif
641.1Srjs
651.5Sriastrad#endif	/* __aarch64__ (vs compat32) */
661.5Sriastrad
671.5Sriastrad#endif	/* _AARCH64_SLJITARCH_H */
68