Commit 842b0539 authored by Julian Kranz's avatar Julian Kranz

Liveness

parent 9d8631a8
#!/bin/bash
./gdsl @MLton fixed-heap 6g -- "specifications/rreil/rreil.ml" "specifications/x86/x86.ml" "specifications/x86/x86-rreil-registermapping.ml" "specifications/x86/x86-pretty.ml" "specifications/rreil/rreil-pretty.ml" "specifications/x86/x86-rreil-translator.ml" "specifications/x86/x86-rreil-translator-a-l.ml" "specifications/x86/x86-rreil-translator-m-z.ml"
#./gdsl @MLton fixed-heap 6g -- "specifications/rreil/rreil.ml" "specifications/x86/x86.ml" "specifications/x86/x86-rreil-registermapping.ml" "specifications/x86/x86-pretty.ml" "specifications/rreil/rreil-pretty.ml" "specifications/x86/x86-rreil-translator.ml" "specifications/x86/x86-rreil-translator-a-l.ml" "specifications/x86/x86-rreil-translator-m-z.ml"
#./gdsl @MLton fixed-heap 6g -- "specifications/rreil/rreil.ml" "specifications/rreil/rreil-pretty.ml" "specifications/rreil/rreil-liveness-test.ml"
./gdsl @MLton fixed-heap 6g -- "specifications/rreil/rreil.ml" "specifications/rreil/rreil-pretty.ml" "specifications/rreil/rreil-liveness-test.ml" "specifications/rreil/rreil-liveness.ml" "specifications/basis/bbtree.ml"
#[ $? -eq 0 ] && clang -fno-inline -O -c dis.c -o dis.o
[ $? -eq 0 ] && clang -fPIC -c dis.c -o dis.o
......
......@@ -389,6 +389,7 @@ end = struct
raisee,
ipget,
index,
println,
add,
sx,
zx,
......
export = tinsng
val arch-show-id x = case 0 of 1: "" end
val print o = update@{nothing=(println o)}
val test-instructions-0 = do
t0 <- mktemp;
t1 <- mktemp;
t2 <- mktemp;
mov 1 t0 (imm 3);
mov 1 t1 (imm 4);
mov 1 t2 (imm 5);
print t0;
add 1 t0 (var t1) (var t2);
mov 1 t0 (imm 42)
end
val tinsng = do
update@{stack=SEM_NIL,tmp=TLIST_NIL};
test-instructions-0;
stack <- query $stack;
return (rreil-stmts-rev stack)
end
......@@ -311,20 +311,11 @@ val fmap-add-field t x f = fmap-update t {id=x, fields=fitree-singleton f}
val fmap-add-range t x sz offs = fmap-add-field t x (to-field sz offs)
val rreil-ltid? a b =
let
val toInt a =
case a of
VIRT_EQ: 0
| VIRT_NEQ: 1
| VIRT_LES: 2
| VIRT_LEU: 3
| VIRT_LTS: 4
| VIRT_LTU: 5
end
val ltf? a b =
case b of
ARCH_R x: '1'
| VIRT_T x: '0'
| _ : toInt a < toInt b
| _ : index a < index b
end
in
case a of
......@@ -338,12 +329,7 @@ val rreil-ltid? a b =
VIRT_T y: x < y
| _ : '1'
end
| VIRT_EQ: ltf? a b
| VIRT_NEQ: ltf? a b
| VIRT_LES: ltf? a b
| VIRT_LEU: ltf? a b
| VIRT_LTS: ltf? a b
| VIRT_LTU: ltf? a b
| _: ltf? a b
end
end
......
......@@ -63,10 +63,6 @@ type sem_stmts =
SEM_CONS of {hd:sem_stmt, tl:sem_stmts}
| SEM_NIL
type sem_writeback =
SEM_WRITE_VAR of {size:int, id:sem_var}
| SEM_WRITE_MEM of {size:int, address:sem_linear, segment:seg_override}
val rreil-sizeOf op =
case op of
SEM_LIN x: x.size
......
......@@ -24,3 +24,6 @@ cmusl-liveness:
cliveness:
gcc -pipe -O3 -Wall -static -I. -I../../.. -Wfatal-errors liveness.c ../../../dis.c -DRELAXEDFATAL -o live
liveness-test:
gcc -pipe -O3 -Wall -static -I. -I../../.. -Wfatal-errors liveness-test.c ../../../dis.o -DRELAXEDFATAL -o liveness-test
/* vim:cindent:ts=2:sw=2:expandtab */
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <dis.h>
#include <sys/resource.h>
int main (int argc, char** argv) {
const rlim_t kStackSize = 64L * 1024L * 1024L; // min stack size = 64 Mb
struct rlimit rl;
int result;
result = getrlimit(RLIMIT_STACK, &rl);
if (result == 0)
{
if (rl.rlim_cur < kStackSize)
{
rl.rlim_cur = kStackSize;
result = setrlimit(RLIMIT_STACK, &rl);
if (result != 0)
{
fprintf(stderr, "setrlimit returned result = %d\n", result);
}
}
}
__obj state = __createState(NULL, 0, 0, 0);
__obj r = __runMonadicNoArg(__tinsng__, &state);
size_t size = 256*1024;
char fmt[size];
__pretty(__rreil_pretty__,r,fmt,size);
puts(fmt);
return 1;
}
......@@ -2,6 +2,10 @@
export = translate translateBlock
type sem_writeback =
SEM_WRITE_VAR of {size:int, id:sem_var}
| SEM_WRITE_MEM of {size:int, address:sem_linear, segment:seg_override}
#Todo: fix
val runtime-stack-address-size = do
mode64 <- mode64?;
......
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