master
h 130 lines 3.11 KB
Raw
1 /*
2 * x86_64 system call definitions
3 *
4 * Copyright (c) 2013 Stacey D. Son
5 *
6 * SPDX-License-Identifier: GPL-2.0-or-later
7 */
8 #ifndef TARGET_SYSCALL_H
9 #define TARGET_SYSCALL_H
10
11 #define __USER_CS (0x33)
12 #define __USER_DS (0x2B)
13
14 struct target_pt_regs {
15 abi_ulong r15;
16 abi_ulong r14;
17 abi_ulong r13;
18 abi_ulong r12;
19 abi_ulong rbp;
20 abi_ulong rbx;
21 /* arguments: non interrupts/non tracing syscalls only save up to here */
22 abi_ulong r11;
23 abi_ulong r10;
24 abi_ulong r9;
25 abi_ulong r8;
26 abi_ulong rax;
27 abi_ulong rcx;
28 abi_ulong rdx;
29 abi_ulong rsi;
30 abi_ulong rdi;
31 abi_ulong orig_rax;
32 /* end of arguments */
33 /* cpu exception frame or undefined */
34 abi_ulong rip;
35 abi_ulong cs;
36 abi_ulong eflags;
37 abi_ulong rsp;
38 abi_ulong ss;
39 /* top of stack page */
40 };
41
42 /* Maximum number of LDT entries supported. */
43 #define TARGET_LDT_ENTRIES 8192
44 /* The size of each LDT entry. */
45 #define TARGET_LDT_ENTRY_SIZE 8
46
47 #define TARGET_GDT_ENTRIES 16
48 #define TARGET_GDT_ENTRY_TLS_ENTRIES 3
49 #define TARGET_GDT_ENTRY_TLS_MIN 12
50 #define TARGET_GDT_ENTRY_TLS_MAX 14
51
52 #if 0 // Redefine this
53 struct target_modify_ldt_ldt_s {
54 unsigned int entry_number;
55 abi_ulong base_addr;
56 unsigned int limit;
57 unsigned int seg_32bit:1;
58 unsigned int contents:2;
59 unsigned int read_exec_only:1;
60 unsigned int limit_in_pages:1;
61 unsigned int seg_not_present:1;
62 unsigned int useable:1;
63 unsigned int lm:1;
64 };
65 #else
66 struct target_modify_ldt_ldt_s {
67 unsigned int entry_number;
68 abi_ulong base_addr;
69 unsigned int limit;
70 unsigned int flags;
71 };
72 #endif
73
74 struct target_ipc64_perm
75 {
76 int key;
77 uint32_t uid;
78 uint32_t gid;
79 uint32_t cuid;
80 uint32_t cgid;
81 unsigned short mode;
82 unsigned short __pad1;
83 unsigned short seq;
84 unsigned short __pad2;
85 abi_ulong __unused1;
86 abi_ulong __unused2;
87 };
88
89 struct target_msqid64_ds {
90 struct target_ipc64_perm msg_perm;
91 unsigned int msg_stime; /* last msgsnd time */
92 unsigned int msg_rtime; /* last msgrcv time */
93 unsigned int msg_ctime; /* last change time */
94 abi_ulong msg_cbytes; /* current number of bytes on queue */
95 abi_ulong msg_qnum; /* number of messages in queue */
96 abi_ulong msg_qbytes; /* max number of bytes on queue */
97 unsigned int msg_lspid; /* pid of last msgsnd */
98 unsigned int msg_lrpid; /* last receive pid */
99 abi_ulong __unused4;
100 abi_ulong __unused5;
101 };
102
103 /* FreeBSD sysarch(2) */
104 #define TARGET_FREEBSD_I386_GET_LDT 0
105 #define TARGET_FREEBSD_I386_SET_LDT 1
106 /* I386_IOPL */
107 #define TARGET_FREEBSD_I386_GET_IOPERM 3
108 #define TARGET_FREEBSD_I386_SET_IOPERM 4
109 /* xxxxx */
110 #define TARGET_FREEBSD_I386_GET_FSBASE 7
111 #define TARGET_FREEBSD_I386_SET_FSBASE 8
112 #define TARGET_FREEBSD_I386_GET_GSBASE 9
113 #define TARGET_FREEBSD_I386_SET_GSBASE 10
114
115 #define TARGET_FREEBSD_AMD64_GET_FSBASE 128
116 #define TARGET_FREEBSD_AMD64_SET_FSBASE 129
117 #define TARGET_FREEBSD_AMD64_GET_GSBASE 130
118 #define TARGET_FREEBSD_AMD64_SET_GSBASE 131
119
120
121 #define UNAME_MACHINE "x86_64"
122 #define TARGET_HW_MACHINE "amd64"
123 #define TARGET_HW_MACHINE_ARCH "amd64"
124
125 #define TARGET_ARCH_SET_GS 0x1001
126 #define TARGET_ARCH_SET_FS 0x1002
127 #define TARGET_ARCH_GET_FS 0x1003
128 #define TARGET_ARCH_GET_GS 0x1004
129
130 #endif /* TARGET_SYSCALL_H */