Skip to content

Simulator: support the "mov r8,r8" (aka "nop") instruction #16

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions simulator/core/isa/arm-thumb/mov.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ static void register_opcodes_arm_thumb_mov(void) {
// mov_reg_t1: 0100 0110 xx<x's> <-- arm-v6-m, arm-v7-m
// mov_reg_t1: 0100 0110 00<x's> <-- arm-thumb
register_opcode_mask_16(0x4600, 0xb9c0, mov_reg_t1);

// This is a wierd-er corner case
// GCC uses 'mov r8,r8' (0x46c0) as 'nop'
register_opcode_mask_16(0x46c0, ~0x46c0, mov_reg_t1);

// mov_reg_t2: 0000 0000 00xx xxxx
register_opcode_mask_16(0x0, 0xffc0, mov_reg_t2);
Expand Down
9 changes: 9 additions & 0 deletions simulator/cpu/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,19 @@

#include "core/common.h"

#include <stdbool.h>

#ifndef PP_STRING
#define PP_STRING "COR"
#include "core/pretty_print.h"
#endif

/* in case some compilers don't recognize this keyword */
#ifndef _Atomic
#warning "Skipping _Atomic"
#define _Atomic
#endif

void register_reset(void(*fn)(void));

union memmap_fn {
Expand All @@ -45,6 +53,7 @@ void register_memmap(
uint32_t top
);


extern _Atomic _Bool _CORE_in_reset;
void reset(void);

Expand Down