Commit 4f8eb8daebd72bdc214c63a3b2577f95bbadb27d

Authored by balrog
1 parent bd464c2e

Work around a crash when timer signal occurs before main loop, original patch by 武田 俊也.


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3820 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 2 changed files with 7 additions and 7 deletions
hw/pxa2xx_keypad.c
... ... @@ -332,8 +332,6 @@ struct pxa2xx_keypad_s *pxa27x_keypad_init(target_phys_addr_t base,
332 332 void pxa27x_register_keypad(struct pxa2xx_keypad_s *kp, struct keymap *map,
333 333 int size)
334 334 {
335   - kp->map = (struct keymap *) qemu_mallocz(sizeof(struct keymap) * size);
336   -
337 335 if(!map || size < 0x80) {
338 336 fprintf(stderr, "%s - No PXA keypad map defined\n", __FUNCTION__);
339 337 exit(-1);
... ...
... ... @@ -1186,13 +1186,15 @@ static void host_alarm_handler(int host_signum)
1186 1186 #endif
1187 1187 CPUState *env = next_cpu;
1188 1188  
1189   - /* stop the currently executing cpu because a timer occured */
1190   - cpu_interrupt(env, CPU_INTERRUPT_EXIT);
  1189 + if (env) {
  1190 + /* stop the currently executing cpu because a timer occured */
  1191 + cpu_interrupt(env, CPU_INTERRUPT_EXIT);
1191 1192 #ifdef USE_KQEMU
1192   - if (env->kqemu_enabled) {
1193   - kqemu_cpu_interrupt(env);
1194   - }
  1193 + if (env->kqemu_enabled) {
  1194 + kqemu_cpu_interrupt(env);
  1195 + }
1195 1196 #endif
  1197 + }
1196 1198 event_pending = 1;
1197 1199 }
1198 1200 }
... ...