kv2: add paging

this also fixes up a bunch of formatting, adding the type vaddr_t

Signed-off-by: Michael Shaw <spencershawiscool@gmail.com>
This commit is contained in:
Michael Shaw 2026-04-13 00:04:26 -04:00
commit d6873d6c7a
18 changed files with 130 additions and 66 deletions

View file

@ -839,13 +839,13 @@ static int _vsnprintf(out_fct_type out, char *buffer, const size_t maxlen, const
width = sizeof(void *) * 2U;
flags |= FLAGS_ZEROPAD | FLAGS_UPPERCASE;
#if defined(PRINTF_SUPPORT_LONG_LONG)
const bool is_ll = sizeof(uintptr_t) == sizeof(long long);
const bool is_ll = sizeof(vaddr_t) == sizeof(long long);
if (is_ll) {
idx = _ntoa_long_long(out, buffer, idx, maxlen, (uintptr_t)va_arg(va, void *), false, 16U,
idx = _ntoa_long_long(out, buffer, idx, maxlen, (vaddr_t)va_arg(va, void *), false, 16U,
precision, width, flags);
} else {
#endif
idx = _ntoa_long(out, buffer, idx, maxlen, (unsigned long)((uintptr_t)va_arg(va, void *)), false,
idx = _ntoa_long(out, buffer, idx, maxlen, (unsigned long)((vaddr_t)va_arg(va, void *)), false,
16U, precision, width, flags);
#if defined(PRINTF_SUPPORT_LONG_LONG)
}
@ -919,7 +919,7 @@ int fctprintf(void (*out)(char character, void *arg), void *arg, const char *for
va_list va;
va_start(va, format);
const out_fct_wrap_type out_fct_wrap = { out, arg };
const int ret = _vsnprintf(_out_fct, (char *)(uintptr_t)&out_fct_wrap, (size_t)-1, format, va);
const int ret = _vsnprintf(_out_fct, (char *)(vaddr_t)&out_fct_wrap, (size_t)-1, format, va);
va_end(va);
return ret;
}