X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=cmd%2Ftrace.c;h=392b129536176dbbbfb097f7751199d50442591c;hb=17282f45abba6f10842adafdd47c0f24cae6b0ef;hp=1e62a1a1999e37bae3c3bdfc413185568eff4a25;hpb=d82477748d641e60ba3e1a0b55d98362aed70f80;p=oweals%2Fu-boot.git diff --git a/cmd/trace.c b/cmd/trace.c index 1e62a1a199..392b129536 100644 --- a/cmd/trace.c +++ b/cmd/trace.c @@ -1,11 +1,11 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * Copyright (c) 2011 The Chromium OS Authors. - * - * SPDX-License-Identifier: GPL-2.0+ */ #include #include +#include #include #include #include @@ -16,10 +16,10 @@ static int get_args(int argc, char * const argv[], char **buff, if (argc < 2) return -1; if (argc < 4) { - *buff_size = getenv_ulong("profsize", 16, 0); - *buff = map_sysmem(getenv_ulong("profbase", 16, 0), + *buff_size = env_get_ulong("profsize", 16, 0); + *buff = map_sysmem(env_get_ulong("profbase", 16, 0), *buff_size); - *buff_ptr = getenv_ulong("profoffset", 16, 0); + *buff_ptr = env_get_ulong("profoffset", 16, 0); } else { *buff_size = simple_strtoul(argv[3], NULL, 16); *buff = map_sysmem(simple_strtoul(argv[2], NULL, 16), @@ -31,8 +31,7 @@ static int get_args(int argc, char * const argv[], char **buff, static int create_func_list(int argc, char * const argv[]) { - size_t buff_size, avail, buff_ptr, used; - unsigned int needed; + size_t buff_size, avail, buff_ptr, needed, used; char *buff; int err; @@ -42,21 +41,20 @@ static int create_func_list(int argc, char * const argv[]) avail = buff_size - buff_ptr; err = trace_list_functions(buff + buff_ptr, avail, &needed); if (err) - printf("Error: truncated (%#x bytes needed)\n", needed); - used = min(avail, needed); + printf("Error: truncated (%#zx bytes needed)\n", needed); + used = min(avail, (size_t)needed); printf("Function trace dumped to %08lx, size %#zx\n", (ulong)map_to_sysmem(buff + buff_ptr), used); - setenv_hex("profbase", map_to_sysmem(buff)); - setenv_hex("profsize", buff_size); - setenv_hex("profoffset", buff_ptr + used); + env_set_hex("profbase", map_to_sysmem(buff)); + env_set_hex("profsize", buff_size); + env_set_hex("profoffset", buff_ptr + used); return 0; } static int create_call_list(int argc, char * const argv[]) { - size_t buff_size, avail, buff_ptr, used; - unsigned int needed; + size_t buff_size, avail, buff_ptr, needed, used; char *buff; int err; @@ -66,14 +64,14 @@ static int create_call_list(int argc, char * const argv[]) avail = buff_size - buff_ptr; err = trace_list_calls(buff + buff_ptr, avail, &needed); if (err) - printf("Error: truncated (%#x bytes needed)\n", needed); - used = min(avail, needed); + printf("Error: truncated (%#zx bytes needed)\n", needed); + used = min(avail, (size_t)needed); printf("Call list dumped to %08lx, size %#zx\n", (ulong)map_to_sysmem(buff + buff_ptr), used); - setenv_hex("profbase", map_to_sysmem(buff)); - setenv_hex("profsize", buff_size); - setenv_hex("profoffset", buff_ptr + used); + env_set_hex("profbase", map_to_sysmem(buff)); + env_set_hex("profsize", buff_size); + env_set_hex("profoffset", buff_ptr + used); return 0; }