Skip to content

Commit

Permalink
Added libudis86 (disassembler library for x86 / x86-64)
Browse files Browse the repository at this point in the history
  • Loading branch information
FrodeSolheim committed Aug 4, 2014
1 parent 6f78106 commit 62b1157
Show file tree
Hide file tree
Showing 18 changed files with 12,132 additions and 2 deletions.
1 change: 1 addition & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ Version 2.6.7dev:

* Modified Makefile.am for out-of-tree builds.
* Fixed crash when playing videos with CD32 FMV (no display yet).
* Added libudis86 (disassembler library for x86 / x86-64).

Version 2.5.6dev:

Expand Down
19 changes: 19 additions & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,17 @@ fs_uae_SOURCES += \
src/slirp/udp.cpp
endif

if WITH_UDIS86
CMCFLAGS += -I$(s)/libudis86/include
fs_uae_SOURCES += \
libudis86/src/decode.c \
libudis86/src/itab.c \
libudis86/src/syn-att.c \
libudis86/src/syn.c \
libudis86/src/syn-intel.c \
libudis86/src/udis86.c
endif

nodist_fs_uae_SOURCES = \
gen/blitfunc.cpp \
gen/blittable.cpp \
Expand Down Expand Up @@ -506,6 +517,13 @@ noinst_HEADERS = \
libfsemu/src/lua/lzio.h \
libfsemu/src/ml/manymouse/manymouse.h \
libfsemu/src/ml/ml_internal.h \
libudis86/src/decode.h \
libudis86/src/types.h \
libudis86/src/syn.h \
libudis86/src/itab.h \
libudis86/src/extern.h \
libudis86/src/udint.h \
libudis86/include/udis86.h \
src/archivers/chd/astring.h \
src/archivers/chd/bitstream.h \
src/archivers/chd/chd.h \
Expand Down Expand Up @@ -746,6 +764,7 @@ EXTRA_DIST = \
fs-uae.spec \
libfsemu/src/emu/keynames.c \
libfsemu/src/ml/sdl2_keys.c \
libudis86/README \
licenses/fs-uae.txt \
licenses/glib.txt \
licenses/ipflib.txt \
Expand Down
2 changes: 2 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,8 @@ OPT_FEATURE([WITH_UAENATIVE], [uaenative], [uaenative],
[enable uaenative.library], [yes])
OPT_FEATURE([WITH_UAENET], [uaenet], [uaenet],
[enable uaenet.device], [no])
OPT_FEATURE([WITH_UDIS86], [udis86], [udis86],
[enable UDIS86 x86/x86-64 disassembler], [yes])
OPT_FEATURE([WITH_XML_SHADER], [xml_shader], [xml-shader],
[enable XML shader support], [yes])
OPT_FEATURE([A_ZIP], [zip], [zip],
Expand Down
91 changes: 91 additions & 0 deletions libudis86/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
Udis86
======

Udis86 is a disassembler for the x86 and x86-64 class of instruction set
architectures. It consists of a C library called libudis86 which
provides a clean and simple interface to decode a stream of raw binary
data, and to inspect the disassembled instructions in a structured
manner.


LICENSE
-------

Udis86 is distributed under the terms of the 2-clause "Simplified BSD
License". A copy of the license is included with the source in LICENSE.


libudis86
---------

o Supports all x86 and x86-64 (AMD64) General purpose and
System instructions.
o Supported ISA extensions:
- MMX, FPU (x87), AMD 3DNow
- SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AES,
- AMD-V, INTEL-VMX, SMX
o Instructions are defined in an XML document, with opcode
tables generated for performance.
o Supports output in both INTEL (NASM) as well as AT&T (GNU as) style
assembly language syntax.
o Supports a variety of input methods: Files, Memory Buffers, and
Function Callback hooks.
o Re-entrant, no dynamic memory allocation.
o Fully documented API


-- EXAMPLE -----------------------------------------------------------

ud_t u;

ud_init(&u);
ud_set_input_file(&u, stdin);
ud_set_mode(&u, 64);
ud_set_syntax(&u, UD_SYN_INTEL);

while (ud_disassemble(&u)) {
printf("\t%s\n", ud_insn_asm(&ud_obj));
}

----------------------------------------------------------------------


udcli
-----

udcli is a small command-line tool for your quick disassembly needs.

-- EXAMPLE -----------------------------------------------------------

$ echo "65 67 89 87 76 65 54 56 78 89 09 00 90" | udcli -32 -x
0000000080000800 656789877665 mov [gs:bx+0x6576], eax
0000000080000806 54 push esp
0000000080000807 56 push esi
0000000080000808 7889 js 0x80000793
000000008000080a 0900 or [eax], eax
000000008000080c 90 nop

----------------------------------------------------------------------


Documentation
-------------

The libudis86 api is fully documented. The package distribution contains
a Texinfo file which can be installed by invoking "make install-info".
You can also find an online html version of the documentation available
at http://udis86.sourceforge.net/.


Autotools Build
---------------

You need autotools if building from sources cloned form version control
system, or if you need to regenerate the build system. The wrapper
script 'autogen.sh' is provided that'll generate the build system.


AUTHOR
------

Udis86 is written and maintained by Vivek Thampi ([email protected]).
33 changes: 33 additions & 0 deletions libudis86/include/udis86.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/* udis86 - udis86.h
*
* Copyright (c) 2002-2009 Vivek Thampi
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef UDIS86_H
#define UDIS86_H

#include "libudis86/types.h"
#include "libudis86/extern.h"
#include "libudis86/itab.h"

#endif
Loading

0 comments on commit 62b1157

Please sign in to comment.