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
17struct thread;
18
19// The caller is responsible for making sure the thread is in an exception
20// or is suspended, and stays so.
21zx_status_t arch_get_general_regs(struct thread* thread, zx_thread_state_general_regs* out);
22zx_status_t arch_set_general_regs(struct thread* thread, const zx_thread_state_general_regs* in);
23
24zx_status_t arch_get_fp_regs(struct thread* thread, zx_thread_state_fp_regs* out);
25zx_status_t arch_set_fp_regs(struct thread* thread, const zx_thread_state_fp_regs* in);
26
27zx_status_t arch_get_single_step(struct thread* thread, bool* single_step);
28zx_status_t arch_set_single_step(struct thread* thread, bool single_step);
29
30zx_status_t arch_get_vector_regs(struct thread* thread, zx_thread_state_vector_regs* out);
31zx_status_t arch_set_vector_regs(struct thread* thread, const zx_thread_state_vector_regs* in);
32
33// Only relevant on x86. Returns ZX_ERR_NOT_SUPPORTED on ARM.
34zx_status_t arch_get_x86_register_fs(struct thread* thread, uint64_t* out);
35zx_status_t arch_set_x86_register_fs(struct thread* thread, const uint64_t* in);
36
37// Only relevant on x86. Returns ZX_ERR_NOT_SUPPORTED on ARM.
38zx_status_t arch_get_x86_register_gs(struct thread* thread, uint64_t* out);
39zx_status_t arch_set_x86_register_gs(struct thread* thread, const uint64_t* in);
40
41__END_CDECLS
42