// vi:set ft=cpp: -*- Mode: C++ -*-
/*
 * (c) 2008-2009 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/re/env>
#include <l4/re/rm>

namespace Ldr {
template< typename Base >
class Local_app_model : public Base
{
public:
  template< typename A1, typename A2 >
  Local_app_model(A1 const &a1, A2 const &a2) : Base(a1, a2) {}

  void prog_reserve_utcb_area()
  {}

  void prog_attach_kip()
  {
    if (Base::prog_info()->kip == l4_addr_t(l4re_kip()))
      return;
    Base::prog_attach_ds(Base::prog_info()->kip, L4_PAGESIZE,
                         Base::local_kip_ds(), 0,
                         L4Re::Rm::F::RX,
                         "[KIP]", 0, "attaching KIP segment");
  }

  void prog_attach_stack(typename Base::Dataspace)
  {}

  void alloc_prog()
  {}

  constexpr l4_addr_t proc_default_reloc() const
  {
    // The first page is reserved. Start searching at the next super page
    // boundary...
    return L4_SUPERPAGESIZE;
  }
};


}
