1 // Copyright 2016 The Fuchsia Authors
2 //
3 // Use of this source code is governed by a MIT-style
4 // license that can be found in the LICENSE file or at
5 // https://opensource.org/licenses/MIT
6 
7 #pragma once
8 
9 #include <stdbool.h>
10 #include <sys/types.h>
11 #include <zircon/compiler.h>
12 #include <zircon/syscalls/debug.h>
13 #include <zircon/types.h>
14 
15 __BEGIN_CDECLS
16 
17 struct thread;
18 
19 // The caller is responsible for making sure the thread is in an exception
20 // or is suspended, and stays so.
21 zx_status_t arch_get_general_regs(struct thread* thread, zx_thread_state_general_regs* out);
22 zx_status_t arch_set_general_regs(struct thread* thread, const zx_thread_state_general_regs* in);
23 
24 zx_status_t arch_get_fp_regs(struct thread* thread, zx_thread_state_fp_regs* out);
25 zx_status_t arch_set_fp_regs(struct thread* thread, const zx_thread_state_fp_regs* in);
26 
27 zx_status_t arch_get_vector_regs(struct thread* thread, zx_thread_state_vector_regs* out);
28 zx_status_t arch_set_vector_regs(struct thread* thread, const zx_thread_state_vector_regs* in);
29 
30 zx_status_t arch_get_debug_regs(struct thread* thread, zx_thread_state_debug_regs* out);
31 zx_status_t arch_set_debug_regs(struct thread* thread, const zx_thread_state_debug_regs* in);
32 
33 zx_status_t arch_get_single_step(struct thread* thread, bool* single_step);
34 zx_status_t arch_set_single_step(struct thread* thread, bool single_step);
35 
36 // Only relevant on x86. Returns ZX_ERR_NOT_SUPPORTED on ARM.
37 zx_status_t arch_get_x86_register_fs(struct thread* thread, uint64_t* out);
38 zx_status_t arch_set_x86_register_fs(struct thread* thread, const uint64_t* in);
39 
40 // Only relevant on x86. Returns ZX_ERR_NOT_SUPPORTED on ARM.
41 zx_status_t arch_get_x86_register_gs(struct thread* thread, uint64_t* out);
42 zx_status_t arch_set_x86_register_gs(struct thread* thread, const uint64_t* in);
43 
44 __END_CDECLS
45