1/**
2 * \file
3 * \brief Essential capability definitions.
4 */
5
6/*
7 * Copyright (c) 2007, 2008, 2009, 2010, ETH Zurich.
8 * All rights reserved.
9 *
10 * This file is distributed under the terms in the attached LICENSE file.
11 * If you do not find this file, copies can be found by writing to:
12 * ETH Zurich D-INFK, Haldeneggsteig 4, CH-8092 Zurich. Attn: Systems Group.
13 */
14
15#ifndef BARRELFISH_SYS_DEBUG_H
16#define BARRELFISH_SYS_DEBUG_H
17
18#include <sys/cdefs.h>
19#include <barrelfish/caddr.h>
20
21__BEGIN_DECLS
22
23// XXX: arguments to sys_debug_set_breakpoint, which are clearly x86-specific!!
24#define X86_DEBUG_MODE_EXECONLY     (0) ///< Break on instruction execution only.
25#define X86_DEBUG_MODE_WRITEONLY    (1) ///< Break on data writes only.
26#define X86_DEBUG_MODE_READWRITE    (3) ///< Break on data reads or writes but not instruction fetches.
27#define X86_DEBUG_LENGTH_1BYTE      (0)
28#define X86_DEBUG_LENGTH_2BYTE      (1)
29#define X86_DEBUG_LENGTH_8BYTE      (2) ///< Undefined?
30#define X86_DEBUG_LENGTH_4BYTE      (3)
31
32errval_t sys_debug_context_counter_reset(void);
33errval_t sys_debug_context_counter_read(uint64_t *ret);
34errval_t sys_debug_timeslice_counter_read(uint64_t *ret);
35errval_t sys_debug_get_tsc_per_ms(uint64_t *ret);
36errval_t sys_debug_get_apic_id(uint8_t *ret);
37errval_t sys_debug_get_apic_timer(uint32_t *ret);
38errval_t sys_debug_print_context_counter(void);
39errval_t sys_debug_print_timeslice(void);
40errval_t sys_debug_flush_cache(void);
41errval_t sys_debug_send_ipi(uint8_t destination, uint8_t shorthand, uint8_t vector);
42errval_t sys_debug_set_breakpoint(uintptr_t addr, uint8_t mode, uint8_t length);
43errval_t sys_debug_hardware_timer_read(uintptr_t* ret);
44errval_t sys_debug_hardware_timer_hertz_read(uintptr_t* ret);
45errval_t sys_debug_hardware_global_timer_read(uint64_t *ret);
46errval_t sys_debug_get_apic_ticks_per_sec(uint32_t *ret);
47errval_t sys_debug_create_irq_src_cap(struct capref cap, uint64_t start, uint64_t end);
48
49#ifdef ENABLE_FEIGN_FRAME_CAP
50errval_t sys_debug_feign_frame_cap(struct capref slot, lpaddr_t base,
51                                   uint8_t bits);
52#endif
53
54errval_t sys_debug_cap_trace_ctrl(uintptr_t types, genpaddr_t start, gensize_t size);
55
56__END_DECLS
57
58#endif //BARRELFISH_SYS_DEBUG_H
59