Permalink
Browse files

target-rl78: Load reset vector to PC

Inspired by ARM M profile. Thanks to Peter for suggesting.

Signed-off-by: Andreas Färber <andreas.faerber@web.de>
  • Loading branch information...
afaerber committed Nov 24, 2011
1 parent 1435b13 commit d752c73cf0feb7c35391aaa39f87e254d9f65ccc
Showing with 13 additions and 0 deletions.
  1. +13 −0 target-78k0/cpu.c
View
@@ -20,19 +20,32 @@
#include "cpu.h"
#include "qemu-common.h"
#include "error.h"
+#ifndef CONFIG_USER_ONLY
+#include "hw/loader.h" /* for rom_ptr() */
+#endif
/* CPUClass::reset() */
static void rl78_cpu_reset(CPUState *cs)
{
RL78CPU *cpu = RL78_CPU(cs);
RL78CPUClass *rcc = RL78_CPU_GET_CLASS(cs);
+ uint8_t *rom;
+ uint16_t reset_vector;
rcc->parent_reset(cs);
tlb_flush(&cpu->env, 1);
memset(&cpu->env, 0, offsetof(CPU78K0State, breakpoints));
+
+ rom = rom_ptr(0x00000);
+ if (rom == NULL) {
+ reset_vector = 0;
+ } else {
+ reset_vector = lduw_p(rom);
+ }
+ cpu->env.pc = reset_vector;
}
static void rl78_cpu_set_pc(CPUState *cs, vaddr value)

0 comments on commit d752c73

Please sign in to comment.