本文整理汇总了C++中HeaderList::getHead方法的典型用法代码示例。如果您正苦于以下问题:C++ HeaderList::getHead方法的具体用法?C++ HeaderList::getHead怎么用?C++ HeaderList::getHead使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HeaderList
的用法示例。
在下文中一共展示了HeaderList::getHead方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void *khrn_hw_unaddr(uint32_t addr)
{
ghw_error_e result;
#ifdef FILE_DUMP
fprintf(fp_dump, "khrn_hw_unaddr %x\n", addr);
#endif
void* virt;
unsigned int phys = (unsigned int) addr;
HeaderNode* head = mem_list.getHead();
while (head != NULL) {
MemHeader* header = head->get();
unsigned int pa = (unsigned int)header->getPhys();
if ( (pa <= phys) && (phys <= pa + header->getSize()) ) {
return ((unsigned char*)header->getVirt()) + (phys-pa);
}
head = head->getNext();
}
result = mem_allocator->phys2virt(phys, (void*&)virt);
if (result != GHW_ERROR_NONE) {
mem_allocator1->phys2virt(phys, (void*&)virt);
}
return virt;
}
示例2: khrn_hw_addr
unsigned int khrn_hw_addr(const void *addr)
{
ghw_error_e result;
#ifdef FILE_DUMP
fprintf(fp_dump, "khrn_hwaddr %x\n", addr);
#endif
u32 phys;
unsigned int virt = (unsigned int) addr;
HeaderNode* head = mem_list.getHead();
while (head != NULL) {
MemHeader* header = head->get();
unsigned int va = (unsigned int)header->getVirt();
if ( (va <= virt) && (virt <= va + header->getSize()) ) {
unsigned int out = header->getPhys() + (virt-va);
if (out == 0)
printf("input of %p out of ZERO!\n", addr);
return out;
}
head = head->getNext();
}
result = mem_allocator->virt2phys(phys, (void*)virt);
if (result != GHW_ERROR_NONE) {
result = mem_allocator1->virt2phys(phys, (void*)virt);
}
if (phys == 0)
printf("input of %p out of ZERO!\n", addr);
return phys;
}
示例3: mem_free_legacy
void mem_free_legacy(void *ptr)
{
#ifdef FILE_DUMP
fprintf(fp_dump, "mem_free_legacy %x\n", ptr);
#endif
u32 phys;
unsigned int virt = (unsigned int) ptr;
HeaderNode* head = mem_list.getHead();
while (head != NULL) {
MemHeader* header = head->get();
unsigned int va = (unsigned int)header->getVirt();
if ( (va <= virt) && (virt <= va + header->getSize()) ) {
header->release();
break;
}
head = head->getNext();
}
}