当前位置: 首页>>代码示例>>C++>>正文


C++ Capability::valid方法代码示例

本文整理汇总了C++中Capability::valid方法的典型用法代码示例。如果您正苦于以下问题:C++ Capability::valid方法的具体用法?C++ Capability::valid怎么用?C++ Capability::valid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Capability的用法示例。


在下文中一共展示了Capability::valid方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1:

bool
Generic_obj_space<SPACE>::v_lookup(Addr const &virt, Phys_addr *phys = 0,
                                   Size *size = 0, unsigned *attribs = 0)
{
  if (size) size->set_value(1);
  Entry *cap;

  if (Optimize_local
      && mem_space() == Mem_space::current_mem_space(current_cpu()))
    cap = cap_virt(virt.value());
  else
    cap = get_cap(virt.value());

  if (EXPECT_FALSE(!cap))
    {
      if (size) size->set_value(Caps_per_page);
      return false;
    }

  if (Optimize_local)
    {
      Capability c = Mem_layout::read_special_safe((Capability*)cap);

      if (phys) *phys = c.obj();
      if (c.valid() && attribs) *attribs = c.rights();
      return c.valid();
    }
  else
    {
      Obj::set_entry(virt, cap);
      if (phys) *phys = cap->obj();
      if (cap->valid() && attribs) *attribs = cap->rights();
      return cap->valid();
    }
}
开发者ID:ExpressOS,项目名称:third_party-l4re,代码行数:35,代码来源:obj_space-virt.cpp

示例2: assert

Obj_space_virt<SPACE>::v_delete(V_pfn virt, Order size,
                                   L4_fpage::Rights page_attribs)
{
  (void)size;
  assert (size == Order(0));

  Entry *c;
  if (Optimize_local
      && SPACE::mem_space(this) == Mem_space::current_mem_space(current_cpu()))
    {
      c = cap_virt(virt);
      if (!c)
	return L4_fpage::Rights(0);

      Capability cap = Mem_layout::read_special_safe((Capability*)c);
      if (!cap.valid())
	return L4_fpage::Rights(0);
    }
  else
    c = get_cap(virt);

  if (c && c->valid())
    {
      if (page_attribs & L4_fpage::Rights::R())
        c->invalidate();
      else
        c->del_rights(page_attribs & L4_fpage::Rights::CWSD());
    }

  return L4_fpage::Rights(0);
}
开发者ID:KyulingLee,项目名称:Fiasco.OC,代码行数:31,代码来源:obj_space_virt_util.cpp

示例3: assert

unsigned long
Generic_obj_space<SPACE>::v_delete(Page_number virt, Size size,
                                   unsigned long page_attribs = L4_fpage::CRWSD)
{
  (void)size;
  assert (size.value() == 1);

  Entry *c;
  if (Optimize_local
      && mem_space() == Mem_space::current_mem_space(current_cpu()))
    {
      c = cap_virt(virt.value());
      if (!c)
	return 0;

      Capability cap = Mem_layout::read_special_safe((Capability*)c);
      if (!cap.valid())
	return 0;
    }
  else
    c = get_cap(virt.value());

  if (c && c->valid())
    {
      if (page_attribs & L4_fpage::R)
        c->invalidate();
      else
        c->del_rights(page_attribs & L4_fpage::CWSD);
    }

  return 0;
}
开发者ID:ExpressOS,项目名称:third_party-l4re,代码行数:32,代码来源:obj_space-virt.cpp

示例4:

Obj_space_phys<SPACE>::v_lookup(V_pfn const &virt, Phys_addr *phys,
                                Page_order *size, Attr *attribs)
{
  if (size) *size = Page_order(0);
  Entry *cap = get_cap(virt);

  if (EXPECT_FALSE(!cap))
    {
      if (size) *size = Page_order(Obj::Caps_per_page_ld2);
      return false;
    }

  Capability c = *cap;

  Obj::set_entry(virt, cap);
  if (phys) *phys = c.obj();
  if (c.valid() && attribs) *attribs = cap->rights();
  return c.valid();
}
开发者ID:KyulingLee,项目名称:Fiasco.OC,代码行数:19,代码来源:obj_space_phys_util.cpp

示例5:

bool
Generic_obj_space<SPACE>::v_lookup(Addr const &virt, Phys_addr *phys = 0,
                                   Size *size = 0, unsigned *attribs = 0)
{
  if (size) *size = Size::create(1);
  Entry *cap = get_cap(virt.value());

  if (EXPECT_FALSE(!cap))
    {
      if (size) *size = Size::create(Caps_per_page);
      return false;
    }

  Capability c = *cap;

  Obj::set_entry(virt, cap);
  if (phys) *phys = c.obj();
  if (c.valid() && attribs) *attribs = cap->rights();
  return c.valid();
}
开发者ID:MicroTrustRepos,项目名称:microkernel,代码行数:20,代码来源:obj_space-phys.cpp

示例6:

Obj_space_virt<SPACE>::v_lookup(V_pfn const &virt, Phys_addr *phys,
                                   Page_order *size, Attr *attribs)
{
  if (size) *size = Order(0);
  Entry *cap;

  if (Optimize_local
      && SPACE::mem_space(this) == Mem_space::current_mem_space(current_cpu()))
    cap = cap_virt(virt);
  else
    cap = get_cap(virt);

  if (EXPECT_FALSE(!cap))
    {
      if (size) *size = Order(Obj::Caps_per_page_ld2);
      return false;
    }

  if (Optimize_local)
    {
      Capability c = Mem_layout::read_special_safe((Capability*)cap);

      if (phys) *phys = c.obj();
      if (c.valid() && attribs)
        *attribs = Attr(c.rights());
      return c.valid();
    }
  else
    {
      Obj::set_entry(virt, cap);
      if (phys) *phys = cap->obj();
      if (cap->valid() && attribs)
        *attribs = Attr(cap->rights());
      return cap->valid();
    }
}
开发者ID:KyulingLee,项目名称:Fiasco.OC,代码行数:36,代码来源:obj_space_virt_util.cpp

示例7: assert

Obj_space_phys<SPACE>::v_delete(V_pfn virt, Page_order size,
                                   L4_fpage::Rights page_attribs = L4_fpage::Rights::FULL())
{
  (void)size;
  assert (size == Page_order(0));
  Capability *c = get_cap(virt);

  if (c && c->valid())
    {
      if (page_attribs & L4_fpage::Rights::R())
        c->invalidate();
      else
	c->del_rights(page_attribs);
    }

  return L4_fpage::Rights(0);
}
开发者ID:KyulingLee,项目名称:Fiasco.OC,代码行数:17,代码来源:obj_space_phys_util.cpp

示例8: assert

unsigned long
Generic_obj_space<SPACE>::v_delete(Page_number virt, Size size,
                                   unsigned long page_attribs = L4_fpage::RWX)
{
  (void)size;
  assert (size.value() == 1);
  Capability *c = get_cap(virt.value());

  if (c && c->valid())
    {
      if (page_attribs & L4_fpage::R)
        c->invalidate();
      else
	c->del_rights(page_attribs & L4_fpage::WX);
    }

  return 0;
}
开发者ID:MicroTrustRepos,项目名称:microkernel,代码行数:18,代码来源:obj_space-phys.cpp


注:本文中的Capability::valid方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。