qemu with hax to log dma reads & writes jcs.org/2018/11/12/vfio

target/unicore32: Prefer qemu_semihosting_log_out() over curses

Use the common API for semihosting logging.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20200603123754.19059-4-f4bug@amsat.org>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>

authored by

Philippe Mathieu-Daudé and committed by
Laurent Vivier
c7a856b4 7a7b6632

+6 -52
+1
default-configs/unicore32-softmmu.mak
··· 3 3 # Boards: 4 4 # 5 5 CONFIG_PUV3=y 6 + CONFIG_SEMIHOSTING=y
+5 -52
target/unicore32/helper.c
··· 14 14 #include "cpu.h" 15 15 #include "exec/exec-all.h" 16 16 #include "exec/helper-proto.h" 17 - #ifndef CONFIG_USER_ONLY 18 - #include "ui/console.h" 19 - #endif 17 + #include "hw/semihosting/console.h" 20 18 21 19 #undef DEBUG_UC32 22 20 ··· 161 159 return 0; 162 160 } 163 161 164 - #ifdef CONFIG_CURSES 165 - 166 - /* KEY_EVENT is defined in wincon.h and in curses.h. Avoid redefinition. */ 167 - #undef KEY_EVENT 168 - #include <curses.h> 169 - #undef KEY_EVENT 170 - 171 - /* 172 - * FIXME: 173 - * 1. curses windows will be blank when switching back 174 - * 2. backspace is not handled yet 175 - */ 176 - static void putc_on_screen(unsigned char ch) 162 + void helper_cp1_putc(target_ulong regval) 177 163 { 178 - static WINDOW *localwin; 179 - static int init; 164 + const char c = regval; 180 165 181 - if (!init) { 182 - /* Assume 80 * 30 screen to minimize the implementation */ 183 - localwin = newwin(30, 80, 0, 0); 184 - scrollok(localwin, TRUE); 185 - init = TRUE; 186 - } 187 - 188 - if (isprint(ch)) { 189 - wprintw(localwin, "%c", ch); 190 - } else { 191 - switch (ch) { 192 - case '\n': 193 - wprintw(localwin, "%c", ch); 194 - break; 195 - case '\r': 196 - /* If '\r' is put before '\n', the curses window will destroy the 197 - * last print line. And meanwhile, '\n' implifies '\r' inside. */ 198 - break; 199 - default: /* Not handled, so just print it hex code */ 200 - wprintw(localwin, "-- 0x%x --", ch); 201 - } 202 - } 203 - 204 - wrefresh(localwin); 166 + qemu_semihosting_log_out(&c, sizeof(c)); 205 167 } 206 - #else 207 - #define putc_on_screen(c) do { } while (0) 208 - #endif 209 - 210 - void helper_cp1_putc(target_ulong x) 211 - { 212 - putc_on_screen((unsigned char)x); /* Output to screen */ 213 - DPRINTF("%c", x); /* Output to stdout */ 214 - } 215 - #endif 168 + #endif /* !CONFIG_USER_ONLY */ 216 169 217 170 bool uc32_cpu_exec_interrupt(CPUState *cs, int interrupt_request) 218 171 {