本文整理汇总了C++中DOMPRINTF函数的典型用法代码示例。如果您正苦于以下问题:C++ DOMPRINTF函数的具体用法?C++ DOMPRINTF怎么用?C++ DOMPRINTF使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了DOMPRINTF函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: vcpu_arm64
static int vcpu_arm64(struct xc_dom_image *dom, void *ptr)
{
vcpu_guest_context_t *ctxt = ptr;
DOMPRINTF_CALLED(dom->xch);
/* clear everything */
memset(ctxt, 0, sizeof(*ctxt));
ctxt->user_regs.pc64 = dom->parms.virt_entry;
/* Linux boot protocol. See linux.Documentation/arm64/booting.txt. */
ctxt->user_regs.x0 = dom->devicetree_blob ?
dom->devicetree_seg.vstart : 0xffffffff;
ctxt->user_regs.x1 = 0;
ctxt->user_regs.x2 = 0;
ctxt->user_regs.x3 = 0;
DOMPRINTF("DTB %"PRIx64, ctxt->user_regs.x0);
ctxt->sctlr = SCTLR_GUEST_INIT;
ctxt->ttbr0 = 0;
ctxt->ttbr1 = 0;
ctxt->ttbcr = 0; /* Defined Reset Value */
ctxt->user_regs.cpsr = PSR_GUEST64_INIT;
ctxt->flags = VGCF_online;
DOMPRINTF("Initial state CPSR %#"PRIx32" PC %#"PRIx64,
ctxt->user_regs.cpsr, ctxt->user_regs.pc64);
return 0;
}
示例2: malloc
void *xc_dom_malloc_page_aligned(struct xc_dom_image *dom, size_t size)
{
struct xc_dom_mem *block;
block = malloc(sizeof(*block));
if ( block == NULL )
{
DOMPRINTF("%s: allocation failed", __FUNCTION__);
return NULL;
}
memset(block, 0, sizeof(*block));
block->mmap_len = size;
block->mmap_ptr = mmap(NULL, block->mmap_len,
PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON,
-1, 0);
if ( block->mmap_ptr == MAP_FAILED )
{
DOMPRINTF("%s: mmap failed", __FUNCTION__);
free(block);
return NULL;
}
block->next = dom->memblocks;
dom->memblocks = block;
dom->alloc_malloc += sizeof(*block);
dom->alloc_mem_map += block->mmap_len;
if ( size > (100 * 1024) )
print_mem(dom, __FUNCTION__, size);
return block->mmap_ptr;
}
示例3: print_mem
static void print_mem(struct xc_dom_image *dom, const char *name, size_t mem)
{
if ( mem > (32 * 1024 * 1024) )
DOMPRINTF("%-24s : %zd MB", name, mem / (1024 * 1024));
else if ( mem > (32 * 1024) )
DOMPRINTF("%-24s : %zd kB", name, mem / 1024);
else
DOMPRINTF("%-24s : %zd bytes", name, mem);
}
示例4: xc_dom_log_memory_footprint
void xc_dom_log_memory_footprint(struct xc_dom_image *dom)
{
DOMPRINTF("domain builder memory footprint");
DOMPRINTF(" allocated");
print_mem(dom, " malloc", dom->alloc_malloc);
print_mem(dom, " anon mmap", dom->alloc_mem_map);
DOMPRINTF(" mapped");
print_mem(dom, " file mmap", dom->alloc_file_map);
print_mem(dom, " domU mmap", dom->alloc_domU_map);
}
示例5: xc_dom_alloc_segment
int xc_dom_alloc_segment(struct xc_dom_image *dom,
struct xc_dom_seg *seg, char *name,
xen_vaddr_t start, xen_vaddr_t size)
{
unsigned int page_size = XC_DOM_PAGE_SIZE(dom);
xen_pfn_t pages;
void *ptr;
if ( start && xc_dom_alloc_pad(dom, start) )
return -1;
pages = (size + page_size - 1) / page_size;
start = dom->virt_alloc_end;
seg->pfn = dom->pfn_alloc_end;
seg->pages = pages;
if ( xc_dom_chk_alloc_pages(dom, name, pages) )
return -1;
/* map and clear pages */
ptr = xc_dom_seg_to_ptr(dom, seg);
if ( ptr == NULL )
return -1;
memset(ptr, 0, pages * page_size);
seg->vstart = start;
seg->vend = dom->virt_alloc_end;
DOMPRINTF("%-20s: %-12s : 0x%" PRIx64 " -> 0x%" PRIx64
" (pfn 0x%" PRIpfn " + 0x%" PRIpfn " pages)",
__FUNCTION__, name, seg->vstart, seg->vend, seg->pfn, pages);
return 0;
}
示例6: xc_try_lzo1x_decode
static int xc_try_lzo1x_decode(
struct xc_dom_image *dom, void **blob, size_t *size)
{
DOMPRINTF("%s: LZO1x decompress support unavailable\n",
__FUNCTION__);
return -1;
}
示例7: xc_try_bzip2_decode
static int xc_try_bzip2_decode(
struct xc_dom_image *dom, void **blob, size_t *size)
{
DOMPRINTF("%s: BZIP2 decompress support unavailable",
__FUNCTION__);
return -1;
}
示例8: xc_dom_compat_check
int xc_dom_compat_check(struct xc_dom_image *dom)
{
xen_capabilities_info_t xen_caps;
char *item, *ptr;
int match, found = 0;
strncpy(xen_caps, dom->xen_caps, XEN_CAPABILITIES_INFO_LEN - 1);
xen_caps[XEN_CAPABILITIES_INFO_LEN - 1] = '\0';
for ( item = strtok_r(xen_caps, " ", &ptr);
item != NULL ; item = strtok_r(NULL, " ", &ptr) )
{
match = !strcmp(dom->guest_type, item);
DOMPRINTF("%s: supported guest type: %s%s", __FUNCTION__,
item, match ? " <= matches" : "");
if ( match )
found++;
}
if ( !found )
xc_dom_panic(dom->xch, XC_INVALID_KERNEL,
"%s: guest type %s not supported by xen kernel, sorry",
__FUNCTION__, dom->guest_type);
return found;
}
示例9: xc_dom_unmap_one
void xc_dom_unmap_one(struct xc_dom_image *dom, xen_pfn_t pfn)
{
unsigned int page_shift = XC_DOM_PAGE_SHIFT(dom);
struct xc_dom_phys *phys, *prev = NULL;
for ( phys = dom->phys_pages; phys != NULL; phys = phys->next )
{
if ( (pfn >= phys->first) && (pfn < (phys->first + phys->count)) )
break;
prev = phys;
}
if ( !phys )
{
DOMPRINTF("%s: Huh? no mapping with pfn 0x%" PRIpfn "",
__FUNCTION__, pfn);
return;
}
munmap(phys->ptr, phys->count << page_shift);
if ( prev )
prev->next = phys->next;
else
dom->phys_pages = phys->next;
xc_domain_cacheflush(dom->xch, dom->guest_domid, phys->first, phys->count);
}
示例10: xc_dom_parse_zimage32_kernel
static int xc_dom_parse_zimage32_kernel(struct xc_dom_image *dom)
{
uint32_t *zimage;
uint32_t start, entry_addr;
uint64_t v_start, v_end;
uint64_t rambase = dom->rambase_pfn << XC_PAGE_SHIFT;
DOMPRINTF_CALLED(dom->xch);
zimage = (uint32_t *)dom->kernel_blob;
/* Do not load kernel at the very first RAM address */
v_start = rambase + 0x8000;
if ( dom->kernel_size > UINT64_MAX - v_start )
{
DOMPRINTF("%s: kernel is too large\n", __FUNCTION__);
return -EINVAL;
}
v_end = v_start + dom->kernel_size;
/*
* If start is invalid then the guest will start at some invalid
* address and crash, but this happens in guest context so doesn't
* concern us here.
*/
start = zimage[ZIMAGE32_START_OFFSET/4];
if (start == 0)
entry_addr = v_start;
else
entry_addr = start;
/* find kernel segment */
dom->kernel_seg.vstart = v_start;
dom->kernel_seg.vend = v_end;
dom->parms.virt_entry = entry_addr;
dom->parms.virt_base = rambase;
dom->guest_type = "xen-3.0-armv7l";
DOMPRINTF("%s: %s: 0x%" PRIx64 " -> 0x%" PRIx64 "",
__FUNCTION__, dom->guest_type,
dom->kernel_seg.vstart, dom->kernel_seg.vend);
return 0;
}
示例11: xc_dom_alloc_segment
int xc_dom_alloc_segment(struct xc_dom_image *dom,
struct xc_dom_seg *seg, char *name,
xen_vaddr_t start, xen_vaddr_t size)
{
unsigned int page_size = XC_DOM_PAGE_SIZE(dom);
xen_pfn_t pages = (size + page_size - 1) / page_size;
xen_pfn_t pfn;
void *ptr;
if ( start == 0 )
start = dom->virt_alloc_end;
if ( start & (page_size - 1) )
{
xc_dom_panic(dom->xch, XC_INTERNAL_ERROR,
"%s: segment start isn't page aligned (0x%" PRIx64 ")",
__FUNCTION__, start);
return -1;
}
if ( start < dom->virt_alloc_end )
{
xc_dom_panic(dom->xch, XC_INTERNAL_ERROR,
"%s: segment start too low (0x%" PRIx64 " < 0x%" PRIx64
")", __FUNCTION__, start, dom->virt_alloc_end);
return -1;
}
seg->vstart = start;
pfn = (seg->vstart - dom->parms.virt_base) / page_size;
seg->pfn = pfn + dom->rambase_pfn;
if ( pages > dom->total_pages || /* multiple test avoids overflow probs */
pfn > dom->total_pages ||
pages > dom->total_pages - pfn)
{
xc_dom_panic(dom->xch, XC_OUT_OF_MEMORY,
"%s: segment %s too large (0x%"PRIpfn" > "
"0x%"PRIpfn" - 0x%"PRIpfn" pages)",
__FUNCTION__, name, pages, dom->total_pages, pfn);
return -1;
}
seg->vend = start + pages * page_size;
dom->virt_alloc_end = seg->vend;
if (dom->allocate)
dom->allocate(dom, dom->virt_alloc_end);
DOMPRINTF("%-20s: %-12s : 0x%" PRIx64 " -> 0x%" PRIx64
" (pfn 0x%" PRIpfn " + 0x%" PRIpfn " pages)",
__FUNCTION__, name, seg->vstart, seg->vend, seg->pfn, pages);
/* map and clear pages */
ptr = xc_dom_seg_to_ptr(dom, seg);
if ( ptr == NULL )
return -1;
memset(ptr, 0, pages * page_size);
return 0;
}
示例12: xc_dom_kernel_file
int xc_dom_kernel_file(struct xc_dom_image *dom, const char *filename)
{
DOMPRINTF("%s: filename=\"%s\"", __FUNCTION__, filename);
dom->kernel_blob = xc_dom_malloc_filemap(dom, filename, &dom->kernel_size,
dom->max_kernel_size);
if ( dom->kernel_blob == NULL )
return -1;
return xc_dom_try_gunzip(dom, &dom->kernel_blob, &dom->kernel_size);
}
示例13: xc_dom_load_bin_kernel
static int xc_dom_load_bin_kernel(struct xc_dom_image *dom)
{
struct xen_bin_image_table *image_info;
char *image = dom->kernel_blob;
char *dest;
size_t image_size = dom->kernel_size;
size_t dest_size;
uint32_t start_addr;
uint32_t load_end_addr;
uint32_t bss_end_addr;
uint32_t skip, text_size, bss_size;
image_info = find_table(dom);
if ( !image_info )
return -EINVAL;
start_addr = image_info->header_addr - ((char *)image_info - image);
load_end_addr = image_info->load_end_addr ?: start_addr + image_size;
bss_end_addr = image_info->bss_end_addr ?: load_end_addr;
/* It's possible that we need to skip the first part of the image */
skip = image_info->load_addr - start_addr;
text_size = load_end_addr - image_info->load_addr;
bss_size = bss_end_addr - load_end_addr;
DOMPRINTF("%s: calculated sizes", __FUNCTION__);
DOMPRINTF(" skip: 0x%" PRIx32 "", skip);
DOMPRINTF(" text_size: 0x%" PRIx32 "", text_size);
DOMPRINTF(" bss_size: 0x%" PRIx32 "", bss_size);
dest = xc_dom_vaddr_to_ptr(dom, dom->kernel_seg.vstart, &dest_size);
if ( dest == NULL )
{
DOMPRINTF("%s: xc_dom_vaddr_to_ptr(dom, dom->kernel_seg.vstart)"
" => NULL", __FUNCTION__);
return -EINVAL;
}
if ( dest_size < text_size ||
dest_size - text_size < bss_size )
{
DOMPRINTF("%s: mapped region is too small for image", __FUNCTION__);
return -EINVAL;
}
if ( image_size < skip ||
image_size - skip < text_size )
{
DOMPRINTF("%s: image is too small for declared text size",
__FUNCTION__);
return -EINVAL;
}
memcpy(dest, image + skip, text_size);
memset(dest + text_size, 0, bss_size);
return 0;
}
示例14: while
static struct xc_dom_loader *xc_dom_find_loader(struct xc_dom_image *dom)
{
struct xc_dom_loader *loader = first_loader;
while ( loader != NULL )
{
DOMPRINTF("%s: trying %s loader ... ", __FUNCTION__, loader->name);
if ( loader->probe(dom) == 0 )
{
DOMPRINTF("loader probe OK");
return loader;
}
DOMPRINTF("loader probe failed");
loader = loader->next;
}
xc_dom_panic(dom->xch,
XC_INVALID_KERNEL, "%s: no loader found", __FUNCTION__);
return NULL;
}
示例15: xc_dom_load_elf_symtab
static elf_errorstatus xc_dom_load_elf_symtab(struct xc_dom_image *dom,
struct elf_binary *elf, bool load)
{
struct elf_binary syms;
ELF_HANDLE_DECL(elf_shdr) shdr; ELF_HANDLE_DECL(elf_shdr) shdr2;
xen_vaddr_t symtab, maxaddr;
elf_ptrval hdr;
size_t size;
unsigned h, count, type, i, tables = 0;
unsigned long *strtab_referenced = NULL;
if ( elf_swap(elf) )
{
DOMPRINTF("%s: non-native byte order, bsd symtab not supported",
__FUNCTION__);
return 0;
}
size = elf->bsd_symtab_pend - elf->bsd_symtab_pstart;
if ( load )
{
char *hdr_ptr;
size_t allow_size;
if ( !dom->bsd_symtab_start )
return 0;
hdr_ptr = xc_dom_vaddr_to_ptr(dom, dom->bsd_symtab_start, &allow_size);
if ( hdr_ptr == NULL )
{
DOMPRINTF("%s: xc_dom_vaddr_to_ptr(dom,dom->bsd_symtab_start"
" => NULL", __FUNCTION__);
return -1;
}
elf->caller_xdest_base = hdr_ptr;
elf->caller_xdest_size = allow_size;
hdr = ELF_REALPTR2PTRVAL(hdr_ptr);
elf_store_val(elf, unsigned, hdr, size - sizeof(unsigned));
}
else
{