Skip to content

Commit

Permalink
Merge remote-tracking branch 'remotes/vivier/tags/m68k-next-pull-requ…
Browse files Browse the repository at this point in the history
…est' into staging

remove m68k simulator syscall interface
Fix comments format
Fix gdbstub

# gpg: Signature made Wed 26 Jun 2019 17:20:41 BST
# gpg:                using RSA key CD2F75DDC8E3A4DC2E4F5173F30C38BD3F2FBE3C
# gpg:                issuer "[email protected]"
# gpg: Good signature from "Laurent Vivier <[email protected]>" [full]
# gpg:                 aka "Laurent Vivier <[email protected]>" [full]
# gpg:                 aka "Laurent Vivier (Red Hat) <[email protected]>" [full]
# Primary key fingerprint: CD2F 75DD C8E3 A4DC 2E4F  5173 F30C 38BD 3F2F BE3C

* remotes/vivier/tags/m68k-next-pull-request:
  linux-user/m68k: remove simulator syscall interface
  m68k comments break patch submission due to being incorrectly formatted
  The m68k gdbstub SR reg request doesnt include Condition-Codes

Signed-off-by: Peter Maydell <[email protected]>
  • Loading branch information
pm215 committed Jul 1, 2019
2 parents ae9108f + c6d0700 commit 5e6ebac
Show file tree
Hide file tree
Showing 17 changed files with 356 additions and 411 deletions.
1 change: 0 additions & 1 deletion linux-user/Makefile.objs
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,3 @@ obj-$(TARGET_I386) += vm86.o
obj-$(TARGET_ARM) += arm/nwfpe/
obj-$(TARGET_ARM) += arm/semihost.o
obj-$(TARGET_AARCH64) += arm/semihost.o
obj-$(TARGET_M68K) += m68k-sim.o
163 changes: 0 additions & 163 deletions linux-user/m68k-sim.c

This file was deleted.

17 changes: 1 addition & 16 deletions linux-user/m68k/cpu_loop.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ void cpu_loop(CPUM68KState *env)
int trapnr;
unsigned int n;
target_siginfo_t info;
TaskState *ts = cs->opaque;

