Add Java binding for ctl set_cpu_model (#1600)

Add Java binding for ctl set_cpu_model
This commit is contained in:
JeroenRobbenFirmalyzer1 2022-04-24 13:29:48 +02:00 committed by GitHub
parent 0c975caf09
commit 36011e145c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 0 deletions

View File

@ -821,5 +821,11 @@ public class Unicorn implements UnicornConst, ArmConst, Arm64Const, M68kConst, S
*/
public native void context_restore(long context);
/**
* Set the emulated cpu model.
*
* @param cpu_model CPU model type (see UC_CPU_*).
*/
public native void ctl_set_cpu_model(int cpu_model);
}

View File

@ -779,3 +779,17 @@ JNIEXPORT void JNICALL Java_unicorn_Unicorn_context_1restore
throwException(env, err);
}
}
/*
* Class: unicorn_Unicorn
* Method: ctl_set_cpu_model
* Signature: (I)V
*/
JNIEXPORT void JNICALL Java_unicorn_Unicorn_ctl_1set_1cpu_1model
(JNIEnv *env, jobject self, jint cpu_model) {
uc_engine *eng = getEngine(env, self);
uc_err err = uc_ctl_set_cpu_model(eng, cpu_model);
if (err != UC_ERR_OK) {
throwException(env, err);
}
}