Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
gdsl-toolkit
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tanzeem Haque
gdsl-toolkit
Commits
f390f2e6
Commit
f390f2e6
authored
Oct 24, 2012
by
Julian Kranz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
X86 Pretty Printer
... - Bug fixes ...
parent
11bf49b0
Changes
7
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
200 additions
and
127 deletions
+200
-127
CFGresolve/CFGresolve/Segment.cpp
CFGresolve/CFGresolve/Segment.cpp
+1
-0
CFGresolve/CFGresolve/main-elf.cpp
CFGresolve/CFGresolve/main-elf.cpp
+67
-4
detail/codegen/c0/runtime.h
detail/codegen/c0/runtime.h
+1
-1
examples/x86/Makefile
examples/x86/Makefile
+4
-4
specifications/x86/x86-pretty.ml
specifications/x86/x86-pretty.ml
+121
-117
specifications/x86/x86-rreil-translator-a-l.ml
specifications/x86/x86-rreil-translator-a-l.ml
+5
-0
specifications/x86/x86-rreil-translator.ml
specifications/x86/x86-rreil-translator.ml
+1
-1
No files found.
CFGresolve/CFGresolve/Segment.cpp
View file @
f390f2e6
...
...
@@ -9,6 +9,7 @@
// Copyright (c) 2012 Axel Simon. All rights reserved.
//
#include <stdint.h>
#include <strings.h>
#include "Segment.h"
#include <sys/mman.h>
...
...
CFGresolve/CFGresolve/main-elf.cpp
View file @
f390f2e6
...
...
@@ -5,9 +5,72 @@
* Author: jucs
*/
#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
#include <iostream>
#include <fstream>
#include "Segment.h"
#include "RReil.h"
#include <vector>
#include <fcntl.h>
int
main
(
void
)
{
printf
(
":-)
\n
"
);
int
main
(
int
argc
,
const
char
*
argv
[])
{
char
*
file_name
=
"/bin/echo"
;
SegmentSet
segments
;
// Read in what code/data segments there are and store them in
// uint32_t cmd_buf[header.sizeofcmds/sizeof(uint32_t)];
// char* cp = (char*) &cmd_buf;
// f.read(cp, header.sizeofcmds);
// uint32_t ncmds = header.ncmds;
// while ((cp-(char*) &cmd_buf)<header.sizeofcmds && ncmds--) {
// struct load_command* lc = (struct load_command*) cp;
// switch (lc->cmd) {
// case LC_SEGMENT_64: {
// struct segment_command_64* cmd = (struct segment_command_64*) cp;
// char name[17];
// name[16]=0;
// memcpy(&name[0], &cmd->segname[0], 16);
// std::cout << "found " << &name[0] << " segment" << std::endl;
// uint32_t nsect = cmd->nsects;
// struct section_64* sect = (struct section_64*) (cp+sizeof(struct segment_command_64));
// for (int i=0; i<nsect; i++, sect++) {
// sect->sectname[15]=0;
// Segment* s = new Segment(&(sect->sectname[0]), sect->addr, sect->size, sect->offset);
// segments.addSegment(s);
// }
// }
// }
// cp = cp+lc->cmdsize;
// }
Segment
*
s
=
new
Segment
(
"text"
,
0x401170
,
0xbd
,
0x1170
);
segments
.
addSegment
(
s
);
// f.close();
int
fd
=
open
(
file_name
,
O_RDONLY
);
if
(
fd
==
-
1
)
return
1
;
bool
res
=
segments
.
map
(
fd
);
if
(
!
res
)
{
std
::
cout
<<
"Cannot map segment sections."
<<
std
::
endl
;
return
1
;
}
//std::cout << segments;
Segment
*
text
=
segments
.
findByName
(
"text"
);
if
(
text
==
NULL
)
{
std
::
cout
<<
"Segment containing code not found."
<<
std
::
endl
;
return
1
;
}
std
::
cout
<<
segments
<<
std
::
endl
;
uint64_t
start
=
text
->
getBase
();
char
*
limit
;
char
*
addr
=
segments
.
resolve
(
start
,
&
limit
);
//std::cout << "first byte of text segment is " << std::hex << start << ": " << std::hex << (uint8_t) (*addr) << std::dec << std::endl;
RReilBB
*
b
=
translate
(
addr
,
limit
);
if
(
b
!=
NULL
)
std
::
cout
<<
"basic block:"
<<
std
::
endl
<<
*
b
<<
std
::
endl
;
return
0
;
}
detail/codegen/c0/runtime.h
View file @
f390f2e6
...
...
@@ -10,7 +10,7 @@
#include <stddef.h>
#include <string.h>
#define __RT_HEAP_SIZE (
4
*1024*1024)
#define __RT_HEAP_SIZE (
8
*1024*1024)
#define __CHECK_HEAP(n)
/* TODO: check for heap-overflow */
#define __ALLOC1() --hp
/* TODO: check for heap-overflow */
...
...
examples/x86/Makefile
View file @
f390f2e6
...
...
@@ -2,13 +2,13 @@
all
:
cmusl-cli
ccmp
:
gcc
-O2
-Wall
-static
-I
.
-I
../..
-I
../../resources/xed/xed2-intel64/include
-L
../../resources/xed/xed2-intel64/lib
-Wfatal-errors
cmp.c ../../dis.c pretty.c
-lbfd
-liberty
-ldl
-lz
-lxed
-DRELAXEDFATAL
-o
cmp
clang
-O2
-Wall
-static
-I
.
-I
../..
-I
../../resources/xed/xed2-intel64/include
-L
../../resources/xed/xed2-intel64/lib
-Wfatal-errors
cmp.c ../../dis.c pretty.c
-lbfd
-liberty
-ldl
-lz
-lxed
-DRELAXEDFATAL
-o
cmp
cxedcmp
:
gcc
-O2
-Wall
-Wfatal-errors
-static
-I
.
-I
../..
-I
../../resources/xed/xed2-intel64/include
-L
../../resources/xed/xed2-intel64/lib xed-cmp.c pretty.c ../../dis.c
-lbfd
-liberty
-ldl
-lz
-lxed
-DRELAXEDFATAL
-o
xed-cmp
clang
-O2
-Wall
-Wfatal-errors
-static
-I
.
-I
../..
-I
../../resources/xed/xed2-intel64/include
-L
../../resources/xed/xed2-intel64/lib xed-cmp.c pretty.c ../../dis.c
-lbfd
-liberty
-ldl
-lz
-lxed
-DRELAXEDFATAL
-o
xed-cmp
ccli
:
gcc
-pipe
-O2
-Wall
-static
-I
.
-I
../..
-Wfatal-errors
cli.c pretty.c ../../dis.c
-DRELAXEDFATAL
-o
cli
clang
-pipe
-O2
-Wall
-static
-I
.
-I
../..
-Wfatal-errors
cli.c pretty.c ../../dis.c
-DRELAXEDFATAL
-o
cli
cmusl-cli
:
/usr/musl/bin/musl-gcc
-pipe
-O3
-Wall
-static
-I
.
-I
../..
-Wfatal-errors
cli.c pretty.c ../../dis.c
-DRELAXEDFATAL
-o
musl-cli
...
...
@@ -17,4 +17,4 @@ cmusl-cli-println:
/usr/musl/bin/musl-gcc
-pipe
-O3
-Wall
-static
-I
.
-I
../..
-Wfatal-errors
cli-println.c ../../dis.c
-DRELAXEDFATAL
-o
musl-cli-println
ccli-println
:
gcc
-O2
-Wall
-static
-I
.
-I
../..
-Wfatal-errors
cli-println.c ../../dis.c
-DRELAXEDFATAL
-o
cli-println
clang
-O2
-Wall
-static
-I
.
-I
../..
-Wfatal-errors
cli-println.c ../../dis.c
-DRELAXEDFATAL
-o
cli-println
specifications/x86/x86-pretty.ml
View file @
f390f2e6
This diff is collapsed.
Click to expand it.
specifications/x86/x86-rreil-translator-a-l.ml
View file @
f390f2e6
...
...
@@ -667,6 +667,11 @@ end
val
sem
-
lddqu
x
=
sem
-
lddqu
-
vlddqu
128
x
;
val
sem
-
vlddqu
x
=
sem
-
lddqu
-
vlddqu
256
x
;
val
sem
-
lds
x
=
do
return
void
end
val
sem
-
lea
x
=
do
opnd
-
sz
<-
sizeof1
x
.
opnd1
;
dst
<-
write
opnd
-
sz
x
.
opnd1
;
...
...
specifications/x86/x86-rreil-translator.ml
View file @
f390f2e6
...
...
@@ -978,7 +978,7 @@ val semantics insn =
|
LAR
x
:
sem
-
undef
-
arity2
x
|
LDDQU
x
:
sem
-
lddqu
x
|
LDMXCSR
x
:
sem
-
undef
-
arity1
x
|
LDS
x
:
sem
-
undef
-
arity2
x
|
LDS
x
:
sem
-
lds
x
|
LEA
x
:
sem
-
lea
x
|
LEAVE
x
:
sem
-
undef
-
arity0
x
|
LES
x
:
sem
-
undef
-
arity2
x
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment