Commit dd48e34a authored by Julian Kranz's avatar Julian Kranz

Jgdrr

- Continued to implement jgdrr
parent 3fa640fd
......@@ -27,7 +27,4 @@ include/
specifications/x86/c/cli-gdrr
jgdrr/.classpath
jgdrr/bin/NativeInterface.class
jgdrr/bin/Program.class
jgdrr/bin/RReilStatement.class
jgdrr/bin/libjgdrr.so
jgdrr/bin/
import rnati.*;
public class Program {
......@@ -9,5 +10,4 @@ public class Program {
n.decodeAndTranslate(null);
}
}
public abstract class RReilStatement {
}
package rnati;
import rreil.Statement;
public class NativeInterface {
public NativeInterface() {
System.loadLibrary("jgdrr");
}
public RReilStatement[] decodeAndTranslate(byte[] bytes) {
return (RReilStatement[]) decodeAndTranslateNative(bytes);
public Statement[] decodeAndTranslate(byte[] bytes) {
return (Statement[]) decodeAndTranslateNative(bytes);
}
/*
* sem_id
*/
private Object virt_eq() {
System.out.println("(j) virt_eq");
return null;
}
private Object virt_neq() {
System.out.println("(j) virt_neq");
return null;
}
private Object virt_les() {
System.out.println("(j) virt_les");
return null;
}
private Object virt_leu() {
System.out.println("(j) virt_leu");
return null;
}
private Object virt_lts() {
System.out.println("(j) virt_lts");
return null;
}
private Object virt_ltu() {
System.out.println("(j) virt_ltu");
return null;
}
private Object virt_t(Object t) {
System.out.println("(j) virt_t");
return null;
}
/*
......@@ -236,6 +279,20 @@ public class NativeInterface {
System.out.println("(j) sem_branch");
return null;
}
/*
* sem_stmts
*/
private Object list_next(Object next, Object list) {
System.out.println("(j) list_next\n");
return null;
}
private Object list_init() {
System.out.println("(j) list_init");
return null;
}
private native Object decodeAndTranslateNative(byte[] bytes);
}
......@@ -3,8 +3,9 @@
#include <stdlib.h>
#include <dis.h>
#include <gdrr.h>
#include "rnati_NativeInterface.h"
//gcc -std=c99 -fPIC -shared -Wl,-soname,libjgdrr.so -I/usr/lib/jvm/java-6-openjdk-amd64/include -I../.. -I../../include ../../dis.o -o ../bin/libjgdrr.so NativeInterface.c ../../gdrr/Debug/libgdrr.a
//gcc -std=c99 -fPIC -shared -Wl,-soname,libjgdrr.so -I/usr/lib/jvm/java-6-openjdk-amd64/include -I../.. -I../../include ../../dis.o -o ../bin/libjgdrr.so rnati_NativeInterface.c ../../gdrr/Debug/libgdrr.a
//echo "48 83 ec 08" | java -Djava.library.path=. Program
struct closure {
......@@ -88,32 +89,33 @@ static jobject java_long_create(void *closure, long int x) {
// sem_id
static gdrr_sem_id_t *virt_eq(void *closure) {
printf("=> virt_eq\n");
return NULL;
jobject ret = java_method_call(closure, "virt_eq", 0);
return (gdrr_sem_id_t*)ret;
}
static gdrr_sem_id_t *virt_neq(void *closure) {
printf("=> virt_neq\n");
return NULL;
jobject ret = java_method_call(closure, "virt_neq", 0);
return (gdrr_sem_id_t*)ret;
}
static gdrr_sem_id_t *virt_les(void *closure) {
printf("=> virt_les\n");
return NULL;
jobject ret = java_method_call(closure, "virt_les", 0);
return (gdrr_sem_id_t*)ret;
}
static gdrr_sem_id_t *virt_leu(void *closure) {
printf("=> virt_leu\n");
return NULL;
jobject ret = java_method_call(closure, "virt_leu", 0);
return (gdrr_sem_id_t*)ret;
}
static gdrr_sem_id_t *virt_lts(void *closure) {
printf("=> virt_lts\n");
return NULL;
jobject ret = java_method_call(closure, "virt_lts", 0);
return (gdrr_sem_id_t*)ret;
}
static gdrr_sem_id_t *virt_ltu(void *closure) {
printf("=> virt_ltu\n");
return NULL;
jobject ret = java_method_call(closure, "virt_ltu", 0);
return (gdrr_sem_id_t*)ret;
}
static gdrr_sem_id_t *virt_t(void *closure, __word t) {
printf("=> id {t=%lu}\n", t);
return NULL;
jobject ret = java_method_call(closure, "virt_t", 1,
java_long_create(closure, (long int)t));
return (gdrr_sem_id_t*)ret;
}
// sem_address
......@@ -360,17 +362,18 @@ static gdrr_sem_stmt_t *sem_branch(void *closure,
// sem_stmts
static gdrr_sem_stmts_t *list_next(void *closure, gdrr_sem_stmt_t *next,
gdrr_sem_stmts_t *list) {
printf("next statement\n\n");
return NULL;
jobject ret = java_method_call(closure, "list_next", 2, (jobject)next,
(jobject)list);
return (gdrr_sem_stmts_t*)ret;
}
static gdrr_sem_stmts_t *list_init(void *closure) {
printf("init\n");
return NULL;
jobject ret = java_method_call(closure, "list_init", 0);
return (gdrr_sem_stmts_t*)ret;
}
JNIEXPORT
jobject
JNICALL Java_NativeInterface_decodeAndTranslateNative(JNIEnv *env, jobject obj,
JNICALL Java_rnati_NativeInterface_decodeAndTranslateNative(JNIEnv *env, jobject obj,
jbyteArray input) {
__char blob[15];
char fmt[1024];
......
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class NativeInterface */
/* Header for class rnati_NativeInterface */
#ifndef _Included_NativeInterface
#define _Included_NativeInterface
#ifndef _Included_rnati_NativeInterface
#define _Included_rnati_NativeInterface
#ifdef __cplusplus
extern "C" {
#endif
/*
* Class: NativeInterface
* Class: rnati_NativeInterface
* Method: decodeAndTranslateNative
* Signature: ([B)Ljava/lang/Object;
*/
JNIEXPORT jobject JNICALL Java_NativeInterface_decodeAndTranslateNative
JNIEXPORT jobject JNICALL Java_rnati_NativeInterface_decodeAndTranslateNative
(JNIEnv *, jobject, jbyteArray);
#ifdef __cplusplus
......
package rreil;
public class AssignStatement extends Statement {
}
package rreil;
public class LoadStatement extends Statement {
}
package rreil;
public abstract class Statement {
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment