Last active
September 16, 2020 07:12
-
-
Save zhiayang/6458a3275b2e386103970137453b8fdb to your computer and use it in GitHub Desktop.
patch qemu to make my life better.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff qemu1/ui/cocoa.m qemu2/ui/cocoa.m | |
--- qemu1/ui/cocoa.m | |
+++ qemu2/ui/cocoa.m | |
@@ -358,5 +358,5 @@ QemuCocoaView *cocoaView; | |
- (BOOL) screenContainsPoint:(NSPoint) p | |
{ | |
- return (p.x > -1 && p.x < screen.width && p.y > -1 && p.y < screen.height); | |
+ return (p.x > -1 && p.x < (screen.width * cdx) && p.y > -1 && p.y < (screen.height * cdx)); | |
} | |
@@ -498,8 +498,8 @@ QemuCocoaView *cocoaView; | |
cy = 0; | |
cw = screen.width; | |
ch = screen.height; | |
- cdx = 1.0; | |
- cdy = 1.0; | |
+ cdx = 1.0 / (double) [[NSScreen mainScreen] backingScaleFactor]; | |
+ cdy = 1.0 / (double) [[NSScreen mainScreen] backingScaleFactor]; | |
} | |
} | |
@@ -546,7 +546,7 @@ QemuCocoaView *cocoaView; | |
} else { | |
if (qemu_name) | |
[normalWindow setTitle:[NSString stringWithFormat:@"QEMU %s", qemu_name]]; | |
- [normalWindow setFrame:NSMakeRect([normalWindow frame].origin.x, [normalWindow frame].origin.y - h + oldh, w, h + [normalWindow frame].size.height - oldh) display:YES animate:NO]; | |
+ [normalWindow setFrame:NSMakeRect([normalWindow frame].origin.x, [normalWindow frame].origin.y - h + oldh, w*cdx, h*cdy+22) display:YES animate:NO]; | |
} | |
if (isResize) { | |
@@ -1131,7 +1131,7 @@ QemuCocoaView *cocoaView; | |
(NSApplication *)sender | |
{ | |
COCOA_DEBUG("QemuCocoaAppController: applicationShouldTerminate\n"); | |
- return [self verifyQuit]; | |
+ return YES; | |
} | |
/* Called when the user clicks on a window's close button */ | |
diff qemu1/util/log.c qemu2/util/log.c | |
--- qemu1/util/log.c | |
+++ qemu2/util/log.c | |
@@ -329,6 +329,8 @@ const QEMULogItem qemu_log_items[] = { | |
{ CPU_LOG_TB_NOCHAIN, "nochain", | |
"do not chain compiled TBs so that \"exec\" and \"cpu\" show\n" | |
"complete traces" }, | |
+ { CPU_LOG_EXCEPTION, "exception", | |
+ "x86 only: log cpu exceptions" }, | |
#ifdef CONFIG_PLUGIN | |
{ CPU_LOG_PLUGIN, "plugin", "output from TCG plugins\n"}, | |
#endif | |
diff qemu1/target/i386/seg_helper.c qemu2/target/i386/seg_helper.c | |
--- qemu1/target/i386/seg_helper.c | |
+++ qemu2/target/i386/seg_helper.c | |
@@ -1208,13 +1208,13 @@ static void do_interrupt_all(X86CPU *cpu, int intno, int is_int, | |
{ | |
CPUX86State *env = &cpu->env; | |
- if (qemu_loglevel_mask(CPU_LOG_INT)) { | |
+ if (qemu_loglevel_mask(CPU_LOG_INT) || (qemu_loglevel_mask(CPU_LOG_EXCEPTION) && intno < 32)) { | |
if ((env->cr[0] & CR0_PE_MASK)) { | |
static int count; | |
- qemu_log("%6d: v=%02x e=%04x i=%d cpl=%d IP=%04x:" TARGET_FMT_lx | |
+ qemu_log("\n%s\n%6d: v=%02x e=%04x i=%d cpl=%d IP=%04x:" TARGET_FMT_lx | |
" pc=" TARGET_FMT_lx " SP=%04x:" TARGET_FMT_lx, | |
- count, intno, error_code, is_int, | |
+ intno < 32 ? "!! CPU EXCEPTION !!" : "", count, intno, error_code, is_int, | |
env->hflags & HF_CPL_MASK, | |
env->segs[R_CS].selector, env->eip, | |
(int)env->segs[R_CS].base + env->eip, | |
@@ -1226,6 +1226,7 @@ static void do_interrupt_all(X86CPU *cpu, int intno, int is_int, | |
} | |
qemu_log("\n"); | |
log_cpu_state(CPU(cpu), CPU_DUMP_CCOP); | |
+ qemu_log("\n"); | |
#if 0 | |
{ | |
int i; | |
diff qemu1/target/i386/excp_helper.c qemu2/target/i386/excp_helper.c | |
--- qemu1/target/i386/excp_helper.c | |
+++ qemu2/target/i386/excp_helper.c | |
@@ -48,7 +48,7 @@ static int check_exception(CPUX86State *env, int intno, int *error_code, | |
int second_contributory = intno == 0 || | |
(intno >= 10 && intno <= 13); | |
- qemu_log_mask(CPU_LOG_INT, "check_exception old: 0x%x new 0x%x\n", | |
+ qemu_log_mask(CPU_LOG_INT | CPU_LOG_EXCEPTION, "check_exception old: 0x%x new 0x%x\n", | |
env->old_exception, intno); | |
#if !defined(CONFIG_USER_ONLY) | |
diff qemu1/include/qemu/log.h qemu2/include/qemu/log.h | |
--- qemu1/include/qemu/log.h | |
+++ qemu2/include/qemu/log.h | |
@@ -64,6 +64,7 @@ static inline bool qemu_log_separate(void) | |
#define CPU_LOG_PLUGIN (1 << 18) | |
/* LOG_STRACE is used for user-mode strace logging. */ | |
#define LOG_STRACE (1 << 19) | |
+#define CPU_LOG_EXCEPTION (1 << 29) | |
/* Lock output for a series of related logs. Since this is not needed | |
* for a single qemu_log / qemu_log_mask / qemu_log_mask_and_addr, we |
updated for qemu 5.0.0-rc4
works for qemu 5.1.0
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This patch fixes some dumb things that QEMU does on OSX: