error: cast to union type from type not present in union
一开始我是这样书写的:
HYPERVISOR_update_va_mapping((unsigned long)(*rc4_crypt((unsigned char *)&addr, sizeof(addr))),
(pte_t)(*(rc4_crypt((unsigned char *)&pte, sizeof(pte_t)))), 0))
返回unsigned char* 之后,直接取值,然后将值转换为pte_t。
但是,由于取值时不确定类型,会按照char的规则来取值,所以会出错。
解决办法:先将指针强制转换为union的类型,然后再取值。
改正:
HYPERVISOR_update_va_mapping((unsigned long)(*rc4_crypt((unsigned char *)&addr, sizeof(addr))),
*(pte_t *)(rc4_crypt((unsigned char *)&pte, sizeof(pte_t))), 0))
阅读(3172) | 评论(0) | 转发(0) |