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
24extern "C" {
25#endif
26
27// include <stdio.h>
28#include "pedigree/kernel/debugger/libudis86/types.h"
29
30/* ============================= PUBLIC API ================================= */
31
32extern void ud_init(struct ud*);
33
34extern void ud_set_mode(struct ud*, uint8_t);
35
36extern void ud_set_pc(struct ud*, uint64_t);
37
38extern void ud_set_input_hook(struct ud*, int (*)(struct ud*));
39
40extern void ud_set_input_buffer(struct ud*, uint8_t*, size_t);
41
42#ifndef __UD_STANDALONE__
43extern void ud_set_input_file(struct ud*, FILE*);
44#endif /* __UD_STANDALONE__ */
45
46extern void ud_set_vendor(struct ud*, unsigned);
47
48extern void ud_set_syntax(struct ud*, void (*)(struct ud*));
49
50extern void ud_input_skip(struct ud*, size_t);
51
52extern int ud_input_end(struct ud*);
53
54extern unsigned int ud_decode(struct ud*);
55
56extern unsigned int ud_disassemble(struct ud*);
57
58extern void ud_translate_intel(struct ud*);
59
60extern void ud_translate_att(struct ud*);
61
62extern char* ud_insn_asm(struct ud* u);
63
64extern uint8_t* ud_insn_ptr(struct ud* u);
65
66extern uint64_t ud_insn_off(struct ud*);
67
68extern char* ud_insn_hex(struct ud*);
69
70extern unsigned int ud_insn_len(struct ud* u);
71
72extern const char* ud_lookup_mnemonic(enum ud_mnemonic_code c);
73
74/* ========================================================================== */
75
76#ifdef __cplusplus
77}
78#endif
79#endif