coreboot-kgpe-d16/payloads/libpayload/include
Yidi Lin eabdd0252a libpayload/libc/time: Fix possible overflow in multiplication
The value from raw_read_cntfrq_el0() could be large enough to cause
overflow when multiplied by USECS_PER_SEC. To prevent this, both
USECS_PER_SEC and hz can be reduced by dividing them by their GCD.

This patch also modifies the return type of `timer_hz()` from
`uint64_t` to `uint32_t`, assuming that in practice the timestamp
counter should never be that fast.

BUG=b:307790895
TEST=boot to kernel and check the timestamps from `cbmem`

Change-Id: Ia55532490651fcf47128b83a8554751f050bcc89
Signed-off-by: Yidi Lin <yidilin@chromium.org>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/78888
Reviewed-by: Julius Werner <jwerner@chromium.org>
Reviewed-by: Yu-Ping Wu <yupingso@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2023-11-07 19:25:23 +00:00
..
arm/arch
arm64/arch
arpa
mock/arch
pci
storage
sys
udc
usb
x86/arch
archive.h
assert.h libpayload: Use __func__ instead of old __FUNCTION__ 2023-02-17 16:19:44 +00:00
boot_device.h
cbfs.h
cbfs_core.h
cbfs_glue.h
cbfs_legacy.h
cbfs_ram.h
cbgfx.h
coreboot_tables.h {commonlib, libpayload}: Add "has_external_display" in coreboot table 2023-10-04 18:50:49 +00:00
ctype.h
delay.h libpayload: Outsource delay function into own header 2023-08-24 13:35:02 +00:00
die.h libpayload: Use __func__ instead of old __FUNCTION__ 2023-02-17 16:19:44 +00:00
endian.h
errno.h
exception.h
fmap.h
fpmath.h
gdb.h
getopt.h
inttypes.h
ipchksum.h
kconfig.h
keycodes.h
libpayload.h libpayload/libc/time: Fix possible overflow in multiplication 2023-11-07 19:25:23 +00:00
limits.h
lp_vboot.h libpayload: Add vboot and reboot utility functions 2023-09-18 15:42:31 +00:00
lz4.h
lzma.h
malloc.h
multiboot_tables.h
panel.h
pci.h
queue.h
stdarg.h libpayload/include/stdarg.h: Add va_copy builtin 2023-08-17 16:46:07 +00:00
stdbool.h
stddef.h libpayload: Outsource delay function into own header 2023-08-24 13:35:02 +00:00
stdint.h
stdio.h
stdlib.h libpayload: Use __func__ instead of old __FUNCTION__ 2023-02-17 16:19:44 +00:00
string.h libpayload/string: add strndup() function 2023-02-16 17:54:51 +00:00
strings.h libpayload: strings.h: Use builtin __ffs instead of included one 2023-03-07 17:11:05 +00:00
sysinfo.h libpayload: Add parsing of SMBIOS address 2023-08-17 15:48:56 +00:00
term.h
time.h
unistd.h
video_console.h
wchar.h