acrn-hypervisor/hypervisor/debug
Shiqing Gao 3df3c9f6a1 hv: vuart: fix 'Shifting value too far'
MISRA-C requires that shift operation cannot exceed the word length.

What this patch does:
- Fix the bug in 'vuart_init'
  The register 'dll' and 'dlh' should be uint8_t rather than char.
  'dll' is the lower 8-bit of divisor.
  'dlh' is the higher 8-bit of divisor.
  So, the shift value should be 8U rather than 16U.
- Fix other data type issues regarding to the registers in 'struct
  vuart'
  The registers should be unsigned variables.

v1 -> v2:
 * Use a local variable 'uint8_t value_u8 = (uint8_t)value' to avoid
   mutiple times type conversion
 * Use '(uint8_t)divisor' rather than '(uint8_t)(divisor & 0xFFU)' to
   get the lower 8 bit of 'divisor'
   Direct type conversion is safe and simple per Xiangyang's suggestion.

Tracked-On: #861
Signed-off-by: Shiqing Gao <shiqing.gao@intel.com>
Reviewed-by: Junjie Mao <junjie.mao@intel.com>
2018-08-16 09:01:53 +08:00
..
console.c hv:cleanup console/uart code 2018-08-02 11:25:40 +08:00
dump.c HV: Logical conjunction needs brackets 2018-08-14 09:53:32 +08:00
logmsg.c HV: Logical conjunction needs brackets 2018-08-14 09:53:32 +08:00
printf.c hv: treewide: fix 'Potential side effect problem in expression' 2018-08-08 10:50:06 +08:00
sbuf.c HV: Logical conjunction needs brackets 2018-08-14 09:53:32 +08:00
shell_priv.h HV: refine shell.c & shell_priv.h 2018-08-14 09:54:48 +08:00
shell.c dump vcpu registers on correct vcpu 2018-08-15 12:05:18 +08:00
uart16550.c hv:Rename port/mmio read and write APIs 2018-08-02 14:03:38 +08:00
uart16550.h hv:cleanup console/uart code 2018-08-02 11:25:40 +08:00
vuart.c hv: vuart: fix 'Shifting value too far' 2018-08-16 09:01:53 +08:00