util: Expose addr config mechanisms in the gem5 op java wrapper.
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>
This commit is contained in:
@@ -53,6 +53,10 @@ public class Ops {
|
||||
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");
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
#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)
|
||||
@@ -108,6 +109,24 @@ Java_gem5_Ops_setupCallTypes(JNIEnv *env, jclass clazz)
|
||||
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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user