summaryrefslogtreecommitdiffstats
path: root/pcm-assembler/pcm-assembler.h
blob: ef7a655f13a2f96067e152d9d68fc0da7e636261 (plain)
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
/*
 * Copyright (C) 2016-2017 Paul Kocialkowski <contact@paulk.fr>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program 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 General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef _PCM_ASSEMBLER_H_
#define _PCM_ASSEMBLER_H_

/*
 * Values
 */

#define PCM_ASSEMBLER_ARGUMENTS_MAX				64

/*
 * Structures
 */

struct pcm_label_address {
	char *label;
	unsigned int address;
};

struct pcm_func_address {
	char *func;
	unsigned int address;

	struct list_head *label_address;
};

struct pcm_ops_data {
	struct list_head *func_address;
	struct list_head *func_address_current;

	int fd;
};

/*
 * Functions
 */

int pcm_asm_write(void *data, unsigned int value, char *mnemonic);
int pcm_asm_write_dummy(void *data, unsigned int value, char *mnemonic);
int pcm_func_address(void *data, char *func);
int pcm_label_address(void *data, char *func);
int pcm_address_dummy(void *data, char *string);

int pcm_func_address_register(char *func, unsigned int address);
void pcm_func_address_flush(void);
struct pcm_func_address *pcm_func_address_find(char *func);
int pcm_func_address_current_set(char *func);
int pcm_label_address_register(char *label, unsigned int address);
void pcm_label_address_flush(void);
struct pcm_label_address *pcm_label_address_find(char *label);

#endif