Skip to content

Commit ca3b8f3

Browse files
committed
device/oprom/{yabel,x86emu}: Fix building with debug options
Enabling all debug options for x86emu causes the build to fail on missing includes or timer functions. Add necessary includes for string and stdio. Rewrite the debug timing macro to use new monotonic timer API. Upstream-Status: Pending Signed-off-by: Michał Żygowski <michal.zygowski@3mdeb.com>
1 parent 0c72118 commit ca3b8f3

3 files changed

Lines changed: 5 additions & 1 deletion

File tree

src/device/oprom/x86emu/debug.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@
4040
#define __X86EMU_DEBUG_H
4141

4242
#include <console/console.h>
43+
#include <string.h>
44+
#include <stdio.h>
4345

4446
/*---------------------- Macros and type definitions ----------------------*/
4547

src/device/oprom/yabel/biosemu.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
#if CONFIG(X86EMU_DEBUG_TIMINGS)
5656
#include <timer.h>
5757
struct mono_time zero;
58+
struct mono_time now;
5859
#endif
5960

6061
static X86EMU_memFuncs my_mem_funcs = {

src/device/oprom/yabel/debug.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939

4040
#if CONFIG(X86EMU_DEBUG_TIMINGS)
4141
extern struct mono_time zero;
42+
extern struct mono_time now;
4243
#endif
4344
extern u32 debug_flags;
4445
// from x86emu...needed for debugging
@@ -100,7 +101,7 @@ static inline void set_ci(void) {};
100101
// to be executed, since the x86emu advances CS:IP _before_ actually executing an instruction
101102

102103
#if CONFIG(X86EMU_DEBUG_TIMINGS)
103-
#define DEBUG_PRINTF_CS_IP(_x...) DEBUG_PRINTF("[%08lx]%x:%x ", (current_time_from(&zero)).microseconds, M.x86.R_CS, M.x86.R_IP); DEBUG_PRINTF(_x);
104+
#define DEBUG_PRINTF_CS_IP(_x...) timer_monotonic_get(&now); DEBUG_PRINTF("[%lld]%x:%x ", mono_time_diff_microseconds(&zero, &now), M.x86.R_CS, M.x86.R_IP); DEBUG_PRINTF(_x);
104105
#else
105106
#define DEBUG_PRINTF_CS_IP(_x...) DEBUG_PRINTF("%x:%x ", M.x86.R_CS, M.x86.R_IP); DEBUG_PRINTF(_x);
106107
#endif

0 commit comments

Comments
 (0)