// vi:set ft=cpp: -*- Mode: C++ -*-
/**
 * \file
 * Virtualization interface
 */
/*
 * (c) 2008-2010 Adam Lackorzynski <adam@os.inf.tu-dresden.de>,
 *               Alexander Warg <warg@os.inf.tu-dresden.de>
 *     economic rights: Technische Universität Dresden (Germany)
 *
 * License: see LICENSE.spdx (in this directory or the directories above)
 */

#pragma once

#include <l4/sys/vm.h>
#include <l4/sys/task>

namespace L4 {

/**
 * Virtual machine host address space.
 * \ingroup l4_kernel_object_api
 *
 * L4::Vm is a specialisation of L4::Task, used for virtual machines. The
 * microkernel employs an appropriate page-table format for hosting VMs, such
 * as ePT on VT-x. On Arm, it offers a call to make the virtual GICC area
 * available to the VM.
 */
class Vm : public Kobject_t<Vm, Task, L4_PROTO_VM>
{
public:
#if defined(__arm__) || defined(__aarch64__)
  /**
   * Map the GIC virtual CPU interface page to the task in case Fiasco
   * detected a GIC version 2.
   *
   * \param vgicc_fpage   Flexpage that describes an area in the address space
   *                      of the destination task to map the vGICC page to.
   * \utcb{utcb}
   *
   * \return Syscall return tag.
   */
  l4_msgtag_t vgicc_map(l4_fpage_t const vgicc_fpage,
                        l4_utcb_t *utcb = l4_utcb()) noexcept
  { return l4_task_vgicc_map_u(cap(), vgicc_fpage, utcb); }
#endif

protected:
  Vm();

private:
  Vm(Vm const &);
  void operator = (Vm const &);
};

};