for(;;) {
cpu_exec_start(cs);
Expand All @@ -37,26 +36,14 @@ void cpu_loop(CPUM68KState *env)
process_queued_cpu_work(cs);

switch(trapnr) {
case EXCP_ILLEGAL:
{
if (ts->sim_syscalls) {
uint16_t nr;
get_user_u16(nr, env->pc + 2);
env->pc += 4;
do_m68k_simcall(env, nr);
} else {
goto do_sigill;
}
}
break;
case EXCP_HALT_INSN:
/* Semihosing syscall. */
env->pc += 4;
do_m68k_semihosting(env, env->dregs[0]);
break;
case EXCP_ILLEGAL:
case EXCP_LINEA:
case EXCP_LINEF:
do_sigill:
info.si_signo = TARGET_SIGILL;
info.si_errno = 0;
info.si_code = TARGET_ILL_ILLOPN;
Expand All @@ -80,7 +67,6 @@ void cpu_loop(CPUM68KState *env)
case EXCP_TRAP0:
{
abi_long ret;
ts->sim_syscalls = 0;
n = env->dregs[0];
env->pc += 2;
ret = do_syscall(env,
Expand Down Expand Up @@ -154,7 +140,6 @@ void target_cpu_copy_regs(CPUArchState *env, struct target_pt_regs *regs)
env->aregs[7] = regs->usp;
env->sr = regs->sr;

ts->sim_syscalls = 1;
ts->stack_base = info->start_stack;
ts->heap_base = info->brk;
/* This will be filled in on the first SYS_HEAPINFO call. */
Expand Down
2 changes: 0 additions & 2 deletions linux-user/m68k/target_syscall.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,4 @@ struct target_pt_regs {

#define TARGET_WANT_OLD_SYS_SELECT

void do_m68k_simcall(CPUM68KState *, int);

#endif /* M68K_TARGET_SYSCALL_H */
1 change: 0 additions & 1 deletion linux-user/qemu.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ typedef struct TaskState {
#endif
abi_ulong child_tidptr;
#ifdef TARGET_M68K
int sim_syscalls;
abi_ulong tp_value;
#endif
#if defined(TARGET_ARM) || defined(TARGET_M68K)
Expand Down
2 changes: 1 addition & 1 deletion target/m68k/cpu-qom.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#define M68K_CPU_GET_CLASS(obj) \
OBJECT_GET_CLASS(M68kCPUClass, (obj), TYPE_M68K_CPU)

/**
/*
* M68kCPUClass:
* @parent_realize: The parent class' realize handler.
* @parent_reset: The parent class' reset handler.
Expand Down
6 changes: 4 additions & 2 deletions target/m68k/cpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,10 @@ static void any_cpu_initfn(Object *obj)
m68k_set_feature(env, M68K_FEATURE_CF_ISA_APLUSC);
m68k_set_feature(env, M68K_FEATURE_BRAL);
m68k_set_feature(env, M68K_FEATURE_CF_FPU);
/* MAC and EMAC are mututally exclusive, so pick EMAC.
It's mostly backwards compatible. */
/*
* MAC and EMAC are mututally exclusive, so pick EMAC.
* It's mostly backwards compatible.
*/
m68k_set_feature(env, M68K_FEATURE_CF_EMAC);
m68k_set_feature(env, M68K_FEATURE_CF_EMAC_B);
m68k_set_feature(env, M68K_FEATURE_USP);
Expand Down
29 changes: 18 additions & 11 deletions target/m68k/cpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,11 @@ typedef struct CPUM68KState {
float_status fp_status;

uint64_t mactmp;
/* EMAC Hardware deals with 48-bit values composed of one 32-bit and
two 8-bit parts. We store a single 64-bit value and
rearrange/extend this when changing modes. */
/*
* EMAC Hardware deals with 48-bit values composed of one 32-bit and
* two 8-bit parts. We store a single 64-bit value and
* rearrange/extend this when changing modes.
*/
uint64_t macc[4];
uint32_t macsr;
uint32_t mac_mask;
Expand Down Expand Up @@ -146,7 +148,7 @@ typedef struct CPUM68KState {
uint32_t features;
} CPUM68KState;

/**
/*
* M68kCPU:
* @env: #CPUM68KState
*
Expand All @@ -171,9 +173,11 @@ int m68k_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg);

void m68k_tcg_init(void);
void m68k_cpu_init_gdb(M68kCPU *cpu);
/* you can call this signal handler from your SIGBUS and SIGSEGV
signal handlers to inform the virtual CPU of exceptions. non zero
is returned if the signal was handled by the virtual CPU. */
/*
* you can call this signal handler from your SIGBUS and SIGSEGV
* signal handlers to inform the virtual CPU of exceptions. non zero
* is returned if the signal was handled by the virtual CPU.
*/
int cpu_m68k_signal_handler(int host_signum, void *pinfo,
void *puc);
uint32_t cpu_m68k_get_ccr(CPUM68KState *env);
Expand All @@ -182,7 +186,8 @@ void cpu_m68k_set_sr(CPUM68KState *env, uint32_t);
void cpu_m68k_set_fpcr(CPUM68KState *env, uint32_t val);


/* Instead of computing the condition codes after each m68k instruction,
/*
* Instead of computing the condition codes after each m68k instruction,
* QEMU just stores one operand (called CC_SRC), the result
* (called CC_DEST) and the type of operation (called CC_OP). When the
* condition codes are needed, the condition codes can be calculated
Expand Down Expand Up @@ -447,9 +452,11 @@ void m68k_switch_sp(CPUM68KState *env);

void do_m68k_semihosting(CPUM68KState *env, int nr);

/* There are 4 ColdFire core ISA revisions: A, A+, B and C.
Each feature covers the subset of instructions common to the
ISA revisions mentioned. */
/*
* There are 4 ColdFire core ISA revisions: A, A+, B and C.
* Each feature covers the subset of instructions common to the
* ISA revisions mentioned.
*/

enum m68k_features {
M68K_FEATURE_M68000,
Expand Down
6 changes: 4 additions & 2 deletions target/m68k/fpu_helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
#include "exec/cpu_ldst.h"
#include "softfloat.h"

/* Undefined offsets may be different on various FPU.
/*
* Undefined offsets may be different on various FPU.
* On 68040 they return 0.0 (floatx80_zero)
*/

Expand Down Expand Up @@ -611,7 +612,8 @@ void HELPER(fcos)(CPUM68KState *env, FPReg *res, FPReg *val)
void HELPER(fsincos)(CPUM68KState *env, FPReg *res0, FPReg *res1, FPReg *val)
{
floatx80 a = val->d;
/* If res0 and res1 specify the same floating-point data register,
/*
* If res0 and res1 specify the same floating-point data register,
* the sine result is stored in the register, and the cosine
* result is discarded.
*/
Expand Down
9 changes: 6 additions & 3 deletions target/m68k/gdbstub.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,16 @@ int m68k_cpu_gdb_read_register(CPUState *cs, uint8_t *mem_buf, int n)
} else {
switch (n) {
case 16:
return gdb_get_reg32(mem_buf, env->sr);
/* SR is made of SR+CCR, CCR is many 1bit flags so uses helper */
return gdb_get_reg32(mem_buf, env->sr | cpu_m68k_get_ccr(env));
case 17:
return gdb_get_reg32(mem_buf, env->pc);
}
}
/* FP registers not included here because they vary between
ColdFire and m68k. Use XML bits for these. */
/*
* FP registers not included here because they vary between
* ColdFire and m68k. Use XML bits for these.
*/
return 0;
}

Expand Down
16 changes: 10 additions & 6 deletions target/m68k/helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -965,9 +965,11 @@ void HELPER(set_sr)(CPUM68KState *env, uint32_t val)
}

/* MAC unit. */
/* FIXME: The MAC unit implementation is a bit of a mess. Some helpers
take values, others take register numbers and manipulate the contents
in-place. */
/*
* FIXME: The MAC unit implementation is a bit of a mess. Some helpers
* take values, others take register numbers and manipulate the contents
* in-place.
*/
void HELPER(mac_move)(CPUM68KState *env, uint32_t dest, uint32_t src)
{
uint32_t mask;
Expand Down Expand Up @@ -1047,9 +1049,11 @@ void HELPER(macsats)(CPUM68KState *env, uint32_t acc)
if (env->macsr & MACSR_V) {
env->macsr |= MACSR_PAV0 << acc;
if (env->macsr & MACSR_OMC) {
/* The result is saturated to 32 bits, despite overflow occurring
at 48 bits. Seems weird, but that's what the hardware docs
say. */
/*
* The result is saturated to 32 bits, despite overflow occurring
* at 48 bits. Seems weird, but that's what the hardware docs
* say.
*/
result = (result >> 63) ^ 0x7fffffff;
}
}
Expand Down
Loading

0 comments on commit 5e6ebac

Please sign in to comment.