summaryrefslogtreecommitdiffstats
path: root/drivers/misc/tegra-profiler/disassembler.h
blob: 2c42e6d712b77952d15b22dcd6fc0dee608e7a1c (plain) (blame)
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
/*
 * drivers/misc/tegra-profiler/disassembler.h
 *
 * Copyright (c) 2015, NVIDIA CORPORATION.  All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms and conditions of the GNU General Public License,
 * version 2, as published by the Free Software Foundation.
 *
 * This program is distributed in the hope 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.
 *
 */

#ifndef __QUADD_DISASSEMBLER_H
#define __QUADD_DISASSEMBLER_H

/* By default we disassemble at most 128 bytes from the beginning
 * of the function...
 */
#define QUADD_DISASM_MAX 128

/* ...but not less than 16 bytes to get meaningful results. */
#define QUADD_DISASM_MIN 16

struct quadd_disasm_data {
	int thumb;
	unsigned long min, max;
	int r_regset;
	int d_regset;
	/*
	 * Used if stack is adjusted with sub sp, sp, [stacksize] (ARM)
	 * or sub sp, [stacksize] (Thumb).
	 */
	long stacksize;
	/*
	 * Otherwise used if sp is saved with add [stackreg], sp, [stackoff]
	 * or mov [stackreg], sp.
	 */
	int stackreg;
	long stackoff;
	/* If the latter, actual register used to restore sp during unwind. */
	int ustackreg;
#ifdef QM_DEBUG_DISASSEMBLER
	int stackmethod;
	struct quadd_disasm_data *orig;
#endif
};

extern long
quadd_disassemble(struct quadd_disasm_data *qd, unsigned long min,
		  unsigned long max, int thumbflag);
extern long
quadd_check_unwind_result(unsigned long pc,
			  struct quadd_disasm_data *qd);

#endif /* __QUADD_DISASSEMBLER_H */