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=%x savedstate=%x label=%lx\n",
29 prefix, vcpu, vcpu->state, vcpu->saved_state, vcpu->i.label);
30 printf("%ssticky=%x user_task=%lx pfa=%lx\n",
31 prefix, vcpu->sticky_flags, vcpu->user_task << L4_CAP_SHIFT,
33 printf("%sentry_sp=%lx entry_ip=%lx\n",
34 prefix, vcpu->entry_sp, vcpu->entry_ip);
35 l4vcpu_print_state_arch(vcpu, prefix);
39 do_l4vcpu_ext_alloc(L4vcpu::Vcpu **vcpu,
41 L4::Cap<L4::Task> task,
42 L4::Cap<L4Re::Rm> rm) L4_NOTHROW
47 if ((r = L4Re::Util::kumem_alloc(&v, 0, task, rm)))
50 *vcpu = L4vcpu::Vcpu::cast(v);
51 *ext_state = v + L4_VCPU_OFFSET_EXT_STATE;
57 l4vcpu_ext_alloc(l4_vcpu_state_t **vcpu, l4_addr_t *ext_state,
58 l4_cap_idx_t task, l4_cap_idx_t regmgr) L4_NOTHROW
60 L4::Cap<L4::Task> t(task);
61 L4::Cap<L4Re::Rm> r(regmgr);
62 L4vcpu::Vcpu **v = reinterpret_cast<L4vcpu::Vcpu **>(vcpu);
63 return do_l4vcpu_ext_alloc(v, ext_state, t, r);
67 L4vcpu::Vcpu::ext_alloc(Vcpu **vcpu,
69 L4::Cap<L4::Task> task,
70 L4::Cap<L4Re::Rm> rm) throw()
72 return do_l4vcpu_ext_alloc(vcpu, ext_state, task, rm);