These allow you to set the target physical address, and map or unmap the
region of physical memory. This is not automatic for two reasons. First,
the address needs to be configured before the mapping is done, and
there's no way to ensure that ordering when everything is handled
automatically. Second, if the user isn't going to use the address based
mechanism, then the mapping and access to /dev/mem isn't necessary and
may prevent using the other call types.
Change-Id: I0f9c32d6bfa402ba59ea1bf5672fb7f11003568d
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/28184
Reviewed-by: Gabe Black <gabe.black@gmail.com>
Maintainer: Bobby R. Bruce <bbruce@ucdavis.edu>
Tested-by: kokoro <noreply+kokoro@google.com>
long sum = gem5_ops.sum(1, 2, 3, 4, 5, 6);
```
+To configure the address based trigger mechanism, you can use these static
+methods.
+
+void setAddr(long addr);
+Set the address for the "magic" address region.
+
+void mapMem();
+Map the "magic" physical address region into the process' address space, likely
+by mmapping the "/dev/mem" device file.
+
+void unmapMem();
+Unmap the "magic" physical address region that was previously mapped.
+
# lua module
private static Map<String, Ops> _callTypes;
public static final Map<String, Ops> callTypes;
+ public static native void setAddr(long addr);
+ public static native void mapMem();
+ public static native void unmapMem();
+
static {
try {
File temp_lib = File.createTempFile("gem5Ops", ".so");
#include "call_type/semi_dt.hh"
#include "gem5/m5ops.h"
#include "java/gem5_Ops.h"
+#include "m5_mmap.h"
#define _stringify(x) #x
#define stringify(x) _stringify(x)
env->DeleteLocalRef(map);
}
+JNIEXPORT void JNICALL
+Java_gem5_Ops_setAddr(JNIEnv *env, jclass clazz, jlong addr)
+{
+ m5op_addr = addr;
+}
+
+JNIEXPORT void JNICALL
+Java_gem5_Ops_mapMem(JNIEnv *env, jclass clazz)
+{
+ map_m5_mem();
+}
+
+JNIEXPORT void JNICALL
+Java_gem5_Ops_unmapMem(JNIEnv *env, jclass clazz)
+{
+ unmap_m5_mem();
+}
+
static DispatchTable *
getDispatchTable(JNIEnv *env, jobject obj)
{