Commit 1edf6fd7 authored by Julian Kranz's avatar Julian Kranz

Gdrr

- Started to implement gdrr
parent 3e6b614d
......@@ -20,3 +20,8 @@ specifications/x86/c/clang-sweep
specifications/x86/c/gcc-sweep
specifications/x86/c/tester
gdrr/.cproject
gdrr/.project
gdrr/Debug/
include/
specifications/x86/c/cli-gdrr
/*
* gdrr.h
*
* Created on: Feb 22, 2013
* Author: jucs
*/
#ifndef GDRR_H_
#define GDRR_H_
#include <dis.h>
void test(__obj semantics);
#endif /* GDRR_H_ */
/*
* gdrr.c
*
* Created on: Feb 22, 2013
* Author: jucs
*/
#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
#include <dis.h>
void test(__obj semantics) {
printf(":-)\n");
while (__CASETAGCON(semantics)==__SEM_CONS) {
__obj rec = __DECON(semantics);
__obj instr = __RECORD_SELECT(rec, ___hd);
switch (__CASETAGCON(instr)) {
case __SEM_ASSIGN: {
printf("assign\n");
break;
}
case __SEM_XOR: {
printf("xor\n");
break;
}
case __SEM_ITE: {
printf("ite\n");
break;
}
default: {
printf("%d\n", __CASETAGCON(instr));
break;
}
}
semantics = __RECORD_SELECT(rec, ___tl);
};
}
......@@ -7,6 +7,9 @@ cmusl-cli:
clang-cli:
clang -pipe -O3 -Wall -static -I. -I../../.. -Wfatal-errors cli.c ../../../dis.o -DRELAXEDFATAL -o clang-cli
cli-gdrr:
gcc -Wall -static -I. -I../../.. -I../../../include -Wfatal-errors cli-gdrr.c ../../../dis.o -DRELAXEDFATAL -o cli-gdrr -lgdrr -L../../../gdrr/Debug
clang-tester:
clang -pipe -O3 -Wall -static -I. -I../../.. -Wfatal-errors tester.c ../../../dis.o -DRELAXEDFATAL -o tester
......
/* vim:cindent:ts=2:sw=2:expandtab */
#include <stdio.h>
#include <stdlib.h>
#include <dis.h>
#include <gdrr.h>
int main (int argc, char** argv) {
__char blob[15];
char fmt[1024];
__word sz = 15;
__obj insn;
int i,c;
for (i=0;i<sz;i++) {
int x = fscanf(stdin,"%x",&c);
switch (x) {
case EOF:
goto done;
case 0:
__fatal("invalid input; should be in hex form: '0f 0b ..'");
}
blob[i] = c & 0xff;
}
done:
__decode(__decode__,blob,i,&insn);
if (___isNil(insn))
__fatal("decode failed");
else {
__pretty(__pretty__,insn,fmt,1024);
puts(fmt);
printf("---------------------------\n");
__obj r = __translate(__translate__,insn);
if(___isNil(r))
__fatal("translate failed");
else {
__pretty(__rreil_pretty__,r,fmt,1024);
puts(fmt);
test(r);
}
}
return (1);
}
......@@ -2663,9 +2663,8 @@ val sem-vzeroupper = do
size <- return 128;
mode64 <- mode64?;
blah <- return (semantic-register-of-offset XMM0 size);
xmm0 <- return {id=Sem_XMM0,offset=size,size=size};
mov (size + blah.size) xmm0 (imm 0);
xmm0 <- return (semantic-register-of-offset XMM0 size);
mov size xmm0 (imm 0);
#xmm1 <- return (semantic-register-of-offset XMM1 size);
#mov size xmm1 (imm 0);
#xmm2 <- return (semantic-register-of-offset XMM2 size);
......
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