Subject: adding a _cacheflush() function to libc (libarch)
To: None <port-m68k@netbsd.org>
From: Ignatios Souvatzis <is@jocelyn.rhein.de>
List: port-m68k
Date: 11/30/1998 23:01:17
Hello,
people maintaining self-modifying code (obj-c compiler writers, java JIT
compiler writers etc) currently have to guess how to synchronize i-cache and
d-cache on our d-cache machines (or grep through the kernel sources). See
pr 4951 and back-then port-amiga or port-m68k discussions.
So, to close pr 4951, I plan to do something like this. Comments please.
cacheflush.S, to go into libc (or libarch?) on m68k:
/* $NetBSD$ */
/* Copyright (c) 1998 Ignatios Souvatzis. All rights reserved. */
#include <sys/cdefs.h>
.globl cerror
ENTRY(_cachectl)
movl sp@(4),a1
movl sp@(8),d1
movl sp@(12),d0
trap #12
tstl d0
jne err
rts
err:
jra cerror
<m68k/cacheflush.h>, also to be included by the sys_machdep.c files to avoid
duplication of the flag definitions:
/* $NetBSD$ */
/* Copyright (c) 1998 Ignatios Souvatzis. All rights reserved. */
#ifndef _M68K_CACHEFLUSH_H_
#define _M68K_CACHEFLUSH_H_
#ifndef _KERNEL
#include <sys/cdefs.h>
#include <sys/types.h>
int _cacheflush __P((void *, size_t, u_int32_t));
#endif /* ! _KERNEL */
#define CC_PURGE 1
#define CC_FLUSH 2
#define CC_IPURGE 4
#define CC_EXTPURGE 0x80000000
#endif /* _M68K_CACHEFLUSH_H_ */
Regards,
-is