Skip to content

Commit

Permalink
target-rl78: Load reset vector to PC
Browse files Browse the repository at this point in the history
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 Aug 25, 2013
1 parent 1435b13 commit d752c73
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions target-78k0/cpu.c
Expand Up @@ -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)
Expand Down

0 comments on commit d752c73

Please sign in to comment.