2 * (c) 2010 Adam Lackorzynski <adam@os.inf.tu-dresden.de>
3 * economic rights: Technische Universität Dresden (Germany)
5 * This file is part of TUD:OS and distributed under the terms of the
6 * GNU General Public License 2.
7 * Please see the COPYING-GPL-2 file for details.
9 * As a special exception, you may use this file as part of a free software
10 * library without restriction. Specifically, if other files instantiate
11 * templates or use macros or inline functions from this file, or you compile
12 * this file and link it with other files to produce an executable, this
13 * file does not by itself cause the resulting executable to be covered by
14 * the GNU General Public License. This exception does not however
15 * invalidate any other reasons why the executable file might be covered by
16 * the GNU General Public License.
19 #include <l4/vcpu/vcpu>
20 #include <l4/re/util/kumem_alloc>
25 l4vcpu_print_state(l4_vcpu_state_t *vcpu,
26 const char *prefix) L4_NOTHROW
28 printf("%svcpu=%p state=%lx savedstate=%lx label=%lx\n",
29 prefix, vcpu, vcpu->state, vcpu->saved_state, vcpu->i.label);
30 printf("%ssticky=%lx user_task=%lx\n",
31 prefix, vcpu->sticky_flags, vcpu->user_task << L4_CAP_SHIFT);
32 printf("%sentry_sp=%lx entry_ip=%lx\n",
33 prefix, vcpu->entry_sp, vcpu->entry_ip);
34 l4vcpu_print_state_arch(vcpu, prefix);
38 do_l4vcpu_ext_alloc(L4vcpu::Vcpu **vcpu,
40 L4::Cap<L4::Task> task,
41 L4::Cap<L4Re::Rm> rm) L4_NOTHROW
46 if ((r = L4Re::Util::kumem_alloc(&v, 0, task, rm)))
49 *vcpu = L4vcpu::Vcpu::cast(v);
50 *ext_state = v + L4_VCPU_OFFSET_EXT_STATE;
56 l4vcpu_ext_alloc(l4_vcpu_state_t **vcpu, l4_addr_t *ext_state,
57 l4_cap_idx_t task, l4_cap_idx_t regmgr) L4_NOTHROW
59 L4::Cap<L4::Task> t(task);
60 L4::Cap<L4Re::Rm> r(regmgr);
61 L4vcpu::Vcpu **v = reinterpret_cast<L4vcpu::Vcpu **>(vcpu);
62 return do_l4vcpu_ext_alloc(v, ext_state, t, r);
66 L4vcpu::Vcpu::ext_alloc(Vcpu **vcpu,
68 L4::Cap<L4::Task> task,
69 L4::Cap<L4Re::Rm> rm) throw()
71 return do_l4vcpu_ext_alloc(vcpu, ext_state, task, rm);