The Pedigree Project  0.1
extern.h
1 /*
2  * Copyright (c) 2008-2014, Pedigree Developers
3  *
4  * Please see the CONTRIB file in the root of the source tree for a full
5  * list of contributors.
6  *
7  * Permission to use, copy, modify, and distribute this software for any
8  * purpose with or without fee is hereby granted, provided that the above
9  * copyright notice and this permission notice appear in all copies.
10  *
11  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18  */
19 
20 #ifndef UD_EXTERN_H
21 #define UD_EXTERN_H
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
27 // include <stdio.h>
28 #include "pedigree/kernel/debugger/libudis86/types.h"
29 
30 /* ============================= PUBLIC API ================================= */
31 
32 extern void ud_init(struct ud *);
33 
34 extern void ud_set_mode(struct ud *, uint8_t);
35 
36 extern void ud_set_pc(struct ud *, uint64_t);
37 
38 extern void ud_set_input_hook(struct ud *, int (*)(struct ud *));
39 
40 extern void ud_set_input_buffer(struct ud *, uint8_t *, size_t);
41 
42 #ifndef __UD_STANDALONE__
43 extern void ud_set_input_file(struct ud *, FILE *);
44 #endif /* __UD_STANDALONE__ */
45 
46 extern void ud_set_vendor(struct ud *, unsigned);
47 
48 extern void ud_set_syntax(struct ud *, void (*)(struct ud *));
49 
50 extern void ud_input_skip(struct ud *, size_t);
51 
52 extern int ud_input_end(struct ud *);
53 
54 extern unsigned int ud_decode(struct ud *);
55 
56 extern unsigned int ud_disassemble(struct ud *);
57 
58 extern void ud_translate_intel(struct ud *);
59 
60 extern void ud_translate_att(struct ud *);
61 
62 extern char *ud_insn_asm(struct ud *u);
63 
64 extern uint8_t *ud_insn_ptr(struct ud *u);
65 
66 extern uint64_t ud_insn_off(struct ud *);
67 
68 extern char *ud_insn_hex(struct ud *);
69 
70 extern unsigned int ud_insn_len(struct ud *u);
71 
72 extern const char *ud_lookup_mnemonic(enum ud_mnemonic_code c);
73 
74 /* ========================================================================== */
75 
76 #ifdef __cplusplus
77 }
78 #endif
79 #endif