xref: /qemu/bsd-user/x86_64/target_syscall.h (revision ea1ab4cf)
1*ea1ab4cfSStacey Son /*
2*ea1ab4cfSStacey Son  *  x86_64 system call definitions
3*ea1ab4cfSStacey Son  *
4*ea1ab4cfSStacey Son  *
5*ea1ab4cfSStacey Son  *  This program is free software; you can redistribute it and/or modify
6*ea1ab4cfSStacey Son  *  it under the terms of the GNU General Public License as published by
7*ea1ab4cfSStacey Son  *  the Free Software Foundation; either version 2 of the License, or
8*ea1ab4cfSStacey Son  *  (at your option) any later version.
9*ea1ab4cfSStacey Son  *
10*ea1ab4cfSStacey Son  *  This program is distributed in the hope that it will be useful,
11*ea1ab4cfSStacey Son  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12*ea1ab4cfSStacey Son  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13*ea1ab4cfSStacey Son  *  GNU General Public License for more details.
14*ea1ab4cfSStacey Son  *
15*ea1ab4cfSStacey Son  *  You should have received a copy of the GNU General Public License
16*ea1ab4cfSStacey Son  *  along with this program; if not, see <http://www.gnu.org/licenses/>.
17*ea1ab4cfSStacey Son  */
180c6940d0SLluís Vilanova #ifndef TARGET_SYSCALL_H
190c6940d0SLluís Vilanova #define TARGET_SYSCALL_H
200c6940d0SLluís Vilanova 
210c6940d0SLluís Vilanova #define __USER_CS	(0x33)
220c6940d0SLluís Vilanova #define __USER_DS	(0x2B)
230c6940d0SLluís Vilanova 
240c6940d0SLluís Vilanova struct target_pt_regs {
250c6940d0SLluís Vilanova 	abi_ulong r15;
260c6940d0SLluís Vilanova 	abi_ulong r14;
270c6940d0SLluís Vilanova 	abi_ulong r13;
280c6940d0SLluís Vilanova 	abi_ulong r12;
290c6940d0SLluís Vilanova 	abi_ulong rbp;
300c6940d0SLluís Vilanova 	abi_ulong rbx;
310c6940d0SLluís Vilanova /* arguments: non interrupts/non tracing syscalls only save up to here */
320c6940d0SLluís Vilanova 	abi_ulong r11;
330c6940d0SLluís Vilanova 	abi_ulong r10;
340c6940d0SLluís Vilanova 	abi_ulong r9;
350c6940d0SLluís Vilanova 	abi_ulong r8;
360c6940d0SLluís Vilanova 	abi_ulong rax;
370c6940d0SLluís Vilanova 	abi_ulong rcx;
380c6940d0SLluís Vilanova 	abi_ulong rdx;
390c6940d0SLluís Vilanova 	abi_ulong rsi;
400c6940d0SLluís Vilanova 	abi_ulong rdi;
410c6940d0SLluís Vilanova 	abi_ulong orig_rax;
420c6940d0SLluís Vilanova /* end of arguments */
430c6940d0SLluís Vilanova /* cpu exception frame or undefined */
440c6940d0SLluís Vilanova 	abi_ulong rip;
450c6940d0SLluís Vilanova 	abi_ulong cs;
460c6940d0SLluís Vilanova 	abi_ulong eflags;
470c6940d0SLluís Vilanova 	abi_ulong rsp;
480c6940d0SLluís Vilanova 	abi_ulong ss;
490c6940d0SLluís Vilanova /* top of stack page */
500c6940d0SLluís Vilanova };
510c6940d0SLluís Vilanova 
520c6940d0SLluís Vilanova /* Maximum number of LDT entries supported. */
530c6940d0SLluís Vilanova #define TARGET_LDT_ENTRIES	8192
540c6940d0SLluís Vilanova /* The size of each LDT entry. */
550c6940d0SLluís Vilanova #define TARGET_LDT_ENTRY_SIZE	8
560c6940d0SLluís Vilanova 
570c6940d0SLluís Vilanova #define TARGET_GDT_ENTRIES 16
580c6940d0SLluís Vilanova #define TARGET_GDT_ENTRY_TLS_ENTRIES 3
590c6940d0SLluís Vilanova #define TARGET_GDT_ENTRY_TLS_MIN 12
600c6940d0SLluís Vilanova #define TARGET_GDT_ENTRY_TLS_MAX 14
610c6940d0SLluís Vilanova 
620c6940d0SLluís Vilanova #if 0 // Redefine this
630c6940d0SLluís Vilanova struct target_modify_ldt_ldt_s {
640c6940d0SLluís Vilanova 	unsigned int  entry_number;
650c6940d0SLluís Vilanova         abi_ulong     base_addr;
660c6940d0SLluís Vilanova 	unsigned int  limit;
670c6940d0SLluís Vilanova 	unsigned int  seg_32bit:1;
680c6940d0SLluís Vilanova 	unsigned int  contents:2;
690c6940d0SLluís Vilanova 	unsigned int  read_exec_only:1;
700c6940d0SLluís Vilanova 	unsigned int  limit_in_pages:1;
710c6940d0SLluís Vilanova 	unsigned int  seg_not_present:1;
720c6940d0SLluís Vilanova 	unsigned int  useable:1;
730c6940d0SLluís Vilanova 	unsigned int  lm:1;
740c6940d0SLluís Vilanova };
750c6940d0SLluís Vilanova #else
760c6940d0SLluís Vilanova struct target_modify_ldt_ldt_s {
770c6940d0SLluís Vilanova 	unsigned int  entry_number;
780c6940d0SLluís Vilanova         abi_ulong     base_addr;
790c6940d0SLluís Vilanova 	unsigned int  limit;
800c6940d0SLluís Vilanova         unsigned int flags;
810c6940d0SLluís Vilanova };
820c6940d0SLluís Vilanova #endif
830c6940d0SLluís Vilanova 
840c6940d0SLluís Vilanova struct target_ipc64_perm
850c6940d0SLluís Vilanova {
860c6940d0SLluís Vilanova 	int		key;
870c6940d0SLluís Vilanova 	uint32_t	uid;
880c6940d0SLluís Vilanova 	uint32_t	gid;
890c6940d0SLluís Vilanova 	uint32_t	cuid;
900c6940d0SLluís Vilanova 	uint32_t	cgid;
910c6940d0SLluís Vilanova 	unsigned short		mode;
920c6940d0SLluís Vilanova 	unsigned short		__pad1;
930c6940d0SLluís Vilanova 	unsigned short		seq;
940c6940d0SLluís Vilanova 	unsigned short		__pad2;
950c6940d0SLluís Vilanova 	abi_ulong		__unused1;
960c6940d0SLluís Vilanova 	abi_ulong		__unused2;
970c6940d0SLluís Vilanova };
980c6940d0SLluís Vilanova 
990c6940d0SLluís Vilanova struct target_msqid64_ds {
1000c6940d0SLluís Vilanova 	struct target_ipc64_perm msg_perm;
1010c6940d0SLluís Vilanova 	unsigned int msg_stime;	/* last msgsnd time */
1020c6940d0SLluís Vilanova 	unsigned int msg_rtime;	/* last msgrcv time */
1030c6940d0SLluís Vilanova 	unsigned int msg_ctime;	/* last change time */
1040c6940d0SLluís Vilanova 	abi_ulong  msg_cbytes;	/* current number of bytes on queue */
1050c6940d0SLluís Vilanova 	abi_ulong  msg_qnum;	/* number of messages in queue */
1060c6940d0SLluís Vilanova 	abi_ulong  msg_qbytes;	/* max number of bytes on queue */
1070c6940d0SLluís Vilanova 	unsigned int msg_lspid;	/* pid of last msgsnd */
1080c6940d0SLluís Vilanova 	unsigned int msg_lrpid;	/* last receive pid */
1090c6940d0SLluís Vilanova 	abi_ulong  __unused4;
1100c6940d0SLluís Vilanova 	abi_ulong  __unused5;
1110c6940d0SLluís Vilanova };
1120c6940d0SLluís Vilanova 
1130c6940d0SLluís Vilanova /* FreeBSD sysarch(2) */
1140c6940d0SLluís Vilanova #define TARGET_FREEBSD_I386_GET_LDT	0
1150c6940d0SLluís Vilanova #define TARGET_FREEBSD_I386_SET_LDT	1
1160c6940d0SLluís Vilanova 				/* I386_IOPL */
1170c6940d0SLluís Vilanova #define TARGET_FREEBSD_I386_GET_IOPERM	3
1180c6940d0SLluís Vilanova #define TARGET_FREEBSD_I386_SET_IOPERM	4
1190c6940d0SLluís Vilanova 				/* xxxxx */
1200c6940d0SLluís Vilanova #define TARGET_FREEBSD_I386_GET_FSBASE	7
1210c6940d0SLluís Vilanova #define TARGET_FREEBSD_I386_SET_FSBASE	8
1220c6940d0SLluís Vilanova #define TARGET_FREEBSD_I386_GET_GSBASE	9
1230c6940d0SLluís Vilanova #define TARGET_FREEBSD_I386_SET_GSBASE	10
1240c6940d0SLluís Vilanova 
1250c6940d0SLluís Vilanova #define TARGET_FREEBSD_AMD64_GET_FSBASE	128
1260c6940d0SLluís Vilanova #define TARGET_FREEBSD_AMD64_SET_FSBASE	129
1270c6940d0SLluís Vilanova #define TARGET_FREEBSD_AMD64_GET_GSBASE	130
1280c6940d0SLluís Vilanova #define TARGET_FREEBSD_AMD64_SET_GSBASE	131
1290c6940d0SLluís Vilanova 
1300c6940d0SLluís Vilanova 
1310c6940d0SLluís Vilanova #define UNAME_MACHINE           "x86_64"
132*ea1ab4cfSStacey Son #define TARGET_HW_MACHINE       "amd64"
133*ea1ab4cfSStacey Son #define TARGET_HW_MACHINE_ARCH  "amd64"
1340c6940d0SLluís Vilanova 
1350c6940d0SLluís Vilanova #define TARGET_ARCH_SET_GS 0x1001
1360c6940d0SLluís Vilanova #define TARGET_ARCH_SET_FS 0x1002
1370c6940d0SLluís Vilanova #define TARGET_ARCH_GET_FS 0x1003
1380c6940d0SLluís Vilanova #define TARGET_ARCH_GET_GS 0x1004
1390c6940d0SLluís Vilanova 
1400c6940d0SLluís Vilanova #endif /* TARGET_SYSCALL_H */
141