HV: logical and high level precedence expression needs brackets

Added brackets for expression to make it easy to understand and
reduce the mistake of precedence. The rule is applied to the
mixed same level of prevedence opeartors, high level presedence
operators and logical expression.

Signed-off-by: Yang, Yu-chu <yu-chu.yang@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
This commit is contained in:
Yang, Yu-chu
2018-07-18 12:49:28 -07:00
committed by lijinxia
parent 7aec6799a1
commit 91337da5a1
22 changed files with 76 additions and 74 deletions

View File

@@ -114,12 +114,12 @@ static void dump_guest_stack(struct vcpu *vcpu)
printf("\r\nGuest Stack:\r\n");
printf("Dump stack for vcpu %hu, from gva 0x%016llx\r\n",
vcpu->vcpu_id, cur_context->rsp);
for (i = 0U; i < DUMP_STACK_SIZE/32U; i++) {
for (i = 0U; i < (DUMP_STACK_SIZE/32U); i++) {
printf("guest_rsp(0x%llx): 0x%016llx 0x%016llx "
"0x%016llx 0x%016llx\r\n",
(cur_context->rsp+i*32),
tmp[i*4], tmp[i*4+1],
tmp[i*4+2], tmp[i*4+3]);
(cur_context->rsp+(i*32)),
tmp[i*4], tmp[(i*4)+1],
tmp[(i*4)+2], tmp[(i*4)+3]);
}
printf("\r\n");
}
@@ -149,7 +149,7 @@ static void show_guest_call_trace(struct vcpu *vcpu)
* try to print out call trace,here can not check if the rbp is valid
* if the address is invalid, it will cause hv page fault
* then halt system */
while ((count++ < CALL_TRACE_HIERARCHY_MAX) && (bp != 0)) {
while ((count < CALL_TRACE_HIERARCHY_MAX) && (bp != 0)) {
uint64_t parent_bp = 0UL;
err_code = 0U;
@@ -163,6 +163,7 @@ static void show_guest_call_trace(struct vcpu *vcpu)
printf("BP_GVA(0x%016llx) RIP=0x%016llx\r\n", bp, parent_bp);
/* Get previous rbp*/
bp = parent_bp;
count++;
}
printf("\r\n");
}
@@ -186,10 +187,10 @@ static void show_host_call_trace(uint64_t rsp, uint64_t rbp, uint16_t pcpu_id)
uint64_t *sp = (uint64_t *)rsp;
printf("\r\nHost Stack: CPU_ID = %hu\r\n", pcpu_id);
for (i = 0U; i < DUMP_STACK_SIZE/32U; i++) {
for (i = 0U; i < (DUMP_STACK_SIZE/32U); i++) {
printf("addr(0x%llx) 0x%016llx 0x%016llx 0x%016llx "
"0x%016llx\r\n", (rsp+i*32U), sp[i*4U], sp[i*4U+1U],
sp[i*4U+2U], sp[i*4U+3U]);
"0x%016llx\r\n", (rsp+(i*32U)), sp[i*4U], sp[(i*4U)+1U],
sp[(i*4U)+2U], sp[(i*4U)+3U]);
}
printf("\r\n");
@@ -216,14 +217,15 @@ static void show_host_call_trace(uint64_t rsp, uint64_t rbp, uint16_t pcpu_id)
while ((rbp <=
(uint64_t)&per_cpu(stack, pcpu_id)[CONFIG_STACK_SIZE - 1])
&& (rbp >= (uint64_t)&per_cpu(stack, pcpu_id)[0])
&& (cb_hierarchy++ < CALL_TRACE_HIERARCHY_MAX)) {
&& (cb_hierarchy < CALL_TRACE_HIERARCHY_MAX)) {
printf("----> 0x%016llx\r\n",
*(uint64_t *)(rbp + sizeof(uint64_t)));
if (*(uint64_t *)(rbp + 2*sizeof(uint64_t))
if (*(uint64_t *)(rbp + (2*sizeof(uint64_t)))
== SP_BOTTOM_MAGIC) {
break;
}
rbp = *(uint64_t *)rbp;
cb_hierarchy++;
}
printf("\r\n");
}

View File

@@ -23,7 +23,7 @@ static struct logmsg logmsg;
static inline void alloc_earlylog_sbuf(uint16_t pcpu_id)
{
uint32_t ele_size = LOG_ENTRY_SIZE;
uint32_t ele_num = ((HVLOG_BUF_SIZE >> 1) / phys_cpu_num
uint32_t ele_num = (((HVLOG_BUF_SIZE >> 1U) / phys_cpu_num)
- SBUF_HEAD_SIZE) / ele_size;
per_cpu(earlylog_sbuf, pcpu_id) = sbuf_allocate(ele_num, ele_size);
@@ -158,10 +158,10 @@ void do_logmsg(uint32_t severity, const char *fmt, ...)
if (sbuf != NULL) {
msg_len = strnlen_s(buffer, LOG_MESSAGE_MAX_SIZE);
for (i = 0; i < (msg_len - 1) / LOG_ENTRY_SIZE + 1;
for (i = 0; i < (((msg_len - 1) / LOG_ENTRY_SIZE) + 1);
i++) {
(void)sbuf_put(sbuf, (uint8_t *)buffer +
i * LOG_ENTRY_SIZE);
(i * LOG_ENTRY_SIZE));
}
}
}

View File

@@ -768,8 +768,8 @@ int shell_vcpu_dumpreg(struct shell *p_shell,
snprintf(temp_str, MAX_STR_SIZE,
"= 0x%016llx 0x%016llx "
"0x%016llx 0x%016llx\r\n",
tmp[i*4UL], tmp[i*4UL+1UL],
tmp[i*4UL+2UL], tmp[i*4UL+3UL]);
tmp[i*4UL], tmp[(i*4UL)+1UL],
tmp[(i*4UL)+2UL], tmp[(i*4UL)+3UL]);
shell_puts(p_shell, temp_str);
}
}
@@ -841,18 +841,18 @@ int shell_vcpu_dumpmem(struct shell *p_shell,
"length %d:\r\n", vcpu_id, gva, length);
shell_puts(p_shell, temp_str);
for (i = 0U; i < length/32U; i++) {
for (i = 0U; i < (length/32U); i++) {
snprintf(temp_str, MAX_STR_SIZE,
"= 0x%016llx 0x%016llx 0x%016llx "
"0x%016llx\r\n", tmp[i*4], tmp[i*4+1],
tmp[i*4+2], tmp[i*4+3]);
"0x%016llx\r\n", tmp[i*4], tmp[(i*4)+1],
tmp[(i*4)+2], tmp[(i*4)+3]);
shell_puts(p_shell, temp_str);
}
if ((length % 32U) != 0) {
snprintf(temp_str, MAX_STR_SIZE,
"= 0x%016llx 0x%016llx 0x%016llx "
"0x%016llx\r\n", tmp[i*4], tmp[i*4+1],
tmp[i*4+2], tmp[i*4+3]);
"0x%016llx\r\n", tmp[i*4], tmp[(i*4)+1],
tmp[(i*4)+2], tmp[(i*4)+3]);
shell_puts(p_shell, temp_str);
}
}