本文整理汇总了C++中MEM_ERROR函数的典型用法代码示例。如果您正苦于以下问题:C++ MEM_ERROR函数的具体用法?C++ MEM_ERROR怎么用?C++ MEM_ERROR使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了MEM_ERROR函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: k8_mc2_mce
static bool k8_mc2_mce(u16 ec, u8 xec)
{
bool ret = true;
if (xec == 0x1)
pr_cont(" in the write data buffers.\n");
else if (xec == 0x3)
pr_cont(" in the victim data buffers.\n");
else if (xec == 0x2 && MEM_ERROR(ec))
pr_cont(": %s error in the L2 cache tags.\n", R4_MSG(ec));
else if (xec == 0x0) {
if (TLB_ERROR(ec))
pr_cont(": %s error in a Page Descriptor Cache or "
"Guest TLB.\n", TT_MSG(ec));
else if (BUS_ERROR(ec))
pr_cont(": %s/ECC error in data read from NB: %s.\n",
R4_MSG(ec), PP_MSG(ec));
else if (MEM_ERROR(ec)) {
u8 r4 = R4(ec);
if (r4 >= 0x7)
pr_cont(": %s error during data copyback.\n",
R4_MSG(ec));
else if (r4 <= 0x1)
pr_cont(": %s parity/ECC error during data "
"access from L2.\n", R4_MSG(ec));
else
ret = false;
} else
ret = false;
} else
ret = false;
return ret;
}
示例2: qaeCryptoMemFree
void qaeCryptoMemFree(void *ptr)
{
int rc;
MEM_DEBUG("%s: Address: %p\n", __func__, ptr);
if (NULL == ptr) {
MEM_WARN("qaeCryptoMemFree trying to free NULL pointer.\n");
return;
}
MEM_DEBUG("%s: pthread_mutex_lock\n", __func__);
if ((rc = pthread_mutex_lock(&mem_mutex)) != 0) {
MEM_ERROR("pthread_mutex_lock: %s\n", strerror(rc));
return;
}
qaeMemFreeNUMA(&ptr);
if ((rc = pthread_mutex_unlock(&mem_mutex)) != 0) {
MEM_ERROR("pthread_mutex_unlock: %s\n", strerror(rc));
return;
}
MEM_DEBUG("%s: pthread_mutex_unlock\n", __func__);
}
示例3: malloc
PixBuf *pixbuf_new(int width, int height) {
PixBuf *pb = malloc(sizeof(PixBuf));
MEM_ERROR(pb);
pb->_ptr = malloc(width * height * sizeof(Pixel) + 15);
MEM_ERROR(pb->_ptr);
intptr_t adr = (intptr_t)pb->_ptr;
adr = (adr+15)&-16;
pb->array = (Pixel*)adr;
pb->width = width;
pb->height = height;
return pb;
}
示例4: k8_mc1_mce
static bool k8_mc1_mce(u16 ec, u8 xec)
{
u8 ll = LL(ec);
bool ret = true;
if (!MEM_ERROR(ec))
return false;
if (ll == 0x2)
pr_cont("during a linefill from L2.\n");
else if (ll == 0x1) {
switch (R4(ec)) {
case R4_IRD:
pr_cont("Parity error during data load.\n");
break;
case R4_EVICT:
pr_cont("Copyback Parity/Victim error.\n");
break;
case R4_SNOOP:
pr_cont("Tag Snoop error.\n");
break;
default:
ret = false;
break;
}
} else
ret = false;
return ret;
}
示例5: read_xattr_entry
/*
* construct the xattr_list entry from the fs xattr, including
* mapping name and prefix into a full name
*/
static int read_xattr_entry(struct xattr_list *xattr, struct squashfs_xattr_entry *entry, void *name) {
int i, len, type = entry->type & XATTR_PREFIX_MASK;
for (i = 0; prefix_table[i].type != -1; i++)
if (prefix_table[i].type == type)
break;
if (prefix_table[i].type == -1) {
ERROR("Unrecognised type in read_xattr_entry\n");
return 0;
}
len = strlen(prefix_table[i].prefix);
xattr->full_name = malloc(len + entry->size + 1);
if (xattr->full_name == NULL)
MEM_ERROR();
memcpy(xattr->full_name, prefix_table[i].prefix, len);
memcpy(xattr->full_name + len, name, entry->size);
xattr->full_name[len + entry->size] = '\0';
xattr->name = xattr->full_name + len;
xattr->size = entry->size;
xattr->type = type;
return 1;
}
示例6: f15h_mc1_mce
static bool f15h_mc1_mce(u16 ec, u8 xec)
{
bool ret = true;
if (!MEM_ERROR(ec))
return false;
switch (xec) {
case 0x0 ... 0xa:
pr_cont("%s.\n", f15h_mc1_mce_desc[xec]);
break;
case 0xd:
pr_cont("%s.\n", f15h_mc1_mce_desc[xec-2]);
break;
case 0x10:
pr_cont("%s.\n", f15h_mc1_mce_desc[xec-4]);
break;
case 0x11 ... 0x14:
pr_cont("Decoder %s parity error.\n", f15h_mc1_mce_desc[xec-4]);
break;
default:
ret = false;
}
return ret;
}
示例7: crypto_slot_get_size
/*****************************************************************************
* function:
* crypto_slot_get_size(void *ptr)
*
* @param[in] ptr, pointer to the slot memory
* @retval int, the size of the slot in bytes
*
* @description
* get the slot memory size in bytes
*
*****************************************************************************/
static int crypto_slot_get_size(void *ptr)
{
if (NULL == ptr) {
MEM_ERROR("%s error can't find %p\n", __func__, ptr);
return 0;
}
qae_slot *slt = (void *)((unsigned char *)ptr - sizeof(qae_slot));
if (slt->pool_index == (NUM_SLOT_SIZE - 1)) {
return MAX_ALLOC;
} else if (slt->pool_index >= 0 && slt->pool_index <= NUM_SLOT_SIZE - 2) {
return slot_sizes_available[slt->pool_index] - sizeof(qae_slot) -
QAE_BYTE_ALIGNMENT;
} else {
MEM_ERROR("%s error invalid pool_index %d\n", __func__, slt->pool_index);
return 0;
}
}
示例8: add_pseudo_file
void add_pseudo_file(struct pseudo_dev *dev)
{
pseudo_file = realloc(pseudo_file, (pseudo_count + 1) *
sizeof(struct pseudo_dev *));
if(pseudo_file == NULL)
MEM_ERROR();
dev->pseudo_id = pseudo_count;
pseudo_file[pseudo_count ++] = dev;
}
示例9: read_fragment_table
int read_fragment_table(int fd, struct squashfs_super_block *sBlk,
struct squashfs_fragment_entry **fragment_table)
{
int res, i;
int bytes = SQUASHFS_FRAGMENT_BYTES(sBlk->fragments);
int indexes = SQUASHFS_FRAGMENT_INDEXES(sBlk->fragments);
long long fragment_table_index[indexes];
TRACE("read_fragment_table: %d fragments, reading %d fragment indexes "
"from 0x%llx\n", sBlk->fragments, indexes,
sBlk->fragment_table_start);
if(sBlk->fragments == 0)
return 1;
*fragment_table = malloc(bytes);
if(*fragment_table == NULL)
MEM_ERROR();
res = read_fs_bytes(fd, sBlk->fragment_table_start,
SQUASHFS_FRAGMENT_INDEX_BYTES(sBlk->fragments),
fragment_table_index);
if(res == 0) {
ERROR("Failed to read fragment table index\n");
ERROR("Filesystem corrupted?\n");
free(*fragment_table);
return 0;
}
SQUASHFS_INSWAP_FRAGMENT_INDEXES(fragment_table_index, indexes);
for(i = 0; i < indexes; i++) {
int expected = (i + 1) != indexes ? SQUASHFS_METADATA_SIZE :
bytes & (SQUASHFS_METADATA_SIZE - 1);
int length = read_block(fd, fragment_table_index[i], NULL,
expected, ((unsigned char *) *fragment_table) +
(i * SQUASHFS_METADATA_SIZE));
TRACE("Read fragment table block %d, from 0x%llx, length %d\n",
i, fragment_table_index[i], length);
if(length == 0) {
ERROR("Failed to read fragment table block %d, from "
"0x%llx, length %d\n", i,
fragment_table_index[i], length);
ERROR("Filesystem corrupted?\n");
free(*fragment_table);
return 0;
}
}
for(i = 0; i < sBlk->fragments; i++)
SQUASHFS_INSWAP_FRAGMENT_ENTRY(&(*fragment_table)[i]);
return 1;
}
示例10: decode_mc2_mce
static void decode_mc2_mce(struct mce *m)
{
u16 ec = EC(m->status);
u8 xec = XEC(m->status, xec_mask);
pr_emerg(HW_ERR "MC2 Error");
if (xec == 0x1)
pr_cont(" in the write data buffers.\n");
else if (xec == 0x3)
pr_cont(" in the victim data buffers.\n");
else if (xec == 0x2 && MEM_ERROR(ec))
pr_cont(": %s error in the L2 cache tags.\n", R4_MSG(ec));
else if (xec == 0x0) {
if (TLB_ERROR(ec))
pr_cont(": %s error in a Page Descriptor Cache or "
"Guest TLB.\n", TT_MSG(ec));
else if (BUS_ERROR(ec))
pr_cont(": %s/ECC error in data read from NB: %s.\n",
R4_MSG(ec), PP_MSG(ec));
else if (MEM_ERROR(ec)) {
u8 r4 = R4(ec);
if (r4 >= 0x7)
pr_cont(": %s error during data copyback.\n",
R4_MSG(ec));
else if (r4 <= 0x1)
pr_cont(": %s parity/ECC error during data "
"access from L2.\n", R4_MSG(ec));
else
goto wrong_mc2_mce;
} else
goto wrong_mc2_mce;
} else
goto wrong_mc2_mce;
return;
wrong_mc2_mce:
pr_emerg(HW_ERR "Corrupted MC2 MCE info?\n");
}
示例11: malloc
static struct file_buffer *cache_alloc(struct cache *cache)
{
struct file_buffer *entry = malloc(sizeof(struct file_buffer) +
cache->buffer_size);
if(entry == NULL)
MEM_ERROR();
entry->cache = cache;
entry->free_prev = entry->free_next = NULL;
cache->count ++;
return entry;
}
示例12: MEM_DEBUG
void *qaeCryptoMemAlloc(size_t memsize, const char *file, int line)
{
CpaStatus status = CPA_STATUS_SUCCESS;
int rc;
void *pAddress = NULL;
MEM_DEBUG("%s: pthread_mutex_lock\n", __func__);
if ((rc = pthread_mutex_lock(&mem_mutex)) != 0) {
MEM_ERROR("pthread_mutex_lock: %s\n", strerror(rc));
return NULL;
}
pAddress = qaeMemAllocNUMA(memsize, 0, QAT_BYTE_ALIGNMENT);
MEM_DEBUG("%s: Address: %p Size: %d File: %s:%d\n", __func__, pAddress,
memsize, file, line);
if ((rc = pthread_mutex_unlock(&mem_mutex)) != 0) {
MEM_ERROR("pthread_mutex_unlock: %s\n", strerror(rc));
}
MEM_DEBUG("%s: pthread_mutex_unlock\n", __func__);
return pAddress;
}
示例13: f15h_mc0_mce
static bool f15h_mc0_mce(u16 ec, u8 xec)
{
bool ret = true;
if (MEM_ERROR(ec)) {
switch (xec) {
case 0x0:
pr_cont("Data Array access error.\n");
break;
case 0x1:
pr_cont("UC error during a linefill from L2/NB.\n");
break;
case 0x2:
case 0x11:
pr_cont("STQ access error.\n");
break;
case 0x3:
pr_cont("SCB access error.\n");
break;
case 0x10:
pr_cont("Tag error.\n");
break;
case 0x12:
pr_cont("LDQ access error.\n");
break;
default:
ret = false;
}
} else if (BUS_ERROR(ec)) {
if (!xec)
pr_cont("System Read Data Error.\n");
else
pr_cont(" Internal error condition type %d.\n", xec);
} else if (INT_ERROR(ec)) {
if (xec <= 0x1f)
pr_cont("Hardware Assert.\n");
else
ret = false;
} else
ret = false;
return ret;
}
示例14: add_priority_list
void add_priority_list(struct dir_ent *dir, int priority)
{
struct priority_entry *new_priority_entry;
priority += 32768;
new_priority_entry = malloc(sizeof(struct priority_entry));
if(new_priority_entry == NULL)
MEM_ERROR();
new_priority_entry->dir = dir;;
new_priority_entry->next = priority_list[priority];
priority_list[priority] = new_priority_entry;
}
示例15: f14h_mc0_mce
static bool f14h_mc0_mce(u16 ec, u8 xec)
{
u8 r4 = R4(ec);
bool ret = true;
if (MEM_ERROR(ec)) {
if (TT(ec) != TT_DATA || LL(ec) != LL_L1)
return false;
switch (r4) {
case R4_DRD:
case R4_DWR:
pr_cont("Data/Tag parity error due to %s.\n",
(r4 == R4_DRD ? "load/hw prf" : "store"));
break;
case R4_EVICT:
pr_cont("Copyback parity error on a tag miss.\n");
break;
case R4_SNOOP:
pr_cont("Tag parity error during snoop.\n");
break;
default:
ret = false;
}
} else if (BUS_ERROR(ec)) {
if ((II(ec) != II_MEM && II(ec) != II_IO) || LL(ec) != LL_LG)
return false;
pr_cont("System read data error on a ");
switch (r4) {
case R4_RD:
pr_cont("TLB reload.\n");
break;
case R4_DWR:
pr_cont("store.\n");
break;
case R4_DRD:
pr_cont("load.\n");
break;
default:
ret = false;
}
} else {
ret = false;
}
return ret;
}