xref: /qemu/bsd-user/x86_64/target_arch_thread.h (revision a8fe6d5d627f2fa9136dc1255e6dc7c67a0c45c3)
1*a8fe6d5dSWarner Losh /*
2*a8fe6d5dSWarner Losh  *  x86_64 thread support
3*a8fe6d5dSWarner Losh  *
4*a8fe6d5dSWarner Losh  *  Copyright (c) 2013 Stacey D. Son
5*a8fe6d5dSWarner Losh  *
6*a8fe6d5dSWarner Losh  *  This program is free software; you can redistribute it and/or modify
7*a8fe6d5dSWarner Losh  *  it under the terms of the GNU General Public License as published by
8*a8fe6d5dSWarner Losh  *  the Free Software Foundation; either version 2 of the License, or
9*a8fe6d5dSWarner Losh  *  (at your option) any later version.
10*a8fe6d5dSWarner Losh  *
11*a8fe6d5dSWarner Losh  *  This program is distributed in the hope that it will be useful,
12*a8fe6d5dSWarner Losh  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13*a8fe6d5dSWarner Losh  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14*a8fe6d5dSWarner Losh  *  GNU General Public License for more details.
15*a8fe6d5dSWarner Losh  *
16*a8fe6d5dSWarner Losh  *  You should have received a copy of the GNU General Public License
17*a8fe6d5dSWarner Losh  *  along with this program; if not, see <http://www.gnu.org/licenses/>.
18*a8fe6d5dSWarner Losh  */
19*a8fe6d5dSWarner Losh #ifndef _TARGET_ARCH_THREAD_H_
20*a8fe6d5dSWarner Losh #define _TARGET_ARCH_THREAD_H_
21*a8fe6d5dSWarner Losh 
22*a8fe6d5dSWarner Losh /* Compare to vm_machdep.c cpu_set_upcall_kse() */
23*a8fe6d5dSWarner Losh static inline void target_thread_set_upcall(CPUX86State *regs, abi_ulong entry,
24*a8fe6d5dSWarner Losh     abi_ulong arg, abi_ulong stack_base, abi_ulong stack_size)
25*a8fe6d5dSWarner Losh {
26*a8fe6d5dSWarner Losh     /* XXX */
27*a8fe6d5dSWarner Losh }
28*a8fe6d5dSWarner Losh 
29*a8fe6d5dSWarner Losh static inline void target_thread_init(struct target_pt_regs *regs,
30*a8fe6d5dSWarner Losh     struct image_info *infop)
31*a8fe6d5dSWarner Losh {
32*a8fe6d5dSWarner Losh     regs->rax = 0;
33*a8fe6d5dSWarner Losh     regs->rsp = infop->start_stack;
34*a8fe6d5dSWarner Losh     regs->rip = infop->entry;
35*a8fe6d5dSWarner Losh     if (bsd_type == target_freebsd) {
36*a8fe6d5dSWarner Losh         regs->rdi = infop->start_stack;
37*a8fe6d5dSWarner Losh     }
38*a8fe6d5dSWarner Losh }
39*a8fe6d5dSWarner Losh 
40*a8fe6d5dSWarner Losh #endif /* !_TARGET_ARCH_THREAD_H_ */
41