-
Notifications
You must be signed in to change notification settings - Fork 32
/
Copy pathcallbacks.c
95 lines (66 loc) · 2.78 KB
/
callbacks.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
/*
* Common interface for translation libraries.
*
* Copyright (c) Antmicro
* Copyright (c) Realtime Embedded
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, see <http://www.gnu.org/licenses/>.
*/
#include <stdlib.h>
#include "callbacks.h"
DEFAULT_VOID_HANDLER1(void tlib_on_translation_block_find_slow, uint32_t pc)
void tlib_abort(char *message) __attribute__((weak));
void tlib_abort(char *message)
{
abort();
}
DEFAULT_VOID_HANDLER2(void tlib_log, enum log_level level, char* message)
DEFAULT_INT_HANDLER1(uint32_t tlib_read_byte, uint32_t address)
DEFAULT_INT_HANDLER1(uint32_t tlib_read_word, uint32_t address)
DEFAULT_INT_HANDLER1(uint32_t tlib_read_double_word, uint32_t address)
DEFAULT_VOID_HANDLER2(void tlib_write_byte, uint32_t address, uint32_t value)
DEFAULT_VOID_HANDLER2(void tlib_write_word, uint32_t address, uint32_t value)
DEFAULT_VOID_HANDLER2(void tlib_write_double_word, uint32_t address, uint32_t value)
DEFAULT_INT_HANDLER1(int32_t tlib_is_io_accessed, uint32_t address)
DEFAULT_VOID_HANDLER2(void tlib_on_block_begin, uint32_t address, uint32_t size)
DEFAULT_INT_HANDLER1(uint32_t tlib_is_block_begin_event_enabled, void)
void *tlib_malloc(size_t size) __attribute__((weak));
void *tlib_malloc(size_t size)
{
return malloc(size);
}
void *tlib_realloc(void *ptr, size_t size) __attribute__((weak));
void *tlib_realloc(void *ptr, size_t size)
{
return realloc(ptr, size);
}
void tlib_free(void *ptr) __attribute__((weak));
void tlib_free(void *ptr)
{
free(ptr);
}
DEFAULT_VOID_HANDLER1(void tlib_on_translation_cache_size_change, int32_t new_size)
DEFAULT_VOID_HANDLER2(void tlib_invalidate_tb_in_other_cpus, unsigned long start, unsigned long end)
DEFAULT_INT_HANDLER1(uint32_t tlib_is_instruction_count_enabled, void)
DEFAULT_VOID_HANDLER1(void tlib_update_instruction_counter, int32_t value)
DEFAULT_INT_HANDLER1(int32_t tlib_get_cpu_index, void)
int32_t tlib_is_on_block_translation_enabled;
void tlib_set_on_block_translation_enabled(int32_t value)
{
tlib_is_on_block_translation_enabled = value;
}
void tlib_on_block_translation(uint32_t start, uint32_t size, uint32_t flags) __attribute__((weak));
void tlib_on_block_translation(uint32_t start, uint32_t size, uint32_t flags)
{
}