1 // Copyright 2017 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 // Userspace general regs are stored in two different structs:
10 // - syscalls = x86_syscall_general_regs_t
11 // - interrupts/exceptions = x86_iframe_t
12 // A tagged pointer is stored in struct arch_thread to specify which one.
13 #define X86_GENERAL_REGS_NONE    0
14 #define X86_GENERAL_REGS_SYSCALL 1
15 #define X86_GENERAL_REGS_IFRAME  2
16 
17 #ifndef __ASSEMBLER__
18 
19 #include <assert.h>
20 #include <zircon/compiler.h>
21 #include <stdint.h>
22 
23 __BEGIN_CDECLS
24 
25 // the structure used to hold the general purpose integer registers
26 // when a syscall is suspended
27 
28 typedef struct {
29     uint64_t rax;
30     uint64_t rbx;
31     uint64_t rcx;
32     uint64_t rdx;
33     uint64_t rsi;
34     uint64_t rdi;
35     uint64_t rbp;
36     uint64_t rsp;
37     uint64_t r8;
38     uint64_t r9;
39     uint64_t r10;
40     uint64_t r11;
41     uint64_t r12;
42     uint64_t r13;
43     uint64_t r14;
44     uint64_t r15;
45     uint64_t rip;
46     uint64_t rflags;
47 } x86_syscall_general_regs_t;
48 
49 __END_CDECLS
50 
51 #endif // !__ASSEMBLER__
52