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