QEMU m68k core additions
Subsystems (2)
cover QEMU m68k core additions
These patches greatly expand Motorola 68k emulation within qemu, and are what I used as a basis for my Google Summer of Code project to add NeXT hardware support to QEMU.
Bryce Lanham
Alexander Paramonov (1):
linux-user: Signals processing is not thread-safe.
Andreas Schwab (3):
m68k: add cas
m68k: define fcntl constants
m68k: add DBcc instruction.
Laurent Vivier (106):
linux-user: add qemu-wrapper
linux-user: define default cpu model in configure instead of
linux-user/main.c
linux-user: specify the cpu model during configure linux-user,m68k: display default cpu
linux-user: define new environment variables
linux-user: define a script to set binfmt using debian flavored tools
linux-user: define default cpu model in configure instead of
linux-user/main.c
m68k: add tcg_gen_debug_insn_start()
m68k: define m680x0 CPUs and features
m68k: add missing accessing modes for some instructions.
m68k: add Motorola 680x0 family common instructions.
m68k: add Scc instruction with memory operand.
m68k: add DBcc instruction.
m68k: modify movem instruction to manage word
m68k: add 64bit divide.
m68k: add 32bit and 64bit multiply
m68k: add word data size for suba/adda
m68k: add fpu
m68k: add "byte", "word" and memory shift
m68k: add "byte", "word" and memory rotate.
m68k: add bitfield_mem, bitfield_reg
m68k: add variable offset/width to bitfield_reg/bitfield_mem
m68k: add cas
m68k: allow fpu to manage double data type.
m68k: allow fpu to manage double data type with fmove to <ea>
m68k: add FScc instruction
m68k: add single data type to gen_ea
m68k: add linkl instruction
m68k: Add fmovecr
m68k: correct typo on f64_to_i32() return type.
m68k: improve CC_OP_LOGIC
m68k: correct neg condition code flags computation
Correct invalid use of "const void *" with "const uint8_t *"
m68k: add EA support for negx
m68k: add abcd instruction
m68k: add sbcd instruction
mm68k: add nbcd instruction
m68k: set X flag according size of operand Set X flag correctly
for addsub, arith_im, addsubq.
m68k: on 0 bit shift, don't update X flag
m68k: improve addx instructions Add (byte, word) opsize Add
memory access
m68k: improve subx,negx instructions Add (byte, word) opsize
Add memory access (subx)
m68k: improve asl/asr evaluate correclty the missing V flag
m68k: use read_imm1() when it is possible
m68k: correct shift side effect for roxrl and roxll
m68k: asl/asr, clear C flag if shift count is 0
m68k: lsl/lsr, clear C flag if shift count is 0
m68k: correct divs.w and divu.w
m68k: correct flags with negl
m68k: for bitfield opcodes, correct operands corruption
m68k: Correct bfclr in register case.
m68k-linux-user: add '--enable-emulop'
m68k: correctly compute divsl
m68k: correctly compute divul
m68k: add m68030 definition
m68k: remove dead code
m68k: remove useless file m68k-qreg.h
m68k: FPU rework (draft)
m68k: some FPU debugging macros
m68k: more tests
m68k: correct compute gen_bitfield_cc()
m68k: add fgetexp
m68k: add fscale
m68k: correct addsubq
m68k: add fetox and flogn
m68k: initialize FRegs, define pickNaN()
m68k: correct cmpa comparison datatype
m68k: add flog10
m68k: add cmpm instruction
m68k: add ftwotox instruction
m68k: better fpu traces
m68k: register source operand is always in extended size
m68k: add facos instruction
m68k: add ftan instruction
m68k: add fsin instruction
m68k: add fcos instruction
m68k: correct fpcr update
m68k: add fmod instruction
m68k: flush flags before negx instruction.
m68k: correct fmovemx FP registers order.
m68k: add fatan instruction
m68k: correct bfins instruction
m68k: fcmp correctly compares infinity.
m68k: allows bfins to manage correctly width = 32
m68k: add ftentox instruction
m68k: correctly define and manage NaN
m68k: don't call gdb_register_coprocessor() twice.
m68k: gdb FP registers are 96 bits
m68k: add exg instruction
m68k: define floatx80_default_inf_high and floatx80_default_inf_low
m68k: add bkpt instruction
m68k: correctly convert floatx80<->long double
m68k: use expl() to compute exp_FP0()
m68k: use exp2l() to compute exp2_FP0()
m68k: use logl() to compute ln_FP0()
m68k: use log10l() to compute log10_FP0()
m68k: correctly load signed word into floating point register
m68k: add fcosh instruction
m68k: add fasin instruction
m68k: add fsincos instruction
m68k: add fsinh instruction
m68k: add ftanh instruction
m68k: add flognp1 instruction
m68k: add fatanh instruction
m68k: first draft of q800 emulation (not working)
m68k: add movec instruction
m68k: move from sr can use effective addresse on m68k
Peter Bjørn Jørgensen (1):
m68k: Added ULL to 64 bit integer in helper.c
PATCH 1/111 linux-user: Signals processing is not thread-safe.
From: Alexander Paramonov <[email protected]>
--- linux-user/qemu.h | 1 + linux-user/signal.c | 39 +++++++++++++++++++++++++++++++-------- 2 files changed, 32 insertions(+), 8 deletions(-)
linux-user/qemu.h +1 -0
@@ -87,6 +87,7 @@ struct vm86_saved_state {struct sigqueue {struct sigqueue *next;target_siginfo_t info; +pid_t pid; };struct emulated_sigtable {
linux-user/signal.c +31 -8
@@ -472,6 +472,7 @@ int queue_signal(CPUState *env, int sig, target_siginfo_t *info) *pq = q; q->info = *info; q->next =NULL ; + q->pid =getpid (); k->pending =1 ;/* signal that a new signal is pending */ ts->signal_pending =1 ;
@@ -5231,21 +5232,34 @@ void process_pending_signals(CPUState *cpu_env)target_sigset_t target_old_set;struct emulated_sigtable *k;struct target_sigaction *sa; -struct sigqueue *q; -TaskState *ts = cpu_env->opaque; +struct sigqueue *q, *q_prev; +TaskState *ts = thread_env->opaque;if (!ts->signal_pending)return ; -/* FIXME: This is not threadsafe. */ k = ts->sigtab; +int signal_pending =0 ;for (sig =1 ; sig <=TARGET_NSIG ; sig++) {if (k->pending) - goto handle_signal; + { + q = k->first; + q_prev =NULL ; +while (q) + { +if (q->pid ==getpid ()) + goto handle_signal; +else + signal_pending =1 ; + q_prev = q; + q = q->next; + } + } k++; } +/* if no signal is pending, just return */ - ts->signal_pending =0 ; + ts->signal_pending = signal_pending;return ; handle_signal:
@@ -5253,9 +5267,18 @@ void process_pending_signals(CPUState *cpu_env)fprintf (stderr,"qemu: process signal %d\n" , sig);#endif /* dequeue signal */ - q = k->first; - k->first = q->next; -if (!k->first) +if (q_prev == k->first) + { + q = k->first; + k->first = q->next; +if (!k->first) + { + k->pending =0 ; + } + } +else if (q_prev) + q_prev->next = q->next; +else k->pending =0 ; sig =gdb_handlesig (cpu_env, sig);
Signature · 1 line
1.7.2.3
PATCH 2/111 linux-user: add qemu-wrapper
In reply to Bryce LanhamFrom: Laurent Vivier <[email protected]>
--- Makefile.target | 8 +++- configure | 9 ++++ linux-user/qemu-wrapper.c | 97 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 113 insertions(+), 1 deletions(-) create mode 100644 linux-user/qemu-wrapper.c
Makefile.target +7 -1
@@ -25,6 +25,7 @@ include $(SRC_PATH)/Makefile.objs ifdef CONFIG_USER_ONLY # user emulator name QEMU_PROG=qemu-$(TARGET_ARCH2) +USER_TOOLS=$(TARGET_TOOLS) else # system emulator name ifeq ($(TARGET_ARCH), i386)
@@ -32,9 +33,10 @@ QEMU_PROG=qemu$(EXESUF) else QEMU_PROG=qemu-system-$(TARGET_ARCH2)$(EXESUF) endif +USER_TOOLS= endif -PROGS=$(QEMU_PROG) +PROGS=$(QEMU_PROG) $(USER_TOOLS) STPFILES= ifndef CONFIG_HAIKU
@@ -64,6 +66,10 @@ else stap: endif +qemu-wrapper.o: $(SRC_PATH)/linux-user/qemu-wrapper.c +qemu-wrapper$(EXESUF): qemu-wrapper.o + + all: $(PROGS) stap # Dummy command so that make thinks it has done something
configure +9 -0
@@ -2636,6 +2636,14 @@ if test "$softmmu" = yes ; then fi fi fi +target_tools= +if test "$linux_user" = yes ; then + for target in $target_list ; do + case $target in + *-linux-user) target_tools="qemu-wrapper\$(EXESUF) $target_tools" ;; + esac + done +fi # Mac OS X ships with a broken assembler roms=
@@ -3079,6 +3087,7 @@ fi echo "CONFIG_TRACE_FILE=$trace_file" >> $config_host_mak echo "TOOLS=$tools" >> $config_host_mak +echo "TARGET_TOOLS=$target_tools" >> $config_host_mak echo "ROMS=$roms" >> $config_host_mak echo "MAKE=$make" >> $config_host_mak echo "INSTALL=$install" >> $config_host_mak
linux-user/qemu-wrapper.c new file +97 -0
97 lines not on this page · raw message
Signature · 1 line
1.7.2.3
PATCH 3/111 linux-user: define default cpu model in configure instead of linux-user/main.c
In reply to Bryce LanhamFrom: Laurent Vivier <[email protected]>
--- configure | 14 ++++++++++++++ linux-user/main.c | 34 +--------------------------------- 2 files changed, 15 insertions(+), 33 deletions(-)
configure +14 -0
@@ -3145,6 +3145,7 @@ target_dir="$target" config_target_mak=$target_dir/config-target.mak target_arch2=`echo $target | cut -d '-' -f 1` target_bigendian="no" +target_default_cpu="any" case "$target_arch2" in armeb|lm32|m68k|microblaze|mips|mipsn32|mips64|ppc|ppcemb|ppc64|ppc64abi32|s390x|sh4eb|sparc|sparc64|sparc32plus)
@@ -3221,11 +3222,13 @@ TARGET_ABI_DIR="" case "$target_arch2" in i386) target_phys_bits=64 + target_default_cpu="qemu32" ;; x86_64) TARGET_BASE_ARCH=i386 target_phys_bits=64 target_long_alignment=8 + target_default_cpu="qemu64" ;; alpha) target_phys_bits=64
@@ -3268,12 +3271,14 @@ case "$target_arch2" in echo "TARGET_ABI_MIPSO32=y" >> $config_target_mak target_nptl="yes" target_phys_bits=64 + target_default_cpu="24Kf" ;; mipsn32|mipsn32el) TARGET_ARCH=mipsn32 TARGET_BASE_ARCH=mips echo "TARGET_ABI_MIPSN32=y" >> $config_target_mak target_phys_bits=64 + target_default_cpu="20Kc" ;; mips64|mips64el) TARGET_ARCH=mips64
@@ -3281,12 +3286,14 @@ case "$target_arch2" in echo "TARGET_ABI_MIPSN64=y" >> $config_target_mak target_phys_bits=64 target_long_alignment=8 + target_default_cpu="20Kc" ;; ppc) gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml" target_phys_bits=32 target_nptl="yes" target_libs_softmmu="$fdt_libs" + target_default_cpu="750" ;; ppcemb) TARGET_BASE_ARCH=ppc
@@ -3295,6 +3302,7 @@ case "$target_arch2" in target_phys_bits=64 target_nptl="yes" target_libs_softmmu="$fdt_libs" + target_default_cpu="750" ;; ppc64) TARGET_BASE_ARCH=ppc
@@ -3303,6 +3311,7 @@ case "$target_arch2" in target_phys_bits=64 target_long_alignment=8 target_libs_softmmu="$fdt_libs" + target_default_cpu="970fx" ;; ppc64abi32) TARGET_ARCH=ppc64
@@ -3312,6 +3321,7 @@ case "$target_arch2" in gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml" target_phys_bits=64 target_libs_softmmu="$fdt_libs" + target_default_cpu="750" ;; sh4|sh4eb) TARGET_ARCH=sh4
@@ -3321,11 +3331,13 @@ case "$target_arch2" in ;; sparc) target_phys_bits=64 + target_default_cpu="Fujitsu MB86904" ;; sparc64) TARGET_BASE_ARCH=sparc target_phys_bits=64 target_long_alignment=8 + target_default_cpu="TI UltraSparc II" ;; sparc32plus) TARGET_ARCH=sparc64
@@ -3333,6 +3345,7 @@ case "$target_arch2" in TARGET_ABI_DIR=sparc echo "TARGET_ABI32=y" >> $config_target_mak target_phys_bits=64 + target_default_cpu="Fujitsu MB86904" ;; s390x) target_nptl="yes"
@@ -3351,6 +3364,7 @@ echo "TARGET_SHORT_ALIGNMENT=$target_short_alignment" >> $config_target_mak echo "TARGET_INT_ALIGNMENT=$target_int_alignment" >> $config_target_mak echo "TARGET_LONG_ALIGNMENT=$target_long_alignment" >> $config_target_mak echo "TARGET_LLONG_ALIGNMENT=$target_llong_alignment" >> $config_target_mak +echo "TARGET_DEFAULT_CPU=\"$target_default_cpu\"" >> $config_target_mak echo "TARGET_ARCH=$TARGET_ARCH" >> $config_target_mak target_arch_name="`echo $TARGET_ARCH | tr '[:lower:]' '[:upper:]'`" echo "TARGET_$target_arch_name=y" >> $config_target_mak
linux-user/main.c +1 -33
@@ -3083,39 +3083,7 @@ int main(int argc, char **argv, char **envp)init_paths (interp_prefix);if (cpu_model ==NULL ) { -#if defined(TARGET_I386 ) -#ifdef TARGET_X86_64 - cpu_model ="qemu64" ; -#else - cpu_model ="qemu32" ; -#endif -#elif defined(TARGET_ARM ) - cpu_model ="any" ; -#elif defined(TARGET_UNICORE32 ) - cpu_model ="any" ; -#elif defined(TARGET_M68K ) - cpu_model ="any" ; -#elif defined(TARGET_SPARC ) -#ifdef TARGET_SPARC64 - cpu_model ="TI UltraSparc II" ; -#else - cpu_model ="Fujitsu MB86904" ; -#endif -#elif defined(TARGET_MIPS ) -#if defined(TARGET_ABI_MIPSN32 ) || defined(TARGET_ABI_MIPSN64 ) - cpu_model ="20Kc" ; -#else - cpu_model ="24Kf" ; -#endif -#elif defined(TARGET_PPC ) -#ifdef TARGET_PPC64 - cpu_model ="970fx" ; -#else - cpu_model ="750" ; -#endif -#else - cpu_model ="any" ; -#endif + cpu_model =TARGET_DEFAULT_CPU ; }tcg_exec_init (0 );cpu_exec_init_all ();
Signature · 1 line
1.7.2.3
PATCH 4/111 linux-user: specify the cpu model during configure
In reply to Bryce LanhamFrom: Laurent Vivier <[email protected]>
This patch allows to set the default cpu model for a given architecture, for instance:
configure --target-list=m68k-linux-user --m68k-default-cpu=m68040
--- configure | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-)
configure +9 -0
@@ -530,6 +530,10 @@ for opt do ;; --target-list=*) target_list="$optarg" ;; + --*-default-cpu=*) + tmp=`expr "x$opt" : 'x--\(.*\)-default-cpu=.*'` + eval ${tmp}_default_cpu="$optarg" + ;; --enable-trace-backend=*) trace_backend="$optarg" ;; --with-trace-file=*) trace_file="$optarg"
@@ -926,6 +930,7 @@ echo " use %M for cpu name [$interp_prefix]" echo " --target-list=LIST set target list (default: build everything)" echo "Available targets: $default_target_list" | \ fold -s -w 53 | sed -e 's/^/ /' +echo " --ARCH-default-cpu=CPU set the default cpu for a given architecture" echo "" echo "Advanced options (experts only):" echo " --source-path=PATH path of source code [$source_path]"
@@ -3360,6 +3365,10 @@ case "$target_arch2" in exit 1 ;; esac +tmp_target_default_cpu=`eval echo \\$${target_arch2}_default_cpu` +if [ "x$tmp_target_default_cpu" != "x" ] ; then + target_default_cpu="$tmp_target_default_cpu" +fi echo "TARGET_SHORT_ALIGNMENT=$target_short_alignment" >> $config_target_mak echo "TARGET_INT_ALIGNMENT=$target_int_alignment" >> $config_target_mak echo "TARGET_LONG_ALIGNMENT=$target_long_alignment" >> $config_target_mak
Signature · 1 line
1.7.2.3
PATCH 6/111 linux-user: define new environment variables
In reply to Bryce LanhamFrom: Laurent Vivier <[email protected]>
QEMU_GDB=port allows to define gdb server port to wait on. QEMU_DEBUG=options allows to activate log file (like -d options)
--- linux-user/main.c | 14 +++++++++++--- qemu-doc.texi | 4 ++++ 2 files changed, 15 insertions(+), 3 deletions(-)
linux-user/main.c +11 -3
@@ -2815,8 +2815,10 @@ static void usage(void)"-strace log system calls\n" "\n" "Environment variables:\n" -"QEMU_STRACE Print system calls and arguments similar to the\n" -" 'strace' program. Enable by setting to any value.\n" +"QEMU_STRACE Print system calls and arguments similar to the\n" +" 'strace' program. Enable by setting to any value.\n" +"QEMU_DEBUG=options Activate log. Use same options as '-d' options\n" +"QEMU_GDB=port Wait gdb connection to port\n" "You can use -E and -U options to set/unset environment variables\n" "for target process. It is possible to provide several variables\n" "by repeating the option. For example:\n"
@@ -2872,7 +2874,7 @@ int main(int argc, char **argv, char **envp)const char *filename;const char *cpu_model;const char *log_file =DEBUG_LOGFILE ; -const char *log_mask =NULL ; +const char *log_mask =getenv ("QEMU_DEBUG" );struct target_pt_regs regs1, *regs = ®s1;struct image_info info1, *info = &info1;struct linux_binprm bprm;
@@ -2919,6 +2921,12 @@ int main(int argc, char **argv, char **envp)#if defined(cpudef_setup)cpudef_setup ();/* parse cpu definitions in target config file (TBD) */ #endif +if (getenv ("QEMU_GDB" )) { + gdbstub_port =atoi (getenv ("QEMU_GDB" )); + } +/* don't propagate QEMU_DEBUG and _GDB to children */ +unsetenv ("QEMU_DEBUG" ); +unsetenv ("QEMU_GDB" ); optind =1 ;for (;;) {
qemu-doc.texi +4 -0
@@ -2293,6 +2293,10 @@ space emulator hasn't implemented ptrace). At the moment this is incomplete. All system calls that don't have a specific argument format are printed with information for six arguments. Many flag-style arguments don't have decoders and will show up as numbers. +@item QEMU_DEBUG=options +Activate log. Use same options as '-d' options. +@item QEMU_GDB=port +Wait gdb connection to port. @end table @node Other binaries
Signature · 1 line
1.7.2.3
PATCH 7/111 linux-user: define a script to set binfmt using debian flavored tools
In reply to Bryce LanhamFrom: Laurent Vivier <[email protected]>
--- scripts/set_binfmt_m68k | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-) create mode 100755 scripts/set_binfmt_m68k
scripts/set_binfmt_m68k new file +8 -0
@@ -0,0 +1,8 @@ +#!/bin/bash + +name="m68k" +magic="\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x04" +mask="\xff\xff\xff\xff\xff\xff\xfe\xfe\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfb\xff\xff" + +update-binfmts --install $name /usr/bin/qemu-m68k \ + --magic $magic --mask $mask
Signature · 1 line
1.7.2.3
PATCH 5/111 linux-user,m68k: display default cpu
In reply to Bryce LanhamFrom: Laurent Vivier <[email protected]>
--- target-m68k/helper.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-)
target-m68k/helper.c +5 -0
@@ -57,6 +57,11 @@ void m68k_cpu_list(FILE *f, fprintf_function cpu_fprintf)unsigned int i;for (i =0 ; m68k_cpu_defs[i].name; i++) { +if (strcmp (m68k_cpu_defs[i].name,TARGET_DEFAULT_CPU ) ==0 ) { + (*cpu_fprintf)(f," >" ); + }else { + (*cpu_fprintf)(f," " ); + } (*cpu_fprintf)(f,"%s\n" , m68k_cpu_defs[i].name); } }
Signature · 1 line
1.7.2.3
PATCH 8/111 linux-user: define default cpu model in configure instead of linux-user/main.c
In reply to Bryce LanhamFrom: Laurent Vivier <[email protected]>
--- configure | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
configure +1 -0
@@ -3251,6 +3251,7 @@ case "$target_arch2" in cris) target_nptl="yes" target_phys_bits=32 + target_default_cpu="" ;; lm32) target_phys_bits=32
Signature · 1 line
1.7.2.3
PATCH 9/111 m68k: add tcg_gen_debug_insn_start()
In reply to Bryce LanhamFrom: Laurent Vivier <[email protected]>
This patch add debug info by writing the PC of the corresponing CPU instruction of an TCG opcode.
--- target-m68k/translate.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)
target-m68k/translate.c +3 -0
@@ -2947,6 +2947,9 @@ static void disas_m68k_insn(CPUState * env, DisasContext *s) {uint16_t insn; +if (unlikely (qemu_loglevel_mask (CPU_LOG_TB_OP ))) +tcg_gen_debug_insn_start (s->pc); + insn =lduw_code (s->pc); s->pc +=2 ;
Signature · 1 line
1.7.2.3
PATCH 10/111 m68k: define m680x0 CPUs and features
In reply to Bryce LanhamFrom: Laurent Vivier <[email protected]>
This patch defines four new Motorola 680x0 family CPUs:
- M68K_CPUID_M68000,
- M68K_CPUID_M68020,
- M68K_CPUID_M68040,
- M68K_CPUID_M68060
And six new features:
- M68K_FEATURE_SCALED_INDEX, scaled address index register
- M68K_FEATURE_LONG_MULDIV, 32bit multiply/divide
- M68K_FEATURE_QUAD_MULDIV, 64bit multiply/divide
- M68K_FEATURE_BCCL, long conditional branches
- M68K_FEATURE_BITFIELD, bit field instructions
- M68K_FEATURE_FPU, FPU instructions
Following patches implement them...
--- target-m68k/cpu.h | 13 ++++++++++--- target-m68k/helper.c | 36 +++++++++++++++++++++++++++++++++++- 2 files changed, 45 insertions(+), 4 deletions(-)
target-m68k/cpu.h +10 -3
@@ -182,6 +182,7 @@ void do_m68k_semihosting(CPUM68KState *env, int nr);ISA revisions mentioned. */ enum m68k_features { +M68K_FEATURE_M68000 ,M68K_FEATURE_CF_ISA_A ,M68K_FEATURE_CF_ISA_B ,/* (ISA B or C). */ M68K_FEATURE_CF_ISA_APLUSC ,/* BIT/BITREV, FF1, STRLDSR (ISA A+ or C). */
@@ -192,7 +193,13 @@ enum m68k_features {M68K_FEATURE_CF_EMAC_B ,/* Revision B EMAC (dual accumulate). */ M68K_FEATURE_USP ,/* User Stack Pointer. (ISA A+, B or C). */ M68K_FEATURE_EXT_FULL ,/* 68020+ full extension word. */ - M68K_FEATURE_WORD_INDEX /* word sized address index registers. */ +M68K_FEATURE_WORD_INDEX ,/* word sized address index registers. */ +M68K_FEATURE_SCALED_INDEX ,/* scaled address index registers. */ +M68K_FEATURE_LONG_MULDIV ,/* 32 bit multiply/divide. */ +M68K_FEATURE_QUAD_MULDIV ,/* 64 bit multiply/divide. */ +M68K_FEATURE_BCCL ,/* Long conditional branches. */ +M68K_FEATURE_BITFIELD ,/* Bit field insns. */ +M68K_FEATURE_FPU };static inline int m68k_feature (CPUM68KState *env,int feature)
@@ -205,8 +212,8 @@ void m68k_cpu_list(FILE *f, fprintf_function cpu_fprintf);void register_m68k_insns (CPUM68KState *env);#ifdef CONFIG_USER_ONLY -/* Linux uses 8k pages. */ -#define TARGET_PAGE_BITS 13 +/* Linux uses 4k pages. */ +#define TARGET_PAGE_BITS 12#else /* Smallest TLB entry size is 1k. */ #define TARGET_PAGE_BITS 10
target-m68k/helper.c +35 -1
@@ -31,6 +31,10 @@#define SIGNBIT (1u << 31)enum m68k_cpuid { +M68K_CPUID_M68000 , +M68K_CPUID_M68020 , +M68K_CPUID_M68040 , +M68K_CPUID_M68060 ,M68K_CPUID_M5206 ,M68K_CPUID_M5208 ,M68K_CPUID_CFV4E ,
@@ -45,6 +49,10 @@ struct m68k_def_t { };static m68k_def_t m68k_cpu_defs[] = { + {"m68000" ,M68K_CPUID_M68000 }, + {"m68020" ,M68K_CPUID_M68020 }, + {"m68040" ,M68K_CPUID_M68040 }, + {"m68060" ,M68K_CPUID_M68060 }, {"m5206" ,M68K_CPUID_M5206 }, {"m5208" ,M68K_CPUID_M5208 }, {"cfv4e" ,M68K_CPUID_CFV4E },
@@ -110,12 +118,30 @@ static int cpu_m68k_set_model(CPUM68KState *env, const char *name)return -1 ;switch (def->id) { +case M68K_CPUID_M68020 : +case M68K_CPUID_M68040 : +m68k_set_feature (env,M68K_FEATURE_QUAD_MULDIV ); +case M68K_CPUID_M68060 : +m68k_set_feature (env,M68K_FEATURE_BRAL ); +m68k_set_feature (env,M68K_FEATURE_BCCL ); +m68k_set_feature (env,M68K_FEATURE_BITFIELD ); +m68k_set_feature (env,M68K_FEATURE_EXT_FULL ); +m68k_set_feature (env,M68K_FEATURE_SCALED_INDEX ); +m68k_set_feature (env,M68K_FEATURE_LONG_MULDIV ); +m68k_set_feature (env,M68K_FEATURE_FPU ); +case M68K_CPUID_M68000 : +m68k_set_feature (env,M68K_FEATURE_M68000 ); +m68k_set_feature (env,M68K_FEATURE_USP ); +m68k_set_feature (env,M68K_FEATURE_WORD_INDEX ); +break ;case M68K_CPUID_M5206 :m68k_set_feature (env,M68K_FEATURE_CF_ISA_A ); +m68k_set_feature (env,M68K_FEATURE_SCALED_INDEX );break ;case M68K_CPUID_M5208 :m68k_set_feature (env,M68K_FEATURE_CF_ISA_A );m68k_set_feature (env,M68K_FEATURE_CF_ISA_APLUSC ); +m68k_set_feature (env,M68K_FEATURE_SCALED_INDEX );m68k_set_feature (env,M68K_FEATURE_BRAL );m68k_set_feature (env,M68K_FEATURE_CF_EMAC );m68k_set_feature (env,M68K_FEATURE_USP );
@@ -123,16 +149,19 @@ static int cpu_m68k_set_model(CPUM68KState *env, const char *name)case M68K_CPUID_CFV4E :m68k_set_feature (env,M68K_FEATURE_CF_ISA_A );m68k_set_feature (env,M68K_FEATURE_CF_ISA_B ); +m68k_set_feature (env,M68K_FEATURE_SCALED_INDEX );m68k_set_feature (env,M68K_FEATURE_BRAL );m68k_set_feature (env,M68K_FEATURE_CF_FPU );m68k_set_feature (env,M68K_FEATURE_CF_EMAC );m68k_set_feature (env,M68K_FEATURE_USP );break ;case M68K_CPUID_ANY : +m68k_set_feature (env,M68K_FEATURE_M68000 );m68k_set_feature (env,M68K_FEATURE_CF_ISA_A );m68k_set_feature (env,M68K_FEATURE_CF_ISA_B );m68k_set_feature (env,M68K_FEATURE_CF_ISA_APLUSC );m68k_set_feature (env,M68K_FEATURE_BRAL ); +m68k_set_feature (env,M68K_FEATURE_BCCL );m68k_set_feature (env,M68K_FEATURE_CF_FPU );/* MAC and EMAC are mututally exclusive, so pick EMAC. It's mostly backwards compatible. */
@@ -140,12 +169,17 @@ static int cpu_m68k_set_model(CPUM68KState *env, const char *name)m68k_set_feature (env,M68K_FEATURE_CF_EMAC_B );m68k_set_feature (env,M68K_FEATURE_USP );m68k_set_feature (env,M68K_FEATURE_EXT_FULL ); +m68k_set_feature (env,M68K_FEATURE_SCALED_INDEX );m68k_set_feature (env,M68K_FEATURE_WORD_INDEX ); +m68k_set_feature (env,M68K_FEATURE_BITFIELD ); +m68k_set_feature (env,M68K_FEATURE_LONG_MULDIV ); +m68k_set_feature (env,M68K_FEATURE_QUAD_MULDIV );break ; }register_m68k_insns (env); -if (m68k_feature (env,M68K_FEATURE_CF_FPU )) { +if (m68k_feature (env,M68K_FEATURE_CF_FPU ) || +m68k_feature (env,M68K_FEATURE_FPU )) {gdb_register_coprocessor (env, fpu_gdb_get_reg, fpu_gdb_set_reg,11 ,"cf-fp.xml" ,18 ); }
Signature · 1 line
1.7.2.3
PATCH 11/111 m68k: add missing accessing modes for some instructions.
In reply to Bryce LanhamFrom: Laurent Vivier <[email protected]>
This patch modifies following instructions to allow them to manage data size other than "long", by adding "byte" and "word" data size: "addsub", "arith_im", "addsubq", "or", "eor", "and".
This patch modifies following instructions to use EA to access data:
"neg", "not".
--- target-m68k/cpu.h | 10 ++- target-m68k/helper.c | 78 +++++++++++++------ target-m68k/translate.c | 202 +++++++++++++++++++++++++++-------------------- 3 files changed, 179 insertions(+), 111 deletions(-)
target-m68k/cpu.h +8 -2
@@ -132,11 +132,17 @@ enum {CC_OP_DYNAMIC ,/* Use env->cc_op */ CC_OP_FLAGS ,/* CC_DEST = CVZN, CC_SRC = unused */ CC_OP_LOGIC ,/* CC_DEST = result, CC_SRC = unused */ +CC_OP_ADDB ,/* CC_DEST = result, CC_SRC = source */ +CC_OP_ADDW ,/* CC_DEST = result, CC_SRC = source */ CC_OP_ADD ,/* CC_DEST = result, CC_SRC = source */ +CC_OP_SUBB ,/* CC_DEST = result, CC_SRC = source */ +CC_OP_SUBW ,/* CC_DEST = result, CC_SRC = source */ CC_OP_SUB ,/* CC_DEST = result, CC_SRC = source */ -CC_OP_CMPB ,/* CC_DEST = result, CC_SRC = source */ -CC_OP_CMPW ,/* CC_DEST = result, CC_SRC = source */ +CC_OP_ADDXB ,/* CC_DEST = result, CC_SRC = source */ +CC_OP_ADDXW ,/* CC_DEST = result, CC_SRC = source */ CC_OP_ADDX ,/* CC_DEST = result, CC_SRC = source */ +CC_OP_SUBXB ,/* CC_DEST = result, CC_SRC = source */ +CC_OP_SUBXW ,/* CC_DEST = result, CC_SRC = source */ CC_OP_SUBX ,/* CC_DEST = result, CC_SRC = source */ CC_OP_SHIFT, /* CC_DEST = result, CC_SRC = carry */ };
target-m68k/helper.c +54 -24
106 lines not on this page · raw message
target-m68k/translate.c +117 -85
371 lines not on this page · raw message
Signature · 1 line
1.7.2.3
PATCH 13/111 m68k: add Scc instruction with memory operand.
In reply to Bryce LanhamFrom: Laurent Vivier <[email protected]>
This patch defines Scc instruction for M68000 feature accessing destination operand using an effective address (existing Scc instruction manages only data registers).
--- target-m68k/translate.c | 18 ++++++++++++++++++ 1 files changed, 18 insertions(+), 0 deletions(-)
target-m68k/translate.c +18 -0
@@ -903,6 +903,23 @@ static void gen_jmp_tb(DisasContext *s, int n, uint32_t dest) s->is_jmp =DISAS_TB_JUMP ; } +DISAS_INSN (scc_mem) +{ +int l1; +int cond; +TCGv dest; + + l1 =gen_new_label (); + cond = (insn >>8 ) &0xf ; + dest =tcg_temp_local_new (); +tcg_gen_movi_i32 (dest,0 ); +gen_jmpcc (s, cond ^1 , l1); +tcg_gen_movi_i32 (dest,0xff ); +gen_set_label (l1); +DEST_EA (insn,OS_BYTE , dest,NULL ); +tcg_temp_free (dest); +} +DISAS_INSN (undef_mac) {gen_exception (s, s->pc -2 ,EXCP_LINEA );
@@ -2972,6 +2989,7 @@ void register_m68k_insns (CPUM68KState *env)INSN (addsubq,5000 , f080,M68000 );INSN (addsubq,5080 , f0c0,M68000 ); INSN(scc, 50c0, f0f8, CF_ISA_A); + INSN(scc_mem, 50c0, f0c0, M68000); INSN(scc, 50c0, f0f8, M68000); INSN(tpf, 51f8, fff8, CF_ISA_A);
Signature · 1 line
1.7.2.3
PATCH 12/111 m68k: add Motorola 680x0 family common instructions.
In reply to Bryce LanhamFrom: Laurent Vivier <[email protected]>
This patch declares existing ISA instructions belonging to previously defined 680x0 familty new features:
- modify gen_lea_indexed() to manage scaled index,
- declare M68000 instructions: arith_im, bitop_reg, arith_im, bitop_im, move, negx, move_from_sr, lea, clr, neg, move_to_ccr, not, pea, swap, ext, tas, tst, illegal, trap, link, unlk, nop, stop, rte, rts, jump, addsubq, scc, branch, moveq, or, divw, addsub, subx, cmp, cmpa, eor, and, mulw, addx, shift_im, shift_reg.
- declare FPU instructions: fbcc, frestore, fsave,
- declare long branch instructions: branch.
--- target-m68k/translate.c | 89 ++++++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 85 insertions(+), 4 deletions(-)
target-m68k/translate.c +85 -4
@@ -325,6 +325,9 @@ static TCGv gen_lea_indexed(DisasContext *s, int opsize, TCGv base)if ((ext &0x800 ) ==0 && !m68k_feature (s->env,M68K_FEATURE_WORD_INDEX ))return NULL_QREG ; +if (!m68k_feature (s->env,M68K_FEATURE_SCALED_INDEX )) + ext &= ~(3 <<9 ); +if (ext &0x100 ) {/* full extension word format */ if (!m68k_feature (s->env,M68K_FEATURE_EXT_FULL ))
@@ -333,7 +336,7 @@ static TCGv gen_lea_indexed(DisasContext *s, int opsize, TCGv base)if ((ext &0x30 ) >0x10 ) {/* base displacement */ if ((ext &0x30 ) ==0x20 ) { - bd = (int16_t )lduw_code (s->pc); + bd =ldsw_code (s->pc); s->pc +=2 ; }else { bd =read_im32 (s);
@@ -382,7 +385,7 @@ static TCGv gen_lea_indexed(DisasContext *s, int opsize, TCGv base)if ((ext &3 ) >1 ) {/* outer displacement */ if ((ext &3 ) ==2 ) { - od = (int16_t )lduw_code (s->pc); + od =ldsw_code (s->pc); s->pc +=2 ; }else { od =read_im32 (s);
@@ -2856,85 +2859,149 @@ void register_m68k_insns (CPUM68KState *env) register_opcode(disas_##name, 0x##opcode, 0x##mask); \ } while(0)INSN (undef,0000 ,0000 ,CF_ISA_A ); +INSN (undef,0000 ,0000 ,M68000 );INSN (arith_im,0080 , fff8,CF_ISA_A ); +INSN (arith_im,0000 , ff00,M68000 ); + INSN(undef, 00c0, ffc0, M68000); INSN(bitrev, 00c0, fff8, CF_ISA_APLUSC);INSN (bitop_reg,0100 , f1c0,CF_ISA_A ); +INSN (bitop_reg,0100 , f1c0,M68000 );INSN (bitop_reg,0140 , f1c0,CF_ISA_A ); +INSN (bitop_reg,0140 , f1c0,M68000 );INSN (bitop_reg,0180 , f1c0,CF_ISA_A ); +INSN (bitop_reg,0180 , f1c0,M68000 ); INSN(bitop_reg, 01c0, f1c0, CF_ISA_A); + INSN(bitop_reg, 01c0, f1c0, M68000);INSN (arith_im,0280 , fff8,CF_ISA_A ); +INSN (arith_im,0200 , ff00,M68000 ); + INSN(undef, 02c0, ffc0, M68000); INSN(byterev, 02c0, fff8, CF_ISA_APLUSC);INSN (arith_im,0480 , fff8,CF_ISA_A ); +INSN (arith_im,0400 , ff00,M68000 ); + INSN(undef, 04c0, ffc0, M68000); +INSN (arith_im,0600 , ff00,M68000 ); + INSN(undef, 06c0, ffc0, M68000); INSN(ff1, 04c0, fff8, CF_ISA_APLUSC);INSN (arith_im,0680 , fff8,CF_ISA_A );INSN (bitop_im,0800 , ffc0,CF_ISA_A ); +INSN (bitop_im,0800 , ffc0,M68000 );INSN (bitop_im,0840 , ffc0,CF_ISA_A ); +INSN (bitop_im,0840 , ffc0,M68000 );INSN (bitop_im,0880 , ffc0,CF_ISA_A ); +INSN (bitop_im,0880 , ffc0,M68000 ); INSN(bitop_im, 08c0, ffc0, CF_ISA_A); + INSN(bitop_im, 08c0, ffc0, M68000); INSN(arith_im, 0a80, fff8, CF_ISA_A); + INSN(arith_im, 0a00, ff00, M68000); + INSN(undef, 0ac0, ffc0, M68000); INSN(arith_im, 0c00, ff38, CF_ISA_A); + INSN(arith_im, 0c00, ff00, M68000); + INSN(undef, 0cc0, ffc0, M68000);INSN (move,1000 , f000,CF_ISA_A ); +INSN (move,1000 , f000,M68000 );INSN (move,2000 , f000,CF_ISA_A ); +INSN (move,2000 , f000,M68000 );INSN (move,3000 , f000,CF_ISA_A ); +INSN (move,3000 , f000,M68000 );INSN (strldsr,40e7 , ffff,CF_ISA_APLUSC );INSN (negx,4080 , fff8,CF_ISA_A ); +INSN (negx,4080 , fff8,M68000 ); + INSN(undef, 40c0, ffc0, M68000); INSN(move_from_sr, 40c0, fff8, CF_ISA_A); + INSN(move_from_sr, 40c0, fff8, M68000); INSN(lea, 41c0, f1c0, CF_ISA_A); + INSN(lea, 41c0, f1c0, M68000);INSN (clr,4200 , ff00,CF_ISA_A ); +INSN (clr,4200 , ff00,M68000 ); INSN(undef, 42c0, ffc0, CF_ISA_A); + INSN(undef, 42c0, ffc0, M68000); INSN(move_from_ccr, 42c0, fff8, CF_ISA_A);INSN (neg,4480 , fff8,CF_ISA_A ); +INSN (neg,4400 , ff00,M68000 ); + INSN(undef, 44c0, ffc0, M68000); INSN(move_to_ccr, 44c0, ffc0, CF_ISA_A); + INSN(move_to_ccr, 44c0, ffc0, M68000);INSN (not,4680 , fff8,CF_ISA_A ); +INSN (not,4600 , ff00,M68000 ); + INSN(undef, 46c0, ffc0, M68000); INSN(move_to_sr, 46c0, ffc0, CF_ISA_A);INSN (pea,4840 , ffc0,CF_ISA_A ); +INSN (pea,4840 , ffc0,M68000 );INSN (swap,4840 , fff8,CF_ISA_A ); +INSN (swap,4840 , fff8,M68000 ); INSN(movem, 48c0, fbc0, CF_ISA_A);INSN (ext,4880 , fff8,CF_ISA_A ); +INSN (ext,4880 , fff8,M68000 ); INSN(ext, 48c0, fff8, CF_ISA_A); + INSN(ext, 48c0, fff8, M68000); INSN(ext, 49c0, fff8, CF_ISA_A); + INSN(ext, 49c0, fff8, M68000); INSN(tst, 4a00, ff00, CF_ISA_A); + INSN(tst, 4a00, ff00, M68000); INSN(tas, 4ac0, ffc0, CF_ISA_B); + INSN(tas, 4ac0, ffc0, M68000); INSN(halt, 4ac8, ffff, CF_ISA_A); INSN(pulse, 4acc, ffff, CF_ISA_A); INSN(illegal, 4afc, ffff, CF_ISA_A); + INSN(illegal, 4afc, ffff, M68000); INSN(mull, 4c00, ffc0, CF_ISA_A); INSN(divl, 4c40, ffc0, CF_ISA_A); INSN(sats, 4c80, fff8, CF_ISA_B);INSN (trap,4e40 , fff0,CF_ISA_A ); +INSN (trap,4e40 , fff0,M68000 );INSN (link,4e50 , fff8,CF_ISA_A ); +INSN (link,4e50 , fff8,M68000 );INSN (unlk,4e58 , fff8,CF_ISA_A ); +INSN (unlk,4e58 , fff8,M68000 );INSN (move_to_usp,4e60 , fff8,USP );INSN (move_from_usp,4e68 , fff8,USP );INSN (nop,4e71 , ffff,CF_ISA_A ); +INSN (nop,4e71 , ffff,M68000 );INSN (stop,4e72 , ffff,CF_ISA_A ); +INSN (stop,4e72 , ffff,M68000 );INSN (rte,4e73 , ffff,CF_ISA_A ); +INSN (rte,4e73 , ffff,M68000 );INSN (rts,4e75 , ffff,CF_ISA_A ); +INSN (rts,4e75 , ffff,M68000 );INSN (movec,4e7b , ffff,CF_ISA_A );INSN (jump,4e80 , ffc0,CF_ISA_A ); +INSN (jump,4e80 , ffc0,M68000 );INSN (jump,4ec0 , ffc0,CF_ISA_A ); -INSN (addsubq,5180 , f1c0,CF_ISA_A ); +INSN (jump,4ec0 , ffc0,M68000 ); +INSN (addsubq,5080 , f0c0,CF_ISA_A ); +INSN (addsubq,5000 , f080,M68000 ); +INSN (addsubq,5080 , f0c0,M68000 ); INSN(scc, 50c0, f0f8, CF_ISA_A); -INSN (addsubq,5080 , f1c0,CF_ISA_A ); + INSN(scc, 50c0, f0f8, M68000); INSN(tpf, 51f8, fff8, CF_ISA_A);/* Branch instructions. */ INSN (branch,6000 , f000,CF_ISA_A ); +INSN (branch,6000 , f000,M68000 );/* Disable long branch instructions, then add back the ones we want. */ INSN (undef,60ff , f0ff,CF_ISA_A );/* All long branches. */ +INSN (undef,60ff , f0ff,M68000 );/* All long branches. */ INSN (branch,60ff , f0ff,CF_ISA_B );INSN (undef,60ff , ffff,CF_ISA_B );/* bra.l */ INSN (branch,60ff , ffff,BRAL ); +INSN (branch,60ff , f0ff,BCCL );INSN (moveq,7000 , f100,CF_ISA_A ); +INSN (moveq,7000 , f100,M68000 );INSN (mvzs,7100 , f100,CF_ISA_B );INSN (or,8000 , f000,CF_ISA_A ); +INSN (or,8000 , f000,M68000 ); INSN(divw, 80c0, f0c0, CF_ISA_A); + INSN(divw, 80c0, f0c0, M68000);INSN (addsub,9000 , f000,CF_ISA_A ); +INSN (addsub,9000 , f000,M68000 ); + INSN(undef, 90c0, f0c0, CF_ISA_A);INSN (subx,9180 , f1f8,CF_ISA_A ); +INSN (subx,9100 , f138,M68000 ); INSN(suba, 91c0, f1c0, CF_ISA_A);INSN (undef_mac, a000, f000,CF_ISA_A ); +INSN (undef_mac, a000, f000,M68000 );INSN (mac, a000, f100,CF_EMAC );INSN (from_mac, a180, f9b0,CF_EMAC );INSN (move_mac, a110, f9fc,CF_EMAC );
@@ -2953,19 +3020,33 @@ void register_m68k_insns (CPUM68KState *env)INSN (cmpa, b0c0, f1c0,CF_ISA_B );/* cmpa.w */ INSN (cmp, b080, f1c0,CF_ISA_A );INSN (cmpa, b1c0, f1c0,CF_ISA_A ); +INSN (cmp, b000, f100,M68000 ); +INSN (eor, b100, f100,M68000 ); +INSN (cmpa, b0c0, f0c0,M68000 );INSN (eor, b180, f1c0,CF_ISA_A );INSN (and, c000, f000,CF_ISA_A ); +INSN (and, c000, f000,M68000 );INSN (mulw, c0c0, f0c0,CF_ISA_A ); +INSN (mulw, c0c0, f0c0,M68000 );INSN (addsub, d000, f000,CF_ISA_A ); +INSN (addsub, d000, f000,M68000 ); +INSN (undef, d0c0, f0c0,CF_ISA_A );INSN (addx, d180, f1f8,CF_ISA_A ); +INSN (addx, d100, f138,M68000 );INSN (adda, d1c0, f1c0,CF_ISA_A );INSN (shift_im, e080, f0f0,CF_ISA_A );INSN (shift_reg, e0a0, f0f0,CF_ISA_A ); +INSN (shift_im, e080, f0f0,M68000 ); +INSN (shift_reg, e0a0, f0f0,M68000 );INSN (undef_fpu, f000, f000,CF_ISA_A ); +INSN (undef_fpu, f000, f000,M68000 );INSN (fpu, f200, ffc0,CF_FPU );INSN (fbcc, f280, ffc0,CF_FPU );INSN (frestore, f340, ffc0,CF_FPU );INSN (fsave, f340, ffc0,CF_FPU ); +INSN (fbcc, f280, ffc0,FPU ); +INSN (frestore, f340, ffc0,FPU ); +INSN (fsave, f340, ffc0,FPU );INSN (intouch, f340, ffc0,CF_ISA_A );INSN (cpushl, f428, ff38,CF_ISA_A );INSN (wddata, fb00, ff00,CF_ISA_A );
Signature · 1 line
1.7.2.3
PATCH 15/111 m68k: modify movem instruction to manage word
In reply to Bryce LanhamFrom: Laurent Vivier <[email protected]>
This patch modifies "movem" to manage "word" and "long" register size instead of only "word". Attach it to M68000 feature.
--- target-m68k/translate.c | 52 +++++++++++++++++++++++++++++++++------------- 1 files changed, 37 insertions(+), 15 deletions(-)
target-m68k/translate.c +37 -15
@@ -1173,6 +1173,8 @@ DISAS_INSN(movem)TCGv reg;TCGv tmp;int is_load; +int opsize; +int32_t incr; mask =lduw_code (s->pc); s->pc +=2 ;
@@ -1184,21 +1186,40 @@ DISAS_INSN(movem) addr =tcg_temp_new ();tcg_gen_mov_i32 (addr, tmp); is_load = ((insn &0x0400 ) !=0 ); -for (i =0 ; i <16 ; i++, mask >>=1 ) { -if (mask &1 ) { -if (i <8 ) - reg =DREG (i,0 ); -else - reg =AREG (i,0 ); -if (is_load) { - tmp =gen_load (s,OS_LONG , addr,0 ); -tcg_gen_mov_i32 (reg, tmp); - }else { -gen_store (s,OS_LONG , addr, reg); - } -if (mask !=1 ) -tcg_gen_addi_i32 (addr, addr,4 ); - } + opsize = (insn &0x40 ) !=0 ?OS_LONG :OS_WORD ; + incr =opsize_bytes (opsize); +if (!is_load && (insn &070 ) ==040 ) { +for (i =15 ; i >=0 ; i--, mask >>=1 ) { +if (mask &1 ) { +if (i <8 ) + reg =DREG (i,0 ); +else + reg =AREG (i,0 ); +gen_store (s, opsize, addr, reg); +if (mask !=1 ) +tcg_gen_subi_i32 (addr, addr, incr); + } + } +tcg_gen_mov_i32 (AREG (insn,0 ), addr); + }else { +for (i =0 ; i <16 ; i++, mask >>=1 ) { +if (mask &1 ) { +if (i <8 ) + reg =DREG (i,0 ); +else + reg =AREG (i,0 ); +if (is_load) { + tmp =gen_load (s, opsize, addr,1 ); +tcg_gen_mov_i32 (reg, tmp); + }else { +gen_store (s, opsize, addr, reg); + } +if (mask !=1 || (insn &070 ) ==030 ) +tcg_gen_addi_i32 (addr, addr, incr); + } + } +if ((insn &070 ) ==030 ) +tcg_gen_mov_i32 (AREG (insn,0 ), addr); } }
@@ -2972,6 +2993,7 @@ void register_m68k_insns (CPUM68KState *env)INSN (swap,4840 , fff8,CF_ISA_A );INSN (swap,4840 , fff8,M68000 ); INSN(movem, 48c0, fbc0, CF_ISA_A); + INSN(movem, 48c0, fbc0, M68000);INSN (ext,4880 , fff8,CF_ISA_A );INSN (ext,4880 , fff8,M68000 ); INSN(ext, 48c0, fff8, CF_ISA_A);
Signature · 1 line
1.7.2.3
PATCH 14/111 m68k: add DBcc instruction.
In reply to Bryce LanhamFrom: Laurent Vivier <[email protected]>
Define DBcc instruction and attach it to M68000 feature.
--- target-m68k/translate.c | 26 ++++++++++++++++++++++++++ 1 files changed, 26 insertions(+), 0 deletions(-)
target-m68k/translate.c +26 -0
@@ -920,6 +920,31 @@ DISAS_INSN(scc_mem)tcg_temp_free (dest); } +DISAS_INSN (dbcc) +{ +int l1; +TCGv reg; +TCGv tmp; +int16_t offset; +uint32_t base; + + reg =DREG (insn,0 ); + base = s->pc; + offset =ldsw_code (s->pc); + s->pc +=2 ; + l1 =gen_new_label (); +gen_jmpcc (s, (insn >>8 ) &0xf , l1); + + tmp =tcg_temp_new (); +tcg_gen_ext16s_i32 (tmp, reg); +tcg_gen_addi_i32 (tmp, tmp,-1 ); +gen_partset_reg (OS_WORD , reg, tmp); +tcg_gen_brcondi_i32 (TCG_COND_EQ , tmp,0 , l1); +gen_jmp_tb (s,1 , base + offset); +gen_set_label (l1); +gen_jmp_tb (s,0 , s->pc); +} +DISAS_INSN (undef_mac) {gen_exception (s, s->pc -2 ,EXCP_LINEA );
@@ -2991,6 +3016,7 @@ void register_m68k_insns (CPUM68KState *env) INSN(scc, 50c0, f0f8, CF_ISA_A); INSN(scc_mem, 50c0, f0c0, M68000); INSN(scc, 50c0, f0f8, M68000); + INSN(dbcc, 50c8, f0f8, M68000); INSN(tpf, 51f8, fff8, CF_ISA_A);/* Branch instructions. */
Signature · 1 line
1.7.2.3
PATCH 16/111 m68k: add 64bit divide.
In reply to Bryce LanhamFrom: Laurent Vivier <[email protected]>
This patch modifies "divl" to support 64bit operands (QUAD_MULDIV feature).
--- target-m68k/cpu.h | 3 ++ target-m68k/helpers.h | 2 + target-m68k/op_helper.c | 77 ++++++++++++++++++++++++++++++++++++++++++++-- target-m68k/qregs.def | 1 + target-m68k/translate.c | 34 ++++++++++++++++---- 5 files changed, 106 insertions(+), 11 deletions(-)
target-m68k/cpu.h +3 -0
@@ -91,6 +91,9 @@ typedef struct CPUM68KState {uint32_t div1;uint32_t div2; +/* Upper 32 bits of a 64bit operand for quad MUL/DIV. */ +uint32_t quadh; +/* MMU status. */ struct {uint32_t ar;
target-m68k/helpers.h +2 -0
@@ -5,6 +5,8 @@ DEF_HELPER_1(ff1, i32, i32) DEF_HELPER_2(sats, i32, i32, i32) DEF_HELPER_2(divu, void, env, i32) DEF_HELPER_2(divs, void, env, i32) +DEF_HELPER_1(divu64, void, env) +DEF_HELPER_1(divs64, void, env) DEF_HELPER_3(addx_cc, i32, env, i32, i32) DEF_HELPER_3(subx_cc, i32, env, i32, i32)DEF_HELPER_3 (shl_cc, i32, env, i32, i32)
target-m68k/op_helper.c +73 -4
88 lines not on this page · raw message
target-m68k/qregs.def +1 -0
@@ -7,6 +7,7 @@ DEFO32(CC_SRC, cc_src) DEFO32(CC_X, cc_x) DEFO32(DIV1, div1) DEFO32(DIV2, div2) +DEFO32(QUADH, quadh) DEFO32(EXCEPTION, exception_index) DEFO32(HALTED, halted) DEFO32(MACSR, macsr)
target-m68k/translate.c +27 -7
@@ -1020,10 +1020,27 @@ DISAS_INSN(divl)TCGv reg;uint16_t ext; - ext =lduw_code (s->pc); - s->pc +=2 ; -if (ext &0x87f8 ) { -gen_exception (s, s->pc -4 ,EXCP_UNSUPPORTED ); + ext =read_im16 (s); +if (ext &0x400 ) { +if (!m68k_feature (s->env,M68K_FEATURE_QUAD_MULDIV )) { +gen_exception (s, s->pc -4 ,EXCP_UNSUPPORTED ); +return ; + } + num =DREG (ext,12 ); + reg =DREG (ext,0 ); +tcg_gen_mov_i32 (QREG_DIV1 , num); +tcg_gen_mov_i32 (QREG_QUADH , reg); +SRC_EA (den,OS_LONG ,0 ,NULL ); +tcg_gen_mov_i32 (QREG_DIV2 , den); +if (ext &0x0800 ) { +gen_helper_divs64 (cpu_env); + }else { +gen_helper_divu64 (cpu_env); + } +tcg_gen_mov_i32 (num,QREG_DIV1 ); +if (!TCGV_EQUAL (num, reg)) +tcg_gen_mov_i32 (reg,QREG_DIV2 ); + s->cc_op =CC_OP_FLAGS ;return ; } num =DREG (ext,12 );
@@ -1036,10 +1053,12 @@ DISAS_INSN(divl) }else {gen_helper_divu (cpu_env,tcg_const_i32 (0 )); } -if ((ext &7 ) == ((ext >>12 ) &7 )) { +if (TCGV_EQUAL (num, reg) || +m68k_feature (s->env,M68K_FEATURE_LONG_MULDIV )) {/* div */ -tcg_gen_mov_i32 (reg,QREG_DIV1 ); - }else { +tcg_gen_mov_i32 (num,QREG_DIV1 ); + } +if (!TCGV_EQUAL (num, reg)) {/* rem */ tcg_gen_mov_i32 (reg,QREG_DIV2 ); }
@@ -3010,6 +3029,7 @@ void register_m68k_insns (CPUM68KState *env) INSN(illegal, 4afc, ffff, M68000); INSN(mull, 4c00, ffc0, CF_ISA_A); INSN(divl, 4c40, ffc0, CF_ISA_A); + INSN(divl, 4c40, ffc0, LONG_MULDIV); INSN(sats, 4c80, fff8, CF_ISA_B);INSN (trap,4e40 , fff0,CF_ISA_A );INSN (trap,4e40 , fff0,M68000 );
Signature · 1 line
1.7.2.3
PATCH 17/111 m68k: add 32bit and 64bit multiply
In reply to Bryce LanhamFrom: Laurent Vivier <[email protected]>
This patch modify "mull" to support 64bit result, and to update CC on 32bit operands.
--- target-m68k/helpers.h | 4 +++ target-m68k/op_helper.c | 66 +++++++++++++++++++++++++++++++++++++++++++++++ target-m68k/translate.c | 36 +++++++++++++++++++++---- 3 files changed, 100 insertions(+), 6 deletions(-)
target-m68k/helpers.h +4 -0
@@ -7,6 +7,10 @@ DEF_HELPER_2(divu, void, env, i32) DEF_HELPER_2(divs, void, env, i32) DEF_HELPER_1(divu64, void, env) DEF_HELPER_1(divs64, void, env) +DEF_HELPER_3(mulu32_cc, i32, env, i32, i32) +DEF_HELPER_3(muls32_cc, i32, env, i32, i32) +DEF_HELPER_3(mulu64, i32, env, i32, i32) +DEF_HELPER_3(muls64, i32, env, i32, i32) DEF_HELPER_3(addx_cc, i32, env, i32, i32) DEF_HELPER_3(subx_cc, i32, env, i32, i32)DEF_HELPER_3 (shl_cc, i32, env, i32, i32)
target-m68k/op_helper.c +66 -0
69 lines not on this page · raw message
target-m68k/translate.c +30 -6
@@ -1631,22 +1631,45 @@ DISAS_INSN(mull)TCGv reg;TCGv src1;TCGv dest; +TCGv regh;/* The upper 32 bits of the product are discarded, so muls.l and mulu.l are functionally equivalent. */ ext =lduw_code (s->pc); s->pc +=2 ; -if (ext &0x87ff ) { -gen_exception (s, s->pc -4 ,EXCP_UNSUPPORTED ); -return ; +if (ext &0x400 ) { +if (!m68k_feature (s->env,M68K_FEATURE_QUAD_MULDIV )) { +gen_exception (s, s->pc -4 ,EXCP_UNSUPPORTED ); +return ; + } + reg =DREG (ext,12 ); + regh =DREG (ext,0 ); +SRC_EA (src1,OS_LONG ,0 ,NULL ); + dest =tcg_temp_new (); +if (ext &0x800 ) +gen_helper_muls64 (dest, cpu_env, src1, reg); +else +gen_helper_mulu64 (dest, cpu_env, src1, reg); +tcg_gen_mov_i32 (reg, dest); +tcg_gen_mov_i32 (regh,QREG_QUADH ); + s->cc_op =CC_OP_FLAGS ; +return ; } reg =DREG (ext,12 );SRC_EA (src1,OS_LONG ,0 ,NULL ); dest =tcg_temp_new (); -tcg_gen_mul_i32 (dest, src1, reg); +if (m68k_feature (s->env,M68K_FEATURE_M68000 )) { +if (ext &0x800 ) +gen_helper_muls32_cc (dest, cpu_env, src1, reg); +else +gen_helper_mulu32_cc (dest, cpu_env, src1, reg); + s->cc_op =CC_OP_FLAGS ; + }else { +tcg_gen_mul_i32 (dest, src1, reg); +/* Unlike m68k, coldfire always clears the overflow bit. */ +gen_logic_cc (s, dest); + }tcg_gen_mov_i32 (reg, dest); -/* Unlike m68k, coldfire always clears the overflow bit. */ -gen_logic_cc (s, dest); }DISAS_INSN (link)
@@ -3028,6 +3051,7 @@ void register_m68k_insns (CPUM68KState *env) INSN(illegal, 4afc, ffff, CF_ISA_A); INSN(illegal, 4afc, ffff, M68000); INSN(mull, 4c00, ffc0, CF_ISA_A); + INSN(mull, 4c00, ffc0, LONG_MULDIV); INSN(divl, 4c40, ffc0, CF_ISA_A); INSN(divl, 4c40, ffc0, LONG_MULDIV); INSN(sats, 4c80, fff8, CF_ISA_B);
Signature · 1 line
1.7.2.3
PATCH 18/111 m68k: add word data size for suba/adda
In reply to Bryce LanhamFrom: Laurent Vivier <[email protected]>
Allows suba and adda to manage word sized effective address, and attach them to M68000 feature.
--- target-m68k/translate.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-)
target-m68k/translate.c +4 -2
@@ -1881,7 +1881,7 @@ DISAS_INSN(suba)TCGv src;TCGv reg; -SRC_EA (src,OS_LONG ,0 ,NULL ); +SRC_EA (src, (insn &0x100 ) ?OS_LONG :OS_WORD ,-1 ,NULL ); reg =AREG (insn,9 );tcg_gen_sub_i32 (reg, reg, src); }
@@ -1991,7 +1991,7 @@ DISAS_INSN(adda)TCGv src;TCGv reg; -SRC_EA (src,OS_LONG ,0 ,NULL ); +SRC_EA (src, (insn &0x100 ) ?OS_LONG :OS_WORD ,-1 ,NULL ); reg =AREG (insn,9 );tcg_gen_add_i32 (reg, reg, src); }
@@ -3109,6 +3109,7 @@ void register_m68k_insns (CPUM68KState *env)INSN (subx,9180 , f1f8,CF_ISA_A );INSN (subx,9100 , f138,M68000 ); INSN(suba, 91c0, f1c0, CF_ISA_A); + INSN(suba, 90c0, f0c0, M68000);INSN (undef_mac, a000, f000,CF_ISA_A );INSN (undef_mac, a000, f000,M68000 );
@@ -3144,6 +3145,7 @@ void register_m68k_insns (CPUM68KState *env)INSN (addx, d180, f1f8,CF_ISA_A );INSN (addx, d100, f138,M68000 );INSN (adda, d1c0, f1c0,CF_ISA_A ); +INSN (adda, d0c0, f0c0,M68000 );INSN (shift_im, e080, f0f0,CF_ISA_A );INSN (shift_reg, e0a0, f0f0,CF_ISA_A );INSN (shift_im, e080, f0f0,M68000 );
Signature · 1 line
1.7.2.3
PATCH 19/111 m68k: add fpu
In reply to Bryce LanhamFrom: Laurent Vivier <[email protected]>
Modify "fpu" instruction to be compatible with 680x0 family and attach it to FPU feature (in addition to CF_FPU).
--- target-m68k/translate.c | 49 ++++++++++++++++++++++++++++++++++++++++------ 1 files changed, 42 insertions(+), 7 deletions(-)
target-m68k/translate.c +42 -7
@@ -2342,18 +2342,43 @@ DISAS_INSN(fpu)case 7 : {TCGv addr; +int incr;uint16_t mask;int i; -if ((ext &0x1f00 ) !=0x1000 || (ext &0xff ) ==0 ) +if ((ext &0xf00 ) !=0 || (ext &0xff ) ==0 ) goto undef; - tmp32 =gen_lea (s, insn,OS_LONG ); -if (IS_NULL_QREG (tmp32)) { -gen_addr_fault (s); -return ; +if ((ext &0x1000 ) ==0 && !m68k_feature (s->env,M68K_FEATURE_FPU )) + goto undef; +if ((insn &070 ) ==040 ) + tmp32 =AREG (insn,0 ); +else { + tmp32 =gen_lea (s, insn,OS_LONG ); +if (IS_NULL_QREG (tmp32)) { +gen_addr_fault (s); +return ; + } } addr =tcg_temp_new_i32 ();tcg_gen_mov_i32 (addr, tmp32); mask =0x80 ; +if (m68k_feature (s->env,M68K_FEATURE_FPU )) + incr =12 ; +else + incr =8 ; +if ((ext & (1 <<13 )) && (insn &070 ) ==040 ) { +for (i =0 ; i <8 ; i++) { +if (ext & mask) { + s->is_mem =1 ; + dest =FREG (i,7 ); +tcg_gen_subi_i32 (addr, addr, incr); +tcg_gen_mov_i32 (AREG (insn,0 ), addr); +tcg_gen_qemu_stf64 (dest, addr,IS_USER (s)); + } + mask >>=1 ; + } +tcg_temp_free_i32 (addr); +return ; + }for (i =0 ; i <8 ; i++) {if (ext & mask) { s->is_mem =1 ;
@@ -2365,8 +2390,11 @@ DISAS_INSN(fpu)/* load */ tcg_gen_qemu_ldf64 (dest, addr,IS_USER (s)); } -if (ext & (mask -1 )) -tcg_gen_addi_i32 (addr, addr,8 ); +if (ext & (mask -1 ) || (insn &070 ) ==030 ) { +tcg_gen_addi_i32 (addr, addr, incr); +if ((insn &070 ) ==030 ) +tcg_gen_mov_i32 (AREG (insn,0 ), addr); + } } mask >>=1 ; }
@@ -2474,6 +2502,12 @@ DISAS_INSN(fpu)case 0x23 :case 0x63 :case 0x67 :/* fmul */ gen_helper_mul_f64 (res, cpu_env, res, src);break ; +case 0x24 :/* fsgldiv */ +gen_helper_div_f64 (res, cpu_env, res, src); +break ; +case 0x27 :/* fsglmul */ +gen_helper_mul_f64 (res, cpu_env, res, src); +break ;case 0x28 :case 0x68 :case 0x6c :/* fsub */ gen_helper_sub_f64 (res, cpu_env, res, src);break ;
@@ -3156,6 +3190,7 @@ void register_m68k_insns (CPUM68KState *env)INSN (fbcc, f280, ffc0,CF_FPU );INSN (frestore, f340, ffc0,CF_FPU );INSN (fsave, f340, ffc0,CF_FPU ); +INSN (fpu, f200, ffc0,FPU );INSN (fbcc, f280, ffc0,FPU );INSN (frestore, f340, ffc0,FPU );INSN (fsave, f340, ffc0,FPU );
Signature · 1 line
1.7.2.3
PATCH 20/111 m68k: add "byte", "word" and memory shift
In reply to Bryce LanhamFrom: Laurent Vivier <[email protected]>
This patch defines shift8_im, shift16_im, shift8_reg, shift16_reg, shift_mem and attach them to M68000 feature.
--- target-m68k/cpu.h | 2 + target-m68k/helper.c | 160 +++++++++++++++++++++++++++-------------------- target-m68k/helpers.h | 12 +++- target-m68k/translate.c | 155 +++++++++++++++++++++++++++++++++++++++++++--- 4 files changed, 249 insertions(+), 80 deletions(-)
target-m68k/cpu.h +2 -0
@@ -147,6 +147,8 @@ enum {CC_OP_SUBXB ,/* CC_DEST = result, CC_SRC = source */ CC_OP_SUBXW ,/* CC_DEST = result, CC_SRC = source */ CC_OP_SUBX ,/* CC_DEST = result, CC_SRC = source */ +CC_OP_SHIFTB ,/* CC_DEST = result, CC_SRC = carry */ +CC_OP_SHIFTW ,/* CC_DEST = result, CC_SRC = carry */ CC_OP_SHIFT, /* CC_DEST = result, CC_SRC = carry */ };
target-m68k/helper.c +96 -74
189 lines not on this page · raw message
target-m68k/helpers.h +9 -3
@@ -13,9 +13,15 @@ DEF_HELPER_3(mulu64, i32, env, i32, i32) DEF_HELPER_3(muls64, i32, env, i32, i32) DEF_HELPER_3(addx_cc, i32, env, i32, i32) DEF_HELPER_3(subx_cc, i32, env, i32, i32) -DEF_HELPER_3(shl_cc, i32, env, i32, i32) -DEF_HELPER_3(shr_cc, i32, env, i32, i32) -DEF_HELPER_3(sar_cc, i32, env, i32, i32) +DEF_HELPER_3(shl8_cc, i32, env, i32, i32) +DEF_HELPER_3(shl16_cc, i32, env, i32, i32) +DEF_HELPER_3(shl32_cc, i32, env, i32, i32) +DEF_HELPER_3(shr8_cc, i32, env, i32, i32) +DEF_HELPER_3(shr16_cc, i32, env, i32, i32) +DEF_HELPER_3(shr32_cc, i32, env, i32, i32) +DEF_HELPER_3(sar8_cc, i32, env, i32, i32) +DEF_HELPER_3(sar16_cc, i32, env, i32, i32) +DEF_HELPER_3(sar32_cc, i32, env, i32, i32) DEF_HELPER_2(xflag_lt, i32, i32, i32) DEF_HELPER_2(set_sr, void, env, i32)DEF_HELPER_3 (movec, void, env, i32, i32)
target-m68k/translate.c +147 -8
195 lines not on this page · raw message
Signature · 1 line
1.7.2.3
PATCH 22/111 m68k: add bitfield_mem, bitfield_reg
In reply to Bryce LanhamFrom: Laurent Vivier <[email protected]>
This patch implements bitfields instructions: bftst, bfextu, bfexts, bfffo, bfchg, bfclr, bfset, bfins and attach them to BITFIELD feature.
--- target-m68k/helper.c | 27 ++++ target-m68k/helpers.h | 3 + target-m68k/translate.c | 323 +++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 353 insertions(+), 0 deletions(-)
target-m68k/helper.c +27 -0
@@ -519,6 +519,33 @@ uint32_t HELPER(ff1)(uint32_t x)return n; } +uint32_t HELPER (bfffo )(uint32_t arg,uint32_t width) +{ +int n; +uint32_t mask; + mask =0x80000000 ; +for (n =0 ; n < width; n++) { +if (arg & mask) +break ; + mask >>=1 ; + } +return n; +} + +uint32_t HELPER (rol32 )(uint32_t val,uint32_t shift) +{ +uint32_t result; + result = (val << shift) | (val >> (32 - shift)); +return result; +} + +uint32_t HELPER (ror32 )(uint32_t val,uint32_t shift) +{ +uint32_t result; + result = (val >> shift) | (val << (32 - shift)); +return result; +} +uint32_t HELPER (sats )(uint32_t val,uint32_t ccr) {/* The result has the opposite sign to the original value. */
target-m68k/helpers.h +3 -0
@@ -2,6 +2,9 @@ DEF_HELPER_1(bitrev, i32, i32) DEF_HELPER_1(ff1, i32, i32) +DEF_HELPER_2(bfffo, i32, i32, i32) +DEF_HELPER_2(rol32, i32, i32, i32) +DEF_HELPER_2(ror32, i32, i32, i32) DEF_HELPER_2(sats, i32, i32, i32) DEF_HELPER_2(divu, void, env, i32)DEF_HELPER_2 (divs, void, env, i32)
target-m68k/translate.c +323 -0
335 lines not on this page · raw message
Signature · 1 line
1.7.2.3
PATCH 21/111 m68k: add "byte", "word" and memory rotate.
In reply to Bryce LanhamFrom: Laurent Vivier <[email protected]>
Add rotate_im, rotate8_im, rotate16_im, rotate_reg, rotate8_reg, rotate16_reg,
rotate_mem and attach them to M68000 feature.
--- target-m68k/helper.c | 149 ++++++++++++++++++++++++++++++++++ target-m68k/helpers.h | 12 +++ target-m68k/translate.c | 205 +++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 366 insertions(+), 0 deletions(-)
target-m68k/helper.c +149 -0
@@ -60,6 +60,42 @@ static m68k_def_t m68k_cpu_defs[] = { {NULL, 0}, }; +/* modulo 33 table */ +const uint8_t rox32_table[64 ] = { +0 ,1 ,2 ,3 ,4 ,5 ,6 ,7 , +8 ,9 ,10 ,11 ,12 ,13 ,14 ,15 , +16 ,17 ,18 ,19 ,20 ,21 ,22 ,23 , +24 ,25 ,26 ,27 ,28 ,29 ,30 ,31 , +32 ,0 ,1 ,2 ,3 ,4 ,5 ,6 , +7 ,8 ,9 ,10 ,11 ,12 ,13 ,14 , +15 ,16 ,17 ,18 ,19 ,20 ,21 ,22 , +23 ,24 ,25 ,26 ,27 ,28 ,29 ,30 , +}; + +/* modulo 17 table */ +const uint8_t rox16_table[64 ] = { +0 ,1 ,2 ,3 ,4 ,5 ,6 ,7 , +8 ,9 ,10 ,11 ,12 ,13 ,14 ,15 , +16 ,0 ,1 ,2 ,3 ,4 ,5 ,6 , +7 ,8 ,9 ,10 ,11 ,12 ,13 ,14 , +15 ,16 ,0 ,1 ,2 ,3 ,4 ,5 , +6 ,7 ,8 ,9 ,10 ,11 ,12 ,13 , +14 ,15 ,16 ,0 ,1 ,2 ,3 ,4 , +5 ,6 ,7 ,8 ,9 ,10 ,11 ,12 , +}; + +/* modulo 9 table */ +const uint8_t rox8_table[64 ] = { +0 ,1 ,2 ,3 ,4 ,5 ,6 ,7 , +8 ,0 ,1 ,2 ,3 ,4 ,5 ,6 , +7 ,8 ,0 ,1 ,2 ,3 ,4 ,5 , +6 ,7 ,8 ,0 ,1 ,2 ,3 ,4 , +5 ,6 ,7 ,8 ,0 ,1 ,2 ,3 , +4 ,5 ,6 ,7 ,8 ,0 ,1 ,2 , +3 ,4 ,5 ,6 ,7 ,8 ,0 ,1 , +2 ,3 ,4 ,5 ,6 ,7 ,8 ,0 , +}; +void m68k_cpu_list (FILE *f,fprintf_function cpu_fprintf) {unsigned int i;
@@ -632,6 +668,119 @@ HELPER_SAR(int8_t, 8) HELPER_SAR(int16_t, 16) HELPER_SAR(int32_t, 32) +#define HELPER_ROL (type, bits) \ +uint32_t HELPER(glue(glue(rol,bits),_cc))(CPUState *env, uint32_t val, uint32_t shift) \ +{ \ + type result; \ + uint32_t flags; \ + int count = shift & (bits - 1); \ + if (count) \ + result = ((type)val << count) | ((type)val >> (bits - count)); \ + else \ + result = (type)val; \ + flags = 0; \ + if (result == 0) \ + flags |= CCF_Z; \ + if (result & (1 << (bits - 1))) \ + flags |= CCF_N; \ + if (shift && result & 1) \ + flags |= CCF_C; \ + env->cc_dest = flags; \ + return result; \ +} + +HELPER_ROL(uint8_t, 8) +HELPER_ROL(uint16_t, 16) +HELPER_ROL(uint32_t, 32) + +#define HELPER_ROR (type, bits) \ +uint32_t HELPER(glue(glue(ror,bits),_cc))(CPUState *env, uint32_t val, uint32_t shift) \ +{ \ + type result; \ + uint32_t flags; \ + int count = shift & (bits - 1); \ + if (count) \ + result = ((type)val >> count) | ((type)val << (bits - count)); \ + else \ + result = (type)val; \ + flags = 0; \ + if (result == 0) \ + flags |= CCF_Z; \ + if (result & (1 << (bits - 1))) \ + flags |= CCF_N; \ + if (shift && result & (1 << (bits - 1))) \ + flags |= CCF_C; \ + env->cc_dest = flags; \ + return result; \ +} + +HELPER_ROR(uint8_t, 8) +HELPER_ROR(uint16_t, 16) +HELPER_ROR(uint32_t, 32) + +#define HELPER_ROXR (type, bits) \ +uint32_t HELPER(glue(glue(roxr,bits),_cc))(CPUState *env, uint32_t val, uint32_t shift) \ +{ \ + type result; \ + uint32_t flags; \ + int count = shift; \ + if (bits == 8) count = rox8_table[count]; \ + if (bits == 16) count = rox16_table[count]; \ + if (bits == 32) count = rox32_table[count]; \ + if (count) { \ + result = ((type)val >> count) | ((type)env->cc_x << (bits - count)); \ + if (count > 1) \ + result |= (type)val << (bits + 1 - count); \ + env->cc_x = ((type)val >> (count - 1)) & 1; \ + } else \ + result = (type)val; \ + flags = 0; \ + if (result == 0) \ + flags |= CCF_Z; \ + if (result & (1 << (bits - 1))) \ + flags |= CCF_N; \ + if (env->cc_x) \ + flags |= CCF_C; \ + env->cc_dest = flags; \ + return result; \ +} + +HELPER_ROXR(uint8_t, 8) +HELPER_ROXR(uint16_t, 16) +HELPER_ROXR(uint32_t, 32) + +#define HELPER_ROXL (type, bits) \ +uint32_t HELPER(glue(glue(roxl,bits),_cc))(CPUState *env, uint32_t val, uint32_t shift) \ +{ \ + type result; \ + uint32_t flags; \ + int count; \ + count = shift; \ + if (bits == 8) count = rox8_table[count]; \ + if (bits == 16) count = rox16_table[count]; \ + if (bits == 32) count = rox32_table[count]; \ + if (count) { \ + result = ((type)val << count) | ((type)env->cc_x << (count - 1)); \ + if (count > 1) \ + result |= (type)val >> (bits + 1 - count); \ + env->cc_x = ((type)val >> (bits - count)) & 1; \ + } else \ + result = (type)val; \ + flags = 0; \ + if (result == 0) \ + flags |= CCF_Z; \ + if (result & (1 << (bits - 1))) \ + flags |= CCF_N; \ + if (env->cc_x) \ + flags |= CCF_C; \ + env->cc_dest = flags; \ + return result; \ +} + +HELPER_ROXL(uint8_t, 8) +HELPER_ROXL(uint16_t, 16) +HELPER_ROXL (uint32_t,32 ) + /* FPU helpers. */uint32_t HELPER (f64_to_i32 )(CPUState *env,float64 val) {
target-m68k/helpers.h +12 -0
@@ -22,6 +22,18 @@ DEF_HELPER_3(shr32_cc, i32, env, i32, i32) DEF_HELPER_3(sar8_cc, i32, env, i32, i32) DEF_HELPER_3(sar16_cc, i32, env, i32, i32) DEF_HELPER_3(sar32_cc, i32, env, i32, i32) +DEF_HELPER_3(rol8_cc, i32, env, i32, i32) +DEF_HELPER_3(rol16_cc, i32, env, i32, i32) +DEF_HELPER_3(rol32_cc, i32, env, i32, i32) +DEF_HELPER_3(ror8_cc, i32, env, i32, i32) +DEF_HELPER_3(ror16_cc, i32, env, i32, i32) +DEF_HELPER_3(ror32_cc, i32, env, i32, i32) +DEF_HELPER_3(roxr8_cc, i32, env, i32, i32) +DEF_HELPER_3(roxr16_cc, i32, env, i32, i32) +DEF_HELPER_3(roxr32_cc, i32, env, i32, i32) +DEF_HELPER_3(roxl8_cc, i32, env, i32, i32) +DEF_HELPER_3(roxl16_cc, i32, env, i32, i32) +DEF_HELPER_3(roxl32_cc, i32, env, i32, i32) DEF_HELPER_2(xflag_lt, i32, i32, i32) DEF_HELPER_2(set_sr, void, env, i32)DEF_HELPER_3 (movec, void, env, i32, i32)
target-m68k/translate.c +205 -0
217 lines not on this page · raw message
Signature · 1 line
1.7.2.3
PATCH 24/111 m68k: add cas
In reply to Bryce LanhamFrom: Laurent Vivier <[email protected]>
This instruction is needed to execute commands like "ls" or "date" (from a debian lenny m68k).
It define a new feaure, CAS, and attach this new instruction to it.
--- target-m68k/cpu.h | 3 +- target-m68k/helper.c | 2 + target-m68k/translate.c | 62 +++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 66 insertions(+), 1 deletions(-)
target-m68k/cpu.h +2 -1
@@ -210,7 +210,8 @@ enum m68k_features {M68K_FEATURE_QUAD_MULDIV ,/* 64 bit multiply/divide. */ M68K_FEATURE_BCCL ,/* Long conditional branches. */ M68K_FEATURE_BITFIELD ,/* Bit field insns. */ - M68K_FEATURE_FPU +M68K_FEATURE_FPU , + M68K_FEATURE_CAS };static inline int m68k_feature (CPUM68KState *env,int feature)
target-m68k/helper.c +2 -0
@@ -165,6 +165,7 @@ static int cpu_m68k_set_model(CPUM68KState *env, const char *name)m68k_set_feature (env,M68K_FEATURE_SCALED_INDEX );m68k_set_feature (env,M68K_FEATURE_LONG_MULDIV );m68k_set_feature (env,M68K_FEATURE_FPU ); +m68k_set_feature (env,M68K_FEATURE_CAS );case M68K_CPUID_M68000 :m68k_set_feature (env,M68K_FEATURE_M68000 );m68k_set_feature (env,M68K_FEATURE_USP );
@@ -210,6 +211,7 @@ static int cpu_m68k_set_model(CPUM68KState *env, const char *name)m68k_set_feature (env,M68K_FEATURE_BITFIELD );m68k_set_feature (env,M68K_FEATURE_LONG_MULDIV );m68k_set_feature (env,M68K_FEATURE_QUAD_MULDIV ); +m68k_set_feature (env,M68K_FEATURE_CAS );break ; }
target-m68k/translate.c +62 -0
74 lines not on this page · raw message
Signature · 1 line
1.7.2.3
PATCH 25/111 m68k: add cas
In reply to Bryce LanhamFrom: Andreas Schwab <[email protected]>
Quoted 5 lines · Laurent Vivier
(quoted diff) +5
-0+ cmp = DREG(ext, 0); + update = DREG(ext, 6); + tmp = gen_load(s, opsize, addr, 0); + dest = tcg_temp_local_new(); + tcg_gen_mov_i32(dest, tmp);
Review
Quoted 10 lines
(quoted diff) +10
-0+ + res = tcg_temp_new(); + tcg_gen_sub_i32(res, dest, cmp); + gen_logic_cc(s, res); + + l1 = gen_new_label(); + l2 = gen_new_label(); + + gen_jmpcc(s, 6 /* !Z */, l1); + gen_store(s, opsize, addr, update);
This has a bug: addr is used around a jump.
Andreas.
--- target-m68k/translate.c | 10 +++++++--- 1 files changed, 7 insertions(+), 3 deletions(-)
target-m68k/translate.c +7 -3
@@ -1378,6 +1378,7 @@ DISAS_INSN(cas)TCGv tmp;TCGv cmp;TCGv update; +TCGv taddr;TCGv addr;TCGv res;uint16_t ext;
@@ -1404,17 +1405,19 @@ DISAS_INSN(cas) ext =lduw_code (s->pc); s->pc +=2 ; - addr =gen_lea (s, insn, opsize); -if (IS_NULL_QREG (addr)) { + taddr =gen_lea (s, insn, opsize); +if (IS_NULL_QREG (taddr)) {gen_addr_fault (s);return ; } cmp =DREG (ext,0 ); update =DREG (ext,6 ); - tmp =gen_load (s, opsize, addr,0 ); + tmp =gen_load (s, opsize, taddr,0 ); dest =tcg_temp_local_new ();tcg_gen_mov_i32 (dest, tmp); + addr =tcg_temp_local_new (); +tcg_gen_mov_i32 (addr, taddr); res =tcg_temp_new ();tcg_gen_sub_i32 (res, dest, cmp);
@@ -1430,6 +1433,7 @@ DISAS_INSN(cas)tcg_gen_mov_i32 (cmp, dest);gen_set_label (l2);tcg_temp_free (dest); +tcg_temp_free (addr); }DISAS_INSN (byterev)
Signature · 1 line
1.7.2.3
PATCH 23/111 m68k: add variable offset/width to bitfield_reg/bitfield_mem
In reply to Bryce LanhamFrom: Laurent Vivier <[email protected]>
This patch allows bitfield instructions to read bit offset and field size from a register instead of an immediat value.
--- target-m68k/helper.c | 50 +++++ target-m68k/helpers.h | 2 + target-m68k/translate.c | 515 +++++++++++++++++++++++------------------------ 3 files changed, 299 insertions(+), 268 deletions(-)
target-m68k/helper.c +50 -0
@@ -535,6 +535,8 @@ uint32_t HELPER(bfffo)(uint32_t arg, uint32_t width)uint32_t HELPER (rol32 )(uint32_t val,uint32_t shift) {uint32_t result; +if (shift ==0 || shift ==32 ) +return val; result = (val << shift) | (val >> (32 - shift));return result; }
@@ -542,6 +544,8 @@ uint32_t HELPER(rol32)(uint32_t val, uint32_t shift)uint32_t HELPER (ror32 )(uint32_t val,uint32_t shift) {uint32_t result; +if (shift ==0 || shift ==32 ) +return val; result = (val >> shift) | (val << (32 - shift));return result; }
@@ -1188,3 +1192,49 @@ void HELPER(set_mac_extu)(CPUState *env, uint32_t val, uint32_t acc) res |= (uint64_t )(val &0xffff0000 ) <<16 ; env->macc[acc +1 ] = res; } + +/* load from a bitfield */ + +uint64_t HELPER (bitfield_load )(uint32_t addr,uint32_t offset,uint32_t width) +{ +uint8_t data[8 ]; +uint64_t bitfield; +int size; +int i; + + size = (offset + width +7 ) >>3 ; +#if defined(CONFIG_USER_ONLY ) +cpu_memory_rw_debug (NULL , (target_ulong )addr, data, size,0 ); +#else +cpu_physical_memory_rw (addr, data, size,0 ); +#endif + + bitfield = data[0 ]; +for (i =1 ; i <8 ; i++) + bitfield = (bitfield <<8 ) | data[i]; + +return bitfield; +} + +/* store to a bitfield */ + +void HELPER (bitfield_store )(uint32_t addr,uint32_t offset,uint32_t width, +uint64_t bitfield) +{ +uint8_t data[8 ]; +int size; +int i; + + size = (offset + width +7 ) >>3 ; + +for (i =0 ; i <8 ; i++) { + data[7 - i] = bitfield; + bitfield >>=8 ; + } + +#if defined(CONFIG_USER_ONLY ) +cpu_memory_rw_debug (NULL , (target_ulong )addr, data, size,1 ); +#else +cpu_physical_memory_rw (addr, data, size,1 ); +#endif +}
target-m68k/helpers.h +2 -0
@@ -78,4 +78,6 @@ DEF_HELPER_3(set_mac_extu, void, env, i32, i32) DEF_HELPER_2(flush_flags, void, env, i32) DEF_HELPER_1(raise_exception, void, i32) +DEF_HELPER_3 (bitfield_load, i64, i32, i32, i32); +DEF_HELPER_4 (bitfield_store, void, i32, i32, i32, i64);#include "def-helper.h"
target-m68k/translate.c +247 -268
569 lines not on this page · raw message
Signature · 1 line
1.7.2.3
PATCH 26/111 m68k: define fcntl constants
In reply to Bryce LanhamFrom: Andreas Schwab <[email protected]>
--- linux-user/syscall_defs.h | 18 ++++++++++++++++++ 1 files changed, 18 insertions(+), 0 deletions(-)
linux-user/syscall_defs.h +18 -0
@@ -2058,6 +2058,24 @@ struct target_statfs64 {#define TARGET_O_NOFOLLOW 0x10000/* don't follow links */ #define TARGET_O_NOATIME 0x100000#define TARGET_O_NDELAY TARGET_O_NONBLOCK +#elif defined (TARGET_M68K ) +#define TARGET_O_ACCMODE 0003 +#define TARGET_O_RDONLY 00 +#define TARGET_O_WRONLY 01 +#define TARGET_O_RDWR 02 +#define TARGET_O_CREAT 0100/* not fcntl */ +#define TARGET_O_EXCL 0200/* not fcntl */ +#define TARGET_O_NOCTTY 0400/* not fcntl */ +#define TARGET_O_TRUNC 01000/* not fcntl */ +#define TARGET_O_APPEND 02000 +#define TARGET_O_NONBLOCK 04000 +#define TARGET_O_NDELAY TARGET_O_NONBLOCK +#define TARGET_O_SYNC 010000 +#define TARGET_FASYNC 020000/* fcntl, for BSD compatibility */ +#define TARGET_O_DIRECTORY 040000/* must be a directory */ +#define TARGET_O_NOFOLLOW 0100000/* don't follow links */ +#define TARGET_O_DIRECT 0200000/* direct disk access hint */ +#define TARGET_O_LARGEFILE 0400000#else #define TARGET_O_ACCMODE 0003#define TARGET_O_RDONLY 00
Signature · 1 line
1.7.2.3
PATCH 27/111 m68k: add DBcc instruction.
In reply to Bryce LanhamFrom: Andreas Schwab <[email protected]>
Review
Quoted 5 lines · Laurent Vivier
(quoted diff) +5
-0+ tmp = tcg_temp_new(); + tcg_gen_ext16s_i32(tmp, reg); + tcg_gen_addi_i32(tmp, tmp, -1); + gen_partset_reg(OS_WORD, reg, tmp); + tcg_gen_brcondi_i32(TCG_COND_EQ, tmp, 0, l1);
The counter needs to be compared with -1, not 0.
Andreas.
--- target-m68k/translate.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
target-m68k/translate.c +1 -1
@@ -939,7 +939,7 @@ DISAS_INSN(dbcc)tcg_gen_ext16s_i32 (tmp, reg);tcg_gen_addi_i32 (tmp, tmp,-1 );gen_partset_reg (OS_WORD , reg, tmp); -tcg_gen_brcondi_i32 (TCG_COND_EQ , tmp,0 , l1); +tcg_gen_brcondi_i32 (TCG_COND_EQ , tmp,-1 , l1);gen_jmp_tb (s,1 , base + offset);gen_set_label (l1);gen_jmp_tb (s,0 , s->pc);
Signature · 1 line
1.7.2.3
PATCH 28/111 m68k: allow fpu to manage double data type.
In reply to Bryce LanhamFrom: Laurent Vivier <[email protected]>
This patch allows to manage instructions like "fcmpd #2.2, %fp0". Original function manages only data accessed through an address register.
--- target-m68k/translate.c | 48 ++++++++++++++-------------------------------- 1 files changed, 15 insertions(+), 33 deletions(-)
target-m68k/translate.c +15 -33
@@ -2939,6 +2939,7 @@ DISAS_INSN(fpu)TCGv_i64 dest;TCGv_i64 res;TCGv tmp32; +TCGv reg;int round;int set_dest;int opsize;
@@ -3111,40 +3112,21 @@ DISAS_INSN(fpu) goto undef; }if (opsize ==OS_DOUBLE ) { - tmp32 =tcg_temp_new_i32 (); -tcg_gen_mov_i32 (tmp32,AREG (insn,0 )); -switch ((insn >>3 ) &7 ) { -case 2 : -case 3 : -break ; -case 4 : -tcg_gen_addi_i32 (tmp32, tmp32,-8 ); -break ; -case 5 : - offset =ldsw_code (s->pc); - s->pc +=2 ; -tcg_gen_addi_i32 (tmp32, tmp32, offset); -break ; -case 7 : - offset =ldsw_code (s->pc); - offset += s->pc -2 ; - s->pc +=2 ; -tcg_gen_addi_i32 (tmp32, tmp32, offset); -break ; -default : - goto undef; - } - src =gen_load64 (s, tmp32); -switch ((insn >>3 ) &7 ) { -case 3 : -tcg_gen_addi_i32 (tmp32, tmp32,8 ); -tcg_gen_mov_i32 (AREG (insn,0 ), tmp32); -break ; -case 4 : -tcg_gen_mov_i32 (AREG (insn,0 ), tmp32); -break ; +if ((insn &0x3f ) ==0x3c ) { + src =gen_load64 (s,tcg_const_i32 (s->pc)); + s->pc +=8 ; + }else { + tmp32 =gen_lea (s, insn, opsize); +if (IS_NULL_QREG (tmp32)) { +gen_addr_fault (s); +return ; + } + src =gen_load64 (s, tmp32); +if ( ((insn >>3 ) &7 ) ==3 ) {/* post-increment */ + reg =AREG (insn,0 ); +tcg_gen_addi_i32 (reg, reg,opsize_bytes (opsize)); + } } -tcg_temp_free_i32 (tmp32); }else {SRC_EA (tmp32, opsize,1 ,NULL ); src =tcg_temp_new_i64 ();
Signature · 1 line
1.7.2.3
PATCH 29/111 m68k: allow fpu to manage double data type with fmove to <ea>
In reply to Bryce LanhamFrom: Laurent Vivier <[email protected]>
This patch allows to manage instructions like "fmoved %fp0,%fp@(-512)".
Original function manages double data only through an address register.
--- target-m68k/translate.c | 73 +++++++++++++++++----------------------------- 1 files changed, 27 insertions(+), 46 deletions(-)
target-m68k/translate.c +27 -46
@@ -2933,7 +2933,6 @@ DISAS_INSN(trap)DISAS_INSN (fpu) {uint16_t ext; -int32_t offset;int opmode;TCGv_i64 src;TCGv_i64 dest;
@@ -2944,8 +2943,7 @@ DISAS_INSN(fpu)int set_dest;int opsize; - ext =lduw_code (s->pc); - s->pc +=2 ; + ext =read_im16 (s); opmode = ext &0x7f ;switch ((ext >>13 ) &7 ) {case 0 :case 2 :
@@ -2958,55 +2956,38 @@ DISAS_INSN(fpu)/* fmove */ /* ??? TODO: Proper behavior on overflow. */ switch ((ext >>10 ) &7 ) { -case 0 : - opsize =OS_LONG ; -gen_helper_f64_to_i32 (tmp32, cpu_env, src); -break ; -case 1 : - opsize =OS_SINGLE ; -gen_helper_f64_to_f32 (tmp32, cpu_env, src); -break ; -case 4 : - opsize =OS_WORD ; -gen_helper_f64_to_i32 (tmp32, cpu_env, src); -break ; -case 5 :/* OS_DOUBLE */ -tcg_gen_mov_i32 (tmp32,AREG (insn,0 )); -switch ((insn >>3 ) &7 ) { -case 2 : -case 3 : -break ; -case 4 : -tcg_gen_addi_i32 (tmp32, tmp32,-8 ); -break ; -case 5 : - offset =ldsw_code (s->pc); - s->pc +=2 ; -tcg_gen_addi_i32 (tmp32, tmp32, offset); -break ; -default : - goto undef; +case 0 : opsize =OS_LONG ;break ; +case 1 : opsize =OS_SINGLE ;break ; +case 4 : opsize =OS_WORD ;break ; +case 5 : opsize =OS_DOUBLE ;break ; +case 6 : opsize =OS_BYTE ;break ; +default : + goto undef; + } +if (opsize ==OS_DOUBLE ) { + tmp32 =gen_lea (s, insn, opsize); +if (IS_NULL_QREG (tmp32)) { +gen_addr_fault (s); +return ; }gen_store64 (s, tmp32, src); -switch ((insn >>3 ) &7 ) { -case 3 : -tcg_gen_addi_i32 (tmp32, tmp32,8 ); -tcg_gen_mov_i32 (AREG (insn,0 ), tmp32); +if ( ((insn >>3 ) &7 ) ==3 ) {/* post-increment */ + reg =AREG (insn,0 ); +tcg_gen_addi_i32 (reg, reg,opsize_bytes (opsize)); + } + }else { +switch (opsize) { +case OS_LONG : +case OS_WORD : +case OS_BYTE : +gen_helper_f64_to_i32 (tmp32, cpu_env, src);break ; -case 4 : -tcg_gen_mov_i32 (AREG (insn,0 ), tmp32); +case OS_SINGLE : +gen_helper_f64_to_f32 (tmp32, cpu_env, src);break ; } -tcg_temp_free_i32 (tmp32); -return ; -case 6 : - opsize =OS_BYTE ; -gen_helper_f64_to_i32 (tmp32, cpu_env, src); -break ; -default : - goto undef; +DEST_EA (insn, opsize, tmp32,NULL ); } -DEST_EA (insn, opsize, tmp32,NULL );tcg_temp_free_i32 (tmp32);return ;case 4 :/* fmove to control register. */
Signature · 1 line
1.7.2.3
PATCH 30/111 m68k: add FScc instruction
In reply to Bryce LanhamFrom: Laurent Vivier <[email protected]>
This patch allows to manage instructions like "fsge %d0".
--- target-m68k/translate.c | 82 +++++++++++++++++++++++++++++++++++++++-------- 1 files changed, 68 insertions(+), 14 deletions(-)
target-m68k/translate.c +68 -14
@@ -3213,27 +3213,15 @@ undef:disas_undef_fpu (s, insn); } -DISAS_INSN (fbcc) +static void gen_fjmpcc (DisasContext *s,int cond,int l1) { -uint32_t offset; -uint32_t addr;TCGv flag; -int l1; - - addr = s->pc; - offset =ldsw_code (s->pc); - s->pc +=2 ; -if (insn & (1 <<6 )) { - offset = (offset <<16 ) |lduw_code (s->pc); - s->pc +=2 ; - } - l1 =gen_new_label ();/* TODO: Raise BSUN exception. */ flag =tcg_temp_new ();gen_helper_compare_f64 (flag, cpu_env,QREG_FP_RESULT );/* Jump to l1 if condition is true. */ -switch (insn &0xf ) { +switch (cond) {case 0 :/* f */ break ;case 1 :/* eq (=0) */
@@ -3284,11 +3272,75 @@ DISAS_INSN(fbcc)tcg_gen_br (l1);break ; } +} + +DISAS_INSN (fbcc) +{ +uint32_t offset; +uint32_t addr; +int l1; + + addr = s->pc; + offset =ldsw_code (s->pc); + s->pc +=2 ; +if (insn & (1 <<6 )) { + offset = (offset <<16 ) |lduw_code (s->pc); + s->pc +=2 ; + } + + l1 =gen_new_label (); +gen_fjmpcc (s, insn &0xf , l1);gen_jmp_tb (s,0 , s->pc);gen_set_label (l1);gen_jmp_tb (s,1 , addr + offset); } +DISAS_INSN (fscc_mem) +{ +int l1, l2; +TCGv taddr; +TCGv addr; +uint16_t ext; + + ext =lduw_code (s->pc); + s->pc +=2 ; + + taddr =gen_lea (s, insn,OS_BYTE ); +if (IS_NULL_QREG (taddr)) { +gen_addr_fault (s); +return ; + } + addr =tcg_temp_local_new (); +tcg_gen_mov_i32 (addr, taddr); + l1 =gen_new_label (); + l2 =gen_new_label (); +gen_fjmpcc (s, ext &0xf , l1); +gen_store (s,OS_BYTE , addr,tcg_const_i32 (0x00 )); +tcg_gen_br (l2); +gen_set_label (l1); +gen_store (s,OS_BYTE , addr,tcg_const_i32 (0xff )); +gen_set_label (l2); +tcg_temp_free (addr); +} + +DISAS_INSN (fscc_reg) +{ +int l1; +TCGv reg; +uint16_t ext; + + ext =lduw_code (s->pc); + s->pc +=2 ; + + reg =DREG (insn,0 ); + + l1 =gen_new_label (); +tcg_gen_ori_i32 (reg, reg,0x000000ff ); +gen_fjmpcc (s, ext &0xf , l1); +tcg_gen_andi_i32 (reg, reg,0xffffff00 ); +gen_set_label (l1); +} +DISAS_INSN (frestore) {/* TODO: Implement frestore. */
@@ -3866,6 +3918,8 @@ void register_m68k_insns (CPUM68KState *env)INSN (frestore, f340, ffc0,CF_FPU );INSN (fsave, f340, ffc0,CF_FPU );INSN (fpu, f200, ffc0,FPU ); +INSN (fscc_mem, f240, ffc0,FPU ); +INSN (fscc_reg, f240, fff8,FPU );INSN (fbcc, f280, ffc0,FPU );INSN (frestore, f340, ffc0,FPU );INSN (fsave, f340, ffc0,FPU );
Signature · 1 line
1.7.2.3
PATCH 31/111 m68k: add single data type to gen_ea
In reply to Bryce LanhamFrom: Laurent Vivier <[email protected]>
This patch allows to have instructions like "fcmps #0.1,%fp1".
--- target-m68k/translate.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
target-m68k/translate.c +1 -0
@@ -696,6 +696,7 @@ static TCGv gen_ea(DisasContext *s, uint16_t insn, int opsize, TCGv val, s->pc +=2 ;break ;case OS_LONG : +case OS_SINGLE : offset =read_im32 (s);break ;default :
Signature · 1 line
1.7.2.3
PATCH 32/111 m68k: add linkl instruction
In reply to Bryce LanhamFrom: Laurent Vivier <[email protected]>
This patch add support for link instruction with 32bit stack frame size
--- target-m68k/translate.c | 20 ++++++++++++++++++-- 1 files changed, 18 insertions(+), 2 deletions(-)
target-m68k/translate.c +18 -2
@@ -1744,8 +1744,23 @@ DISAS_INSN(link)TCGv reg;TCGv tmp; - offset =ldsw_code (s->pc); - s->pc +=2 ; + offset =read_im16 (s); + reg =AREG (insn,0 ); + tmp =tcg_temp_new (); +tcg_gen_subi_i32 (tmp,QREG_SP ,4 ); +gen_store (s,OS_LONG , tmp, reg); +if ((insn &7 ) !=7 ) +tcg_gen_mov_i32 (reg, tmp); +tcg_gen_addi_i32 (QREG_SP , tmp, offset); +} + +DISAS_INSN (linkl) +{ +int32_t offset; +TCGv reg; +TCGv tmp; + + offset =read_im32 (s); reg =AREG (insn,0 ); tmp =tcg_temp_new ();tcg_gen_subi_i32 (tmp,QREG_SP ,4 );
@@ -3778,6 +3793,7 @@ void register_m68k_insns (CPUM68KState *env)INSN (not,4600 , ff00,M68000 ); INSN(undef, 46c0, ffc0, M68000); INSN(move_to_sr, 46c0, ffc0, CF_ISA_A); +INSN (linkl,4808 , fff8,M68000 );INSN (pea,4840 , ffc0,CF_ISA_A );INSN (pea,4840 , ffc0,M68000 );INSN (swap,4840 , fff8,CF_ISA_A );
Signature · 1 line
1.7.2.3
PATCH 36/111 m68k: correct neg condition code flags computation
In reply to Bryce LanhamFrom: Laurent Vivier <[email protected]>
--- target-m68k/translate.c | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-)
target-m68k/translate.c +1 -2
@@ -1547,9 +1547,8 @@ DISAS_INSN(neg)tcg_gen_neg_i32 (dest, src1);DEST_EA (insn, opsize, dest, &addr);SET_CC_OP (opsize,SUB ); -gen_update_cc_add (src1, dest); +gen_update_cc_add (dest, src1);gen_helper_xflag_lt (QREG_CC_X ,tcg_const_i32 (0 ), dest); -SET_CC_OP (opsize,SUB ); }static void gen_set_sr_im (DisasContext *s,uint16_t val,int ccr_only)
Signature · 1 line
1.7.2.3
PATCH 39/111 m68k: add abcd instruction
In reply to Bryce LanhamFrom: Laurent Vivier <[email protected]>
--- target-m68k/helper.c | 38 ++++++++++++++++++++++++++++++++++++++ target-m68k/helpers.h | 2 ++ target-m68k/translate.c | 32 ++++++++++++++++++++++++++++++++ 3 files changed, 72 insertions(+), 0 deletions(-)
target-m68k/helper.c +38 -0
@@ -1286,3 +1286,41 @@ void HELPER(bitfield_store)(uint32_t addr, uint32_t offset, uint32_t width,cpu_physical_memory_rw (addr, data, size,1 );#endif } + +uint32_t HELPER (abcd_cc )(CPUState *env,uint32_t src,uint32_t dest) +{ +uint16_t hi, lo; +uint16_t res; +uint32_t flags; + + flags = env->cc_dest; + flags &= ~(CCF_C |CCF_X ); + + lo = (src &0x0f ) + (dest &0x0f ); +if (env->cc_x) + lo ++; + hi = (src &0xf0 ) + (dest &0xf0 ); + + res = hi + lo; +if (lo >9 ) + res +=0x06 ; + +/* C and X flags: set if decimal carry, cleared otherwise */ + +if ((res &0x3F0 ) >0x90 ) { + res +=0x60 ; + flags |=CCF_C |CCF_X ; + } + +/* Z flag: cleared if nonzero */ + +if (res &0xff ) + flags &= ~CCF_Z ; + + dest = (dest &0xffffff00 ) | (res &0xff ); + + env->cc_x = (flags &CCF_X ) !=0 ; + env->cc_dest = flags; + +return dest; +}
target-m68k/helpers.h +2 -0
@@ -81,4 +81,6 @@ DEF_HELPER_1(raise_exception, void, i32)DEF_HELPER_3 (bitfield_load, i64, i32, i32, i32);DEF_HELPER_4 (bitfield_store, void, i32, i32, i32, i64); + +DEF_HELPER_3 (abcd_cc, i32, env, i32, i32);#include "def-helper.h"
target-m68k/translate.c +32 -0
@@ -1065,6 +1065,36 @@ DISAS_INSN(divl) s->cc_op =CC_OP_FLAGS ; } +DISAS_INSN (abcd_reg) +{ +TCGv src; +TCGv dest; + + src =DREG (insn,0 ); + dest =DREG (insn,9 ); +gen_helper_abcd_cc (dest, cpu_env, src, dest); +} + +DISAS_INSN (abcd_mem) +{ +TCGv src; +TCGv addr_src; +TCGv dest; +TCGv addr_dest; + + addr_src =AREG (insn,0 ); +tcg_gen_subi_i32 (addr_src, addr_src,OS_BYTE ); + src =gen_load (s,OS_BYTE , addr_src,0 ); + + addr_dest =AREG (insn,9 ); +tcg_gen_subi_i32 (addr_dest, addr_dest,OS_BYTE ); + dest =gen_load (s,OS_BYTE , addr_dest,0 ); + +gen_helper_abcd_cc (dest, cpu_env, src, dest); + +gen_store (s,OS_BYTE , addr_dest, dest); +} +DISAS_INSN (addsub) {TCGv reg;
@@ -3915,6 +3945,8 @@ void register_m68k_insns (CPUM68KState *env)INSN (and, c000, f000,M68000 );INSN (mulw, c0c0, f0c0,CF_ISA_A );INSN (mulw, c0c0, f0c0,M68000 ); +INSN (abcd_reg, c100, f1f8,M68000 ); +INSN (abcd_mem, c108, f1f8,M68000 );INSN (addsub, d000, f000,CF_ISA_A );INSN (addsub, d000, f000,M68000 );INSN (undef, d0c0, f0c0,CF_ISA_A );
Signature · 1 line
1.7.2.3
PATCH 35/111 m68k: improve CC_OP_LOGIC
In reply to Bryce LanhamFrom: Laurent Vivier <[email protected]>
Add support for all opsize (byte, word) instead of only long. On 680x0, don't clear/modify the X flag.
--- target-m68k/cpu.h | 2 + target-m68k/helper.c | 31 +++++++++++++++------ target-m68k/translate.c | 70 +++++++++++++++++++++++------------------------ 3 files changed, 58 insertions(+), 45 deletions(-)
target-m68k/cpu.h +2 -0
@@ -134,6 +134,8 @@ void cpu_m68k_flush_flags(CPUM68KState *, int);enum {CC_OP_DYNAMIC ,/* Use env->cc_op */ CC_OP_FLAGS ,/* CC_DEST = CVZN, CC_SRC = unused */ +CC_OP_LOGICB ,/* CC_DEST = result, CC_SRC = unused */ +CC_OP_LOGICW ,/* CC_DEST = result, CC_SRC = unused */ CC_OP_LOGIC ,/* CC_DEST = result, CC_SRC = unused */ CC_OP_ADDB ,/* CC_DEST = result, CC_SRC = source */ CC_OP_ADDW ,/* CC_DEST = result, CC_SRC = source */
target-m68k/helper.c +22 -9
@@ -282,15 +282,15 @@ void cpu_m68k_flush_flags(CPUM68KState *env, int cc_op)#define HIGHBIT (type) (1u << (sizeof(type) * 8 - 1)) -#define SET_NZ (x) do { \ - if ((x) == 0) \ +#define SET_NZ (x, type) do { \ + if ((type)(x) == 0) \ flags |= CCF_Z; \ - else if ((int32_t)(x) < 0) \ + else if ((type)(x) < 0) \ flags |= CCF_N; \ } while (0)#define SET_FLAGS_SUB (type, utype) do { \ - SET_NZ((type)dest); \ + SET_NZ(dest, type); \ tmp = dest + src; \ if ((utype) tmp < (utype) src) \ flags |= CCF_C; \
@@ -299,7 +299,7 @@ void cpu_m68k_flush_flags(CPUM68KState *env, int cc_op) } while (0)#define SET_FLAGS_ADD (type, utype) do { \ - SET_NZ((type)dest); \ + SET_NZ(dest, type); \ if ((utype) dest < (utype) src) \ flags |= CCF_C; \ tmp = dest - src; \
@@ -308,7 +308,7 @@ void cpu_m68k_flush_flags(CPUM68KState *env, int cc_op) } while (0)#define SET_FLAGS_ADDX (type, utype) do { \ - SET_NZ((type)dest); \ + SET_NZ(dest, type); \ if ((utype) dest <= (utype) src) \ flags |= CCF_C; \ tmp = dest - src - 1; \
@@ -317,7 +317,7 @@ void cpu_m68k_flush_flags(CPUM68KState *env, int cc_op) } while (0)#define SET_FLAGS_SUBX (type, utype) do { \ - SET_NZ((type)dest); \ + SET_NZ(dest, type); \ tmp = dest + src + 1; \ if ((utype) tmp <= (utype) src) \ flags |= CCF_C; \
@@ -326,7 +326,7 @@ void cpu_m68k_flush_flags(CPUM68KState *env, int cc_op) } while (0)#define SET_FLAGS_SHIFT (type) do { \ - SET_NZ((type)dest); \ + SET_NZ(dest, type); \ if (src) \ flags |= CCF_C; \ } while(0)
@@ -338,8 +338,21 @@ void cpu_m68k_flush_flags(CPUM68KState *env, int cc_op)case CC_OP_FLAGS : flags = dest;break ; +case CC_OP_LOGICB : +SET_NZ (dest, int8_t); + goto set_x; +break ; +case CC_OP_LOGICW : +SET_NZ (dest, int16_t); + goto set_x; +break ;case CC_OP_LOGIC : -SET_NZ (dest); +SET_NZ (dest, int32_t); +set_x: +if (env->cc_x &&m68k_feature (env,M68K_FEATURE_M68000 )) { +/* Unlike m68k, coldfire always clears the overflow bit. */ + flags |=CCF_X ; + }break ;case CC_OP_ADDB :SET_FLAGS_ADD (int8_t, uint8_t);
target-m68k/translate.c +34 -36
220 lines not on this page · raw message
Signature · 1 line
1.7.2.3
PATCH 42/111 m68k: set X flag according size of operand Set X flag correctly for addsub, arith_im, addsubq.
In reply to Bryce LanhamFrom: Laurent Vivier <[email protected]>
--- target-m68k/helper.c | 12 +++++++++++- target-m68k/helpers.h | 4 +++- target-m68k/translate.c | 23 ++++++++++++++++------- 3 files changed, 30 insertions(+), 9 deletions(-)
target-m68k/helper.c +11 -1
@@ -619,7 +619,17 @@ uint32_t HELPER(addx_cc)(CPUState *env, uint32_t op1, uint32_t op2)return res; } -uint32_t HELPER (xflag_lt )(uint32_t a,uint32_t b) +uint32_t HELPER (xflag_lt_i8 )(uint32_t a,uint32_t b) +{ +return (uint8_t )a < (uint8_t )b; +} + +uint32_t HELPER (xflag_lt_i16 )(uint32_t a,uint32_t b) +{ +return (uint16_t )a < (uint16_t )b; +} + +uint32_t HELPER (xflag_lt_i32 )(uint32_t a,uint32_t b) {return a < b; }
target-m68k/helpers.h +3 -1
@@ -37,7 +37,9 @@ DEF_HELPER_3(roxr32_cc, i32, env, i32, i32) DEF_HELPER_3(roxl8_cc, i32, env, i32, i32) DEF_HELPER_3(roxl16_cc, i32, env, i32, i32) DEF_HELPER_3(roxl32_cc, i32, env, i32, i32) -DEF_HELPER_2(xflag_lt, i32, i32, i32) +DEF_HELPER_2(xflag_lt_i8, i32, i32, i32) +DEF_HELPER_2(xflag_lt_i16, i32, i32, i32) +DEF_HELPER_2(xflag_lt_i32, i32, i32, i32) DEF_HELPER_2(set_sr, void, env, i32)DEF_HELPER_3 (movec, void, env, i32, i32)
target-m68k/translate.c +16 -7
@@ -440,6 +440,15 @@ static inline void gen_flush_flags(DisasContext *s) } \ } while (0) +#define SET_X_FLAG (opsize, a, b) do { \ + switch (opsize) { \ + case OS_BYTE: gen_helper_xflag_lt_i8(QREG_CC_X, a, b); break; \ + case OS_WORD: gen_helper_xflag_lt_i16(QREG_CC_X, a, b); break; \ + case OS_LONG: gen_helper_xflag_lt_i32(QREG_CC_X, a, b); break; \ + default: abort(); \ + } \ +} while (0) +static void gen_logic_cc (DisasContext *s,TCGv val,int opsize) {tcg_gen_mov_i32 (QREG_CC_DEST , val);
@@ -1160,10 +1169,10 @@ DISAS_INSN(addsub) }if (add) {tcg_gen_add_i32 (dest, tmp, src); -gen_helper_xflag_lt (QREG_CC_X , dest, src); +SET_X_FLAG (opsize, dest, src);SET_CC_OP (opsize,ADD ); }else { -gen_helper_xflag_lt (QREG_CC_X , tmp, src); +SET_X_FLAG (opsize, tmp, src);tcg_gen_sub_i32 (dest, tmp, src);SET_CC_OP (opsize,SUB ); }
@@ -1413,7 +1422,7 @@ DISAS_INSN(arith_im)break ;case 2 :/* subi */ tcg_gen_mov_i32 (dest, src1); -gen_helper_xflag_lt (QREG_CC_X , dest,tcg_const_i32 (im)); +SET_X_FLAG (opsize, dest,tcg_const_i32 (im));tcg_gen_subi_i32 (dest, dest, im);gen_update_cc_add (dest,tcg_const_i32 (im));SET_CC_OP (opsize,SUB );
@@ -1422,7 +1431,7 @@ DISAS_INSN(arith_im)tcg_gen_mov_i32 (dest, src1);tcg_gen_addi_i32 (dest, dest, im);gen_update_cc_add (dest,tcg_const_i32 (im)); -gen_helper_xflag_lt (QREG_CC_X , dest,tcg_const_i32 (im)); +SET_X_FLAG (opsize, dest,tcg_const_i32 (im));SET_CC_OP (opsize,ADD );break ;case 5 :/* eori */
@@ -1625,7 +1634,7 @@ DISAS_INSN(neg)DEST_EA (insn, opsize, dest, &addr);SET_CC_OP (opsize,SUB );gen_update_cc_add (dest, src1); -gen_helper_xflag_lt (QREG_CC_X ,tcg_const_i32 (0 ), dest); +SET_X_FLAG (opsize,tcg_const_i32 (0 ), dest); }static void gen_set_sr_im (DisasContext *s,uint16_t val,int ccr_only)
@@ -1920,12 +1929,12 @@ DISAS_INSN(addsubq) }else { src2 =tcg_const_i32 (val);if (insn &0x0100 ) { -gen_helper_xflag_lt (QREG_CC_X , dest, src2); +SET_X_FLAG (opsize, dest, src2);tcg_gen_subi_i32 (dest, dest, val);SET_CC_OP (opsize,SUB ); }else {tcg_gen_addi_i32 (dest, dest, val); -gen_helper_xflag_lt (QREG_CC_X , dest, src2); +SET_X_FLAG (opsize, dest, src2);SET_CC_OP (opsize,ADD ); }gen_update_cc_add (dest, src2);
Signature · 1 line
1.7.2.3
PATCH 34/111 m68k: correct typo on f64_to_i32() return type.
In reply to Bryce LanhamFrom: Laurent Vivier <[email protected]>
It returns i32, not f32.
--- target-m68k/helpers.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
target-m68k/helpers.h +1 -1
@@ -42,7 +42,7 @@ DEF_HELPER_2(set_sr, void, env, i32) DEF_HELPER_3(movec, void, env, i32, i32)DEF_HELPER_2 (const_f64, f64, env, i32); -DEF_HELPER_2(f64_to_i32, f32, env, f64) +DEF_HELPER_2(f64_to_i32, i32, env, f64) DEF_HELPER_2(f64_to_f32, f32, env, f64) DEF_HELPER_2(i32_to_f64, f64, env, i32)DEF_HELPER_2 (f32_to_f64, f64, env, f32)
Signature · 1 line
1.7.2.3
PATCH 40/111 m68k: add sbcd instruction
In reply to Bryce LanhamFrom: Laurent Vivier <[email protected]>
--- target-m68k/helper.c | 45 +++++++++++++++++++++++++++++++++++++++++++++ target-m68k/helpers.h | 1 + target-m68k/translate.c | 32 ++++++++++++++++++++++++++++++++ 3 files changed, 78 insertions(+), 0 deletions(-)
target-m68k/helper.c +45 -0
@@ -1324,3 +1324,48 @@ uint32_t HELPER(abcd_cc)(CPUState *env, uint32_t src, uint32_t dest)return dest; } + +uint32_t HELPER (sbcd_cc )(CPUState *env,uint32_t src,uint32_t dest) +{ +uint16_t hi, lo; +uint16_t res; +uint32_t flags; +int bcd =0 , carry =0 ; + + flags = env->cc_dest; + flags &= ~(CCF_C |CCF_X ); + +if (env->cc_x) + carry =1 ; + + lo = (dest &0x0f ) - (src &0x0f ) - carry; + hi = (dest &0xf0 ) - (src &0xf0 ); + + res = hi + lo; +if (lo &0xf0 ) { + res -=0x06 ; + bcd =0x06 ; + } + +if ((((dest &0xff ) - (src &0xff ) - carry) &0x100 ) >0xff ) { + res -=0x60 ; + } + +/* C and X flags: set if decimal carry, cleared otherwise */ + +if ((((dest &0xff ) - (src &0xff ) - (bcd + carry)) &0x300 ) >0xff ) { + flags |=CCF_C |CCF_X ; + } + +/* Z flag: cleared if nonzero */ + +if (res &0xff ) + flags &= ~CCF_Z ; + + dest = (dest &0xffffff00 ) | (res &0xff ); + + env->cc_x = (flags &CCF_X ) !=0 ; + env->cc_dest = flags; + +return dest; +}
target-m68k/helpers.h +1 -0
@@ -83,4 +83,5 @@ DEF_HELPER_3(bitfield_load, i64, i32, i32, i32);DEF_HELPER_4 (bitfield_store, void, i32, i32, i32, i64);DEF_HELPER_3 (abcd_cc, i32, env, i32, i32); +DEF_HELPER_3 (sbcd_cc, i32, env, i32, i32);#include "def-helper.h"
target-m68k/translate.c +32 -0
@@ -1095,6 +1095,36 @@ DISAS_INSN(abcd_mem)gen_store (s,OS_BYTE , addr_dest, dest); } +DISAS_INSN (sbcd_reg) +{ +TCGv src; +TCGv dest; + + src =DREG (insn,0 ); + dest =DREG (insn,9 ); +gen_helper_sbcd_cc (dest, cpu_env, src, dest); +} + +DISAS_INSN (sbcd_mem) +{ +TCGv src; +TCGv addr_src; +TCGv dest; +TCGv addr_dest; + + addr_src =AREG (insn,0 ); +tcg_gen_subi_i32 (addr_src, addr_src,OS_BYTE ); + src =gen_load (s,OS_BYTE , addr_src,0 ); + + addr_dest =AREG (insn,9 ); +tcg_gen_subi_i32 (addr_dest, addr_dest,OS_BYTE ); + dest =gen_load (s,OS_BYTE , addr_dest,0 ); + +gen_helper_sbcd_cc (dest, cpu_env, src, dest); + +gen_store (s,OS_BYTE , addr_dest, dest); +} +DISAS_INSN (addsub) {TCGv reg;
@@ -3909,6 +3939,8 @@ void register_m68k_insns (CPUM68KState *env)INSN (or,8000 , f000,M68000 ); INSN(divw, 80c0, f0c0, CF_ISA_A); INSN(divw, 80c0, f0c0, M68000); +INSN (sbcd_reg,8100 , f1f8,M68000 ); +INSN (sbcd_mem,8108 , f1f8,M68000 );INSN (addsub,9000 , f000,CF_ISA_A );INSN (addsub,9000 , f000,M68000 ); INSN(undef, 90c0, f0c0, CF_ISA_A);
Signature · 1 line
1.7.2.3
PATCH 45/111 m68k: improve subx, negx instructions Add (byte, word) opsize Add memory access (subx)
In reply to Bryce LanhamFrom: Laurent Vivier <[email protected]>
--- target-m68k/helper.c | 48 ++++++++++++++++++++++++++++++- target-m68k/helpers.h | 4 ++- target-m68k/translate.c | 72 +++++++++++++++++++++++++++++++++++++++++++--- 3 files changed, 117 insertions(+), 7 deletions(-)
target-m68k/helper.c +47 -1
@@ -573,7 +573,53 @@ uint32_t HELPER(sats)(uint32_t val, uint32_t ccr)return val; } -uint32_t HELPER (subx_cc )(CPUState *env,uint32_t op1,uint32_t op2) +uint32_t HELPER (subx8_cc )(CPUState *env,uint32_t op1,uint32_t op2) +{ +uint8_t res; +uint32_t old_flags; + + old_flags = env->cc_dest; +if (env->cc_x) { + env->cc_x = ((uint8_t )op1 <= (uint8_t )op2); + env->cc_op =CC_OP_SUBXB ; + res = (uint8_t )op1 - ((uint8_t )op2 +1 ); + }else { + env->cc_x = ((uint8_t )op1 < (uint8_t )op2); + env->cc_op =CC_OP_SUBB ; + res = (uint8_t )op1 - (uint8_t )op2; + } + env->cc_dest = res; + env->cc_src = (uint8_t )op2; +cpu_m68k_flush_flags (env, env->cc_op); +/* !Z is sticky. */ + env->cc_dest &= (old_flags | ~CCF_Z ); +return (op1 &0xffffff00 ) | res; +} + +uint32_t HELPER (subx16_cc )(CPUState *env,uint32_t op1,uint32_t op2) +{ +uint16_t res; +uint32_t old_flags; + + old_flags = env->cc_dest; +if (env->cc_x) { + env->cc_x = ((uint16_t )op1 <= (uint16_t )op2); + env->cc_op =CC_OP_SUBXW ; + res = (uint16_t )op1 - ((uint16_t )op2 +1 ); + }else { + env->cc_x = ((uint16_t )op1 < (uint16_t )op2); + env->cc_op =CC_OP_SUBW ; + res = (uint16_t )op1 - (uint16_t )op2; + } + env->cc_dest = res; + env->cc_src = (uint16_t )op2; +cpu_m68k_flush_flags (env, env->cc_op); +/* !Z is sticky. */ + env->cc_dest &= (old_flags | ~CCF_Z ); +return (op1 &0xffff0000 ) | res; +} + +uint32_t HELPER (subx32_cc )(CPUState *env,uint32_t op1,uint32_t op2) {uint32_t res;uint32_t old_flags;
target-m68k/helpers.h +3 -1
@@ -17,7 +17,9 @@ DEF_HELPER_3(muls64, i32, env, i32, i32) DEF_HELPER_3(addx8_cc, i32, env, i32, i32) DEF_HELPER_3(addx16_cc, i32, env, i32, i32) DEF_HELPER_3(addx32_cc, i32, env, i32, i32) -DEF_HELPER_3(subx_cc, i32, env, i32, i32) +DEF_HELPER_3(subx8_cc, i32, env, i32, i32) +DEF_HELPER_3(subx16_cc, i32, env, i32, i32) +DEF_HELPER_3(subx32_cc, i32, env, i32, i32) DEF_HELPER_3(shl8_cc, i32, env, i32, i32) DEF_HELPER_3(shl16_cc, i32, env, i32, i32)DEF_HELPER_3 (shl32_cc, i32, env, i32, i32)
target-m68k/translate.c +67 -5
97 lines not on this page · raw message
Signature · 1 line
1.7.2.3
PATCH 47/111 m68k: use read_imm1() when it is possible
In reply to Bryce LanhamFrom: Laurent Vivier <[email protected]>
--- target-m68k/translate.c | 48 +++++++++++++++------------------------------- 1 files changed, 16 insertions(+), 32 deletions(-)
target-m68k/translate.c +16 -32
@@ -567,8 +567,7 @@ static TCGv gen_lea(DisasContext *s, uint16_t insn, int opsize)case 5 :/* Indirect displacement. */ reg =AREG (insn,0 ); tmp =tcg_temp_new (); - ext =lduw_code (s->pc); - s->pc +=2 ; + ext =read_im16 (s);tcg_gen_addi_i32 (tmp, reg, (int16_t )ext);return tmp;case 6 :/* Indirect index + displacement. */
@@ -1276,8 +1275,7 @@ DISAS_INSN(movem)int opsize;int32_t incr; - mask =lduw_code (s->pc); - s->pc +=2 ; + mask =read_im16 (s); tmp =gen_lea (s, insn,OS_LONG );if (IS_NULL_QREG (tmp)) {gen_addr_fault (s);
@@ -1339,8 +1337,7 @@ DISAS_INSN(bitop_im) opsize =OS_LONG ; op = (insn >>6 ) &3 ; - bitnum =lduw_code (s->pc); - s->pc +=2 ; + bitnum =read_im16 (s);if (bitnum &0xff00 ) {disas_undef (s, insn);return ;
@@ -1484,8 +1481,7 @@ DISAS_INSN(cas)abort (); } - ext =lduw_code (s->pc); - s->pc +=2 ; + ext =read_im16 (s); taddr =gen_lea (s, insn, opsize);if (IS_NULL_QREG (taddr)) {gen_addr_fault (s);
@@ -1677,8 +1673,7 @@ static void gen_set_sr(DisasContext *s, uint16_t insn, int ccr_only)else if ((insn &0x3f ) ==0x3c ) {uint16_t val; - val =lduw_code (s->pc); - s->pc +=2 ; + val =read_im16 (s);gen_set_sr_im (s, val, ccr_only); }else
@@ -1796,8 +1791,7 @@ DISAS_INSN(mull)/* The upper 32 bits of the product are discarded, so muls.l and mulu.l are functionally equivalent. */ - ext =lduw_code (s->pc); - s->pc +=2 ; + ext =read_im16 (s);if (ext &0x400 ) {if (!m68k_feature (s->env,M68K_FEATURE_QUAD_MULDIV )) {gen_exception (s, s->pc -4 ,EXCP_UNSUPPORTED );
@@ -2731,8 +2725,7 @@ DISAS_INSN(bitfield_reg) reg =DREG (insn,0 ); op = (insn >>8 ) &7 ; - ext =lduw_code (s->pc); - s->pc +=2 ; + ext =read_im16 (s);bitfield_param (ext, &offset, &width, &mask);
@@ -2905,8 +2898,7 @@ DISAS_INSN(bitfield_mem)TCGv tmp; op = (insn >>8 ) &7 ; - ext =lduw_code (s->pc); - s->pc +=2 ; + ext =read_im16 (s); src =gen_lea (s, insn,OS_LONG );if (IS_NULL_QREG (src)) {gen_addr_fault (s);
@@ -3010,14 +3002,12 @@ DISAS_INSN(strldsr)uint32_t addr; addr = s->pc -2 ; - ext =lduw_code (s->pc); - s->pc +=2 ; + ext =read_im16 (s);if (ext !=0x46FC ) {gen_exception (s, addr,EXCP_UNSUPPORTED );return ; } - ext =lduw_code (s->pc); - s->pc +=2 ; + ext =read_im16 (s);if (IS_USER (s) || (ext &SR_S ) ==0 ) {gen_exception (s, addr,EXCP_PRIVILEGE );return ;
@@ -3084,8 +3074,7 @@ DISAS_INSN(stop)return ; } - ext =lduw_code (s->pc); - s->pc +=2 ; + ext =read_im16 (s);gen_set_sr_im (s, ext,0 );tcg_gen_movi_i32 (QREG_HALTED ,1 );
@@ -3111,8 +3100,7 @@ DISAS_INSN(movec)return ; } - ext =lduw_code (s->pc); - s->pc +=2 ; + ext =read_im16 (s);if (ext &0x8000 ) { reg =AREG (ext,12 );
@@ -3545,8 +3533,7 @@ DISAS_INSN(fscc_mem)TCGv addr;uint16_t ext; - ext =lduw_code (s->pc); - s->pc +=2 ; + ext =read_im16 (s); taddr =gen_lea (s, insn,OS_BYTE );if (IS_NULL_QREG (taddr)) {
@@ -3572,8 +3559,7 @@ DISAS_INSN(fscc_reg)TCGv reg;uint16_t ext; - ext =lduw_code (s->pc); - s->pc +=2 ; + ext =read_im16 (s); reg =DREG (insn,0 );
@@ -3641,8 +3627,7 @@ DISAS_INSN(mac) s->done_mac =1 ; } - ext =lduw_code (s->pc); - s->pc +=2 ; + ext =read_im16 (s); acc = ((insn >>7 ) &1 ) | ((ext >>3 ) &2 ); dual = ((insn &0x30 ) !=0 && (ext &3 ) !=0 );
@@ -4190,8 +4175,7 @@ static void disas_m68k_insn(CPUState * env, DisasContext *s)if (unlikely (qemu_loglevel_mask (CPU_LOG_TB_OP )))tcg_gen_debug_insn_start (s->pc); - insn =lduw_code (s->pc); - s->pc +=2 ; + insn =read_im16 (s); opcode_table[insn](s, insn); }
Signature · 1 line
1.7.2.3
PATCH 46/111 m68k: improve asl/asr evaluate correclty the missing V flag
In reply to Bryce LanhamFrom: Laurent Vivier <[email protected]>
--- target-m68k/helper.c | 49 ++++++++++++++++++++++++++++++++++++++++++---- target-m68k/helpers.h | 3 ++ target-m68k/translate.c | 36 ++++++++++++++++++++++++++++----- 3 files changed, 77 insertions(+), 11 deletions(-)
target-m68k/helper.c +44 -5
@@ -327,8 +327,7 @@ void cpu_m68k_flush_flags(CPUM68KState *env, int cc_op)#define SET_FLAGS_SHIFT (type) do { \ SET_NZ(dest, type); \ - if (src) \ - flags |= CCF_C; \ + flags |= src; \ } while(0) flags =0 ;
@@ -751,7 +750,7 @@ uint32_t HELPER(glue(glue(shl, bits),_cc))(CPUState *env, uint32_t val, uint32_t result =0 ; \ cf =0 ; \ } \ - env->cc_src = cf; \ + env->cc_src = cf ?CCF_C :0 ; \if (shift) env->cc_x = (cf !=0 ); \ env->cc_dest = result; \return result; \
@@ -780,7 +779,7 @@ uint32_t HELPER(glue(glue(shr, bits), _cc))(CPUState *env, uint32_t val, uint32_ result =0 ; \ cf =0 ; \ } \ - env->cc_src = cf; \ + env->cc_src = cf ?CCF_C :0 ; \if (shift) env->cc_x = (cf !=0 ); \ env->cc_dest = result; \return result; \
@@ -790,6 +789,46 @@ HELPER_SHR(uint8_t, 8) HELPER_SHR(uint16_t, 16) HELPER_SHR(uint32_t, 32) +#define HELPER_SAL (type, bits) \ +uint32_t HELPER(glue(glue(sal, bits),_cc))(CPUState *env, uint32_t val, uint32_t shift) \ +{ \ + type result; \ + uint32_t cf; \ + uint32_t vf; \ + uint32_t m; \ + shift &= 63; \ + if (shift == 0) { \ + vf = 0; \ + } else if (shift < bits) { \ + m = ((1llu << (shift + 1)) - 1) << (bits - shift - 1); \ + vf = (val & m) != m && (val & m) != 0; \ + } else {\ + m = (1llu << bits) - 1; \ + vf = (val & m) != 0; \ + }\ + if (shift == 0) { \ + result = (type)val; \ + cf = env->cc_src & CCF_C; \ + } else if (shift < bits) { \ + result = (type)val << shift; \ + cf = ((type)val >> (bits - shift)) & 1; \ + } else if (shift == bits) { \ + result = 0; \ + cf = val & 1; \ + } else/* shift > bits */ { \ + result =0 ; \ + cf =0 ; \ + } \ + env->cc_src = (cf ?CCF_C :0 ) | (vf ?CCF_V :0 ); \ +if (shift) env->cc_x = (cf !=0 ); \ + env->cc_dest = result; \ +return result; \ +} + +HELPER_SAL(int8_t, 8) +HELPER_SAL(int16_t, 16) +HELPER_SAL(int32_t, 32) +#define HELPER_SAR (type, bits) \ uint32_t HELPER(glue(glue(sar, bits), _cc))(CPUState *env, uint32_t val, uint32_t shift) \ { \
@@ -806,7 +845,7 @@ uint32_t HELPER(glue(glue(sar, bits), _cc))(CPUState *env, uint32_t val, uint32_ result = (type )val >> (bits -1 ); \ cf = (type )val >> (bits -1 ); \ } \ - env->cc_src = cf; \ + env->cc_src = cf ?CCF_C :0 ; \if (shift) env->cc_x = (cf !=0 ); \ env->cc_dest = result; \return result; \
target-m68k/helpers.h +3 -0
@@ -26,6 +26,9 @@ DEF_HELPER_3(shl32_cc, i32, env, i32, i32) DEF_HELPER_3(shr8_cc, i32, env, i32, i32) DEF_HELPER_3(shr16_cc, i32, env, i32, i32) DEF_HELPER_3(shr32_cc, i32, env, i32, i32) +DEF_HELPER_3(sal8_cc, i32, env, i32, i32) +DEF_HELPER_3(sal16_cc, i32, env, i32, i32) +DEF_HELPER_3(sal32_cc, i32, env, i32, i32) DEF_HELPER_3(sar8_cc, i32, env, i32, i32) DEF_HELPER_3(sar16_cc, i32, env, i32, i32)DEF_HELPER_3 (sar32_cc, i32, env, i32, i32)
target-m68k/translate.c +30 -6
@@ -2298,7 +2298,11 @@ DISAS_INSN(shift8_im) dest =tcg_temp_new_i32 ();/* No need to flush flags becuse we know we will set C flag. */ if (insn &0x100 ) { -gen_helper_shl8_cc (dest, cpu_env, reg, shift); +if (insn &8 ) { +gen_helper_shl8_cc (dest, cpu_env, reg, shift); + }else { +gen_helper_sal8_cc (dest, cpu_env, reg, shift); + } }else {if (insn &8 ) {gen_helper_shr8_cc (dest, cpu_env, reg, shift);
@@ -2326,7 +2330,11 @@ DISAS_INSN(shift16_im) dest =tcg_temp_new_i32 ();/* No need to flush flags becuse we know we will set C flag. */ if (insn &0x100 ) { -gen_helper_shl16_cc (dest, cpu_env, reg, shift); +if (insn &8 ) { +gen_helper_shl16_cc (dest, cpu_env, reg, shift); + }else { +gen_helper_sal16_cc (dest, cpu_env, reg, shift); + } }else {if (insn &8 ) {gen_helper_shr16_cc (dest, cpu_env, reg, shift);
@@ -2353,7 +2361,11 @@ DISAS_INSN(shift_im) shift =tcg_const_i32 (tmp);/* No need to flush flags becuse we know we will set C flag. */ if (insn &0x100 ) { -gen_helper_shl32_cc (reg, cpu_env, reg, shift); +if (insn &8 ) { +gen_helper_shl32_cc (reg, cpu_env, reg, shift); + }else { +gen_helper_sal32_cc (reg, cpu_env, reg, shift); + } }else {if (insn &8 ) {gen_helper_shr32_cc (reg, cpu_env, reg, shift);
@@ -2379,7 +2391,11 @@ DISAS_INSN(shift8_reg)/* Shift by zero leaves C flag unmodified. */ gen_flush_flags (s);if (insn &0x100 ) { -gen_helper_shl8_cc (dest, cpu_env, reg, tmp); +if (insn &8 ) { +gen_helper_shl8_cc (dest, cpu_env, reg, tmp); + }else { +gen_helper_sal8_cc (dest, cpu_env, reg, tmp); + } }else {if (insn &8 ) {gen_helper_shr8_cc (dest, cpu_env, reg, tmp);
@@ -2406,7 +2422,11 @@ DISAS_INSN(shift16_reg)/* Shift by zero leaves C flag unmodified. */ gen_flush_flags (s);if (insn &0x100 ) { -gen_helper_shl16_cc (dest, cpu_env, reg, tmp); +if (insn &8 ) { +gen_helper_shl16_cc (dest, cpu_env, reg, tmp); + }else { +gen_helper_sal16_cc (dest, cpu_env, reg, tmp); + } }else {if (insn &8 ) {gen_helper_shr16_cc (dest, cpu_env, reg, tmp);
@@ -2428,7 +2448,11 @@ DISAS_INSN(shift_reg)/* Shift by zero leaves C flag unmodified. */ gen_flush_flags (s);if (insn &0x100 ) { -gen_helper_shl32_cc (reg, cpu_env, reg, shift); +if (insn &8 ) { +gen_helper_shl32_cc (reg, cpu_env, reg, shift); + }else { +gen_helper_sal32_cc (reg, cpu_env, reg, shift); + } }else {if (insn &8 ) {gen_helper_shr32_cc (reg, cpu_env, reg, shift);
Signature · 1 line
1.7.2.3
PATCH 49/111 m68k: asl/asr, clear C flag if shift count is 0
In reply to Bryce LanhamFrom: Laurent Vivier <[email protected]>
--- target-m68k/helper.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
target-m68k/helper.c +2 -2
@@ -808,7 +808,7 @@ uint32_t HELPER(glue(glue(sal, bits),_cc))(CPUState *env, uint32_t val, uint32_t }\if (shift ==0 ) { \ result = (type )val; \ - cf = env->cc_src &CCF_C ; \ + cf =0 ; \ }else if (shift < bits) { \ result = (type )val << shift; \ cf = ((type )val >> (bits - shift)) &1 ; \
@@ -837,7 +837,7 @@ uint32_t HELPER(glue(glue(sar, bits), _cc))(CPUState *env, uint32_t val, uint32_ shift &=63 ; \if (shift ==0 ) { \ result = (type )val; \ - cf = (env->cc_src &CCF_C ) !=0 ; \ + cf =0 ; \ }else if (shift < bits) { \ result = (type )val >> shift; \ cf = ((type )val >> (shift -1 )) &1 ; \
Signature · 1 line
1.7.2.3
PATCH 33/111 m68k: Add fmovecr
In reply to Bryce LanhamFrom: Laurent Vivier <[email protected]>
This patch allows to read constant from the FPU ROM. It implements instructions like "fmovecrx #0,%fp0" (which loads Pi to %fp0).
--- target-m68k/helper.c | 33 +++++++++++++++++++++++++++++++++ target-m68k/helpers.h | 1 + target-m68k/translate.c | 12 +++++++++++- 3 files changed, 45 insertions(+), 1 deletions(-)
target-m68k/helper.c +33 -0
@@ -815,6 +815,39 @@ HELPER_ROXL(uint16_t, 16)HELPER_ROXL (uint32_t,32 ) /* FPU helpers. */ + +static const floatx80 fpu_rom[128 ] = { + [0x00 ] = { .high =0x4000 , .low =0xc90fdaa22168c235 },/* Pi */ + + [0x0b ] = { .high =0x3ffd , .low =0x9a209a84fbcff798 },/* Log10(2) */ + [0x0c ] = { .high =0x4000 , .low =0xadf85458a2bb4a9a },/* e */ + [0x0d ] = { .high =0x3fff , .low =0xb8aa3b295c17f0bc },/* Log2(e) */ + [0x0e ] = { .high =0x3ffd , .low =0xde5bd8a937287195 },/* Log10(e) */ + [0x0f ] = { .high =0x0000 , .low =0x0000000000000000 },/* Zero */ + + [0x30 ] = { .high =0x3ffe , .low =0xb17217f7d1cf79ac },/* ln(2) */ + [0x31 ] = { .high =0x4000 , .low =0x935d8dddaaa8ac17 },/* ln(10) */ + [0x32 ] = { .high =0x3fff , .low =0x8000000000000000 },/* 10^0 */ + [0x33 ] = { .high =0x4002 , .low =0xa000000000000000 },/* 10^1 */ + [0x34 ] = { .high =0x4005 , .low =0xc800000000000000 },/* 10^2 */ + [0x35 ] = { .high =0x400c , .low =0x9c40000000000000 },/* 10^4 */ + [0x36 ] = { .high =0x4019 , .low =0xbebc200000000000 },/* 10^8 */ + [0x37 ] = { .high =0x4034 , .low =0x8e1bc9bf04000000 },/* 10^16 */ + [0x38 ] = { .high =0x4069 , .low =0x9dc5ada82b70b59e },/* 10^32 */ + [0x39 ] = { .high =0x40d3 , .low =0xc2781f49ffcfa6d5 },/* 10^64 */ + [0x3a ] = { .high =0x41a8 , .low =0x93ba47c980e98ce0 },/* 10^128 */ + [0x3b ] = { .high =0x4351 , .low =0xaa7eebfb9df9de8e },/* 10^256 */ + [0x3c ] = { .high =0x46a3 , .low =0xe319a0aea60e91c7 },/* 10^512 */ + [0x3d ] = { .high =0x4d48 , .low =0xc976758681750c17 },/* 10^1024 */ + [0x3e ] = { .high =0x5a92 , .low =0x9e8b3b5dc53d5de5 },/* 10^2048 */ + [0x3f ] = { .high =0x7525 , .low =0xc46052028a20979b },/* 10^4096 */ +}; + +float64 HELPER (const_f64 )(CPUState *env,uint32_t offset) +{ +return floatx80_to_float64 (fpu_rom[offset], &env->fp_status); +} +uint32_t HELPER (f64_to_i32 )(CPUState *env,float64 val) {return float64_to_int32 (val, &env->fp_status);
target-m68k/helpers.h +1 -0
@@ -41,6 +41,7 @@ DEF_HELPER_2(xflag_lt, i32, i32, i32) DEF_HELPER_2(set_sr, void, env, i32) DEF_HELPER_3(movec, void, env, i32, i32) +DEF_HELPER_2 (const_f64, f64, env, i32); DEF_HELPER_2(f64_to_i32, f32, env, f64) DEF_HELPER_2(f64_to_f32, f32, env, f64)DEF_HELPER_2 (i32_to_f64, f64, env, i32)
target-m68k/translate.c +11 -1
@@ -2949,6 +2949,7 @@ DISAS_INSN(trap)DISAS_INSN (fpu) {uint16_t ext; +uint8_t rom_offset;int opmode;TCGv_i64 src;TCGv_i64 dest;
@@ -2962,10 +2963,19 @@ DISAS_INSN(fpu) ext =read_im16 (s); opmode = ext &0x7f ;switch ((ext >>13 ) &7 ) { -case 0 :case 2 : +case 0 :break ;case 1 : goto undef; +case 2 : +if ( insn ==0xf200 && (ext &0xfc00 ) ==0x5c00 ) { +/* fmovecr */ + rom_offset = ext &0x7f ; + dest =FREG (ext,7 ); +gen_helper_const_f64 (dest, cpu_env,tcg_const_i32 (rom_offset)); +return ; + } +break ;case 3 :/* fmove out */ src =FREG (ext,7 ); tmp32 =tcg_temp_new_i32 ();
Signature · 1 line
1.7.2.3
PATCH 37/111 Correct invalid use of "const void *" with "const uint8_t *"
In reply to Bryce LanhamFrom: Laurent Vivier <[email protected]>
When cpu-all.h is used with m68k-tester (an m68k testsuite), the header is compiled with g++ and reports the following errors:
../qemu-m68k/cpu-all.h: In function ‘int lduw_be_p(const void*)’:../qemu-m68k/cpu-all.h:414: error: invalid conversion from ‘const void*’ to ‘const uint8_t*’ ../qemu-m68k/cpu-all.h: In function ‘int ldsw_be_p(const void*)’:../qemu-m68k/cpu-all.h:429: error: invalid conversion from ‘const void*’ to ‘const uint8_t*’
This patch casts the variable to "const uint8_t*"
--- bswap.h | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
bswap.h +3 -3
@@ -533,7 +533,7 @@ static inline int lduw_be_p(const void *ptr) : "m" (*(uint16_t *)ptr));return val;#else -const uint8_t *b = ptr; +const uint8_t *b = (const uint8_t *)ptr;return ((b[0 ] <<8 ) | b[1 ]);#endif }
@@ -548,7 +548,7 @@ static inline int ldsw_be_p(const void *ptr) : "m" (*(uint16_t *)ptr));return (int16_t )val;#else -const uint8_t *b = ptr; +const uint8_t *b = (const uint8_t *)ptr;return (int16_t )((b[0 ] <<8 ) | b[1 ]);#endif }
@@ -563,7 +563,7 @@ static inline int ldl_be_p(const void *ptr) : "m" (*(uint32_t *)ptr));return val;#else -const uint8_t *b = ptr; +const uint8_t *b = (const uint8_t *)ptr;return (b[0 ] <<24 ) | (b[1 ] <<16 ) | (b[2 ] <<8 ) | b[3 ];#endif }
Signature · 1 line
1.7.2.3
PATCH 41/111 mm68k: add nbcd instruction
In reply to Bryce LanhamFrom: Laurent Vivier <[email protected]>
--- target-m68k/translate.c | 13 +++++++++++++ 1 files changed, 13 insertions(+), 0 deletions(-)
target-m68k/translate.c +13 -0
@@ -1125,6 +1125,18 @@ DISAS_INSN(sbcd_mem)gen_store (s,OS_BYTE , addr_dest, dest); } +DISAS_INSN (nbcd) +{ +TCGv dest; +TCGv addr; + +SRC_EA (dest,OS_BYTE ,-1 , &addr); + +gen_helper_sbcd_cc (dest, cpu_env, dest,tcg_const_i32 (0 )); + +DEST_EA (insn,OS_BYTE , dest, &addr); +} +DISAS_INSN (addsub) {TCGv reg;
@@ -3865,6 +3877,7 @@ void register_m68k_insns (CPUM68KState *env)INSN (not,4600 , ff00,M68000 ); INSN(undef, 46c0, ffc0, M68000); INSN(move_to_sr, 46c0, ffc0, CF_ISA_A); +INSN (nbcd,4800 , ffc0,M68000 );INSN (linkl,4808 , fff8,M68000 );INSN (pea,4840 , ffc0,CF_ISA_A );INSN (pea,4840 , ffc0,M68000 );
Signature · 1 line
1.7.2.3
PATCH 38/111 m68k: add EA support for negx
In reply to Bryce LanhamFrom: Laurent Vivier <[email protected]>
--- target-m68k/translate.c | 15 ++++++++++----- 1 files changed, 10 insertions(+), 5 deletions(-)
target-m68k/translate.c +10 -5
@@ -1483,11 +1483,16 @@ DISAS_INSN(move)DISAS_INSN (negx) { -TCGv reg; +TCGv src; +TCGv dest; +TCGv addr; +int opsize; -gen_flush_flags (s); - reg =DREG (insn,0 ); -gen_helper_subx_cc (reg, cpu_env,tcg_const_i32 (0 ), reg); + opsize =insn_opsize (insn,6 ); +SRC_EA (src, opsize,-1 , &addr); + dest =tcg_temp_new (); +gen_helper_subx_cc (dest, cpu_env,tcg_const_i32 (0 ), src); +DEST_EA (insn, opsize, dest, &addr); }DISAS_INSN (lea)
@@ -3780,7 +3785,7 @@ void register_m68k_insns (CPUM68KState *env)INSN (move,3000 , f000,M68000 );INSN (strldsr,40e7 , ffff,CF_ISA_APLUSC );INSN (negx,4080 , fff8,CF_ISA_A ); -INSN (negx,4080 , fff8,M68000 ); +INSN (negx,4000 , ff00,M68000 ); INSN(undef, 40c0, ffc0, M68000); INSN(move_from_sr, 40c0, fff8, CF_ISA_A); INSN(move_from_sr, 40c0, fff8, M68000);
Signature · 1 line
1.7.2.3
PATCH 48/111 m68k: correct shift side effect for roxrl and roxll
In reply to Bryce LanhamFrom: Laurent Vivier <[email protected]>
--- target-m68k/helper.c | 10 ++++++++-- 1 files changed, 8 insertions(+), 2 deletions(-)
target-m68k/helper.c +8 -2
@@ -915,7 +915,10 @@ uint32_t HELPER(glue(glue(roxr,bits),_cc))(CPUState *env, uint32_t val, uint32_tif (bits ==16 ) count = rox16_table[count]; \if (bits ==32 ) count = rox32_table[count]; \if (count) { \ - result = ((type )val >> count) | ((type )env->cc_x << (bits - count)); \ +if (count == bits)\ + result = ((type )env->cc_x << (bits - count));\ +else \ + result = ((type )val >> count) | ((type )env->cc_x << (bits - count));\if (count >1 ) \ result |= (type )val << (bits +1 - count); \ env->cc_x = ((type )val >> (count -1 )) &1 ; \
@@ -947,7 +950,10 @@ uint32_t HELPER(glue(glue(roxl,bits),_cc))(CPUState *env, uint32_t val, uint32_tif (bits ==16 ) count = rox16_table[count]; \if (bits ==32 ) count = rox32_table[count]; \if (count) { \ - result = ((type )val << count) | ((type )env->cc_x << (count -1 )); \ +if (count == bits) \ + result = ((type )env->cc_x << (count -1 )); \ +else \ + result = ((type )val << count) | ((type )env->cc_x << (count -1 )); \if (count >1 ) \ result |= (type )val >> (bits +1 - count); \ env->cc_x = ((type )val >> (bits - count)) &1 ; \
Signature · 1 line
1.7.2.3
PATCH 50/111 m68k: lsl/lsr, clear C flag if shift count is 0
In reply to Bryce LanhamFrom: Laurent Vivier <[email protected]>
--- target-m68k/helper.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
target-m68k/helper.c +2 -2
@@ -739,7 +739,7 @@ uint32_t HELPER(glue(glue(shl, bits),_cc))(CPUState *env, uint32_t val, uint32_t shift &=63 ; \if (shift ==0 ) { \ result = (type )val; \ - cf = env->cc_src &CCF_C ; \ + cf =0 ; \ }else if (shift < bits) { \ result = (type )val << shift; \ cf = ((type )val >> (bits - shift)) &1 ; \
@@ -768,7 +768,7 @@ uint32_t HELPER(glue(glue(shr, bits), _cc))(CPUState *env, uint32_t val, uint32_ shift &=63 ; \if (shift ==0 ) { \ result = (type )val; \ - cf = env->cc_src &CCF_C ; \ + cf =0 ; \ }else if (shift < bits) { \ result = (type )val >> shift; \ cf = ((type )val >> (shift -1 )) &1 ; \
Signature · 1 line
1.7.2.3
PATCH 43/111 m68k: on 0 bit shift, don't update X flag
In reply to Bryce LanhamFrom: Laurent Vivier <[email protected]>
--- target-m68k/helper.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
target-m68k/helper.c +3 -3
@@ -660,7 +660,7 @@ uint32_t HELPER(glue(glue(shl, bits),_cc))(CPUState *env, uint32_t val, uint32_t cf =0 ; \ } \ env->cc_src = cf; \ - env->cc_x = (cf !=0 ); \ +if (shift) env->cc_x = (cf !=0 ); \ env->cc_dest = result; \return result; \ }
@@ -689,7 +689,7 @@ uint32_t HELPER(glue(glue(shr, bits), _cc))(CPUState *env, uint32_t val, uint32_ cf =0 ; \ } \ env->cc_src = cf; \ - env->cc_x = (cf !=0 ); \ +if (shift) env->cc_x = (cf !=0 ); \ env->cc_dest = result; \return result; \ }
@@ -715,7 +715,7 @@ uint32_t HELPER(glue(glue(sar, bits), _cc))(CPUState *env, uint32_t val, uint32_ cf = (type )val >> (bits -1 ); \ } \ env->cc_src = cf; \ - env->cc_x = cf; \ +if (shift) env->cc_x = (cf !=0 ); \ env->cc_dest = result; \return result; \ }
Signature · 1 line
1.7.2.3
PATCH 44/111 m68k: improve addx instructions Add (byte, word) opsize Add memory access
In reply to Bryce LanhamFrom: Laurent Vivier <[email protected]>
--- target-m68k/helper.c | 48 ++++++++++++++++++++++++++++++++++++++- target-m68k/helpers.h | 4 ++- target-m68k/translate.c | 58 +++++++++++++++++++++++++++++++++++++++++++--- 3 files changed, 104 insertions(+), 6 deletions(-)
target-m68k/helper.c +47 -1
@@ -596,7 +596,53 @@ uint32_t HELPER(subx_cc)(CPUState *env, uint32_t op1, uint32_t op2)return res; } -uint32_t HELPER (addx_cc )(CPUState *env,uint32_t op1,uint32_t op2) +uint32_t HELPER (addx8_cc )(CPUState *env,uint32_t op1,uint32_t op2) +{ +uint8_t res; +uint32_t old_flags; + + old_flags = env->cc_dest; +if (env->cc_x) { + res = (uint8_t )op1 + (uint8_t )op2 +1 ; + env->cc_x = (res <= (uint8_t )op2); + env->cc_op =CC_OP_ADDXB ; + }else { + res = (uint8_t )op1 + (uint8_t )op2; + env->cc_x = (res < (uint8_t )op2); + env->cc_op =CC_OP_ADDB ; + } + env->cc_dest = res; + env->cc_src = (uint8_t )op2; +cpu_m68k_flush_flags (env, env->cc_op); +/* !Z is sticky. */ + env->cc_dest &= (old_flags | ~CCF_Z ); +return (op1 &0xffffff00 ) | res; +} + +uint32_t HELPER (addx16_cc )(CPUState *env,uint32_t op1,uint32_t op2) +{ +uint16_t res; +uint32_t old_flags; + + old_flags = env->cc_dest; +if (env->cc_x) { + res = (uint16_t )op1 + (uint16_t )op2 +1 ; + env->cc_x = (res <= (uint16_t )op2); + env->cc_op =CC_OP_ADDXW ; + }else { + res = (uint16_t )op1 + (uint16_t )op2; + env->cc_x = (res < (uint16_t )op2); + env->cc_op =CC_OP_ADDW ; + } + env->cc_dest = res; + env->cc_src = (uint16_t )op2; +cpu_m68k_flush_flags (env, env->cc_op); +/* !Z is sticky. */ + env->cc_dest &= (old_flags | ~CCF_Z ); +return (op1 &0xffff0000 ) | res; +} + +uint32_t HELPER (addx32_cc )(CPUState *env,uint32_t op1,uint32_t op2) {uint32_t res;uint32_t old_flags;
target-m68k/helpers.h +3 -1
@@ -14,7 +14,9 @@ DEF_HELPER_3(mulu32_cc, i32, env, i32, i32) DEF_HELPER_3(muls32_cc, i32, env, i32, i32) DEF_HELPER_3(mulu64, i32, env, i32, i32) DEF_HELPER_3(muls64, i32, env, i32, i32) -DEF_HELPER_3(addx_cc, i32, env, i32, i32) +DEF_HELPER_3(addx8_cc, i32, env, i32, i32) +DEF_HELPER_3(addx16_cc, i32, env, i32, i32) +DEF_HELPER_3(addx32_cc, i32, env, i32, i32) DEF_HELPER_3(subx_cc, i32, env, i32, i32) DEF_HELPER_3(shl8_cc, i32, env, i32, i32)DEF_HELPER_3 (shl16_cc, i32, env, i32, i32)
target-m68k/translate.c +54 -4
78 lines not on this page · raw message
Signature · 1 line
1.7.2.3
PATCH 52/111 m68k: correct flags with negl
In reply to Bryce LanhamFrom: Laurent Vivier <[email protected]>
--- target-m68k/translate.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
target-m68k/translate.c +1 -1
@@ -1646,10 +1646,10 @@ DISAS_INSN(neg)SRC_EA (src1, opsize,-1 , &addr); dest =tcg_temp_new ();tcg_gen_neg_i32 (dest, src1); -DEST_EA (insn, opsize, dest, &addr);SET_CC_OP (opsize,SUB );gen_update_cc_add (dest, src1);SET_X_FLAG (opsize,tcg_const_i32 (0 ), dest); +DEST_EA (insn, opsize, dest, &addr); }static void gen_set_sr_im (DisasContext *s,uint16_t val,int ccr_only)
Signature · 1 line
1.7.2.3
PATCH 54/111 m68k: Added ULL to 64 bit integer in helper.c
In reply to Bryce LanhamFrom: Peter Bjørn Jørgensen <[email protected]>
--- target-m68k/helper.c | 48 ++++++++++++++++++++++++------------------------ 1 files changed, 24 insertions(+), 24 deletions(-)
target-m68k/helper.c +24 -24
@@ -977,30 +977,30 @@ HELPER_ROXL(uint32_t, 32)/* FPU helpers. */ static const floatx80 fpu_rom[128 ] = { - [0x00 ] = { .high =0x4000 , .low =0xc90fdaa22168c235 },/* Pi */ - - [0x0b ] = { .high =0x3ffd , .low =0x9a209a84fbcff798 },/* Log10(2) */ - [0x0c ] = { .high =0x4000 , .low =0xadf85458a2bb4a9a },/* e */ - [0x0d ] = { .high =0x3fff , .low =0xb8aa3b295c17f0bc },/* Log2(e) */ - [0x0e ] = { .high =0x3ffd , .low =0xde5bd8a937287195 },/* Log10(e) */ - [0x0f ] = { .high =0x0000 , .low =0x0000000000000000 },/* Zero */ - - [0x30 ] = { .high =0x3ffe , .low =0xb17217f7d1cf79ac },/* ln(2) */ - [0x31 ] = { .high =0x4000 , .low =0x935d8dddaaa8ac17 },/* ln(10) */ - [0x32 ] = { .high =0x3fff , .low =0x8000000000000000 },/* 10^0 */ - [0x33 ] = { .high =0x4002 , .low =0xa000000000000000 },/* 10^1 */ - [0x34 ] = { .high =0x4005 , .low =0xc800000000000000 },/* 10^2 */ - [0x35 ] = { .high =0x400c , .low =0x9c40000000000000 },/* 10^4 */ - [0x36 ] = { .high =0x4019 , .low =0xbebc200000000000 },/* 10^8 */ - [0x37 ] = { .high =0x4034 , .low =0x8e1bc9bf04000000 },/* 10^16 */ - [0x38 ] = { .high =0x4069 , .low =0x9dc5ada82b70b59e },/* 10^32 */ - [0x39 ] = { .high =0x40d3 , .low =0xc2781f49ffcfa6d5 },/* 10^64 */ - [0x3a ] = { .high =0x41a8 , .low =0x93ba47c980e98ce0 },/* 10^128 */ - [0x3b ] = { .high =0x4351 , .low =0xaa7eebfb9df9de8e },/* 10^256 */ - [0x3c ] = { .high =0x46a3 , .low =0xe319a0aea60e91c7 },/* 10^512 */ - [0x3d ] = { .high =0x4d48 , .low =0xc976758681750c17 },/* 10^1024 */ - [0x3e ] = { .high =0x5a92 , .low =0x9e8b3b5dc53d5de5 },/* 10^2048 */ - [0x3f ] = { .high =0x7525 , .low =0xc46052028a20979b },/* 10^4096 */ + [0x00 ] = { .high =0x4000 , .low =0xc90fdaa22168c235ULL },/* Pi */ + + [0x0b ] = { .high =0x3ffd , .low =0x9a209a84fbcff798ULL },/* Log10(2) */ + [0x0c ] = { .high =0x4000 , .low =0xadf85458a2bb4a9aULL },/* e */ + [0x0d ] = { .high =0x3fff , .low =0xb8aa3b295c17f0bcULL },/* Log2(e) */ + [0x0e ] = { .high =0x3ffd , .low =0xde5bd8a937287195ULL },/* Log10(e) */ + [0x0f ] = { .high =0x0000 , .low =0x0000000000000000ULL },/* Zero */ + + [0x30 ] = { .high =0x3ffe , .low =0xb17217f7d1cf79acULL },/* ln(2) */ + [0x31 ] = { .high =0x4000 , .low =0x935d8dddaaa8ac17ULL },/* ln(10) */ + [0x32 ] = { .high =0x3fff , .low =0x8000000000000000ULL },/* 10^0 */ + [0x33 ] = { .high =0x4002 , .low =0xa000000000000000ULL },/* 10^1 */ + [0x34 ] = { .high =0x4005 , .low =0xc800000000000000ULL },/* 10^2 */ + [0x35 ] = { .high =0x400c , .low =0x9c40000000000000ULL },/* 10^4 */ + [0x36 ] = { .high =0x4019 , .low =0xbebc200000000000ULL },/* 10^8 */ + [0x37 ] = { .high =0x4034 , .low =0x8e1bc9bf04000000ULL },/* 10^16 */ + [0x38 ] = { .high =0x4069 , .low =0x9dc5ada82b70b59eULL },/* 10^32 */ + [0x39 ] = { .high =0x40d3 , .low =0xc2781f49ffcfa6d5ULL },/* 10^64 */ + [0x3a ] = { .high =0x41a8 , .low =0x93ba47c980e98ce0ULL },/* 10^128 */ + [0x3b ] = { .high =0x4351 , .low =0xaa7eebfb9df9de8eULL },/* 10^256 */ + [0x3c ] = { .high =0x46a3 , .low =0xe319a0aea60e91c7ULL },/* 10^512 */ + [0x3d ] = { .high =0x4d48 , .low =0xc976758681750c17ULL },/* 10^1024 */ + [0x3e ] = { .high =0x5a92 , .low =0x9e8b3b5dc53d5de5ULL },/* 10^2048 */ + [0x3f ] = { .high =0x7525 , .low =0xc46052028a20979bULL },/* 10^4096 */ };float64 HELPER (const_f64 )(CPUState *env,uint32_t offset)
Signature · 1 line
1.7.2.3
PATCH 55/111 m68k: Correct bfclr in register case.
In reply to Bryce LanhamFrom: Laurent Vivier <[email protected]>
Apply a "not" on the mask to really clear bits with the "and"... (as it is done for bfclr in the memory case)
--- target-m68k/translate.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
target-m68k/translate.c +1 -0
@@ -2769,6 +2769,7 @@ DISAS_INSN(bitfield_reg)tcg_gen_sar_i32 (reg2, reg2, width);break ;case 4 :/* bfclr */ +tcg_gen_not_i32 (mask, mask);tcg_gen_and_i32 (reg, reg, mask);break ;case 5 :/* bfffo */
Signature · 1 line
1.7.2.3
PATCH 68/111 m68k: correct addsubq
In reply to Bryce LanhamFrom: Laurent Vivier <[email protected]>
DEST_EA() must use same opsize as SRC_EA().
This allows to run nano and vim.
--- target-m68k/translate.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
target-m68k/translate.c +1 -1
@@ -2274,7 +2274,7 @@ DISAS_INSN(addsubq) }gen_update_cc_add (dest, src2); } -DEST_EA (insn,OS_LONG , dest, &addr); +DEST_EA (insn, opsize, dest, &addr); }DISAS_INSN (tpf)
Signature · 1 line
1.7.2.3
PATCH 56/111 m68k-linux-user: add '--enable-emulop'
In reply to Bryce LanhamFrom: Laurent Vivier <[email protected]>
Allow to configure if the m68k emulator must implement fake operation to allow returning from the emulator when the emulator is used with the m68k-tester tool.
--- configure | 11 +++++++++++ target-m68k/cpu.h | 3 +++ target-m68k/translate.c | 10 ++++++++++ 3 files changed, 24 insertions(+), 0 deletions(-)
configure +11 -0
@@ -135,6 +135,7 @@ kvm="no" gprof="no" debug_tcg="no" debug_mon="no" +emulop="no" debug="no" strip_opt="yes" bigendian="no"
@@ -582,6 +583,10 @@ for opt do ;; --disable-debug-tcg) debug_tcg="no" ;; + --enable-emulop) emulop="yes" + ;; + --disable-emulop) emulop="no" + ;; --enable-debug-mon) debug_mon="yes" ;; --disable-debug-mon) debug_mon="no"
@@ -1046,6 +1051,8 @@ echo " --disable-usb-redir disable usb network redirection support" echo " --enable-usb-redir enable usb network redirection support" echo " --disable-guest-agent disable building of the QEMU Guest Agent" echo " --enable-guest-agent enable building of the QEMU Guest Agent" +echo " --enable-emulop enable emulation tester helper" +echo " --disable-emulop disable emulation tester helper" echo "" echo "NOTE: The object files are built at the place where configure is launched" exit 1
@@ -2684,6 +2691,7 @@ echo "host CPU $cpu" echo "host big endian $bigendian" echo "target list $target_list" echo "tcg debug enabled $debug_tcg" +echo "emulop enabled $emulop" echo "Mon debug enabled $debug_mon" echo "gprof enabled $gprof" echo "sparse enabled $sparse"
@@ -3449,6 +3457,9 @@ if test ! -z "$gdb_xml_files" ; then echo "TARGET_XML_FILES=$list" >> $config_target_mak fi +if test "$target_user_only" = "yes" -a "$target_arch2" = "m68k" -a "$emulop" = "yes" ; then + echo "CONFIG_EMULOP=y" >> $config_target_mak +fi if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then echo "TARGET_HAS_BFLT=y" >> $config_target_mak fi
target-m68k/cpu.h +3 -0
@@ -54,6 +54,9 @@#define EXCP_RTE 0x100#define EXCP_HALT_INSN 0x101 +#ifdef CONFIG_EMULOP +#define EXCP_EXEC_RETURN 0x20000 +#endif #define NB_MMU_MODES 2
target-m68k/translate.c +10 -0
@@ -3904,6 +3904,13 @@ DISAS_INSN(to_mext)gen_helper_set_mac_extu (cpu_env, val, acc); } +#ifdef CONFIG_EMULOP +DISAS_INSN (emulop_exec_return) +{ +gen_exception (s, s->pc -2 ,EXCP_EXEC_RETURN ); +} +#endif +static disas_proc opcode_table[65536 ]; static void
@@ -4173,6 +4180,9 @@ void register_m68k_insns (CPUM68KState *env)INSN (cpushl, f428, ff38,CF_ISA_A );INSN (wddata, fb00, ff00,CF_ISA_A );INSN (wdebug, fbc0, ffc0,CF_ISA_A ); +#ifdef CONFIG_EMULOP +INSN (emulop_exec_return,7100 , ffff,M68000 ); +#endif #undef INSN }
Signature · 1 line
1.7.2.3
PATCH 51/111 m68k: correct divs.w and divu.w
In reply to Bryce LanhamFrom: Laurent Vivier <[email protected]>
- the source register to be divided is a 32bit, so don't extend the 16bit value sign
- don't modify the destination operand on overflow
- don't modify N and Z flags on overflow (documentation says "undefined" but real 68040 is doing like this)
--- target-m68k/op_helper.c | 46 ++++++++++++++++++++++++++-------------------- target-m68k/translate.c | 26 +++++++++++++++++--------- 2 files changed, 43 insertions(+), 29 deletions(-)
target-m68k/op_helper.c +26 -20
@@ -213,17 +213,20 @@ void HELPER(divu)(CPUState *env, uint32_t word)/* Avoid using a PARAM1 of zero. This breaks dyngen because it uses the address of a symbol, and gcc knows symbols can't have address zero. */ -if (word && quot >0xffff ) - flags |=CCF_V ; -if (quot ==0 ) - flags |=CCF_Z ; -else if ((int32_t )quot <0 ) - flags |=CCF_N ; -/* Don't modify destination if overflow occured. */ -if ((flags &CCF_V ) ==0 ) { - env->div1 = quot; - env->div2 = rem; +if (word && quot >0xffff ) { +/* real 68040 keep Z and N on overflow, +* whereas documentation says "undefined" +*/ + flags |=CCF_V | (env->cc_dest & (CCF_Z |CCF_N )); + }else { +if (quot ==0 ) + flags |=CCF_Z ; +else if ((int16_t )quot <0 ) + flags |=CCF_N ; } + + env->div1 = quot; + env->div2 = rem; env->cc_dest = flags; }
@@ -242,17 +245,20 @@ void HELPER(divs)(CPUState *env, uint32_t word) quot = num / den; rem = num % den; flags =0 ; -if (word && quot != (int16_t )quot) - flags |=CCF_V ; -if (quot ==0 ) - flags |=CCF_Z ; -else if (quot <0 ) - flags |=CCF_N ; -/* Don't modify destination if overflow occured. */ -if ((flags &CCF_V ) ==0 ) { - env->div1 = quot; - env->div2 = rem; +if (word && quot != (int16_t )quot) { +/* real 68040 keep Z and N on overflow, +* whereas documentation says "undefined" +*/ + flags |=CCF_V | (env->cc_dest & (CCF_Z |CCF_N )); + }else { +if (quot ==0 ) + flags |=CCF_Z ; +else if ((int16_t )quot <0 ) + flags |=CCF_N ; } + + env->div1 = quot; + env->div2 = rem; env->cc_dest = flags; }
target-m68k/translate.c +17 -9
@@ -993,32 +993,40 @@ DISAS_INSN(mulw)DISAS_INSN (divw) { -TCGv reg; +TCGv dest;TCGv tmp;TCGv src;int sign; +int l1; sign = (insn &0x100 ) !=0 ; - reg =DREG (insn,9 ); -if (sign) { -tcg_gen_ext16s_i32 (QREG_DIV1 , reg); - }else { -tcg_gen_ext16u_i32 (QREG_DIV1 , reg); - } + +/* dest.l / src.w */ + + dest =DREG (insn,9 ); +tcg_gen_mov_i32 (QREG_DIV1 , dest); +SRC_EA (src,OS_WORD , sign,NULL );tcg_gen_mov_i32 (QREG_DIV2 , src); + +/* div1 / div2 */ +if (sign) {gen_helper_divs (cpu_env,tcg_const_i32 (1 )); }else {gen_helper_divu (cpu_env,tcg_const_i32 (1 )); } + s->cc_op =CC_OP_FLAGS ; + + l1 =gen_new_label (); +gen_jmpcc (s,9 /* V */ , l1); tmp =tcg_temp_new (); src =tcg_temp_new ();tcg_gen_ext16u_i32 (tmp,QREG_DIV1 );tcg_gen_shli_i32 (src,QREG_DIV2 ,16 ); -tcg_gen_or_i32 (reg, tmp, src); - s->cc_op =CC_OP_FLAGS ; +tcg_gen_or_i32 (dest, tmp, src); +gen_set_label (l1); }DISAS_INSN (divl)
Signature · 1 line
1.7.2.3
PATCH 57/111 m68k: correctly compute divsl
In reply to Bryce LanhamFrom: Laurent Vivier <[email protected]>
- put results in QUADH and DIV1
- correctly compute overflow flag (idea from aranym/UAE)
--- target-m68k/op_helper.c | 34 ++++++++++++++++++---------------- target-m68k/translate.c | 2 +- 2 files changed, 19 insertions(+), 17 deletions(-)
target-m68k/op_helper.c +18 -16
@@ -290,37 +290,39 @@ void HELPER(divu64)(CPUState *env)/* Don't modify destination if overflow occured. */ if ((flags &CCF_V ) ==0 ) { env->div1 = quot; - env->div2 = rem; + env->quadh = rem; } env->cc_dest = flags; }void HELPER (divs64 )(CPUState *env) { -int32_t num; +uint32_t num;int32_t den; -int32_t quot; +int64_t quot;int32_t rem;int32_t flags; +int64_t quad; num = env->div1; den = env->div2;if (den ==0 )raise_exception (EXCP_DIV0 ); - quot = (num | ((int64_t )env->quadh <<32 )) / den; - rem = (num | ((int64_t )env->quadh <<32 )) % den; - rem = num % den; - flags =0 ; -if (quot != (int32_t )quot) - flags |=CCF_V ; -if (quot ==0 ) - flags |=CCF_Z ; -else if (quot <0 ) - flags |=CCF_N ; -/* Don't modify destination if overflow occured. */ -if ((flags &CCF_V ) ==0 ) { + quad = num | ((int64_t )env->quadh <<32 ); + quot = quad / (int64_t )den; + rem = quad % (int64_t )den; + +if ((quot &0xffffffff80000000ULL ) && + (quot &0xffffffff80000000ULL ) !=0xffffffff80000000ULL ) { + flags = (env->cc_dest & ~CCF_C ) |CCF_V ; + }else { + flags =0 ; +if (quot ==0 ) + flags |=CCF_Z ; +else if ((int32_t )quot <0 ) + flags |=CCF_N ; env->div1 = quot; - env->div2 = rem; + env->quadh = rem; } env->cc_dest = flags; }
target-m68k/translate.c +1 -1
@@ -1055,7 +1055,7 @@ DISAS_INSN(divl) }tcg_gen_mov_i32 (num,QREG_DIV1 );if (!TCGV_EQUAL (num, reg)) -tcg_gen_mov_i32 (reg,QREG_DIV2 ); +tcg_gen_mov_i32 (reg,QREG_QUADH ); s->cc_op =CC_OP_FLAGS ;return ; }
Signature · 1 line
1.7.2.3
PATCH 53/111 m68k: for bitfield opcodes, correct operands corruption
In reply to Bryce LanhamFrom: Laurent Vivier <[email protected]>
This patch doesn't modify values inside operand "shift" and "offset", instead copy them in a TCG temp.
--- target-m68k/translate.c | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-)
target-m68k/translate.c +4 -3
@@ -2693,7 +2693,8 @@ static void bitfield_param(uint16_t ext, TCGv *offset, TCGv *width, TCGv *mask)/* offset */ if (ext &0x0800 ) { - *offset =DREG (ext,6 ); + *offset =tcg_temp_new_i32 (); +tcg_gen_mov_i32 (*offset,DREG (ext,6 )); }else { *offset =tcg_temp_new_i32 ();tcg_gen_movi_i32 (*offset, (ext >>6 ) &31 );
@@ -2702,8 +2703,8 @@ static void bitfield_param(uint16_t ext, TCGv *offset, TCGv *width, TCGv *mask)/* width */ if (ext &0x0020 ) { - *width =DREG (ext,0 ); -tcg_gen_subi_i32 (*width, *width,1 ); + *width =tcg_temp_new_i32 (); +tcg_gen_subi_i32 (*width,DREG (ext,0 ),1 );tcg_gen_andi_i32 (*width, *width,31 );tcg_gen_addi_i32 (*width, *width,1 ); }else {
Signature · 1 line
1.7.2.3
PATCH 59/111 m68k: add m68030 definition
In reply to Bryce LanhamFrom: Laurent Vivier <[email protected]>
--- target-m68k/helper.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)
target-m68k/helper.c +3 -0
@@ -33,6 +33,7 @@enum m68k_cpuid {M68K_CPUID_M68000 ,M68K_CPUID_M68020 , +M68K_CPUID_M68030 ,M68K_CPUID_M68040 ,M68K_CPUID_M68060 ,M68K_CPUID_M5206 ,
@@ -51,6 +52,7 @@ struct m68k_def_t {static m68k_def_t m68k_cpu_defs[] = { {"m68000" ,M68K_CPUID_M68000 }, {"m68020" ,M68K_CPUID_M68020 }, + {"m68030" ,M68K_CPUID_M68030 }, {"m68040" ,M68K_CPUID_M68040 }, {"m68060" ,M68K_CPUID_M68060 }, {"m5206" ,M68K_CPUID_M5206 },
@@ -155,6 +157,7 @@ static int cpu_m68k_set_model(CPUM68KState *env, const char *name)switch (def->id) {case M68K_CPUID_M68020 : +case M68K_CPUID_M68030 :case M68K_CPUID_M68040 :m68k_set_feature (env,M68K_FEATURE_QUAD_MULDIV );case M68K_CPUID_M68060 :
Signature · 1 line
1.7.2.3
PATCH 69/111 m68k: add fetox and flogn
In reply to Bryce LanhamFrom: Laurent Vivier <[email protected]>
--- fpu/softfloat.h | 2 ++ target-m68k/helper.c | 38 ++++++++++++++++++++++++++++++++++++-- target-m68k/helpers.h | 2 ++ target-m68k/translate.c | 6 ++++++ tests/m68k/Makefile | 2 +- tests/m68k/fetox.S | 8 ++++++++ tests/m68k/flogn.S | 8 ++++++++ 7 files changed, 63 insertions(+), 3 deletions(-) create mode 100644 tests/m68k/fetox.S create mode 100644 tests/m68k/flogn.S
fpu/softfloat.h +2 -0
@@ -532,6 +532,8 @@ INLINE int floatx80_is_any_nan(floatx80 a)#define floatx80_pi make_floatx80(0x4000, 0xc90fdaa22168c235LL)#define floatx80_half make_floatx80(0x3ffe, 0x8000000000000000LL)#define floatx80_infinity make_floatx80(0x7fff, 0x8000000000000000LL) +#define floatx80_e make_floatx80(0x4000, 0xadf85458a2bb4a9aULL) +#define floatx80_log2e make_floatx80(0x3fff, 0xb8aa3b295c17f0bcULL)/*---------------------------------------------------------------------------- | The pattern for a default generated extended double-precision NaN.
target-m68k/helper.c +36 -2
@@ -997,8 +997,8 @@ static const floatx80 fpu_rom[128] = { [0x00] = floatx80_pi, /* Pi */ [0x0b] = { .high = 0x3ffd, .low = 0x9a209a84fbcff798ULL }, /* Log10(2) */ - [0x0c] = { .high = 0x4000, .low = 0xadf85458a2bb4a9aULL }, /* e */ - [0x0d] = { .high = 0x3fff, .low = 0xb8aa3b295c17f0bcULL }, /* Log2(e) */ + [0x0c] = floatx80_e, /* e */ + [0x0d] = floatx80_log2e, /* Log2(e) */ [0x0e] = { .high = 0x3ffd, .low = 0xde5bd8a937287195ULL }, /* Log10(e) */ [0x0f] = floatx80_zero, /* Zero */
@@ -1255,6 +1255,40 @@ void HELPER(sqrt_FP0)(CPUState *env)floatx80_to_FP0 (env, res); } +void HELPER (ln_FP0 )(CPUState *env) +{ +float64 f, log2; +floatx80 res; + +/* ln(x) = log2(x) / log2(e) */ + +DBG_FPU ("ln_FP0\n" ); + + f =floatx80_to_float64 (FP0_to_floatx80 (env), &env->fp_status); + + log2 =float64_log2 (f, &env->fp_status); + res =floatx80_div (float64_to_floatx80 (log2, &env->fp_status), + floatx80_log2e, &env->fp_status); + +floatx80_to_FP0 (env, res); +} + +void HELPER (exp_FP0 )(CPUState *env) +{ +floatx80 f; +float32 res; + +/* exp(x) = exp2(x * log2(e)) */ + +DBG_FPU ("exp_FP0\n" ); + + f =floatx80_mul (FP0_to_floatx80 (env), floatx80_log2e, &env->fp_status); + res =float32_exp2 (floatx80_to_float32 (f, &env->fp_status), + &env->fp_status); + +floatx80_to_FP0 (env,float32_to_floatx80 (res, &env->fp_status)); +} +void HELPER (abs_FP0 )(CPUState *env) {floatx80 res;
target-m68k/helpers.h +2 -0
@@ -65,6 +65,8 @@ DEF_HELPER_2(const_FP0, void, env, i32) DEF_HELPER_1(iround_FP0, void, env) DEF_HELPER_1(itrunc_FP0, void, env) DEF_HELPER_1(sqrt_FP0, void, env) +DEF_HELPER_1(exp_FP0, void, env) +DEF_HELPER_1(ln_FP0, void, env) DEF_HELPER_1(abs_FP0, void, env) DEF_HELPER_1(chs_FP0, void, env)DEF_HELPER_1 (getexp_FP0, void, env)
target-m68k/translate.c +6 -0
@@ -3641,6 +3641,12 @@ DISAS_INSN(fpu)case 4 :case 0x41 :case 0x45 :/* fsqrt */ gen_helper_sqrt_FP0 (cpu_env);break ; +case 0x10 :/* fetox */ +gen_helper_exp_FP0 (cpu_env); +break ; +case 0x14 :/* flogn */ +gen_helper_ln_FP0 (cpu_env); +break ;case 0x18 :case 0x58 :case 0x5c :/* fabs */ gen_helper_abs_FP0 (cpu_env);break ;
tests/m68k/Makefile +1 -1
@@ -1,4 +1,4 @@ -TESTS=fmovecr fmove fmovem fsub fdiv fmul fabs fgetexp fscale +TESTS=fmovecr fmove fmovem fsub fdiv fmul fabs fgetexp fscale flogn fetox all: $(TESTS)
tests/m68k/fetox.S new file +8 -0
@@ -0,0 +1,8 @@ + .include "trap.i" + + .text + .globl _start +_start: + fmove.l #1,%fp0 // 1 + fetox.x %fp0,%fp0 // e + exit 0
tests/m68k/flogn.S new file +8 -0
@@ -0,0 +1,8 @@ + .include "trap.i" + + .text + .globl _start +_start: + fmovecr.x #0x0C,%fp0 // e + flogn.x %fp0,%fp0 // 1 + exit 0
Signature · 1 line
1.7.2.3
PATCH 58/111 m68k: correctly compute divul
In reply to Bryce LanhamFrom: Laurent Vivier <[email protected]>
--- target-m68k/op_helper.c | 28 +++++++++++++--------------- 1 files changed, 13 insertions(+), 15 deletions(-)
target-m68k/op_helper.c +13 -15
@@ -266,29 +266,27 @@ void HELPER(divu64)(CPUState *env) {uint32_t num;uint32_t den; -uint32_t quot; +uint64_t quot;uint32_t rem;uint32_t flags; +uint64_t quad; num = env->div1; den = env->div2;/* ??? This needs to make sure the throwing location is accurate. */ if (den ==0 )raise_exception (EXCP_DIV0 ); - quot = (num | ((uint64_t )env->quadh <<32 )) / den; - rem = (num | ((uint64_t )env->quadh <<32 )) % den; - flags =0 ; -/* Avoid using a PARAM1 of zero. This breaks dyngen because it uses -the address of a symbol, and gcc knows symbols can't have address -zero. */ -if (quot >0xffffffff ) - flags |=CCF_V ; -if (quot ==0 ) - flags |=CCF_Z ; -else if ((int32_t )quot <0 ) - flags |=CCF_N ; -/* Don't modify destination if overflow occured. */ -if ((flags &CCF_V ) ==0 ) { + quad = num | ((uint64_t )env->quadh <<32 ); + quot = quad / den; + rem = quad % den; +if (quot >0xffffffffULL ) { + flags = (env->cc_dest & ~CCF_C ) |CCF_V ; + }else { + flags =0 ; +if (quot ==0 ) + flags |=CCF_Z ; +else if ((int32_t )quot <0 ) + flags |=CCF_N ; env->div1 = quot; env->quadh = rem; }
Signature · 1 line
1.7.2.3
PATCH 65/111 m68k: correct compute gen_bitfield_cc()
In reply to Bryce LanhamFrom: Laurent Vivier <[email protected]>
--- target-m68k/translate.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
target-m68k/translate.c +1 -1
@@ -3134,7 +3134,7 @@ static TCGv gen_bitfield_cc(DisasContext *s,/* tmp = (bitfield << offset) >> 32 */ -tcg_gen_shri_i64 (tmp64, bitfield,32ULL ); +tcg_gen_shri_i64 (tmp64, tmp64,32ULL ); dest =tcg_temp_new_i32 ();tcg_gen_trunc_i64_i32 (dest, tmp64);
Signature · 1 line
1.7.2.3
PATCH 67/111 m68k: add fscale
In reply to Bryce LanhamFrom: Laurent Vivier <[email protected]>
--- .gitignore | 1 + target-m68k/helper.c | 17 +++++++++++++++++ target-m68k/helpers.h | 1 + target-m68k/translate.c | 4 ++++ tests/m68k/Makefile | 2 +- tests/m68k/fscale.S | 9 +++++++++ 6 files changed, 33 insertions(+), 1 deletions(-) create mode 100644 tests/m68k/fscale.S
.gitignore +1 -0
@@ -79,3 +79,4 @@ tests/m68k/fmovem tests/m68k/fmul tests/m68k/fsub tests/m68k/fgetexp +tests/m68k/fscale
target-m68k/helper.c +17 -0
@@ -1292,6 +1292,23 @@ void HELPER(getexp_FP0)(CPUState *env)floatx80_to_FP0 (env, res); } +void HELPER (scale_FP0_FP1 )(CPUState *env) +{ +int32_t scale; +int32_t exp; + +DBG_FPU ("getexp_FP0(%Lg)\n" ,LDOUBLE (FP0_to_floatx80 (env))); + +DBG_FPU (" fp0h 0x%08x fp0l 0x%016" PRIx64"\n" , env->fp0h, env->fp0l); + + scale =floatx80_to_int32 (FP0_to_floatx80 (env), &env->fp_status); + + exp = (env->fp1h &0x7fff ) + scale; + + env->fp0h = (env->fp1h &0x8000 ) | (exp &0x7fff ); + env->fp0l = env->fp1l; +} +void HELPER (add_FP0_FP1 )(CPUState *env) {floatx80 res;
target-m68k/helpers.h +1 -0
@@ -68,6 +68,7 @@ DEF_HELPER_1(sqrt_FP0, void, env) DEF_HELPER_1(abs_FP0, void, env) DEF_HELPER_1(chs_FP0, void, env) DEF_HELPER_1(getexp_FP0, void, env) +DEF_HELPER_1(scale_FP0_FP1, void, env) DEF_HELPER_1(add_FP0_FP1, void, env) DEF_HELPER_1(sub_FP0_FP1, void, env)DEF_HELPER_1 (mul_FP0_FP1, void, env)
target-m68k/translate.c +4 -0
@@ -3666,6 +3666,10 @@ DISAS_INSN(fpu)gen_op_load_fpr_FP1 (REG (ext,7 ));gen_helper_div_FP0_FP1 (cpu_env);break ; +case 0x26 :/* fscale */ +gen_op_load_fpr_FP1 (REG (ext,7 )); +gen_helper_scale_FP0_FP1 (cpu_env); +break ;case 0x27 :/* fsglmul */ gen_op_load_fpr_FP1 (REG (ext,7 ));gen_helper_mul_FP0_FP1 (cpu_env);
tests/m68k/Makefile +1 -1
@@ -1,4 +1,4 @@ -TESTS=fmovecr fmove fmovem fsub fdiv fmul fabs fgetexp +TESTS=fmovecr fmove fmovem fsub fdiv fmul fabs fgetexp fscale all: $(TESTS)
tests/m68k/fscale.S new file +9 -0
@@ -0,0 +1,9 @@ + .include "trap.i" + + .text + .globl _start +_start: + fmove.l #2, %fp0 + fmovecr.x #0x00,%fp1 + fscale.x %fp0, %fp1 + exit 0
Signature · 1 line
1.7.2.3
PATCH 70/111 m68k: initialize FRegs, define pickNaN()
In reply to Bryce LanhamFrom: Laurent Vivier <[email protected]>
--- fpu/softfloat-specialize.h | 20 ++++++++++++++++++++ target-m68k/helper.c | 13 ++++++++++++- 2 files changed, 32 insertions(+), 1 deletions(-)
fpu/softfloat-specialize.h +20 -0
@@ -387,6 +387,26 @@ static int pickNaN(flag aIsQNaN, flag aIsSNaN, flag bIsQNaN, flag bIsSNaN, return 1; } } +#elif defined(TARGET_M68K) +static int pickNaN (flag aIsQNaN,flag aIsSNaN,flag bIsQNaN,flag bIsSNaN, +flag aIsLargerSignificand) +{ +/* If either operand, but not both operands, of an operation is a +* nonsignaling NAN, then that NAN is returned as the result. If both +* operands are nonsignaling NANs, then the destination operand +* nonsignaling NAN is returned as the result. +*/ + +if (aIsSNaN) { +return 0 ; + }else if (bIsSNaN) { +return 1 ; + }else if (bIsQNaN) { +return 1 ; + }else { +return 0 ; + } +}#else static int pickNaN (flag aIsQNaN,flag aIsSNaN,flag bIsQNaN,flag bIsSNaN,flag aIsLargerSignificand)
target-m68k/helper.c +12 -1
@@ -244,6 +244,8 @@ static int cpu_m68k_set_model(CPUM68KState *env, const char *name)void cpu_reset (CPUM68KState *env) { +int i; +if (qemu_loglevel_mask (CPU_LOG_RESET )) {qemu_log ("CPU Reset (CPU %d)\n" , env->cpu_index);log_cpu_state (env,0 );
@@ -254,7 +256,16 @@ void cpu_reset(CPUM68KState *env) env->sr =0x2700 ;#endif m68k_switch_sp (env); -/* ??? FP regs should be initialized to NaN. */ + +for (i =0 ; i <8 ; i++) { + env->fregs[i].l.upper = floatx80_default_nan_high; + env->fregs[i].l.lower =0xffffffffffffffffULL ; + } + env->fp0h = floatx80_default_nan_high; + env->fp0l =0xffffffffffffffffULL ; + env->fp1h = floatx80_default_nan_high; + env->fp1l =0xffffffffffffffffULL ; + env->cc_op =CC_OP_FLAGS ;/* TODO: We should set PC from the interrupt vector. */ env->pc =0 ;
Signature · 1 line
1.7.2.3
PATCH 60/111 m68k: remove dead code
In reply to Bryce LanhamFrom: Laurent Vivier <[email protected]>
--- target-m68k/translate.c | 3 --- 1 files changed, 0 insertions(+), 3 deletions(-)
target-m68k/translate.c +0 -3
@@ -4320,9 +4320,6 @@ gen_intermediate_code_internal(CPUState *env, TranslationBlock *tb, tb->size = dc->pc - pc_start; tb->icount = num_insns; } - -//optimize_flags(); -//expand_target_qops(); }void gen_intermediate_code (CPUState *env,TranslationBlock *tb)
Signature · 1 line
1.7.2.3
PATCH 62/111 m68k: FPU rework (draft)
In reply to Bryce LanhamFrom: Laurent Vivier <[email protected]>
--- target-m68k/cpu.h | 53 +++- target-m68k/helper.c | 345 +++++++++++++++++---- target-m68k/helpers.h | 39 ++- target-m68k/qregs.def | 3 +- target-m68k/translate.c | 776 +++++++++++++++++++++++++++++++---------------- tests/m68k/Makefile | 15 + tests/m68k/fmove.S | 55 ++++ tests/m68k/fmovecr.S | 29 ++ tests/m68k/fmovem.S | 17 + tests/m68k/trap.i | 5 + 10 files changed, 978 insertions(+), 359 deletions(-) create mode 100644 tests/m68k/Makefile create mode 100644 tests/m68k/fmove.S create mode 100644 tests/m68k/fmovecr.S create mode 100644 tests/m68k/fmovem.S create mode 100644 tests/m68k/trap.i
target-m68k/cpu.h +38 -15
@@ -60,6 +60,36 @@#define NB_MMU_MODES 2 +#define TARGET_PHYS_ADDR_SPACE_BITS 32 +#define TARGET_VIRT_ADDR_SPACE_BITS 32 + +#ifdef CONFIG_USER_ONLY +/* Linux uses 4k pages. */ +#define TARGET_PAGE_BITS 12 +#else +/* Smallest TLB entry size is 1k. */ +#define TARGET_PAGE_BITS 10 +#endif + +#include "cpu-all.h" + +typedef uint32_t CPUM68K_SingleU ; +typedef uint64_t CPUM68K_DoubleU ; + +typedef struct { +uint32_t high; +uint64_t low; +} __attribute__((packed))CPUM68K_XDoubleU ; + +typedef struct { +uint8_t high[2 ]; +uint8_t low[10 ]; +} __attribute__((packed))CPUM68K_PDoubleU ; + +typedef CPU_LDoubleU FPReg ; +#define PRIxFPH PRIx16 +#define PRIxFPL PRIx64 + typedef struct CPUM68KState { uint32_t dregs[8]; uint32_t aregs[8];
@@ -76,8 +106,7 @@ typedef struct CPUM68KState {uint32_t cc_src;uint32_t cc_x; -float64 fregs[8 ]; -float64 fp_result; +FPReg fregs[8 ];uint32_t fpcr;uint32_t fpsr;float_status fp_status;
@@ -90,6 +119,13 @@ typedef struct CPUM68KState {uint32_t macsr;uint32_t mac_mask; +/* Temporary storage for FPU */ + +uint32_t fp0h; +uint64_t fp0l; +uint32_t fp1h; +uint64_t fp1l; +/* Temporary storage for DIV helpers. */ uint32_t div1;uint32_t div2;
@@ -228,17 +264,6 @@ void m68k_cpu_list(FILE *f, fprintf_function cpu_fprintf);void register_m68k_insns (CPUM68KState *env); -#ifdef CONFIG_USER_ONLY -/* Linux uses 4k pages. */ -#define TARGET_PAGE_BITS 12 -#else -/* Smallest TLB entry size is 1k. */ -#define TARGET_PAGE_BITS 10 -#endif - -#define TARGET_PHYS_ADDR_SPACE_BITS 32 -#define TARGET_VIRT_ADDR_SPACE_BITS 32 -#define cpu_init cpu_m68k_init#define cpu_exec cpu_m68k_exec#define cpu_gen_code cpu_m68k_gen_code
@@ -267,8 +292,6 @@ static inline void cpu_clone_regs(CPUState *env, target_ulong newsp) }#endif -#include "cpu-all.h" -static inline void cpu_get_tb_cpu_state (CPUState *env,target_ulong *pc,target_ulong *cs_base,int *flags) {
target-m68k/helper.c +279 -66
424 lines not on this page · raw message
target-m68k/helpers.h +23 -16
@@ -50,22 +50,29 @@ DEF_HELPER_2(xflag_lt_i32, i32, i32, i32) DEF_HELPER_2(set_sr, void, env, i32) DEF_HELPER_3(movec, void, env, i32, i32) -DEF_HELPER_2 (const_f64, f64, env, i32); -DEF_HELPER_2(f64_to_i32, i32, env, f64) -DEF_HELPER_2(f64_to_f32, f32, env, f64) -DEF_HELPER_2(i32_to_f64, f64, env, i32) -DEF_HELPER_2(f32_to_f64, f64, env, f32) -DEF_HELPER_2(iround_f64, f64, env, f64) -DEF_HELPER_2(itrunc_f64, f64, env, f64) -DEF_HELPER_2(sqrt_f64, f64, env, f64) -DEF_HELPER_1(abs_f64, f64, f64) -DEF_HELPER_1(chs_f64, f64, f64) -DEF_HELPER_3(add_f64, f64, env, f64, f64) -DEF_HELPER_3(sub_f64, f64, env, f64, f64) -DEF_HELPER_3(mul_f64, f64, env, f64, f64) -DEF_HELPER_3(div_f64, f64, env, f64, f64) -DEF_HELPER_3(sub_cmp_f64, f64, env, f64, f64) -DEF_HELPER_2(compare_f64, i32, env, f64) +DEF_HELPER_1(exts32_FP0, void, env) +DEF_HELPER_1(extf32_FP0, void, env) +DEF_HELPER_1(extf64_FP0, void, env) +DEF_HELPER_1(redf32_FP0, void, env) +DEF_HELPER_1(redf64_FP0, void, env) +DEF_HELPER_1(extp96_FP0, void, env) +DEF_HELPER_1(reds32_FP0, void, env) +DEF_HELPER_1(redp96_FP0, void, env) + +DEF_HELPER_4(fmovem, void, env, i32, i32, i32) +DEF_HELPER_2(set_fpcr, void, env, i32) +DEF_HELPER_2(const_FP0, void, env, i32) +DEF_HELPER_1(iround_FP0, void, env) +DEF_HELPER_1(itrunc_FP0, void, env) +DEF_HELPER_1(sqrt_FP0, void, env) +DEF_HELPER_1(abs_FP0, void, env) +DEF_HELPER_1(chs_FP0, void, env) +DEF_HELPER_1(add_FP0_FP1, void, env) +DEF_HELPER_1(sub_FP0_FP1, void, env) +DEF_HELPER_1(mul_FP0_FP1, void, env) +DEF_HELPER_1(div_FP0_FP1, void, env) +DEF_HELPER_1(fcmp_FP0_FP1, void, env) +DEF_HELPER_1(compare_FP0, i32, env) DEF_HELPER_3(mac_move, void, env, i32, i32)DEF_HELPER_3 (macmulf, i64, env, i32, i32)
target-m68k/qregs.def +2 -1
@@ -1,4 +1,5 @@ -DEFF64(FP_RESULT, fp_result) +DEFF96(FP0, fp0) +DEFF96(FP1, fp1) DEFO32(PC, pc) DEFO32(SR, sr) DEFO32(CC_OP, cc_op)
target-m68k/translate.c +515 -261
1,044 lines not on this page · raw message
tests/m68k/Makefile new file +15 -0
@@ -0,0 +1,15 @@ +TESTS=fmovecr fmove fmovem + +all: $(TESTS) + +%: %.S + m68k-linux-gnu-gcc -m68040 -nostartfiles -nodefaultlibs -nostdlib -o $@ $< + +fmovecr: fmovecr.S +fmove: fmove.S +fmovem: fmovem.S + +.PHONY: clean + +clean: + rm -f $(TESTS)
tests/m68k/fmove.S new file +55 -0
55 lines not on this page · raw message
tests/m68k/fmovecr.S new file +29 -0
@@ -0,0 +1,29 @@ + .include "trap.i" + + .text + .globl _start +_start: + fmovecr.x #0x00,%fp0 + fmovecr.x #0x0B,%fp0 + fmovecr.x #0x0C,%fp0 + fmovecr.x #0x0D,%fp0 + fmovecr.x #0x0E,%fp0 + fmovecr.x #0x0F,%fp0 + fmovecr.x #0x30,%fp0 + fmovecr.x #0x31,%fp0 + fmovecr.x #0x32,%fp0 + fmovecr.x #0x33,%fp0 + fmovecr.x #0x34,%fp0 + fmovecr.x #0x35,%fp0 + fmovecr.x #0x36,%fp0 + fmovecr.x #0x37,%fp0 + fmovecr.x #0x38,%fp0 + fmovecr.x #0x39,%fp0 + fmovecr.x #0x3A,%fp0 + fmovecr.x #0x3B,%fp0 + fmovecr.x #0x3c,%fp0 + fmovecr.x #0x3d,%fp0 + fmovecr.x #0x3e,%fp0 + fmovecr.x #0x3f,%fp0 + + exit 0
tests/m68k/fmovem.S new file +17 -0
@@ -0,0 +1,17 @@ + .include "trap.i" + + .data +pi: .long 0x40000000 + .long 0xc90fdaa2 + .long 0x2168C235 +ln2: .long 0x3ffe0000 + .long 0xb17217f7 + .long 0xd1cf79ac + + .text + .globl _start +_start: + lea pi,%a0 + fmovem.x (%a0), %fp2-%fp3 + fmovem.x (%a0)+, %fp0-%fp1 + exit 0
tests/m68k/trap.i new file +5 -0
@@ -0,0 +1,5 @@ +.macro exit value + move.l #\value,%d1 + move.l #1, %d0 + trap #0 +.endm
Signature · 1 line
1.7.2.3
PATCH 73/111 m68k: add cmpm instruction
In reply to Bryce LanhamFrom: Laurent Vivier <[email protected]>
Allow to run 'flex'.
--- target-m68k/translate.c | 19 +++++++++++++++++++ 1 files changed, 19 insertions(+), 0 deletions(-)
target-m68k/translate.c +19 -0
@@ -2504,6 +2504,25 @@ DISAS_INSN(eor)int opsize; opsize =insn_opsize (insn,6 ); + +if (((insn >>3 ) &7 ) ==1 ) { +/* cmpm */ + reg =AREG (insn,0 ); + src =gen_load (s, opsize, reg,1 ); +tcg_gen_addi_i32 (reg, reg,opsize_bytes (opsize)); + + reg =AREG (insn,9 ); + dest =gen_load (s, opsize, reg,1 ); +tcg_gen_addi_i32 (reg, reg,opsize_bytes (opsize)); + + reg =tcg_temp_new (); +tcg_gen_sub_i32 (reg, dest, src); +gen_update_cc_add (reg, src); +SET_CC_OP (opsize,SUB ); + +return ; + } +SRC_EA (src, opsize,-1 , &addr); reg =DREG (insn,9 ); dest =tcg_temp_new ();
Signature · 1 line
1.7.2.3
PATCH 72/111 m68k: add flog10
In reply to Bryce LanhamFrom: Laurent Vivier <[email protected]>
--- fpu/softfloat.h | 1 + target-m68k/helper.c | 23 ++++++++++++++++++++++- target-m68k/helpers.h | 1 + target-m68k/translate.c | 3 +++ 4 files changed, 27 insertions(+), 1 deletions(-)
fpu/softfloat.h +1 -0
@@ -534,6 +534,7 @@ INLINE int floatx80_is_any_nan(floatx80 a)#define floatx80_infinity make_floatx80(0x7fff, 0x8000000000000000LL)#define floatx80_e make_floatx80(0x4000, 0xadf85458a2bb4a9aULL)#define floatx80_log2e make_floatx80(0x3fff, 0xb8aa3b295c17f0bcULL) +#define floatx80_10 make_floatx80(0x4002, 0xa000000000000000ULL)/*---------------------------------------------------------------------------- | The pattern for a default generated extended double-precision NaN.
target-m68k/helper.c +22 -1
@@ -1016,7 +1016,7 @@ static const floatx80 fpu_rom[128] = { [0x30] = floatx80_ln2, /* ln(2) */ [0x31] = { .high = 0x4000, .low = 0x935d8dddaaa8ac17ULL }, /* ln(10) */ [0x32] = floatx80_one, /* 10^0 */ - [0x33] = { .high = 0x4002, .low = 0xa000000000000000ULL }, /* 10^1 */ + [0x33] = floatx80_10, /* 10^1 */ [0x34] = { .high = 0x4005, .low = 0xc800000000000000ULL }, /* 10^2 */ [0x35] = { .high = 0x400c, .low = 0x9c40000000000000ULL }, /* 10^4 */ [0x36] = { .high = 0x4019, .low = 0xbebc200000000000ULL }, /* 10^8 */
@@ -1284,6 +1284,27 @@ void HELPER(ln_FP0)(CPUState *env)floatx80_to_FP0 (env, res); } +void HELPER (log10_FP0 )(CPUState *env) +{ +float64 f, log2, log210; +floatx80 res; + +/* log10(x) = log2(x) / log2(10) */ + +DBG_FPU ("log10_FP0(%Lg)\n" ,LDOUBLE (FP0_to_floatx80 (env))); + f =floatx80_to_float64 (FP0_to_floatx80 (env), &env->fp_status); + + log2 =float64_log2 (f, &env->fp_status); + log210 =float64_log2 (floatx80_to_float64 (floatx80_10, &env->fp_status), + &env->fp_status); + res =floatx80_div (float64_to_floatx80 (log2, &env->fp_status), +float64_to_floatx80 (log210, &env->fp_status), + &env->fp_status); +DBG_FPU (" = %Lg\n" ,LDOUBLE (res)); + +floatx80_to_FP0 (env, res); +} +void HELPER (exp_FP0 )(CPUState *env) {floatx80 f;
target-m68k/helpers.h +1 -0
@@ -67,6 +67,7 @@ DEF_HELPER_1(itrunc_FP0, void, env) DEF_HELPER_1(sqrt_FP0, void, env) DEF_HELPER_1(exp_FP0, void, env) DEF_HELPER_1(ln_FP0, void, env) +DEF_HELPER_1(log10_FP0, void, env) DEF_HELPER_1(abs_FP0, void, env) DEF_HELPER_1(chs_FP0, void, env)DEF_HELPER_1 (getexp_FP0, void, env)
target-m68k/translate.c +3 -0
@@ -3647,6 +3647,9 @@ DISAS_INSN(fpu)case 0x14 :/* flogn */ gen_helper_ln_FP0 (cpu_env);break ; +case 0x15 :/* flog10 */ +gen_helper_log10_FP0 (cpu_env); +break ;case 0x18 :case 0x58 :case 0x5c :/* fabs */ gen_helper_abs_FP0 (cpu_env);break ;
Signature · 1 line
1.7.2.3
PATCH 61/111 m68k: remove useless file m68k-qreg.h
In reply to Bryce LanhamFrom: Laurent Vivier <[email protected]>
--- target-m68k/m68k-qreg.h | 11 ----------- 1 files changed, 0 insertions(+), 11 deletions(-) delete mode 100644 target-m68k/m68k-qreg.h
target-m68k/m68k-qreg.h deleted +0 -11
@@ -1,11 +0,0 @@ -enum { -#define DEFO32(name, offset) QREG_##name, -#define DEFR (name, reg, mode) QREG_##name, -#define DEFF64 (name, offset) QREG_##name, - QREG_NULL, -#include "qregs.def" - TARGET_NUM_QREGS = 0x100 -#undef DEFO32 -#undef DEFR -#undef DEFF64 -};
Signature · 1 line
1.7.2.3
PATCH 66/111 m68k: add fgetexp
In reply to Bryce LanhamFrom: Laurent Vivier <[email protected]>
--- .gitignore | 1 + target-m68k/helper.c | 17 +++++++++++++++++ target-m68k/helpers.h | 1 + target-m68k/translate.c | 3 +++ tests/m68k/Makefile | 2 +- tests/m68k/fgetexp.S | 8 ++++++++ 6 files changed, 31 insertions(+), 1 deletions(-) create mode 100644 tests/m68k/fgetexp.S
.gitignore +1 -0
@@ -78,3 +78,4 @@ tests/m68k/fmovecr tests/m68k/fmovem tests/m68k/fmul tests/m68k/fsub +tests/m68k/fgetexp
target-m68k/helper.c +17 -0
@@ -1275,6 +1275,23 @@ void HELPER(chs_FP0)(CPUState *env)floatx80_to_FP0 (env, res); } +void HELPER (getexp_FP0 )(CPUState *env) +{ +int32_t exp; +floatx80 res; + +DBG_FPU ("getexp_FP0(%Lg)\n" ,LDOUBLE (FP0_to_floatx80 (env))); + +DBG_FPU (" fp0h 0x%08x fp0l 0x%016" PRIx64"\n" , env->fp0h, env->fp0l); + + exp = (env->fp0h &0x7fff ) -0x3fff ; + + res =int32_to_floatx80 (exp, &env->fp_status); + +DBG_FPU (" = %Lg\n" ,LDOUBLE (res)); +floatx80_to_FP0 (env, res); +} +void HELPER (add_FP0_FP1 )(CPUState *env) {floatx80 res;
target-m68k/helpers.h +1 -0
@@ -67,6 +67,7 @@ DEF_HELPER_1(itrunc_FP0, void, env) DEF_HELPER_1(sqrt_FP0, void, env) DEF_HELPER_1(abs_FP0, void, env) DEF_HELPER_1(chs_FP0, void, env) +DEF_HELPER_1(getexp_FP0, void, env) DEF_HELPER_1(add_FP0_FP1, void, env) DEF_HELPER_1(sub_FP0_FP1, void, env)DEF_HELPER_1 (mul_FP0_FP1, void, env)
target-m68k/translate.c +3 -0
@@ -3647,6 +3647,9 @@ DISAS_INSN(fpu)case 0x1a :case 0x5a :case 0x5e :/* fneg */ gen_helper_chs_FP0 (cpu_env);break ; +case 0x1e :/* fgetexp */ +gen_helper_getexp_FP0 (cpu_env); +break ;case 0x20 :case 0x60 :case 0x64 :/* fdiv */ gen_op_load_fpr_FP1 (REG (ext,7 ));gen_helper_div_FP0_FP1 (cpu_env);
tests/m68k/Makefile +1 -1
@@ -1,4 +1,4 @@ -TESTS=fmovecr fmove fmovem fsub fdiv fmul fabs +TESTS=fmovecr fmove fmovem fsub fdiv fmul fabs fgetexp all: $(TESTS)
tests/m68k/fgetexp.S new file +8 -0
@@ -0,0 +1,8 @@ + .include "trap.i" + + .text + .globl _start +_start: + fmove.l #4096, %fp0 + fgetexp.x %fp0, %fp1 + exit 0
Signature · 1 line
1.7.2.3
PATCH 71/111 m68k: correct cmpa comparison datatype
In reply to Bryce LanhamFrom: Laurent Vivier <[email protected]>
Even if cmpa uses an 16 bits source data, the comparison with the register is done on 32 bits.
This allows to run "gcc hello.c" without segfault.
--- target-m68k/translate.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
target-m68k/translate.c +1 -1
@@ -2492,7 +2492,7 @@ DISAS_INSN(cmpa) dest =tcg_temp_new ();tcg_gen_sub_i32 (dest, reg, src);gen_update_cc_add (dest, src); -SET_CC_OP (opsize,SUB ); +SET_CC_OP (OS_LONG ,SUB ); }DISAS_INSN (eor)
Signature · 1 line
1.7.2.3
PATCH 74/111 m68k: add ftwotox instruction
In reply to Bryce LanhamFrom: Laurent Vivier <[email protected]>
Used by "gconf-schemas --register metacity.schemas" via libm
--- target-m68k/helper.c | 12 ++++++++++++ target-m68k/helpers.h | 1 + target-m68k/translate.c | 3 +++ 3 files changed, 16 insertions(+), 0 deletions(-)
target-m68k/helper.c +12 -0
@@ -1321,6 +1321,18 @@ void HELPER(exp_FP0)(CPUState *env)floatx80_to_FP0 (env,float32_to_floatx80 (res, &env->fp_status)); } +void HELPER (exp2_FP0 )(CPUState *env) +{ +float32 res; + +DBG_FPU ("exp_FP0\n" ); + + res =float32_exp2 (floatx80_to_float32 (FP0_to_floatx80 (env), + &env->fp_status), &env->fp_status); + +floatx80_to_FP0 (env,float32_to_floatx80 (res, &env->fp_status)); +} +void HELPER (abs_FP0 )(CPUState *env) {floatx80 res;
target-m68k/helpers.h +1 -0
@@ -66,6 +66,7 @@ DEF_HELPER_1(iround_FP0, void, env) DEF_HELPER_1(itrunc_FP0, void, env) DEF_HELPER_1(sqrt_FP0, void, env) DEF_HELPER_1(exp_FP0, void, env) +DEF_HELPER_1(exp2_FP0, void, env) DEF_HELPER_1(ln_FP0, void, env) DEF_HELPER_1(log10_FP0, void, env)DEF_HELPER_1 (abs_FP0, void, env)
target-m68k/translate.c +3 -0
@@ -3663,6 +3663,9 @@ DISAS_INSN(fpu)case 0x10 :/* fetox */ gen_helper_exp_FP0 (cpu_env);break ; +case 0x11 :/* ftwotox */ +gen_helper_exp2_FP0 (cpu_env); +break ;case 0x14 :/* flogn */ gen_helper_ln_FP0 (cpu_env);break ;
Signature · 1 line
1.7.2.3
PATCH 77/111 m68k: add facos instruction
In reply to Bryce LanhamFrom: Laurent Vivier <[email protected]>
--- target-m68k/helper.c | 29 ++++++++++++++++++++++++----- target-m68k/helpers.h | 1 + target-m68k/translate.c | 3 +++ 3 files changed, 28 insertions(+), 5 deletions(-)
target-m68k/helper.c +24 -5
@@ -28,10 +28,15 @@#include "gdbstub.h" #include "helpers.h" +#include <math.h> #if 0 #define DBG_FPUH (...) do { fprintf(stderr, "0x%08x: ", env->pc); fprintf(stderr, __VA_ARGS__); } while(0)#define DBG_FPU (...) do { fprintf(stderr, __VA_ARGS__); } while(0) +#else +#define DBG_FPUH (...) +#define DBG_FPU (...) +#endif static inline float FLOAT (float32 x) {return *(float *)&x;
@@ -44,11 +49,10 @@ static inline long double LDOUBLE(floatx80 x) {return *(long double *)&x; } -#else -#define DBG_FPUH (...) -#define DBG_FPU (...) -#define LDOUBLE (x) -#endif +static inline floatx80 FLOATx80 (long double x) +{ +return *(floatx80 *)&x; +}#define SIGNBIT (1u << 31)
@@ -1386,6 +1390,21 @@ void HELPER(chs_FP0)(CPUState *env)floatx80_to_FP0 (env, res); } +void HELPER (acos_FP0 )(CPUState *env) +{ +floatx80 res; +long double val; + + res =FP0_to_floatx80 (env); + val =LDOUBLE (res); + +DBG_FPUH ("acos_FP0 %Lg" , val); + val =acosl (val); +DBG_FPU (" = %Lg" , val); + res =FLOATx80 (val); +floatx80_to_FP0 (env, res); +} +void HELPER (getexp_FP0 )(CPUState *env) {int32_t exp;
target-m68k/helpers.h +1 -0
@@ -71,6 +71,7 @@ DEF_HELPER_1(ln_FP0, void, env) DEF_HELPER_1(log10_FP0, void, env) DEF_HELPER_1(abs_FP0, void, env) DEF_HELPER_1(chs_FP0, void, env) +DEF_HELPER_1(acos_FP0, void, env) DEF_HELPER_1(getexp_FP0, void, env) DEF_HELPER_1(scale_FP0_FP1, void, env)DEF_HELPER_1 (add_FP0_FP1, void, env)
target-m68k/translate.c +3 -0
@@ -3679,6 +3679,9 @@ DISAS_INSN(fpu)case 0x1a :case 0x5a :case 0x5e :/* fneg */ gen_helper_chs_FP0 (cpu_env);break ; +case 0x1c :/* facos */ +gen_helper_acos_FP0 (cpu_env); +break ;case 0x1e :/* fgetexp */ gen_helper_getexp_FP0 (cpu_env);break ;
Signature · 1 line
1.7.2.3
PATCH 63/111 m68k: some FPU debugging macros
In reply to Bryce LanhamFrom: Laurent Vivier <[email protected]>
--- target-m68k/helper.c | 69 +++++++++++++++++++++++++++++++++++++++++++------ 1 files changed, 60 insertions(+), 9 deletions(-)
target-m68k/helper.c +60 -9
@@ -29,6 +29,17 @@#include "helpers.h" +#if 0 +#define DBG_FPU (...) do { fprintf(stderr, "0x%08x: ", env->pc); fprintf(stderr, __VA_ARGS__); } while(0) +static inline long double LDOUBLE (floatx80 x) +{ +return *(long double *)&x; +} +#else +#define DBG_FPU (...) +#define LDOUBLE (x) +#endif +#define SIGNBIT (1u << 31)enum m68k_cpuid {
@@ -1009,12 +1020,6 @@ static const floatx80 fpu_rom[128] = { [0x3f] = { .high = 0x7525, .low = 0xc46052028a20979bULL }, /* 10^4096 */ }; -void HELPER (const_FP0 )(CPUState *env,uint32_t offset) -{ - env->fp0h = fpu_rom[offset].high; - env->fp0l = fpu_rom[offset].low; -} -static inline floatx80 FP0_to_floatx80 (CPUState *env) {floatx80 res;
@@ -1072,6 +1077,14 @@ static inline floatx80 FP1_to_floatx80(CPUState *env)return res; } +void HELPER (const_FP0 )(CPUState *env,uint32_t offset) +{ + env->fp0h = fpu_rom[offset].high; + env->fp0l = fpu_rom[offset].low; +DBG_FPU ("ROM[0x%02x] %" PRIxFPH" %" PRIxFPL" %.17Lg\n" , + offset, env->fp0h, env->fp0l,LDOUBLE (FP0_to_floatx80 (env))); +} +static inline void restore_precision_mode (CPUState *env) {int rounding_precision;
@@ -1118,6 +1131,8 @@ static inline void restore_rounding_mode(CPUState *env)void HELPER (set_fpcr )(CPUState *env,uint32_t val) { +DBG_FPU ("set_fpcr %04x\n" , val); + env->fpcr = val &0xffff ;restore_precision_mode (env);
@@ -1128,8 +1143,11 @@ void HELPER(exts32_FP0)(CPUState *env) {floatx80 res; +DBG_FPU ("exts32_FP0 %d\n" ,FP0_to_int32 (env)); + res =int32_to_floatx80 (FP0_to_int32 (env), &env->fp_status); +DBG_FPU (" = %Lg\n" ,LDOUBLE (res));floatx80_to_FP0 (env, res); }
@@ -1137,6 +1155,7 @@ void HELPER(extf32_FP0)(CPUState *env) {floatx80 res; +DBG_FPU ("extf32_FP0\n" ); res =float32_to_floatx80 (FP0_to_float32 (env), &env->fp_status);floatx80_to_FP0 (env, res);
@@ -1145,8 +1164,12 @@ void HELPER(extf32_FP0)(CPUState *env)void HELPER (extf64_FP0 )(CPUState *env) {floatx80 res; +uint64_t val; - res =float64_to_floatx80 (FP0_to_float64 (env), &env->fp_status); + val =FP0_to_float64 (env); +DBG_FPU ("extf64_FP0 0x%016" PRIx64", %g\n" , val, *(double *)&val); + res =float64_to_floatx80 (val, &env->fp_status); +DBG_FPU (" = %Lg\n" ,LDOUBLE (res));floatx80_to_FP0 (env, res); }
@@ -1161,7 +1184,9 @@ void HELPER(reds32_FP0)(CPUState *env)int32_t res; val =FP0_to_floatx80 (env); +DBG_FPU ("reds32_FP0 %Lg\n" ,LDOUBLE (val)); res =floatx80_to_int32 (val, &env->fp_status); +DBG_FPU (" = %d\n" , res);int32_to_FP0 (env, res); }
@@ -1171,6 +1196,7 @@ void HELPER(redf32_FP0)(CPUState *env)floatx80 val;float32 res; +DBG_FPU ("redf32_FP0\n" ); val =FP0_to_floatx80 (env); res =floatx80_to_float32 (val, &env->fp_status);
@@ -1183,19 +1209,24 @@ void HELPER(redf64_FP0)(CPUState *env)float64 res; val =FP0_to_floatx80 (env); +DBG_FPU ("redf64_FP0 %Lg\n" ,LDOUBLE (val)); res =floatx80_to_float64 (val, &env->fp_status); +DBG_FPU (" = %g\n" , *(double *)&res);float64_to_FP0 (env, res); }void HELPER (redp96_FP0 )(CPUState *env) { +DBG_FPU ("redp96_FP0\n" ); }void HELPER (iround_FP0 )(CPUState *env) {floatx80 res; +DBG_FPU ("iround_FP0\n" ); + res =floatx80_round_to_int (FP0_to_floatx80 (env), &env->fp_status);floatx80_to_FP0 (env, res);
@@ -1205,6 +1236,8 @@ void HELPER(itrunc_FP0)(CPUState *env) {floatx80 res; +DBG_FPU ("itrunc_FP0\n" ); +set_float_rounding_mode (float_round_to_zero, &env->fp_status); res =floatx80_round_to_int (FP0_to_floatx80 (env), &env->fp_status);restore_rounding_mode (env);
@@ -1216,6 +1249,7 @@ void HELPER(sqrt_FP0)(CPUState *env) {floatx80 res; +DBG_FPU ("sqrt_FP0\n" ); res =floatx80_sqrt (FP0_to_floatx80 (env), &env->fp_status);floatx80_to_FP0 (env, res);
@@ -1225,6 +1259,7 @@ void HELPER(abs_FP0)(CPUState *env) {floatx80 res; +DBG_FPU ("abs_FP0\n" ); res =floatx80_abs (FP0_to_floatx80 (env));floatx80_to_FP0 (env, res);
@@ -1234,6 +1269,7 @@ void HELPER(chs_FP0)(CPUState *env) {floatx80 res; +DBG_FPU ("chs_FP0\n" ); res =floatx80_chs (FP0_to_floatx80 (env));floatx80_to_FP0 (env, res);
@@ -1243,8 +1279,11 @@ void HELPER(add_FP0_FP1)(CPUState *env) {floatx80 res; +DBG_FPU ("add_FP0_FP1(%Lg,%Lg)\n" ,LDOUBLE (FP0_to_floatx80 (env)), +LDOUBLE (FP1_to_floatx80 (env))); res =floatx80_add (FP0_to_floatx80 (env),FP1_to_floatx80 (env), &env->fp_status); +DBG_FPU (" = %Lg\n" ,LDOUBLE (res));floatx80_to_FP0 (env, res); }
@@ -1253,8 +1292,11 @@ void HELPER(sub_FP0_FP1)(CPUState *env) {floatx80 res; - res =floatx80_sub (FP0_to_floatx80 (env),FP1_to_floatx80 (env), +DBG_FPU ("sub_FP0 %Lg %Lg\n" ,LDOUBLE (FP0_to_floatx80 (env)), +LDOUBLE (FP1_to_floatx80 (env))); + res =floatx80_sub (FP1_to_floatx80 (env),FP0_to_floatx80 (env), &env->fp_status); +DBG_FPU (" = %Lg\n" ,LDOUBLE (res));floatx80_to_FP0 (env, res); }
@@ -1263,8 +1305,11 @@ void HELPER(mul_FP0_FP1)(CPUState *env) {floatx80 res; +DBG_FPU ("mul_FP0_FP1 %Lg %Lg\n" , +LDOUBLE (FP0_to_floatx80 (env)),LDOUBLE (FP1_to_floatx80 (env))); res =floatx80_mul (FP0_to_floatx80 (env),FP1_to_floatx80 (env), &env->fp_status); +DBG_FPU (" = %Lg\n" ,LDOUBLE (res));floatx80_to_FP0 (env, res); }
@@ -1273,7 +1318,8 @@ void HELPER(div_FP0_FP1)(CPUState *env) {floatx80 res; - res =floatx80_div (FP0_to_floatx80 (env),FP1_to_floatx80 (env), +DBG_FPU ("div\n" ); + res =floatx80_div (FP1_to_floatx80 (env),FP0_to_floatx80 (env), &env->fp_status);floatx80_to_FP0 (env, res);
@@ -1284,6 +1330,8 @@ void HELPER(fcmp_FP0_FP1)(CPUState *env)/* ??? This may incorrectly raise exceptions. */ /* ??? Should flush denormals to zero. */ floatx80 res; +DBG_FPU ("cmp_FP0_FP1 %Lg %Lg\n" ,LDOUBLE (FP1_to_floatx80 (env)), +LDOUBLE (FP0_to_floatx80 (env))); res =floatx80_sub (FP1_to_floatx80 (env),FP0_to_floatx80 (env), &env->fp_status);if (floatx80_is_any_nan (res)) {
@@ -1295,6 +1343,7 @@ void HELPER(fcmp_FP0_FP1)(CPUState *env) res =floatx80_chs (res); } } +DBG_FPU (" : %Lg\n" ,LDOUBLE (res));floatx80_to_FP0 (env, res); }
@@ -1302,9 +1351,11 @@ uint32_t HELPER(compare_FP0)(CPUState *env) {uint32_t res; +DBG_FPU ("compare_FP0 %Lg\n" ,LDOUBLE (FP0_to_floatx80 (env))); res =float64_compare_quiet (floatx80_to_float64 (FP0_to_floatx80 (env), &env->fp_status), float64_zero, &env->fp_status); +DBG_FPU (" = %d\n" , res);return res; }
Signature · 1 line
1.7.2.3
PATCH 64/111 m68k: more tests
In reply to Bryce LanhamFrom: Laurent Vivier <[email protected]>
--- .gitignore | 7 +++++++ tests/m68k/Makefile | 6 +----- tests/m68k/fabs.S | 9 +++++++++ tests/m68k/fdiv.S | 10 ++++++++++ tests/m68k/fmove.S | 13 +++++++++---- tests/m68k/fmul.S | 9 +++++++++ tests/m68k/fsub.S | 11 +++++++++++ 7 files changed, 56 insertions(+), 9 deletions(-) create mode 100644 tests/m68k/fabs.S create mode 100644 tests/m68k/fdiv.S create mode 100644 tests/m68k/fmul.S create mode 100644 tests/m68k/fsub.S
.gitignore +7 -0
@@ -71,3 +71,10 @@ cscope.* tags TAGS *~ +tests/m68k/fabs +tests/m68k/fdiv +tests/m68k/fmove +tests/m68k/fmovecr +tests/m68k/fmovem +tests/m68k/fmul +tests/m68k/fsub
tests/m68k/Makefile +1 -5
@@ -1,14 +1,10 @@ -TESTS=fmovecr fmove fmovem +TESTS=fmovecr fmove fmovem fsub fdiv fmul fabs all: $(TESTS) %: %.S m68k-linux-gnu-gcc -m68040 -nostartfiles -nodefaultlibs -nostdlib -o $@ $< -fmovecr: fmovecr.S -fmove: fmove.S -fmovem: fmovem.S - .PHONY: clean clean:
tests/m68k/fabs.S new file +9 -0
@@ -0,0 +1,9 @@ + .include "trap.i" + + .text + .globl _start +_start: + fabs.b #-55, %fp0 + fmove.l #-1024, %fp1 + fabs.x %fp1 + exit 0
tests/m68k/fdiv.S new file +10 -0
@@ -0,0 +1,10 @@ + .include "trap.i" + + .text + .globl _start +_start: +# Pi + fmove.b #10, %fp0 + fmove.b #3, %fp1 + fdiv.x %fp1, %fp0 + exit 0
tests/m68k/fmove.S +9 -4
@@ -2,9 +2,8 @@ .data tmp: .long 0x88776655 -pi: .long 0x40000000 - .long 0xc90fdaa2 - .long 0x2168C235 +pi: .long 0x40000000, 0xc90fdaa2, 0x2168C235 +store: .long 0, 0, 0 .text .globl _start
@@ -12,6 +11,12 @@ _start: lea pi,%a0 move.l (%a0), %d0 fmove.x (%a0), %fp4 + fmove.b %fp4, store + fmove.w %fp4, store + fmove.l %fp4, store + fmove.s %fp4, store + fmove.d %fp4, store + fmove.x %fp4, store # Dn move.l #-1, %d3
@@ -48,7 +53,7 @@ _start: fmove.w #0xFABC,%fp1 fmove.l #0xFABCDEFA,%fp2 fmove.s #0xDEADBEAF,%fp3 - fmove.d #0xFABCDEFADEADBEAF,%fp4 + fmove.d #0f4.29497E+09,%fp4 fmove.x #0xFABCDEFADEADBEAF12345678,%fp5 fmove.p #0xFABCDEFADEADBEAF12345678,%fp6
tests/m68k/fmul.S new file +9 -0
@@ -0,0 +1,9 @@ + .include "trap.i" + + .text + .globl _start +_start: + fmove.b #255, %fp0 + fmove.w #1023, %fp1 + fmul.x %fp1, %fp0 + exit 0
tests/m68k/fsub.S new file +11 -0
@@ -0,0 +1,11 @@ + .include "trap.i" + + .text + .globl _start +_start: +# Pi + fmovecr.x #0x00, %fp0 + fmove.b #3, %fp1 +# 0.1415926535897932 + fsub.x %fp1, %fp0 + exit 0
Signature · 1 line
1.7.2.3
PATCH 75/111 m68k: better fpu traces
In reply to Bryce LanhamFrom: Laurent Vivier <[email protected]>
--- target-m68k/helper.c | 136 +++++++++++++++++++++++++++++++------------------ 1 files changed, 86 insertions(+), 50 deletions(-)
target-m68k/helper.c +86 -50
@@ -30,12 +30,22 @@#include "helpers.h" #if 0 -#define DBG_FPU (...) do { fprintf(stderr, "0x%08x: ", env->pc); fprintf(stderr, __VA_ARGS__); } while(0) +#define DBG_FPUH (...) do { fprintf(stderr, "0x%08x: ", env->pc); fprintf(stderr, __VA_ARGS__); } while(0) +#define DBG_FPU (...) do { fprintf(stderr, __VA_ARGS__); } while(0) +static inline float FLOAT (float32 x) +{ +return *(float *)&x; +} +static inline double DOUBLE (float64 x) +{ +return *(double *)&x; +}static inline long double LDOUBLE (floatx80 x) {return *(long double *)&x; }#else +#define DBG_FPUH (...)#define DBG_FPU (...)#define LDOUBLE (x)#endif
@@ -1092,7 +1102,7 @@ void HELPER(const_FP0)(CPUState *env, uint32_t offset) { env->fp0h = fpu_rom[offset].high; env->fp0l = fpu_rom[offset].low; -DBG_FPU ("ROM[0x%02x] %" PRIxFPH" %" PRIxFPL" %.17Lg\n" , +DBG_FPUH ("ROM[0x%02x] %" PRIxFPH" %" PRIxFPL" %.17Lg\n" , offset, env->fp0h, env->fp0l,LDOUBLE (FP0_to_floatx80 (env))); }
@@ -1142,7 +1152,7 @@ static inline void restore_rounding_mode(CPUState *env)void HELPER (set_fpcr )(CPUState *env,uint32_t val) { -DBG_FPU ("set_fpcr %04x\n" , val); +DBG_FPUH ("set_fpcr %04x\n" , val); env->fpcr = val &0xffff ;
@@ -1154,11 +1164,11 @@ void HELPER(exts32_FP0)(CPUState *env) {floatx80 res; -DBG_FPU ("exts32_FP0 %d\n" ,FP0_to_int32 (env)); +DBG_FPUH ("exts32_FP0 %d" ,FP0_to_int32 (env)); res =int32_to_floatx80 (FP0_to_int32 (env), &env->fp_status); -DBG_FPU (" = %Lg\n" ,LDOUBLE (res)); +DBG_FPU (" = %Lg\n" ,LDOUBLE (res));floatx80_to_FP0 (env, res); }
@@ -1166,8 +1176,9 @@ void HELPER(extf32_FP0)(CPUState *env) {floatx80 res; -DBG_FPU ("extf32_FP0\n" ); +DBG_FPUH ("extf32_FP0 %f" ,FLOAT (FP0_to_float32 (env))); res =float32_to_floatx80 (FP0_to_float32 (env), &env->fp_status); +DBG_FPU (" = %Lg\n" ,LDOUBLE (res));floatx80_to_FP0 (env, res); }
@@ -1178,9 +1189,9 @@ void HELPER(extf64_FP0)(CPUState *env)uint64_t val; val =FP0_to_float64 (env); -DBG_FPU ("extf64_FP0 0x%016" PRIx64", %g\n" , val, *(double *)&val); +DBG_FPUH ("extf64_FP0 0x%016" PRIx64", %g" , val, *(double *)&val); res =float64_to_floatx80 (val, &env->fp_status); -DBG_FPU (" = %Lg\n" ,LDOUBLE (res)); +DBG_FPU (" = %Lg\n" ,LDOUBLE (res));floatx80_to_FP0 (env, res); }
@@ -1195,9 +1206,9 @@ void HELPER(reds32_FP0)(CPUState *env)int32_t res; val =FP0_to_floatx80 (env); -DBG_FPU ("reds32_FP0 %Lg\n" ,LDOUBLE (val)); +DBG_FPUH ("reds32_FP0 %Lg" ,LDOUBLE (val)); res =floatx80_to_int32 (val, &env->fp_status); -DBG_FPU (" = %d\n" , res); +DBG_FPU (" = %d\n" , res);int32_to_FP0 (env, res); }
@@ -1207,9 +1218,10 @@ void HELPER(redf32_FP0)(CPUState *env)floatx80 val;float32 res; -DBG_FPU ("redf32_FP0\n" ); val =FP0_to_floatx80 (env); +DBG_FPUH ("redf32_FP0 %Lg" ,LDOUBLE (val)); res =floatx80_to_float32 (val, &env->fp_status); +DBG_FPU (" = %f\n" ,FLOAT (res));float32_to_FP0 (env, res); }
@@ -1220,25 +1232,29 @@ void HELPER(redf64_FP0)(CPUState *env)float64 res; val =FP0_to_floatx80 (env); -DBG_FPU ("redf64_FP0 %Lg\n" ,LDOUBLE (val)); +DBG_FPUH ("redf64_FP0 %Lg" ,LDOUBLE (val)); res =floatx80_to_float64 (val, &env->fp_status); -DBG_FPU (" = %g\n" , *(double *)&res); +DBG_FPU (" = %g\n" , *(double *)&res);float64_to_FP0 (env, res); }void HELPER (redp96_FP0 )(CPUState *env) { -DBG_FPU ("redp96_FP0\n" ); +DBG_FPUH ("redp96_FP0\n" ); }void HELPER (iround_FP0 )(CPUState *env) {floatx80 res; -DBG_FPU ("iround_FP0\n" ); + res =FP0_to_floatx80 (env); - res =floatx80_round_to_int (FP0_to_floatx80 (env), &env->fp_status); +DBG_FPUH ("iround_FP0 %Lg" ,LDOUBLE (res)); + + res =floatx80_round_to_int (res, &env->fp_status); + +DBG_FPU (" = %Lg\n" ,LDOUBLE (res));floatx80_to_FP0 (env, res); }
@@ -1247,12 +1263,15 @@ void HELPER(itrunc_FP0)(CPUState *env) {floatx80 res; -DBG_FPU ("itrunc_FP0\n" ); + res =FP0_to_floatx80 (env); +DBG_FPUH ("itrunc_FP0 %Lg" ,LDOUBLE (res));set_float_rounding_mode (float_round_to_zero, &env->fp_status); - res =floatx80_round_to_int (FP0_to_floatx80 (env), &env->fp_status); + res =floatx80_round_to_int (res, &env->fp_status);restore_rounding_mode (env); +DBG_FPU (" = %Lg\n" ,LDOUBLE (res)); +floatx80_to_FP0 (env, res); }
@@ -1260,8 +1279,10 @@ void HELPER(sqrt_FP0)(CPUState *env) {floatx80 res; -DBG_FPU ("sqrt_FP0\n" ); - res =floatx80_sqrt (FP0_to_floatx80 (env), &env->fp_status); + res =FP0_to_floatx80 (env); +DBG_FPUH ("sqrt_FP0 %Lg" ,LDOUBLE (res)); + res =floatx80_sqrt (res, &env->fp_status); +DBG_FPU (" = %Lg\n" ,LDOUBLE (res));floatx80_to_FP0 (env, res); }
@@ -1273,13 +1294,15 @@ void HELPER(ln_FP0)(CPUState *env)/* ln(x) = log2(x) / log2(e) */ -DBG_FPU ("ln_FP0\n" ); + res =FP0_to_floatx80 (env); +DBG_FPUH ("ln_FP0 %Lg" ,LDOUBLE (res)); - f =floatx80_to_float64 (FP0_to_floatx80 (env), &env->fp_status); + f =floatx80_to_float64 (res, &env->fp_status); log2 =float64_log2 (f, &env->fp_status); res =floatx80_div (float64_to_floatx80 (log2, &env->fp_status), floatx80_log2e, &env->fp_status); +DBG_FPU (" = %Lg\n" ,LDOUBLE (res));floatx80_to_FP0 (env, res); }
@@ -1291,7 +1314,7 @@ void HELPER(log10_FP0)(CPUState *env)/* log10(x) = log2(x) / log2(10) */ -DBG_FPU ("log10_FP0(%Lg)\n" ,LDOUBLE (FP0_to_floatx80 (env))); +DBG_FPUH ("log10_FP0 %Lg" ,LDOUBLE (FP0_to_floatx80 (env))); f =floatx80_to_float64 (FP0_to_floatx80 (env), &env->fp_status); log2 =float64_log2 (f, &env->fp_status);
@@ -1300,7 +1323,7 @@ void HELPER(log10_FP0)(CPUState *env) res =floatx80_div (float64_to_floatx80 (log2, &env->fp_status),float64_to_floatx80 (log210, &env->fp_status), &env->fp_status); -DBG_FPU (" = %Lg\n" ,LDOUBLE (res)); +DBG_FPU (" = %Lg\n" ,LDOUBLE (res));floatx80_to_FP0 (env, res); }
@@ -1312,23 +1335,29 @@ void HELPER(exp_FP0)(CPUState *env)/* exp(x) = exp2(x * log2(e)) */ -DBG_FPU ("exp_FP0\n" ); + f =FP0_to_floatx80 (env); + +DBG_FPUH ("exp_FP0 %Lg" ,LDOUBLE (f)); - f =floatx80_mul (FP0_to_floatx80 (env), floatx80_log2e, &env->fp_status); + f =floatx80_mul (f, floatx80_log2e, &env->fp_status); res =float32_exp2 (floatx80_to_float32 (f, &env->fp_status), &env->fp_status); +DBG_FPU (" = %f\n" ,FLOAT (res));floatx80_to_FP0 (env,float32_to_floatx80 (res, &env->fp_status)); }void HELPER (exp2_FP0 )(CPUState *env) {float32 res; +floatx80 f; -DBG_FPU ("exp_FP0\n" ); + f =FP0_to_floatx80 (env); +DBG_FPUH ("exp2_FP0 %Lg" ,LDOUBLE (f)); - res =float32_exp2 (floatx80_to_float32 (FP0_to_floatx80 (env), - &env->fp_status), &env->fp_status); + res =float32_exp2 (floatx80_to_float32 (f, &env->fp_status), + &env->fp_status); +DBG_FPU (" = %f\n" ,FLOAT (res));floatx80_to_FP0 (env,float32_to_floatx80 (res, &env->fp_status)); }
@@ -1337,8 +1366,10 @@ void HELPER(abs_FP0)(CPUState *env) {floatx80 res; -DBG_FPU ("abs_FP0\n" ); - res =floatx80_abs (FP0_to_floatx80 (env)); + res =FP0_to_floatx80 (env); +DBG_FPUH ("abs_FP0 %Lg" ,LDOUBLE (res)); + res =floatx80_abs (res); +DBG_FPU (" = %Lg\n" ,LDOUBLE (res));floatx80_to_FP0 (env, res); }
@@ -1347,8 +1378,10 @@ void HELPER(chs_FP0)(CPUState *env) {floatx80 res; -DBG_FPU ("chs_FP0\n" ); - res =floatx80_chs (FP0_to_floatx80 (env)); + res =FP0_to_floatx80 (env); +DBG_FPUH ("chs_FP0 %Lg" ,LDOUBLE (res)); + res =floatx80_chs (res); +DBG_FPU (" = %Lg\n" ,LDOUBLE (res));floatx80_to_FP0 (env, res); }
@@ -1358,15 +1391,15 @@ void HELPER(getexp_FP0)(CPUState *env)int32_t exp;floatx80 res; -DBG_FPU ("getexp_FP0(%Lg)\n" ,LDOUBLE (FP0_to_floatx80 (env))); +DBG_FPUH ("getexp_FP0 %Lg" ,LDOUBLE (FP0_to_floatx80 (env))); -DBG_FPU (" fp0h 0x%08x fp0l 0x%016" PRIx64"\n" , env->fp0h, env->fp0l); +DBG_FPU (" fp0h 0x%08x fp0l 0x%016" PRIx64, env->fp0h, env->fp0l); exp = (env->fp0h &0x7fff ) -0x3fff ; res =int32_to_floatx80 (exp, &env->fp_status); -DBG_FPU (" = %Lg\n" ,LDOUBLE (res)); +DBG_FPU (" = %Lg" ,LDOUBLE (res));floatx80_to_FP0 (env, res); }
@@ -1375,9 +1408,9 @@ void HELPER(scale_FP0_FP1)(CPUState *env)int32_t scale;int32_t exp; -DBG_FPU ("getexp_FP0(%Lg)\n" ,LDOUBLE (FP0_to_floatx80 (env))); +DBG_FPUH ("scale_FP0 %Lg" ,LDOUBLE (FP0_to_floatx80 (env))); -DBG_FPU (" fp0h 0x%08x fp0l 0x%016" PRIx64"\n" , env->fp0h, env->fp0l); +DBG_FPU (" fp0h 0x%08x fp0l 0x%016" PRIx64, env->fp0h, env->fp0l); scale =floatx80_to_int32 (FP0_to_floatx80 (env), &env->fp_status);
@@ -1385,17 +1418,18 @@ void HELPER(scale_FP0_FP1)(CPUState *env) env->fp0h = (env->fp1h &0x8000 ) | (exp &0x7fff ); env->fp0l = env->fp1l; +DBG_FPU (" = %Lg" ,LDOUBLE (FP0_to_floatx80 (env))); }void HELPER (add_FP0_FP1 )(CPUState *env) {floatx80 res; -DBG_FPU ("add_FP0_FP1(%Lg,%Lg)\n" ,LDOUBLE (FP0_to_floatx80 (env)), +DBG_FPUH ("add_FP0_FP1 %Lg %Lg" ,LDOUBLE (FP0_to_floatx80 (env)),LDOUBLE (FP1_to_floatx80 (env))); res =floatx80_add (FP0_to_floatx80 (env),FP1_to_floatx80 (env), &env->fp_status); -DBG_FPU (" = %Lg\n" ,LDOUBLE (res)); +DBG_FPU (" = %Lg\n" ,LDOUBLE (res));floatx80_to_FP0 (env, res); }
@@ -1404,11 +1438,11 @@ void HELPER(sub_FP0_FP1)(CPUState *env) {floatx80 res; -DBG_FPU ("sub_FP0 %Lg %Lg\n" ,LDOUBLE (FP0_to_floatx80 (env)), +DBG_FPUH ("sub_FP0 %Lg %Lg" ,LDOUBLE (FP0_to_floatx80 (env)),LDOUBLE (FP1_to_floatx80 (env))); res =floatx80_sub (FP1_to_floatx80 (env),FP0_to_floatx80 (env), &env->fp_status); -DBG_FPU (" = %Lg\n" ,LDOUBLE (res)); +DBG_FPU (" = %Lg\n" ,LDOUBLE (res));floatx80_to_FP0 (env, res); }
@@ -1417,11 +1451,11 @@ void HELPER(mul_FP0_FP1)(CPUState *env) {floatx80 res; -DBG_FPU ("mul_FP0_FP1 %Lg %Lg\n" , +DBG_FPUH ("mul_FP0_FP1 %Lg %Lg" ,LDOUBLE (FP0_to_floatx80 (env)),LDOUBLE (FP1_to_floatx80 (env))); res =floatx80_mul (FP0_to_floatx80 (env),FP1_to_floatx80 (env), &env->fp_status); -DBG_FPU (" = %Lg\n" ,LDOUBLE (res)); +DBG_FPU (" = %Lg\n" ,LDOUBLE (res));floatx80_to_FP0 (env, res); }
@@ -1430,9 +1464,11 @@ void HELPER(div_FP0_FP1)(CPUState *env) {floatx80 res; -DBG_FPU ("div\n" ); +DBG_FPUH ("div_FP0_FP1 %Lg %Lg" , +LDOUBLE (FP0_to_floatx80 (env)),LDOUBLE (FP1_to_floatx80 (env))); res =floatx80_div (FP1_to_floatx80 (env),FP0_to_floatx80 (env), &env->fp_status); +DBG_FPU (" = %Lg\n" ,LDOUBLE (res));floatx80_to_FP0 (env, res); }
@@ -1442,8 +1478,8 @@ void HELPER(fcmp_FP0_FP1)(CPUState *env)/* ??? This may incorrectly raise exceptions. */ /* ??? Should flush denormals to zero. */ floatx80 res; -DBG_FPU ("cmp_FP0_FP1 %Lg %Lg\n" ,LDOUBLE (FP1_to_floatx80 (env)), -LDOUBLE (FP0_to_floatx80 (env))); +DBG_FPUH ("cmp_FP0_FP1 %Lg %Lg" ,LDOUBLE (FP0_to_floatx80 (env)), +LDOUBLE (FP1_to_floatx80 (env))); res =floatx80_sub (FP1_to_floatx80 (env),FP0_to_floatx80 (env), &env->fp_status);if (floatx80_is_any_nan (res)) {
@@ -1455,7 +1491,7 @@ void HELPER(fcmp_FP0_FP1)(CPUState *env) res =floatx80_chs (res); } } -DBG_FPU (" : %Lg\n" ,LDOUBLE (res)); +DBG_FPU (" = %Lg\n" ,LDOUBLE (res));floatx80_to_FP0 (env, res); }
@@ -1463,11 +1499,11 @@ uint32_t HELPER(compare_FP0)(CPUState *env) {uint32_t res; -DBG_FPU ("compare_FP0 %Lg\n" ,LDOUBLE (FP0_to_floatx80 (env))); +DBG_FPUH ("compare_FP0 %Lg" ,LDOUBLE (FP0_to_floatx80 (env))); res =float64_compare_quiet (floatx80_to_float64 (FP0_to_floatx80 (env), &env->fp_status), float64_zero, &env->fp_status); -DBG_FPU (" = %d\n" , res); +DBG_FPU (" = %d\n" , res);return res; }
Signature · 1 line
1.7.2.3
PATCH 78/111 m68k: add ftan instruction
In reply to Bryce LanhamFrom: Laurent Vivier <[email protected]>
--- target-m68k/helper.c | 15 +++++++++++++++ target-m68k/helpers.h | 1 + target-m68k/translate.c | 3 +++ 3 files changed, 19 insertions(+), 0 deletions(-)
target-m68k/helper.c +15 -0
@@ -1332,6 +1332,21 @@ void HELPER(log10_FP0)(CPUState *env)floatx80_to_FP0 (env, res); } +void HELPER (tan_FP0 )(CPUState *env) +{ +floatx80 res; +long double val; + + res =FP0_to_floatx80 (env); + val =LDOUBLE (res); + +DBG_FPUH ("tan_FP0 %Lg" , val); + val =tanl (val); +DBG_FPU (" = %Lg" , val); + res =FLOATx80 (val); +floatx80_to_FP0 (env, res); +} +void HELPER (exp_FP0 )(CPUState *env) {floatx80 f;
target-m68k/helpers.h +1 -0
@@ -65,6 +65,7 @@ DEF_HELPER_2(const_FP0, void, env, i32) DEF_HELPER_1(iround_FP0, void, env) DEF_HELPER_1(itrunc_FP0, void, env) DEF_HELPER_1(sqrt_FP0, void, env) +DEF_HELPER_1(tan_FP0, void, env) DEF_HELPER_1(exp_FP0, void, env) DEF_HELPER_1(exp2_FP0, void, env)DEF_HELPER_1 (ln_FP0, void, env)
target-m68k/translate.c +3 -0
@@ -3661,6 +3661,9 @@ DISAS_INSN(fpu)case 4 :case 0x41 :case 0x45 :/* fsqrt */ gen_helper_sqrt_FP0 (cpu_env);break ; +case 0x0f :/* ftan */ +gen_helper_tan_FP0 (cpu_env); +break ;case 0x10 :/* fetox */ gen_helper_exp_FP0 (cpu_env);break ;
Signature · 1 line
1.7.2.3
PATCH 79/111 m68k: add fsin instruction
In reply to Bryce LanhamFrom: Laurent Vivier <[email protected]>
--- target-m68k/helper.c | 15 +++++++++++++++ target-m68k/helpers.h | 1 + target-m68k/translate.c | 3 +++ 3 files changed, 19 insertions(+), 0 deletions(-)
target-m68k/helper.c +15 -0
@@ -1332,6 +1332,21 @@ void HELPER(log10_FP0)(CPUState *env)floatx80_to_FP0 (env, res); } +void HELPER (sin_FP0 )(CPUState *env) +{ +floatx80 res; +long double val; + + res =FP0_to_floatx80 (env); + val =LDOUBLE (res); + +DBG_FPUH ("sin_FP0 %Lg" , val); + val =sinl (val); +DBG_FPU (" = %Lg" , val); + res =FLOATx80 (val); +floatx80_to_FP0 (env, res); +} +void HELPER (tan_FP0 )(CPUState *env) {floatx80 res;
target-m68k/helpers.h +1 -0
@@ -65,6 +65,7 @@ DEF_HELPER_2(const_FP0, void, env, i32) DEF_HELPER_1(iround_FP0, void, env) DEF_HELPER_1(itrunc_FP0, void, env) DEF_HELPER_1(sqrt_FP0, void, env) +DEF_HELPER_1(sin_FP0, void, env) DEF_HELPER_1(tan_FP0, void, env) DEF_HELPER_1(exp_FP0, void, env)DEF_HELPER_1 (exp2_FP0, void, env)
target-m68k/translate.c +3 -0
@@ -3661,6 +3661,9 @@ DISAS_INSN(fpu)case 4 :case 0x41 :case 0x45 :/* fsqrt */ gen_helper_sqrt_FP0 (cpu_env);break ; +case 0x0e :/* fsin */ +gen_helper_sin_FP0 (cpu_env); +break ;case 0x0f :/* ftan */ gen_helper_tan_FP0 (cpu_env);break ;
Signature · 1 line
1.7.2.3
PATCH 80/111 m68k: add fcos instruction
In reply to Bryce LanhamFrom: Laurent Vivier <[email protected]>
--- target-m68k/helper.c | 15 +++++++++++++++ target-m68k/helpers.h | 1 + target-m68k/translate.c | 3 +++ 3 files changed, 19 insertions(+), 0 deletions(-)
target-m68k/helper.c +15 -0
@@ -1435,6 +1435,21 @@ void HELPER(acos_FP0)(CPUState *env)floatx80_to_FP0 (env, res); } +void HELPER (cos_FP0 )(CPUState *env) +{ +floatx80 res; +long double val; + + res =FP0_to_floatx80 (env); + val =LDOUBLE (res); + +DBG_FPUH ("cos_FP0 %Lg" , val); + val =cosl (val); +DBG_FPU (" = %Lg" , val); + res =FLOATx80 (val); +floatx80_to_FP0 (env, res); +} +void HELPER (getexp_FP0 )(CPUState *env) {int32_t exp;
target-m68k/helpers.h +1 -0
@@ -74,6 +74,7 @@ DEF_HELPER_1(log10_FP0, void, env) DEF_HELPER_1(abs_FP0, void, env) DEF_HELPER_1(chs_FP0, void, env) DEF_HELPER_1(acos_FP0, void, env) +DEF_HELPER_1(cos_FP0, void, env) DEF_HELPER_1(getexp_FP0, void, env) DEF_HELPER_1(scale_FP0_FP1, void, env)DEF_HELPER_1 (add_FP0_FP1, void, env)
target-m68k/translate.c +3 -0
@@ -3688,6 +3688,9 @@ DISAS_INSN(fpu)case 0x1c :/* facos */ gen_helper_acos_FP0 (cpu_env);break ; +case 0x1d :/* fcos */ +gen_helper_cos_FP0 (cpu_env); +break ;case 0x1e :/* fgetexp */ gen_helper_getexp_FP0 (cpu_env);break ;
Signature · 1 line
1.7.2.3
PATCH 81/111 m68k: correct fpcr update
In reply to Bryce LanhamFrom: Laurent Vivier <[email protected]>
allow to run metacity
--- target-m68k/translate.c | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-)
target-m68k/translate.c +1 -2
@@ -3602,7 +3602,7 @@ DISAS_INSN(fpu)case 4 :/* FPCR */ SRC_EA (val,OS_LONG ,0 ,NULL );gen_helper_set_fpcr (cpu_env, val); -break ; +return ;case 1 :/* FPIAR */ case 2 :/* FPSR */ default :
@@ -3613,7 +3613,6 @@ DISAS_INSN(fpu)case 5 :/* fmove from control register. */ switch ((ext >>10 ) &7 ) {case 4 :/* FPCR */ -/* Not implemented. Always return zero. */ DEST_EA (insn,OS_LONG ,QEMU_FPCR ,NULL );return ;case 1 :/* FPIAR */
Signature · 1 line
1.7.2.3
PATCH 82/111 m68k: add fmod instruction
In reply to Bryce LanhamFrom: Laurent Vivier <[email protected]>
used by gnome-system-monitor.
--- target-m68k/helper.c | 16 ++++++++++++++++ target-m68k/helpers.h | 1 + target-m68k/translate.c | 4 ++++ 3 files changed, 21 insertions(+), 0 deletions(-)
target-m68k/helper.c +16 -0
@@ -1537,6 +1537,22 @@ void HELPER(div_FP0_FP1)(CPUState *env)floatx80_to_FP0 (env, res); } +void HELPER (mod_FP0_FP1 )(CPUState *env) +{ +floatx80 res; +long double src, dst; + + src =LDOUBLE (FP0_to_floatx80 (env)); + dst =LDOUBLE (FP1_to_floatx80 (env)); + +DBG_FPUH ("mod_FP0_FP1 %Lg %Lg" , src, dst); + dst =fmodl (dst, src); +DBG_FPU (" = %Lg\n" , dst); + + res =FLOATx80 (dst); +floatx80_to_FP0 (env, res); +} +void HELPER (fcmp_FP0_FP1 )(CPUState *env) {/* ??? This may incorrectly raise exceptions. */
target-m68k/helpers.h +1 -0
@@ -81,6 +81,7 @@ DEF_HELPER_1(add_FP0_FP1, void, env) DEF_HELPER_1(sub_FP0_FP1, void, env) DEF_HELPER_1(mul_FP0_FP1, void, env) DEF_HELPER_1(div_FP0_FP1, void, env) +DEF_HELPER_1(mod_FP0_FP1, void, env) DEF_HELPER_1(fcmp_FP0_FP1, void, env)DEF_HELPER_1 (compare_FP0, i32, env)
target-m68k/translate.c +4 -0
@@ -3697,6 +3697,10 @@ DISAS_INSN(fpu)gen_op_load_fpr_FP1 (REG (ext,7 ));gen_helper_div_FP0_FP1 (cpu_env);break ; +case 0x21 :/* fmod */ +gen_op_load_fpr_FP1 (REG (ext,7 )); +gen_helper_mod_FP0_FP1 (cpu_env); +break ;case 0x22 :case 0x62 :case 0x66 :/* fadd */ gen_op_load_fpr_FP1 (REG (ext,7 ));gen_helper_add_FP0_FP1 (cpu_env);
Signature · 1 line
1.7.2.3
PATCH 76/111 m68k: register source operand is always in extended size
In reply to Bryce LanhamFrom: Laurent Vivier <[email protected]>
Allow Xvnc4 to run.
--- target-m68k/translate.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
target-m68k/translate.c +2 -1
@@ -3637,11 +3637,12 @@ DISAS_INSN(fpu)gen_op_fmovem (s, insn, ext);return ; } - opsize =ext_opsize (ext,10 );if (ext & (1 <<14 )) { + opsize =ext_opsize (ext,10 );gen_op_load_ea_FP0 (s, insn, opsize); }else {/* Source register. */ + opsize =OS_EXTENDED ;gen_op_load_fpr_FP0 (REG (ext,10 )); } round =1 ;
Signature · 1 line
1.7.2.3
PATCH 83/111 m68k: flush flags before negx instruction.
In reply to Bryce LanhamFrom: Laurent Vivier <[email protected]>
Force the computing of the flags before negx as
negx will keep Z flag from previous instructions
if result is non zero.
Seen with gcc testsuite,gcc.c-torture/execute/builtin-bitops-1.c
--- target-m68k/translate.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
target-m68k/translate.c +1 -0
@@ -1896,6 +1896,7 @@ DISAS_INSN(negx)int opsize; opsize =insn_opsize (insn,6 ); +gen_flush_flags (s);SRC_EA (src, opsize,-1 , &addr); dest =tcg_temp_new ();switch (opsize) {
Signature · 1 line
1.7.2.3
PATCH 84/111 m68k: correct fmovemx FP registers order.
In reply to Bryce LanhamFrom: Laurent Vivier <[email protected]>
seen with gcc testsuite, gcc-4.1.2/gcc/testsuite/gcc.c-torture/execute/930622-2.c
allow to run gtk-demo, gimp ...
--- target-m68k/translate.c | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-)
target-m68k/translate.c +6 -6
@@ -3536,18 +3536,18 @@ static void gen_op_fmovem(DisasContext *s, uint32_t insn, uint32_t ext) mask = ext &0x00FF ;if (!is_load && (mode &2 ) ==0 ) { -for (i =7 ; i >=0 ; i--, mask >>=1 ) { -if (mask &1 ) { +for (i =7 ; i >=0 ; i--, mask <<=1 ) { +if (mask &0x80 ) {gen_op_load_fpr_FP0 (i);gen_store_FP0 (s, opsize, addr); -if (mask !=1 ) +if ((mask &0xff ) !=0x80 )tcg_gen_subi_i32 (addr, addr, incr); } }tcg_gen_mov_i32 (AREG (insn,0 ), addr); }else { -for (i =0 ; i <8 ; i++, mask >>=1 ) { -if (mask &1 ) { +for (i =0 ; i <8 ; i++, mask <<=1 ) { +if (mask &0x80 ) {if (is_load) {gen_load_FP0 (s, opsize, addr);gen_op_store_fpr_FP0 (i);
@@ -3555,7 +3555,7 @@ static void gen_op_fmovem(DisasContext *s, uint32_t insn, uint32_t ext)gen_op_load_fpr_FP0 (i);gen_store_FP0 (s, opsize, addr); } -if (mask !=1 || (insn &070 ) ==030 ) +if ((mask &0xff ) !=0x80 || (insn &070 ) ==030 )tcg_gen_addi_i32 (addr, addr, incr); } }
Signature · 1 line
1.7.2.3
PATCH 85/111 m68k: add fatan instruction
In reply to Bryce LanhamFrom: Laurent Vivier <[email protected]>
allow to run gtk-demo/Color Selector/Change the above color
--- target-m68k/helper.c | 15 +++++++++++++++ target-m68k/helpers.h | 1 + target-m68k/translate.c | 3 +++ 3 files changed, 19 insertions(+), 0 deletions(-)
target-m68k/helper.c +15 -0
@@ -1332,6 +1332,21 @@ void HELPER(log10_FP0)(CPUState *env)floatx80_to_FP0 (env, res); } +void HELPER (atan_FP0 )(CPUState *env) +{ +floatx80 res; +long double val; + + res =FP0_to_floatx80 (env); + val =LDOUBLE (res); + +DBG_FPUH ("atan_FP0 %Lg" , val); + val =atanl (val); +DBG_FPU (" = %Lg" , val); + res =FLOATx80 (val); +floatx80_to_FP0 (env, res); +} +void HELPER (sin_FP0 )(CPUState *env) {floatx80 res;
target-m68k/helpers.h +1 -0
@@ -65,6 +65,7 @@ DEF_HELPER_2(const_FP0, void, env, i32) DEF_HELPER_1(iround_FP0, void, env) DEF_HELPER_1(itrunc_FP0, void, env) DEF_HELPER_1(sqrt_FP0, void, env) +DEF_HELPER_1(atan_FP0, void, env) DEF_HELPER_1(sin_FP0, void, env) DEF_HELPER_1(tan_FP0, void, env)DEF_HELPER_1 (exp_FP0, void, env)
target-m68k/translate.c +3 -0
@@ -3661,6 +3661,9 @@ DISAS_INSN(fpu)case 4 :case 0x41 :case 0x45 :/* fsqrt */ gen_helper_sqrt_FP0 (cpu_env);break ; +case 0x0a :/* fatan */ +gen_helper_atan_FP0 (cpu_env); +break ;case 0x0e :/* fsin */ gen_helper_sin_FP0 (cpu_env);break ;
Signature · 1 line
1.7.2.3
PATCH 86/111 m68k: correct bfins instruction
In reply to Bryce LanhamFrom: Laurent Vivier <[email protected]>
correctly update generated condition code.
seen with gcc testsuite, gcc-4.1.2/gcc/testsuite/gcc.c-torture/execute/960301-1.c
--- target-m68k/translate.c | 34 +++++++++++++++++++++++++++++----- tests/m68k/Makefile | 3 ++- tests/m68k/bfins.S | 23 +++++++++++++++++++++++ 3 files changed, 54 insertions(+), 6 deletions(-) create mode 100644 tests/m68k/bfins.S
target-m68k/translate.c +29 -5
@@ -3091,9 +3091,22 @@ DISAS_INSN(bitfield_reg) tmp1 =tcg_temp_new_i32 ();gen_helper_rol32 (tmp1, tmp, offset); -gen_logic_cc (s, tmp1,OS_LONG ); reg2 =DREG (ext,12 ); +if (op ==7 ) { +TCGv tmp2; + + tmp2 =tcg_temp_new_i32 (); +tcg_gen_sub_i32 (tmp2,tcg_const_i32 (32 ), width); +tcg_gen_shl_i32 (tmp2, reg2, tmp2); +tcg_gen_and_i32 (tmp2, tmp2, mask); +gen_logic_cc (s, tmp2,OS_LONG ); + +tcg_temp_free_i32 (tmp1); + }else { +gen_logic_cc (s, tmp1,OS_LONG ); + } +switch (op) {case 0 :/* bftst */ break ;
@@ -3157,11 +3170,7 @@ static TCGv gen_bitfield_cc(DisasContext *s,tcg_gen_shri_i64 (tmp64, tmp64,32ULL ); dest =tcg_temp_new_i32 ();tcg_gen_trunc_i64_i32 (dest, tmp64); - -/* compute cc */ -tcg_gen_and_i32 (dest, dest, mask_cc); -gen_logic_cc (s, dest,OS_LONG );return dest; }
@@ -3283,6 +3292,21 @@ DISAS_INSN(bitfield_mem)/* execute operation */ reg =DREG (ext,12 ); + +if (op ==7 ) { +TCGv tmp1; + + tmp1 =tcg_temp_new_i32 (); +tcg_gen_sub_i32 (tmp1,tcg_const_i32 (32 ), width); +tcg_gen_shl_i32 (tmp1, reg, tmp1); +tcg_gen_and_i32 (tmp1, tmp1, mask_cc); +gen_logic_cc (s, tmp1,OS_LONG ); + +tcg_temp_free_i32 (tmp1); + }else { +gen_logic_cc (s, val,OS_LONG ); + } +switch (op) {case 0 :/* bftst */ break ;
tests/m68k/Makefile +2 -1
@@ -1,4 +1,5 @@ -TESTS=fmovecr fmove fmovem fsub fdiv fmul fabs fgetexp fscale flogn fetox +TESTS=fmovecr fmove fmovem fsub fdiv fmul fabs fgetexp fscale flogn fetox \ + bfins all: $(TESTS)
tests/m68k/bfins.S new file +23 -0
@@ -0,0 +1,23 @@ + .include "trap.i" + + .data +.A: .long 0 + .text + .globl _start +_start: + move.l #0,%d1 + move.l #1,%d0 + bfins %d0,%d1,4,4 + move.l #3,%d0 + bfins %d0,%d1,8,2 + move.l #0,%d0 + bfins %d0,%d1,8,16 + + move.l #1,%d0 + lea .A,%a0 + bfins %d0,(%a0),4,4 + move.l #3,%d0 + bfins %d0,(%a0),8,2 + move.l #0,%d0 + bfins %d0,(%a0),8,16 + exit 0
Signature · 1 line
1.7.2.3
PATCH 87/111 m68k: fcmp correctly compares infinity.
In reply to Bryce LanhamFrom: Laurent Vivier <[email protected]>
seen with gcc testsuite, gcc-4.1.2/gcc/testsuite/gcc.c-torture/execute/960405-1.c
--- target-m68k/helper.c | 4 ++-- tests/m68k/Makefile | 2 +- tests/m68k/inf.S | 17 +++++++++++++++++ 3 files changed, 20 insertions(+), 3 deletions(-) create mode 100644 tests/m68k/inf.S
target-m68k/helper.c +2 -2
@@ -1581,8 +1581,8 @@ void HELPER(fcmp_FP0_FP1)(CPUState *env)/* +/-inf compares equal against itself, but sub returns nan. */ if (!floatx80_is_any_nan (FP0_to_floatx80 (env)) && !floatx80_is_any_nan (FP1_to_floatx80 (env))) { -if (floatx80_lt_quiet (FP1_to_floatx80 (env), floatx80_zero, - &env->fp_status)) + res = floatx80_zero; +if (floatx80_lt_quiet (FP1_to_floatx80 (env), res, &env->fp_status)) res =floatx80_chs (res); } }
tests/m68k/Makefile +1 -1
@@ -1,5 +1,5 @@ TESTS=fmovecr fmove fmovem fsub fdiv fmul fabs fgetexp fscale flogn fetox \ - bfins + bfins inf all: $(TESTS)
tests/m68k/inf.S new file +17 -0
@@ -0,0 +1,17 @@ + .include "trap.i" + + .data +X: .long 0x7ffe0000, 0x80000000, 0x00000000 + + .text + .globl _start +_start: + fmove.x X, %fp0 + fmove.x X, %fp1 + fadd.x %fp0, %fp1 + fmul.l #2,%fp0 + fcmp.x %fp0, %fp1 + fbeq a + nop +a: + exit 0
Signature · 1 line
1.7.2.3
Quoted 2 lines · Bryce Lanham
These patches greatly expand Motorola 68k emulation within qemu, and are what I used as a basis for my Google Summer of Code project to add NeXT hardware support to QEMU.
Please don't crap flood the list with a series of 100 patches.
Split things into logical chunks such that a series can be reasonably reviewed and applied.
Regards,
Anthony Liguori
Quoted 128 lines
Bryce Lanham
Alexander Paramonov (1):
linux-user: Signals processing is not thread-safe.Andreas Schwab (3):
m68k: add cas
m68k: define fcntl constants
m68k: add DBcc instruction.Laurent Vivier (106):
linux-user: add qemu-wrapper
linux-user: define default cpu model in configure instead of
linux-user/main.c
linux-user: specify the cpu model during configure linux-user,m68k: display default cpu
linux-user: define new environment variables
linux-user: define a script to set binfmt using debian flavored tools
linux-user: define default cpu model in configure instead of
linux-user/main.c
m68k: addtcg_gen_debug_insn_start()
m68k: define m680x0 CPUs and features
m68k: add missing accessing modes for some instructions.
m68k: add Motorola 680x0 family common instructions.
m68k: add Scc instruction with memory operand.
m68k: add DBcc instruction.
m68k: modify movem instruction to manage word
m68k: add 64bit divide.
m68k: add 32bit and 64bit multiply
m68k: add word data size for suba/adda
m68k: add fpu
m68k: add "byte", "word" and memory shift
m68k: add "byte", "word" and memory rotate.
m68k: addbitfield_mem,bitfield_reg
m68k: add variable offset/width to bitfield_reg/bitfield_mem
m68k: add cas
m68k: allow fpu to manage double data type.
m68k: allow fpu to manage double data type with fmove to<ea>
m68k: add FScc instruction
m68k: add single data type togen_ea
m68k: add linkl instruction
m68k: Add fmovecr
m68k: correct typo onf64_to_i32()return type.
m68k: improveCC_OP_LOGIC
m68k: correct neg condition code flags computation Correct invalid use of "const void *" with "constuint8_t*"
m68k: add EA support for negx
m68k: add abcd instruction
m68k: add sbcd instruction
mm68k: add nbcd instruction
m68k: set X flag according size of operand Set X flag correctly
for addsub,arith_im, addsubq.
m68k: on 0 bit shift, don't update X flag
m68k: improve addx instructions Add (byte, word) opsize Add
memory access
m68k: improve subx,negx instructions Add (byte, word) opsize
Add memory access (subx)
m68k: improve asl/asr evaluate correclty the missing V flag
m68k: useread_imm1()when it is possible
m68k: correct shift side effect for roxrl and roxll
m68k: asl/asr, clear C flag if shift count is 0
m68k: lsl/lsr, clear C flag if shift count is 0
m68k: correct divs.w and divu.w
m68k: correct flags with negl
m68k: for bitfield opcodes, correct operands corruption
m68k: Correct bfclr in register case.
m68k-linux-user: add '--enable-emulop'
m68k: correctly compute divsl
m68k: correctly compute divul
m68k: add m68030 definition
m68k: remove dead code
m68k: remove useless filem68k-qreg.h
m68k: FPU rework (draft)
m68k: some FPU debugging macros
m68k: more tests
m68k: correct computegen_bitfield_cc()
m68k: add fgetexp
m68k: add fscale
m68k: correct addsubq
m68k: add fetox and flogn
m68k: initialize FRegs, definepickNaN()
m68k: correct cmpa comparison datatype
m68k: add flog10
m68k: add cmpm instruction
m68k: add ftwotox instruction
m68k: better fpu traces
m68k: register source operand is always in extended size
m68k: add facos instruction
m68k: add ftan instruction
m68k: add fsin instruction
m68k: add fcos instruction
m68k: correct fpcr update
m68k: add fmod instruction
m68k: flush flags before negx instruction.
m68k: correct fmovemx FP registers order.
m68k: add fatan instruction
m68k: correct bfins instruction
m68k: fcmp correctly compares infinity.
m68k: allows bfins to manage correctly width = 32
m68k: add ftentox instruction
m68k: correctly define and manage NaN
m68k: don't callgdb_register_coprocessor()twice.
m68k: gdb FP registers are 96 bits
m68k: add exg instruction
m68k: definefloatx80_default_inf_highandfloatx80_default_inf_low
m68k: add bkpt instruction
m68k: correctly convert floatx80<->long double
m68k: useexpl()to computeexp_FP0()
m68k: useexp2l()to computeexp2_FP0()
m68k: uselogl()to computeln_FP0()
m68k: uselog10l()to computelog10_FP0()
m68k: correctly load signed word into floating point register
m68k: add fcosh instruction
m68k: add fasin instruction
m68k: add fsincos instruction
m68k: add fsinh instruction
m68k: add ftanh instruction
m68k: add flognp1 instruction
m68k: add fatanh instruction
m68k: first draft of q800 emulation (not working)
m68k: add movec instruction
m68k: move from sr can use effective addresse on m68kPeter Bjørn Jørgensen (1):
m68k: Added ULL to 64 bit integer inhelper.c
Ugh, I'm sorry about that. This is why I should test before using unfamiliar tools. Someone suggested using git format-patch/git send-email instead of a big patch.
Apologies,
Bryce Lanham
Quoted 145 lines · Anthony Liguori
Quoted 4 lines · Bryce Lanham
These patches greatly expand Motorola 68k emulation within qemu, and are what I used as a basis for my
Google Summer of Code project to add NeXT hardware support to QEMU.Please don't crap flood the list with a series of 100 patches.
Split things into logical chunks such that a series can be reasonably reviewed and applied.
Regards,
Anthony Liguori
Quoted 128 lines
Bryce Lanham
Alexander Paramonov (1):
linux-user: Signals processing is not thread-safe.Andreas Schwab (3):
m68k: add cas
m68k: define fcntl constants
m68k: add DBcc instruction.Laurent Vivier (106):
linux-user: add qemu-wrapper
linux-user: define default cpu model in configure instead oflinux-user/main.c
linux-user: specify the cpu model during configure linux-user,m68k: display default cpu
linux-user: define new environment variables
linux-user: define a script to set binfmt using debian flavored tools
linux-user: define default cpu model in configure instead oflinux-user/main.c
m68k: addtcg_gen_debug_insn_start()
m68k: define m680x0 CPUs and features
m68k: add missing accessing modes for some instructions.
m68k: add Motorola 680x0 family common instructions.
m68k: add Scc instruction with memory operand.
m68k: add DBcc instruction.
m68k: modify movem instruction to manage word
m68k: add 64bit divide.
m68k: add 32bit and 64bit multiply
m68k: add word data size for suba/adda
m68k: add fpu
m68k: add "byte", "word" and memory shift
m68k: add "byte", "word" and memory rotate.
m68k: addbitfield_mem,bitfield_reg
m68k: add variable offset/width to bitfield_reg/bitfield_mem
m68k: add cas
m68k: allow fpu to manage double data type.
m68k: allow fpu to manage double data type with fmove to<ea>
m68k: add FScc instruction
m68k: add single data type togen_ea
m68k: add linkl instruction
m68k: Add fmovecr
m68k: correct typo onf64_to_i32()return type.
m68k: improveCC_OP_LOGIC
m68k: correct neg condition code flags computation
Correct invalid use of "const void *" with "constuint8_t*"
m68k: add EA support for negx
m68k: add abcd instruction
m68k: add sbcd instruction
mm68k: add nbcd instruction
m68k: set X flag according size of operand Set X flag correctly for addsub,arith_im, addsubq.
m68k: on 0 bit shift, don't update X flag
m68k: improve addx instructions Add (byte, word) opsize Add memory access
m68k: improve subx,negx instructions Add (byte, word) opsize Add memory access (subx)
m68k: improve asl/asr evaluate correclty the missing V flag
m68k: useread_imm1()when it is possible
m68k: correct shift side effect for roxrl and roxll
m68k: asl/asr, clear C flag if shift count is 0
m68k: lsl/lsr, clear C flag if shift count is 0
m68k: correct divs.w and divu.w
m68k: correct flags with negl
m68k: for bitfield opcodes, correct operands corruption
m68k: Correct bfclr in register case.
m68k-linux-user: add '--enable-emulop'
m68k: correctly compute divsl
m68k: correctly compute divul
m68k: add m68030 definition
m68k: remove dead code
m68k: remove useless filem68k-qreg.h
m68k: FPU rework (draft)
m68k: some FPU debugging macros
m68k: more tests
m68k: correct computegen_bitfield_cc()
m68k: add fgetexp
m68k: add fscale
m68k: correct addsubq
m68k: add fetox and flogn
m68k: initialize FRegs, definepickNaN()
m68k: correct cmpa comparison datatype
m68k: add flog10
m68k: add cmpm instruction
m68k: add ftwotox instruction
m68k: better fpu traces
m68k: register source operand is always in extended size
m68k: add facos instruction
m68k: add ftan instruction
m68k: add fsin instruction
m68k: add fcos instruction
m68k: correct fpcr update
m68k: add fmod instruction
m68k: flush flags before negx instruction.
m68k: correct fmovemx FP registers order.
m68k: add fatan instruction
m68k: correct bfins instruction
m68k: fcmp correctly compares infinity.
m68k: allows bfins to manage correctly width = 32
m68k: add ftentox instruction
m68k: correctly define and manage NaN
m68k: don't callgdb_register_coprocessor()twice.
m68k: gdb FP registers are 96 bits
m68k: add exg instruction
m68k: definefloatx80_default_inf_highandfloatx80_default_inf_low
m68k: add bkpt instruction
m68k: correctly convert floatx80<->long double
m68k: useexpl()to computeexp_FP0()
m68k: useexp2l()to computeexp2_FP0()
m68k: uselogl()to computeln_FP0()
m68k: uselog10l()to computelog10_FP0()
m68k: correctly load signed word into floating point register
m68k: add fcosh instruction
m68k: add fasin instruction
m68k: add fsincos instruction
m68k: add fsinh instruction
m68k: add ftanh instruction
m68k: add flognp1 instruction
m68k: add fatanh instruction
m68k: first draft of q800 emulation (not working)
m68k: add movec instruction
m68k: move from sr can use effective addresse on m68kPeter Bjørn Jørgensen (1):
m68k: Added ULL to 64 bit integer inhelper.c
Quoted 3 lines · Bryce Lanham
Ugh, I'm sorry about that. This is why I should test before using unfamiliar tools. Someone suggested using git format-patch/git send-email instead of a big patch.
git send-email has a "--dry-run" option which I commend to your attention :-)
-- PMM
Quoted 8 lines · Anthony Liguori
Quoted 2 lines · Bryce Lanham
These patches greatly expand Motorola 68k emulation within qemu, and are what I used as a basis for my Google Summer of Code project to add NeXT hardware support to QEMU.
Please don't crap flood the list with a series of 100 patches.
Split things into logical chunks such that a series can be reasonably reviewed and applied.
And I'm not sure this series of patches is ready for inclusion in qemu mainline as it should break existing m68k emulation...
Bryce, you should only post your patches, refering to the repository on which they apply, i.e. git://gitorious.org/qemu-m68k/qemu-m68k.git , master branch.
Regards,
Laurent
Quoted 134 lines
Regards,
Anthony Liguori
Quoted 128 lines
Bryce Lanham
Alexander Paramonov (1):
linux-user: Signals processing is not thread-safe.Andreas Schwab (3):
m68k: add cas
m68k: define fcntl constants
m68k: add DBcc instruction.Laurent Vivier (106):
linux-user: add qemu-wrapper
linux-user: define default cpu model in configure instead of
linux-user/main.c
linux-user: specify the cpu model during configure linux-user,m68k: display default cpu
linux-user: define new environment variables
linux-user: define a script to set binfmt using debian flavored tools
linux-user: define default cpu model in configure instead of
linux-user/main.c
m68k: addtcg_gen_debug_insn_start()
m68k: define m680x0 CPUs and features
m68k: add missing accessing modes for some instructions.
m68k: add Motorola 680x0 family common instructions.
m68k: add Scc instruction with memory operand.
m68k: add DBcc instruction.
m68k: modify movem instruction to manage word
m68k: add 64bit divide.
m68k: add 32bit and 64bit multiply
m68k: add word data size for suba/adda
m68k: add fpu
m68k: add "byte", "word" and memory shift
m68k: add "byte", "word" and memory rotate.
m68k: addbitfield_mem,bitfield_reg
m68k: add variable offset/width to bitfield_reg/bitfield_mem
m68k: add cas
m68k: allow fpu to manage double data type.
m68k: allow fpu to manage double data type with fmove to<ea>
m68k: add FScc instruction
m68k: add single data type togen_ea
m68k: add linkl instruction
m68k: Add fmovecr
m68k: correct typo onf64_to_i32()return type.
m68k: improveCC_OP_LOGIC
m68k: correct neg condition code flags computation Correct invalid use of "const void *" with "constuint8_t*"
m68k: add EA support for negx
m68k: add abcd instruction
m68k: add sbcd instruction
mm68k: add nbcd instruction
m68k: set X flag according size of operand Set X flag correctly
for addsub,arith_im, addsubq.
m68k: on 0 bit shift, don't update X flag
m68k: improve addx instructions Add (byte, word) opsize Add
memory access
m68k: improve subx,negx instructions Add (byte, word) opsize
Add memory access (subx)
m68k: improve asl/asr evaluate correclty the missing V flag
m68k: useread_imm1()when it is possible
m68k: correct shift side effect for roxrl and roxll
m68k: asl/asr, clear C flag if shift count is 0
m68k: lsl/lsr, clear C flag if shift count is 0
m68k: correct divs.w and divu.w
m68k: correct flags with negl
m68k: for bitfield opcodes, correct operands corruption
m68k: Correct bfclr in register case.
m68k-linux-user: add '--enable-emulop'
m68k: correctly compute divsl
m68k: correctly compute divul
m68k: add m68030 definition
m68k: remove dead code
m68k: remove useless filem68k-qreg.h
m68k: FPU rework (draft)
m68k: some FPU debugging macros
m68k: more tests
m68k: correct computegen_bitfield_cc()
m68k: add fgetexp
m68k: add fscale
m68k: correct addsubq
m68k: add fetox and flogn
m68k: initialize FRegs, definepickNaN()
m68k: correct cmpa comparison datatype
m68k: add flog10
m68k: add cmpm instruction
m68k: add ftwotox instruction
m68k: better fpu traces
m68k: register source operand is always in extended size
m68k: add facos instruction
m68k: add ftan instruction
m68k: add fsin instruction
m68k: add fcos instruction
m68k: correct fpcr update
m68k: add fmod instruction
m68k: flush flags before negx instruction.
m68k: correct fmovemx FP registers order.
m68k: add fatan instruction
m68k: correct bfins instruction
m68k: fcmp correctly compares infinity.
m68k: allows bfins to manage correctly width = 32
m68k: add ftentox instruction
m68k: correctly define and manage NaN
m68k: don't callgdb_register_coprocessor()twice.
m68k: gdb FP registers are 96 bits
m68k: add exg instruction
m68k: definefloatx80_default_inf_highandfloatx80_default_inf_low
m68k: add bkpt instruction
m68k: correctly convert floatx80<->long double
m68k: useexpl()to computeexp_FP0()
m68k: useexp2l()to computeexp2_FP0()
m68k: uselogl()to computeln_FP0()
m68k: uselog10l()to computelog10_FP0()
m68k: correctly load signed word into floating point register
m68k: add fcosh instruction
m68k: add fasin instruction
m68k: add fsincos instruction
m68k: add fsinh instruction
m68k: add ftanh instruction
m68k: add flognp1 instruction
m68k: add fatanh instruction
m68k: first draft of q800 emulation (not working)
m68k: add movec instruction
m68k: move from sr can use effective addresse on m68kPeter Bjørn Jørgensen (1):
m68k: Added ULL to 64 bit integer inhelper.c
Quoted 10 lines · Laurent Vivier
Quoted 8 lines · Anthony Liguori
Quoted 2 lines · Bryce Lanham
These patches greatly expand Motorola 68k emulation within qemu, and are what I used as a basis for my Google Summer of Code project to add NeXT hardware support to QEMU.
Please don't crap flood the list with a series of 100 patches.
Split things into logical chunks such that a series can be reasonably reviewed and applied.
Quoted 7 lines
And I'm not sure this series of patches is ready for inclusion in qemu mainline as it should break existing m68k emulation...
Bryce, you should only post your patches, refering to the repository on which they apply, i.e.
git://gitorious.org/qemu-m68k/qemu-m68k.git, master branch.
Btw, are you planning on merging it back someday?
François.
Le 18 août 2011 à 13:12, "François Revol" <[email protected]> a écrit :
Quoted 15 lines · Laurent Vivier
Quoted 14 lines · Anthony Liguori
Quoted 9 lines · Bryce Lanham
Quoted 3 lines
These patches greatly expand Motorola 68k emulation within qemu, and are what I used as a basis for my
Google Summer of Code project to add NeXT hardware support to QEMU.Please don't crap flood the list with a series of 100 patches.
Split things into logical chunks such that a series can be reasonably reviewed and applied.
And I'm not sure this series of patches is ready for inclusion in qemu mainline as it should break existing m68k emulation...
Quoted 7 lines
Quoted 4 lines
Bryce, you should only post your patches, refering to the repository on which they apply, i.e.
git://gitorious.org/qemu-m68k/qemu-m68k.git, master branch.Btw, are you planning on merging it back someday?
Yes... when it will work correctly.
I have at least, to rework 680x0 FPU part (80bit fpu) to not break the existing one (64bit fpu).
I have to check modified instructions don't break existing m68k emulation.
Currently, I'm trying to port some parts of BasiliskII into Qemu to be able to boot MacOS 7.6.
Regards,
Laurent
Quoted 4 lines · Bryce Lanham
Ugh, I'm sorry about that. This is why I should test before using unfamiliar tools. Someone suggested using git format-patch/git send-email instead of a big patch.
That's definitely preferred actually, but you should look at breaking this into multiple logical/self-contained series for easier review/testing.
Quoted 150 lines
Apologies,
Bryce LanhamQuoted 145 lines · Anthony Liguori
Quoted 4 lines · Bryce Lanham
These patches greatly expand Motorola 68k emulation within qemu, and are what I used as a basis for my
Google Summer of Code project to add NeXT hardware support to QEMU.Please don't crap flood the list with a series of 100 patches.
Split things into logical chunks such that a series can be reasonably reviewed and applied.
Regards,
Anthony Liguori
Quoted 128 lines
Bryce Lanham
Alexander Paramonov (1):
linux-user: Signals processing is not thread-safe.Andreas Schwab (3):
m68k: add cas
m68k: define fcntl constants
m68k: add DBcc instruction.Laurent Vivier (106):
linux-user: add qemu-wrapper
linux-user: define default cpu model in configure instead of
linux-user/main.c
linux-user: specify the cpu model during configure linux-user,m68k: display default cpu
linux-user: define new environment variables
linux-user: define a script to set binfmt using debian flavored tools
linux-user: define default cpu model in configure instead of
linux-user/main.c
m68k: addtcg_gen_debug_insn_start()
m68k: define m680x0 CPUs and features
m68k: add missing accessing modes for some instructions.
m68k: add Motorola 680x0 family common instructions.
m68k: add Scc instruction with memory operand.
m68k: add DBcc instruction.
m68k: modify movem instruction to manage word
m68k: add 64bit divide.
m68k: add 32bit and 64bit multiply
m68k: add word data size for suba/adda
m68k: add fpu
m68k: add "byte", "word" and memory shift
m68k: add "byte", "word" and memory rotate.
m68k: addbitfield_mem,bitfield_reg
m68k: add variable offset/width to bitfield_reg/bitfield_mem
m68k: add cas
m68k: allow fpu to manage double data type.
m68k: allow fpu to manage double data type with fmove to<ea>
m68k: add FScc instruction
m68k: add single data type togen_ea
m68k: add linkl instruction
m68k: Add fmovecr
m68k: correct typo onf64_to_i32()return type.
m68k: improveCC_OP_LOGIC
m68k: correct neg condition code flags computation Correct invalid use of "const void *" with "constuint8_t*"
m68k: add EA support for negx
m68k: add abcd instruction
m68k: add sbcd instruction
mm68k: add nbcd instruction
m68k: set X flag according size of operand Set X flag correctly
for addsub,arith_im, addsubq.
m68k: on 0 bit shift, don't update X flag
m68k: improve addx instructions Add (byte, word) opsize Add
memory access
m68k: improve subx,negx instructions Add (byte, word) opsize
Add memory access (subx)
m68k: improve asl/asr evaluate correclty the missing V flag
m68k: useread_imm1()when it is possible
m68k: correct shift side effect for roxrl and roxll
m68k: asl/asr, clear C flag if shift count is 0
m68k: lsl/lsr, clear C flag if shift count is 0
m68k: correct divs.w and divu.w
m68k: correct flags with negl
m68k: for bitfield opcodes, correct operands corruption
m68k: Correct bfclr in register case.
m68k-linux-user: add '--enable-emulop'
m68k: correctly compute divsl
m68k: correctly compute divul
m68k: add m68030 definition
m68k: remove dead code
m68k: remove useless filem68k-qreg.h
m68k: FPU rework (draft)
m68k: some FPU debugging macros
m68k: more tests
m68k: correct computegen_bitfield_cc()
m68k: add fgetexp
m68k: add fscale
m68k: correct addsubq
m68k: add fetox and flogn
m68k: initialize FRegs, definepickNaN()
m68k: correct cmpa comparison datatype
m68k: add flog10
m68k: add cmpm instruction
m68k: add ftwotox instruction
m68k: better fpu traces
m68k: register source operand is always in extended size
m68k: add facos instruction
m68k: add ftan instruction
m68k: add fsin instruction
m68k: add fcos instruction
m68k: correct fpcr update
m68k: add fmod instruction
m68k: flush flags before negx instruction.
m68k: correct fmovemx FP registers order.
m68k: add fatan instruction
m68k: correct bfins instruction
m68k: fcmp correctly compares infinity.
m68k: allows bfins to manage correctly width = 32
m68k: add ftentox instruction
m68k: correctly define and manage NaN
m68k: don't callgdb_register_coprocessor()twice.
m68k: gdb FP registers are 96 bits
m68k: add exg instruction
m68k: definefloatx80_default_inf_highandfloatx80_default_inf_low
m68k: add bkpt instruction
m68k: correctly convert floatx80<->long double
m68k: useexpl()to computeexp_FP0()
m68k: useexp2l()to computeexp2_FP0()
m68k: uselogl()to computeln_FP0()
m68k: uselog10l()to computelog10_FP0()
m68k: correctly load signed word into floating point register
m68k: add fcosh instruction
m68k: add fasin instruction
m68k: add fsincos instruction
m68k: add fsinh instruction
m68k: add ftanh instruction
m68k: add flognp1 instruction
m68k: add fatanh instruction
m68k: first draft of q800 emulation (not working)
m68k: add movec instruction
m68k: move from sr can use effective addresse on m68kPeter Bjørn Jørgensen (1):
m68k: Added ULL to 64 bit integer inhelper.c
Hi Laurent,
Quoted 23 lines · Laurent Vivier
Quoted 19 lines · François Revol
Quoted 17 lines · Laurent Vivier
Quoted 8 lines · Anthony Liguori
Quoted 2 lines · Bryce Lanham
These patches greatly expand Motorola 68k emulation within qemu, and are what I used as a basis for my Google Summer of Code project to add NeXT hardware support to QEMU.
Please don't crap flood the list with a series of 100 patches.
Split things into logical chunks such that a series can be reasonably reviewed and applied.
And I'm not sure this series of patches is ready for inclusion in qemu mainline as it should break existing m68k emulation...
Bryce, you should only post your patches, refering to the repository on which they apply, i.e.
git://gitorious.org/qemu-m68k/qemu-m68k.git, master branch.
Quoted 7 lines
Quoted 2 lines
Btw, are you planning on merging it back someday?
Yes... when it will work correctly.
I have at least, to rework 680x0 FPU part (80bit fpu) to not break the existing one (64bit fpu). I have to check modified instructions don't break existing m68k emulation.
Maybe Bryce can help you
Quoted 1 line
Currently, I'm trying to port some parts of BasiliskII into Qemu to be able to boot MacOS 7.6.
Why are you planning to port a hack instead of making a full machine emulation?
Quoted 2 lines
Regards,
Laurent
Quoted 1 line · Natalia Portillo
Hi Laurent,
Hi Natalia,
Quoted 40 lines · Laurent Vivier
Quoted 39 lines · François Revol
Quoted 3 lines · Laurent Vivier
Quoted 1 line
Le mercredi 17 août 2011 à 17:35 -0500, Anthony Liguori a
écrit :
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines · Bryce Lanham
Quoted 1 line
These patches greatly expand Motorola 68k emulation within
qemu, and are what I used as a basis for my
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Google Summer of Code project to add NeXT hardware support to
QEMU.
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Please don't crap flood the list with a series of 100 patches.
Split things into logical chunks such that a series can be
reasonably
Quoted 3 lines
Quoted 3 lines
Quoted 1 line
reviewed and applied.
And I'm not sure this series of patches is ready for inclusion
in qemu
Quoted 3 lines
Quoted 3 lines
mainline as it should break existing m68k emulation...
Bryce, you should only post your patches, refering to the
repository on
Quoted 1 line
Quoted 1 line
which they apply, i.e.
git://gitorious.org/qemu-m68k/qemu-m68k.git,Quoted 5 lines
Quoted 2 lines
master branch.
Btw, are you planning on merging it back someday?
Yes... when it will work correctly.
Quoted 7 lines
Quoted 4 lines
I have at least, to rework 680x0 FPU part (80bit fpu) to not break the existing one (64bit fpu).
I have to check modified instructions don't break existing m68k emulation.Maybe Bryce can help you
I don't know if he is courageous enough to review and push 111 patches ;-)
Quoted 6 lines
Quoted 2 lines
Currently, I'm trying to port some parts of BasiliskII into Qemu to be able to boot MacOS 7.6.
Why are you planning to port a hack instead of making a full machine emulation?
Because I'm lazy and dumb: the work is already done, I like cut'n'paste.
Regards,
Laurent
Hi Laurent,
Quoted 51 lines · Laurent Vivier
Quoted 1 line · Natalia Portillo
Hi Laurent,
Hi Natalia,
Quoted 46 lines · Laurent Vivier
Quoted 43 lines · François Revol
Quoted 3 lines · Laurent Vivier
Quoted 1 line
Le mercredi 17 août 2011 à 17:35 -0500, Anthony Liguori a
écrit :
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines · Bryce Lanham
Quoted 1 line
These patches greatly expand Motorola 68k emulation within
qemu, and are what I used as a basis for my
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Google Summer of Code project to add NeXT hardware support to
QEMU.
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Please don't crap flood the list with a series of 100 patches.
Split things into logical chunks such that a series can be
reasonably
Quoted 3 lines
Quoted 3 lines
Quoted 1 line
reviewed and applied.
And I'm not sure this series of patches is ready for inclusion
in qemu
Quoted 3 lines
Quoted 3 lines
mainline as it should break existing m68k emulation...
Bryce, you should only post your patches, refering to the
repository on
Quoted 1 line
Quoted 1 line
which they apply, i.e.
git://gitorious.org/qemu-m68k/qemu-m68k.git,Quoted 5 lines
Quoted 2 lines
master branch.
Btw, are you planning on merging it back someday?
Yes... when it will work correctly.
I have at least, to rework 680x0 FPU part (80bit fpu) to not break the existing one (64bit fpu).
I have to check modified instructions don't break existing m68k emulation.
Quoted 4 lines
Quoted 1 line
Maybe Bryce can help you
I don't know if he is courageous enough to review and push 111 patches ;-)
He worked on emulating an abandoned, strange, difficult to get, and undocumented hardware, using your 111 patches, and finished it before the wholy more experienced MESS team.
He is! xD
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
Currently, I'm trying to port some parts of BasiliskII into Qemu to be able to boot MacOS 7.6.
Why are you planning to port a hack instead of making a full machine emulation?
Because I'm lazy and dumb: the work is already done, I like cut'n'paste.
Yeah, you said it!
The work is already done, we have all the hardware emulation that Basilisk substitutes for hacks. We only lack the 68k cpu (oh! your patches!!!) and the glue :p
Please don't port Basilisk on top of TCG, I beg to you in the name of some god of your own choice :(
(1000 Mb floppies patching .sony instead of implementing SCSI and SWIM, no ethernet controller but a working TCP/IP, oh hell, it's not a Mac, it's a Match!)
Quoted 55 lines · Natalia Portillo
Hi Laurent,
Quoted 51 lines · Laurent Vivier
Quoted 1 line · Natalia Portillo
Hi Laurent,
Hi Natalia,
Quoted 46 lines · Laurent Vivier
Quoted 43 lines · François Revol
Quoted 3 lines · Laurent Vivier
Quoted 1 line
Le mercredi 17 août 2011 à 17:35 -0500, Anthony Liguori a
écrit :
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines · Bryce Lanham
Quoted 1 line
These patches greatly expand Motorola 68k emulation within
qemu, and are what I used as a basis for my
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Google Summer of Code project to add NeXT hardware support to
QEMU.
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Please don't crap flood the list with a series of 100 patches.
Split things into logical chunks such that a series can be
reasonably
Quoted 3 lines
Quoted 3 lines
Quoted 1 line
reviewed and applied.
And I'm not sure this series of patches is ready for inclusion
in qemu
Quoted 3 lines
Quoted 3 lines
mainline as it should break existing m68k emulation...
Bryce, you should only post your patches, refering to the
repository on
Quoted 1 line
Quoted 1 line
which they apply, i.e.
git://gitorious.org/qemu-m68k/qemu-m68k.git,Quoted 5 lines
Quoted 2 lines
master branch.
Btw, are you planning on merging it back someday?
Yes... when it will work correctly.
I have at least, to rework 680x0 FPU part (80bit fpu) to not break the existing one (64bit fpu).
I have to check modified instructions don't break existing m68k emulation.
Quoted 6 lines
Quoted 4 lines
Quoted 1 line
Maybe Bryce can help you
I don't know if he is courageous enough to review and push 111 patches ;-)
He worked on emulating an abandoned, strange, difficult to get, and undocumented hardware, using your 111 patches, and finished it before the wholy more experienced MESS team.
The next-cube emulation is really working ?
Quoted 1 line
He is! xD
There is no problem for me, he can do...
Quoted 11 lines
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
Currently, I'm trying to port some parts of BasiliskII into Qemu to be able to boot MacOS 7.6.
Why are you planning to port a hack instead of making a full machine emulation?
Because I'm lazy and dumb: the work is already done, I like cut'n'paste.
Yeah, you said it!
The work is already done, we have all the hardware emulation that Basilisk substitutes for hacks.
I'm not sure of that... no MMU emulation, no Nubus, no ethernet card, no video card, no SWIM, no SCSI, ... useless with a patched ROM.
You know, nights are not long enough...
Quoted 1 line
We only lack the 68k cpu (oh! your patches!!!) and the glue :p
this part is not working well as well ... gcc cannot compile linux kernel, some demos fail in gtk-demo, ...
Quoted 1 line
Please don't port Basilisk on top of TCG, I beg to you in the name of some god of your own choice :(
I believe only in Santa Claus, and it's not Christmas.
Quoted 1 line
(1000 Mb floppies patching .sony instead of implementing SCSI and SWIM, no ethernet controller but a working TCP/IP, oh hell, it's not a Mac, it's a Match!)
Regards,
Laurent
Hi,
Quoted 56 lines · Laurent Vivier
Quoted 55 lines · Natalia Portillo
Hi Laurent,
Quoted 51 lines · Laurent Vivier
Quoted 1 line · Natalia Portillo
Hi Laurent,
Hi Natalia,
Quoted 46 lines · Laurent Vivier
Quoted 43 lines · François Revol
Quoted 3 lines · Laurent Vivier
Quoted 1 line
Le mercredi 17 août 2011 à 17:35 -0500, Anthony Liguori a
écrit :
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines · Bryce Lanham
Quoted 1 line
These patches greatly expand Motorola 68k emulation within
qemu, and are what I used as a basis for my
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Google Summer of Code project to add NeXT hardware support to
QEMU.
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Please don't crap flood the list with a series of 100 patches.
Split things into logical chunks such that a series can be
reasonably
Quoted 3 lines
Quoted 3 lines
Quoted 1 line
reviewed and applied.
And I'm not sure this series of patches is ready for inclusion
in qemu
Quoted 3 lines
Quoted 3 lines
mainline as it should break existing m68k emulation...
Bryce, you should only post your patches, refering to the
repository on
Quoted 1 line
Quoted 1 line
which they apply, i.e.
git://gitorious.org/qemu-m68k/qemu-m68k.git,Quoted 5 lines
Quoted 2 lines
master branch.
Btw, are you planning on merging it back someday?
Yes... when it will work correctly.
I have at least, to rework 680x0 FPU part (80bit fpu) to not break the existing one (64bit fpu).
I have to check modified instructions don't break existing m68k emulation.
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Quoted 1 line
Maybe Bryce can help you
I don't know if he is courageous enough to review and push 111 patches ;-)
He worked on emulating an abandoned, strange, difficult to get, and undocumented hardware, using your 111 patches, and finished it before the wholy more experienced MESS team.
The next-cube emulation is really working ?
Yes, it is, absolutely.
Quoted 11 lines
Quoted 1 line
He is! xD
There is no problem for me, he can do...
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
Quoted 2 lines
Currently, I'm trying to port some parts of BasiliskII into Qemu to be able to boot MacOS 7.6.
Why are you planning to port a hack instead of making a full machine emulation?
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
Because I'm lazy and dumb: the work is already done, I like cut'n'paste.
Yeah, you said it!
The work is already done, we have all the hardware emulation that Basilisk substitutes for hacks.I'm not sure of that... no MMU emulation, no Nubus, no ethernet card, no video card, no SWIM, no SCSI, ... useless with a patched ROM.
Macs do not have videocards :p, only the Mac II and we're not forced to emulate that one.
SWIM is a piece of cake that can be even implemented without ICs, just some logical arrays.
NuBus is not required for almost anything, only the video card uses it, and it's present only on the Mac II, a stub will suffice to make Toolbox be happy. Most m68k didn't include a network card, third party ones are stock chips (probably almost all are NE2000, 3COM and PCNET), and Apple integrated ones are also stock, easy to do :p The MMU is your part I won't discuss on it.
But porting BasiliskII will not make qemu have an m68k-system, but a macos7-wrapper.
And that's the problem with Basilisk, that's why you cannot partition a disk, try MachTen, don't even think on A/UX.
If you insist, please name it "basilisk2" and let Bryce (he wants to in the future) do the real machines (-M quadra, -M centris, -M IIcx)
Quoted 1 line
You know, nights are not long enough...
Move to North Pole, I've heard nights are six month long there ^^
Quoted 4 lines
Quoted 1 line
We only lack the 68k cpu (oh! your patches!!!) and the glue :p
this part is not working well as well ... gcc cannot compile linux kernel, some demos fail in gtk-demo, ...
I know it's not perfect, but right now, it's better than nothing.
There is no 68k cpu emulation complete afaik, I discussed with Ray Arachelian a lot on that when he was working on LisaEm. However emulators are live, Aranym, UAE, LisaEm, BasiliskII.
qemu-m68k is quite complete to go live (when it does not break mcoldfire) right now. Bugs are easy to be corrected by more people when they are in main than in a developer's own clone.
Leave your little kid go wild, it's old and big enough :p
Quoted 9 lines
Quoted 1 line
Please don't port Basilisk on top of TCG, I beg to you in the name of some god of your own choice :(
I believe only in Santa Claus, and it's not Christmas.
Quoted 1 line
(1000 Mb floppies patching .sony instead of implementing SCSI and SWIM, no ethernet controller but a working TCP/IP, oh hell, it's not a Mac, it's a Match!)
Regards,
Laurent
Quoted 2 lines · Natalia Portillo
Hi,
[...]
(no need to quote the full thread!)
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
He worked on emulating an abandoned, strange, difficult to get, and undocumented hardware, using your 111 patches, and finished it before the wholy more experienced MESS team.
The next-cube emulation is really working ?
Yes, it is, absolutely.
Cool I need to add this target to my Haiku port... where are the docs for the boot process ?
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
Why are you planning to port a hack instead of making a full machine emulation?
Because I'm lazy and dumb: the work is already done, I like cut'n'paste.
Yeah, you said it!
The work is already done, we have all the hardware emulation that Basilisk substitutes for hacks.
Quoted 7 lines
Quoted 2 lines
I'm not sure of that... no MMU emulation, no Nubus, no ethernet card, no video card, no SWIM, no SCSI, ... useless with a patched ROM.
Macs do not have videocards :p, only the Mac II and we're not forced to emulate that one.
SWIM is a piece of cake that can be even implemented without ICs, just some logical arrays.
NuBus is not required for almost anything, only the video card uses it, and it's present only on the Mac II, a stub will suffice to make Toolbox be happy. Most m68k didn't include a network card, third party ones are stock chips (probably almost all are NE2000, 3COM and PCNET), and Apple integrated ones are also stock, easy to do :p
NIC isn't really necessary at first, those things don't netboot anyway, do they ?
Quoted 1 line
The MMU is your part I won't discuss on it.
There is 040 mmu support in ARAnyM (Atari Running on Any Machine), enough to run Linux, that has been backported to UAE (ARAnyM is based on the UAE core), that should give some hints:
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=201442
http://www.amigaemulator.org/patches
http://www.amigaemulator.org/bin/patches/mmu/uae-0.8.20.2-mmu.diff.gz
(though I fixed a bug in handling TTR1 in ARAnyM)
It's why I chose to go Falcon first and use ARAnyM for the 68k Haiku port.
The 030 or 68551 ones are much more complex though (the 040 one has a fixed table layout, others have fully configurable table size for all the 4 levels). The 060 one is just the 040 with some cache restrictions.
Quoted 8 lines
I know it's not perfect, but right now, it's better than nothing.
There is no 68k cpu emulation complete afaik, I discussed with Ray Arachelian a lot on that when he was working on LisaEm. However emulators are live, Aranym, UAE, LisaEm, BasiliskII.qemu-m68k is quite complete to go live (when it does not break mcoldfire) right now. Bugs are easy to be corrected by more people when they are in main than in a developer's own clone.
Leave your little kid go wild, it's old and big enough :p
Release early, release often :p
François.
Quoted 8 lines · François Revol
Quoted 2 lines · Natalia Portillo
Hi,
[...]
(no need to quote the full thread!)Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
He worked on emulating an abandoned, strange, difficult to get, and undocumented hardware, using your 111 patches, and finished it before the wholy more experienced MESS team.
The next-cube emulation is really working ?
Yes, it is, absolutely.
Cool I need to add this target to my Haiku port... where are the docs for the boot process ?
NetBSD sources :D
Quoted 12 lines
Quoted 12 lines
Quoted 11 lines
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
Why are you planning to port a hack instead of making a full machine emulation?
Because I'm lazy and dumb: the work is already done, I like cut'n'paste.
Yeah, you said it!
The work is already done, we have all the hardware emulation that Basilisk substitutes for hacks.I'm not sure of that... no MMU emulation, no Nubus, no ethernet card, no video card, no SWIM, no SCSI, ... useless with a patched ROM.
Quoted 6 lines
Quoted 4 lines
Macs do not have videocards :p, only the Mac II and we're not forced to emulate that one.
SWIM is a piece of cake that can be even implemented without ICs, just some logical arrays.
NuBus is not required for almost anything, only the video card uses it, and it's present only on the Mac II, a stub will suffice to make Toolbox be happy. Most m68k didn't include a network card, third party ones are stock chips (probably almost all are NE2000, 3COM and PCNET), and Apple integrated ones are also stock, easy to do :pNIC isn't really necessary at first, those things don't netboot anyway, do they ?
AFAIK, none of them did until PowerPC, and that was OpenFirmware.
Quoted 16 lines
Quoted 1 line
The MMU is your part I won't discuss on it.
There is 040 mmu support in ARAnyM (Atari Running on Any Machine), enough to run Linux, that has been backported to UAE (ARAnyM is based on the UAE core), that should give some hints:
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=201442
http://www.amigaemulator.org/patches
http://www.amigaemulator.org/bin/patches/mmu/uae-0.8.20.2-mmu.diff.gz
(though I fixed a bug in handling TTR1 in ARAnyM)It's why I chose to go Falcon first and use ARAnyM for the 68k Haiku port.
The 030 or 68551 ones are much more complex though (the 040 one has a fixed table layout, others have fully configurable table size for all the 4 levels). The 060 one is just the 040 with some cache restrictions.
Quoted 4 lines
I know it's not perfect, but right now, it's better than nothing.
There is no 68k cpu emulation complete afaik, I discussed with Ray Arachelian a lot on that when he was working on LisaEm. However emulators are live, Aranym, UAE, LisaEm, BasiliskII.
Quoted 6 lines
Quoted 4 lines
qemu-m68k is quite complete to go live (when it does not break mcoldfire) right now. Bugs are easy to be corrected by more people when they are in main than in a developer's own clone.
Leave your little kid go wild, it's old and big enough :p
Release early, release often :p
+1
Quoted 1 line
François.
Le 19 août 2011 à 17:52, Natalia Portillo <[email protected]> a écrit :
Quoted 2 lines · François Revol
[snip]
Quoted 4 lines
Quoted 1 line
Release early, release often :p
+1Ok, Ok, I think all m68k core can be submitted except some bitfield operations and fpu instructions.
Just need to know how Anthony and Paul want I proceed...
Regards,
Laurent
Quoted 8 lines · Laurent Vivier
Quoted 1 line · Natalia Portillo
Quoted 8 lines
Quoted 1 line · François Revol
[snip]
Quoted 4 lines
Quoted 1 line
Release early, release often :p
+1Ok, Ok, I think all m68k core can be submitted except some bitfield operations and fpu instructions.
Just need to know how Anthony and Paul want I proceed...
Well let's step back here for a minute.
The most important problem to solve is for someone to maintain whatever is in the tree consistently (and incrementally) improving what we have.
Laurent, if you want to take over m68k and Paul doesn't object, I'm all for it. But that doesn't mean that I want to see 400 commits of stuff that only half works. I'd like to see a systematic approach to either picking a platform and making it robust or fixing what's there already.
Regards,
Anthony Liguori
Quoted 3 lines
Regards,
Laurent
Quoted 2 lines · Bryce Lanham
These patches greatly expand Motorola 68k emulation within qemu, and are what I used as a basis for my Google Summer of Code project to add NeXT hardware support to QEMU.
Can I get these patches as a tarball or a git tree or something? Trying to fish them out of either thunderbird of the web archive is a bit tricky, and I'd very much like to test them.
Also, it looks like you're adding NeXT target support. What would be involved in adding simple Amiga, Atari, or ancient macintosh support that Linux could boot on? (I.E. I'm interested in Linux system emulation of non-coldfire m68k. So far that means "use aranym".)
Thanks,
Rob
Quoted 15 lines · François Revol
Quoted 14 lines · Laurent Vivier
Quoted 9 lines · Anthony Liguori
Quoted 3 lines · Bryce Lanham
These patches greatly expand Motorola 68k emulation within qemu, and are what I used as a basis for my
Google Summer of Code project to add NeXT hardware support to QEMU.Please don't crap flood the list with a series of 100 patches.
Split things into logical chunks such that a series can be reasonably reviewed and applied.
And I'm not sure this series of patches is ready for inclusion in qemu mainline as it should break existing m68k emulation...
Quoted 8 lines
Quoted 4 lines
Bryce, you should only post your patches, refering to the repository on which they apply, i.e.
git://gitorious.org/qemu-m68k/qemu-m68k.git, master branch.Btw, are you planning on merging it back someday?
François.
I note that I pulled that this morning, did "./configure --disable-werror --target-list=m68k-softmmu", and then ran make, which generated 4 header files and considered itself done.
I.E. m68k system emulation doesn't seem to be building in that tree.
Rob
Quoted 41 lines · Natalia Portillo
Hi Laurent,
Quoted 37 lines · Laurent Vivier
Quoted 4 lines · Le 18 août 2011 à 13:12, "François Revol" <[email protected]…
Quoted 3 lines · Laurent Vivier
Quoted 2 lines · Anthony Liguori
Quoted 1 line · Bryce Lanham
These patches greatly expand Motorola 68k emulation within qemu,
and are what I used as a basis for my
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 1 line
Google Summer of Code project to add NeXT hardware support to QEMU.
Please don't crap flood the list with a series of 100 patches.
Split things into logical chunks such that a series can be
reasonably
Quoted 3 lines
Quoted 3 lines
Quoted 1 line
reviewed and applied.
And I'm not sure this series of patches is ready for inclusion in
qemu
Quoted 3 lines
Quoted 3 lines
mainline as it should break existing m68k emulation...
Bryce, you should only post your patches, refering to the
repository on
Quoted 6 lines
Quoted 3 lines
which they apply, i.e.
git://gitorious.org/qemu-m68k/qemu-m68k.git, master branch.Btw, are you planning on merging it back someday?
Yes... when it will work correctly.
Quoted 5 lines
Quoted 3 lines
I have at least, to rework 680x0 FPU part (80bit fpu) to not break the existing one (64bit fpu).
I have to check modified instructions don't break existing m68k emulation.Maybe Bryce can help you
I have a build system that builds the same simple Linux system for a dozen different targets (uClibc 0.9.32, Linux 3.0, busybox 1.19.0, binutils 2.17, gcc 4.2.1, make 3.81), boots them all under qemu the same way, and either interactively use them or can automatically build the whole of Linux From Scratch under them (either with a fully native toolchain or with distcc calling out to the cross compiler to speed things up).
I would very much like to test m68k. I've been building m68k system images forever (the kernel's some atari variant donated to the project by a user), but have only been able to test them a couple times under aranym, not under qemu.
Web page:
http://landley.net/aboriginal
Prebuilt binary system images for use with qemu:
http://landley.net/aboriginal/downloads/binaries
Quoted 5 lines
Quoted 2 lines
Currently, I'm trying to port some parts of BasiliskII into Qemu to be able to boot MacOS 7.6.
Why are you planning to port a hack instead of making a full machine emulation?
Yay machine emulation. If qemu comes up with an m68k system emulation that has a chance of running Linux, please let me know...
Rob
Quoted 23 lines · Rob Landley
Quoted 22 lines · François Revol
Quoted 11 lines · Laurent Vivier
Quoted 9 lines · Anthony Liguori
Quoted 3 lines · Bryce Lanham
These patches greatly expand Motorola 68k emulation within qemu, and are what I used as a basis for my
Google Summer of Code project to add NeXT hardware support to QEMU.Please don't crap flood the list with a series of 100 patches.
Split things into logical chunks such that a series can be reasonably reviewed and applied.
Quoted 7 lines
And I'm not sure this series of patches is ready for inclusion in qemu mainline as it should break existing m68k emulation...
Bryce, you should only post your patches, refering to the repository on which they apply, i.e.
git://gitorious.org/qemu-m68k/qemu-m68k.git, master branch.Btw, are you planning on merging it back someday?
Quoted 7 lines
Quoted 1 line
François.
I note that I pulled that this morning, did "./configure --disable-werror --target-list=m68k-softmmu", and then ran make, which generated 4 header files and considered itself done.
I.E. m68k system emulation doesn't seem to be building in that tree.
first off all, this branch is only able to build m68k-linux-user qemu/, then try:
cd qemu
mkdir build-test
cd build-test
../configure --disable-werror --target-list=m68k-softmmu make
and let me know what happens...
Regards,
Laurent
Quoted 44 lines · François Revol
Quoted 2 lines · Natalia Portillo
Hi,
[...]
(no need to quote the full thread!)Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
He worked on emulating an abandoned, strange, difficult to get, and undocumented hardware, using your 111 patches, and finished it before the wholy more experienced MESS team.
The next-cube emulation is really working ?
Yes, it is, absolutely.
Cool I need to add this target to my Haiku port... where are the docs for the boot process ?
Quoted 13 lines
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
Quoted 2 lines
Why are you planning to port a hack instead of making a full machine emulation?
Because I'm lazy and dumb: the work is already done, I like cut'n'paste.
Quoted 6 lines
Quoted 3 lines
Yeah, you said it!
The work is already done, we have all the hardware emulation that Basilisk substitutes for hacks.I'm not sure of that... no MMU emulation, no Nubus, no ethernet card, no video card, no SWIM, no SCSI, ... useless with a patched ROM.
Quoted 10 lines
Macs do not have videocards :p, only the Mac II and we're not forced to emulate that one.
SWIM is a piece of cake that can be even implemented without ICs, just some logical arrays.
NuBus is not required for almost anything, only the video card uses it, and it's present only on the Mac II, a stub will suffice to make Toolbox be happy.
Most m68k didn't include a network card, third party ones are stock chips (probably almost all are NE2000, 3COM and PCNET), and Apple integrated ones are also stock, easy to do :p
Quoted 2 lines
NIC isn't really necessary at first, those things don't netboot anyway, do they ?
The hardware I'm interested in is:
A) CPU with MMU (FPU is nice but optional)
B) At least 256k ram,
C) Serial port
D) Three hard drives (IDE, SCSI, etc.)
E) Hardware clock
F) Network card (for distcc)
One of the goals of mmy project is to replace cross comiling with native compiling, and that's the set of hardware I need to get a reasonably convenient native development environment running under the emulator.
Rob
Quoted 16 lines · Anthony Liguori
Quoted 15 lines · Laurent Vivier
Quoted 2 lines · Natalia Portillo
El 19/08/2011, a las 09:55, François Revol escribió:
[snip]
Quoted 4 lines
Quoted 1 line
Release early, release often :p
+1Ok, Ok, I think all m68k core can be submitted except some bitfield operations and fpu instructions.
Quoted 6 lines
Quoted 1 line
Just need to know how Anthony and Paul want I proceed...
Well let's step back here for a minute.
The most important problem to solve is for someone to maintain whatever is in the tree consistently (and incrementally) improving what we have.
I dunno about maintain and improve, but if an m68k board emulation starts working I can regression test it against Linux system images and make puppy eyes at people when it breaks. (Plus the occasional monkey patch offering The Wrong Fix to motivate people. :)
Quoted 4 lines
Laurent, if you want to take over m68k and Paul doesn't object, I'm all for it. But that doesn't mean that I want to see 400 commits of stuff that only half works. I'd like to see a systematic approach to either picking a platform and making it robust or fixing what's there already.
I would very much like something capable of booting m68k Linux, specifically
http://landley.net/aboriginal/downloads/binaries/old/1.0.1/system-image-m68k.tar.bz2
(The kernel in that tarball is randomish, I think some defconfig for atari, but the root filesystem was tested under ananym and worked.)
I'm in the process of building a Linux 3.0, uClibc 0.9.32, busybox 1.19.0 variant which should be ready tomorrow-ish, if that would be a better testing base. I'm probably basing it on the atari_defconfig in the 3.0 kernel unless somebody has a better idea. (In case I need to fish out aranym again.)
Rob
Quoted 84 lines · Laurent Vivier
Quoted 55 lines · Natalia Portillo
Hi Laurent,
Quoted 51 lines · Laurent Vivier
Quoted 1 line · Natalia Portillo
Hi Laurent,
Hi Natalia,
Quoted 46 lines · Laurent Vivier
Quoted 43 lines · François Revol
Quoted 3 lines · Laurent Vivier
Quoted 1 line
Le mercredi 17 août 2011 à 17:35 -0500, Anthony Liguori a
écrit :
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines · Bryce Lanham
Quoted 1 line
These patches greatly expand Motorola 68k emulation within
qemu, and are what I used as a basis for my
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Google Summer of Code project to add NeXT hardware support to
QEMU.
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Please don't crap flood the list with a series of 100 patches.
Split things into logical chunks such that a series can be
reasonably
Quoted 3 lines
Quoted 3 lines
Quoted 1 line
reviewed and applied.
And I'm not sure this series of patches is ready for inclusion
in qemu
Quoted 3 lines
Quoted 3 lines
mainline as it should break existing m68k emulation...
Bryce, you should only post your patches, refering to the
repository on
Quoted 1 line
Quoted 1 line
which they apply, i.e.
git://gitorious.org/qemu-m68k/qemu-m68k.git,Quoted 5 lines
Quoted 2 lines
master branch.
Btw, are you planning on merging it back someday?
Yes... when it will work correctly.
I have at least, to rework 680x0 FPU part (80bit fpu) to not break the existing one (64bit fpu).
I have to check modified instructions don't break existing m68k emulation.Quoted 6 lines
Quoted 4 lines
Quoted 1 line
Maybe Bryce can help you
I don't know if he is courageous enough to review and push 111 patches ;-)
He worked on emulating an abandoned, strange, difficult to get, and undocumented hardware, using your 111 patches, and finished it before the wholy more experienced MESS team.
The next-cube emulation is really working ?
Quoted 1 line
He is! xD
There is no problem for me, he can do...
Quoted 11 lines
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
Currently, I'm trying to port some parts of BasiliskII into Qemu to be able to boot MacOS 7.6.
Why are you planning to port a hack instead of making a full machine emulation?
Because I'm lazy and dumb: the work is already done, I like cut'n'paste.
Yeah, you said it!
The work is already done, we have all the hardware emulation that Basilisk substitutes for hacks.I'm not sure of that... no MMU emulation, no Nubus, no ethernet card, no video card, no SWIM, no SCSI, ... useless with a patched ROM.
Quoted 6 lines
You know, nights are not long enough...
Quoted 1 line
We only lack the 68k cpu (oh! your patches!!!) and the glue :p
this part is not working well as well ... gcc cannot compile linux kernel, some demos fail in gtk-demo, ...
I got gcc 4.2.1 with binutils 2.17 to compile the m68k Linux kernel (including 3.0).
This kind of regression testing of each new release on various platforms is what I've been doing for the ones I've got working for years now. I'd love to add m68k to it (heck, I've got infrastructure to do nightly builds from upstream -git of the kernel and uClibc and auto-bisect breakage that prevented dropbear and strace from building natively under the result; I admit I haven't put in the effort to follow up on the result yet).
But all i've been able to say so far is 'I got it to compile", I can't _run_ it on qemu. (And my aranym setup keeps bit rotting, and hasn't got the right kind of console anyway...)
Rob
Quoted 35 lines · Laurent Vivier
Quoted 23 lines · Rob Landley
Quoted 22 lines · François Revol
Quoted 11 lines · Laurent Vivier
Quoted 9 lines · Anthony Liguori
Quoted 3 lines · Bryce Lanham
These patches greatly expand Motorola 68k emulation within qemu, and are what I used as a basis for my
Google Summer of Code project to add NeXT hardware support to QEMU.Please don't crap flood the list with a series of 100 patches.
Split things into logical chunks such that a series can be reasonably reviewed and applied.
Quoted 7 lines
And I'm not sure this series of patches is ready for inclusion in qemu mainline as it should break existing m68k emulation...
Bryce, you should only post your patches, refering to the repository on which they apply, i.e.
git://gitorious.org/qemu-m68k/qemu-m68k.git, master branch.Btw, are you planning on merging it back someday?
Quoted 7 lines
Quoted 1 line
François.
I note that I pulled that this morning, did "./configure --disable-werror --target-list=m68k-softmmu", and then ran make, which generated 4 header files and considered itself done.
I.E. m68k system emulation doesn't seem to be building in that tree.
first off all, this branch is only able to build m68k-linux-user qemu/, then try:
Quoted 7 lines
cd qemu
mkdir build-test
cd build-test
../configure --disable-werror --target-list=m68k-softmmu makeand let me know what happens...
It complained about config-devices.mak not being there... then built for a while until it died with:
qapi-generated/qga-qapi-types.c:19:28: error: qga-qapi-visit.h: No such file or directory
Rob
Quoted 5 lines · Laurent Vivier
Quoted 1 line
I.E. m68k system emulation doesn't seem to be building in that tree.
first off all, this branch is only able to build m68k-linux-user qemu/, then try:
Quoted 7 lines
cd qemu
mkdir build-test
cd build-test
../configure --disable-werror --target-list=m68k-softmmu makeand let me know what happens...
Ahem, helps to do that in the right tree. (That test was in current vanilla -git.)
It built fine. No new board targets, but I'll see if I can find time to fiddle with it.
Thanks,
Rob
Hi,
Quoted 10 lines · Rob Landley
Quoted 2 lines · Bryce Lanham
These patches greatly expand Motorola 68k emulation within qemu, and are what I used as a basis for my Google Summer of Code project to add NeXT hardware support to QEMU.
Can I get these patches as a tarball or a git tree or something? Trying to fish them out of either thunderbird of the web archive is a bit tricky, and I'd very much like to test them.
Also, it looks like you're adding NeXT target support. What would be involved in adding simple Amiga
You would need to add (or copy/paste from UAE) all the Amiga custom chips, the Zorro bus, and implement the MMU (currently is anything but finished in Laurent's words)
Quoted 1 line
, Atari,
You would need to add (or copy/paste from Aranym) all the Atari Falcon not-so-custom chips, and implement the MMU.
Quoted 1 line
or ancient macintosh support
Most of the hardware (but a few required ones like SWIM) is already in QEMU, you need to glue everything, make Toolbox be VERY happy about its environment, make Mac OS boot so it can second-boot Linux (the direct-booter is so buggy it may introduce phantom bugs on the emulation) and implement the MMU.
Quoted 2 lines
that Linux could boot on? (I.E. I'm interested in Linux system emulation of non-coldfire m68k. So far that means "use aranym".)
Linux requires the MMU and an almost complete hardware emulation.
Standard m68k emulations (UAE, Aranym and specially BasiliskII) try to patch the OS to work.
Indeed BasiliskII is anything but a real macintosh emulator, as it patches heavily the Toolbox and Mac OS (that's why Linux and A/UX will never work on it)
Quoted 4 lines
Thanks,
Rob
Quoted 35 lines · Laurent Vivier
Quoted 23 lines · Rob Landley
Quoted 22 lines · François Revol
Quoted 11 lines · Laurent Vivier
Quoted 9 lines · Anthony Liguori
Quoted 3 lines · Bryce Lanham
These patches greatly expand Motorola 68k emulation within qemu, and are what I used as a basis for my
Google Summer of Code project to add NeXT hardware support to QEMU.Please don't crap flood the list with a series of 100 patches.
Split things into logical chunks such that a series can be reasonably reviewed and applied.
Quoted 7 lines
And I'm not sure this series of patches is ready for inclusion in qemu mainline as it should break existing m68k emulation...
Bryce, you should only post your patches, refering to the repository on which they apply, i.e.
git://gitorious.org/qemu-m68k/qemu-m68k.git, master branch.Btw, are you planning on merging it back someday?
Quoted 7 lines
Quoted 1 line
François.
I note that I pulled that this morning, did "./configure --disable-werror --target-list=m68k-softmmu", and then ran make, which generated 4 header files and considered itself done.
I.E. m68k system emulation doesn't seem to be building in that tree.
first off all, this branch is only able to build m68k-linux-user qemu/, then try:
Quoted 7 lines
cd qemu
mkdir build-test
cd build-test
../configure --disable-werror --target-list=m68k-softmmu makeand let me know what happens...
Hmmm, there is a q800 target I hadn't noticed. I built the mac_defconfig target and did -kernel vmlinux on that with -nographic and -append "console=/dev/ttyS0", and it went:
(qemu) QEMU 0.15.50 monitor - type 'help' for more information (qemu) qemu: fatal: Illegal instruction: 7f45 @ 00000000
D0 = fffffffb A0 = 0021b24c F0 = ffff c000000000000000 D1 = 00000000 A1 = 002c16fe F1 = ffff c000000000000000 D2 = 002c002c A2 = 00001000 F2 = ffff c000000000000000 D3 = 17b82700 A3 = 002d8eb0 F3 = ffff c000000000000000 D4 = 00000000 A4 = 00000000 F4 = ffff c000000000000000 D5 = 00000000 A5 = 00000000 F5 = ffff c000000000000000 D6 = 00000000 A6 = 00000000 F6 = ffff c000000000000000 D7 = 00000000 A7 = 0000103c F7 = ffff c000000000000000 PC = 00000000 SR = 2700 ----- Aborted
This sound at all familiar? (Is there a different kernel file I should be using? There's no arch/m68k/boot or arch/m68k/mac/boot I could find.
Or is q800 not entirely there?)
Thanks,
Rob
Quoted 7 lines · Natalia Portillo
Quoted 1 line
or ancient macintosh support
Most of the hardware (but a few required ones like SWIM) is already in QEMU, you need to glue everything, make Toolbox be VERY happy about its environment, make Mac OS boot so it can second-boot Linux (the direct-booter is so buggy it may introduce phantom bugs on the emulation) and implement the MMU.
I haven't got a copy of ancient MacOS.
Why is the direct booter buggy? I'm happy to track down and isolate phantom bugs, either in the kernel or in qemu. (One nice thing about emulators is you can get deterministic regression tests reasonably easily. :)
How do I _use_ the direct booter, anyway? I built mac_defconfig in 3.0 but it only gave me a vmlinux, which faulted on the instruction at address 0. I tried m68k-objdump -O binary vmlinux vmlinux.bin but that wouldnt' bot at all (qemu -kernel refused to load it).
Quoted 6 lines
Quoted 2 lines
that Linux could boot on? (I.E. I'm interested in Linux system emulation of non-coldfire m68k. So far that means "use aranym".)
Linux requires the MMU and an almost complete hardware emulation. Standard m68k emulations (UAE, Aranym and specially BasiliskII) try to patch the OS to work.
That's kinda sad. Is there a web page anywhere that elaborates on this?
Quoted 3 lines
Indeed BasiliskII is anything but a real macintosh emulator, as it patches heavily the Toolbox and Mac OS (that's why Linux and A/UX will never work on it)
I believe toolbox is the ancient mac bios, correct? Does Linux need/use it at all?
Rob
Quoted 21 lines · Rob Landley
Quoted 7 lines · Natalia Portillo
Quoted 1 line
or ancient macintosh support
Most of the hardware (but a few required ones like SWIM) is already in QEMU, you need to glue everything, make Toolbox be VERY happy about its environment, make Mac OS boot so it can second-boot Linux (the direct-booter is so buggy it may introduce phantom bugs on the emulation) and implement the MMU.
I haven't got a copy of ancient MacOS.
Why is the direct booter buggy? I'm happy to track down and isolate phantom bugs, either in the kernel or in qemu. (One nice thing about emulators is you can get deterministic regression tests reasonably easily. :)
How do I _use_ the direct booter, anyway? I built
mac_defconfigin 3.0 but it only gave me a vmlinux, which faulted on the instruction at address 0. I tried m68k-objdump -O binary vmlinux vmlinux.bin but that wouldnt' bot at all (qemu -kernel refused to load it).
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
that Linux could boot on? (I.E. I'm interested in Linux system emulation of non-coldfire m68k. So far that means "use aranym".)
Linux requires the MMU and an almost complete hardware emulation. Standard m68k emulations (UAE, Aranym and specially BasiliskII) try to patch the OS to work.
That's kinda sad. Is there a web page anywhere that elaborates on this?
It is a known thing that Linux requires MMU, it appears on the installation guide of all m68k distros. On how and how much they patch the OS, check their sources.
Quoted 6 lines
Quoted 3 lines
Indeed BasiliskII is anything but a real macintosh emulator, as it patches heavily the Toolbox and Mac OS (that's why Linux and A/UX will never work on it)
I believe toolbox is the ancient mac bios, correct? Does Linux need/use it at all?
Yes and no to both.
Mac OS is a really complex operating system where everything is divided in little pieces that can be loaded individually and independently (the Grand Unified Model, the reason why resource forks exist). Toolbox is the most important part, the one that resides inside the ROM chip, provides the specific model drivers (and in the II models, loads the video driver from the NuBus card), and loads the rest of the system from the System file inside MacOS.
It does not expect a boot loader, it's the OS itself, indeed in an specific model the whole OS is contained in ROM.
There is a table for OS functions that can be made to point to ROM (implemented on Toolbox) or in RAM (System file, bug or functionality updates).
BasiliskII patches that table inserting their own functions (for example, the floppy driver is "enhanced" to provide access to the host disk images, instead of calling to the SWIM chip that will manage the floppy drive in a real macintosh).
The Linux bootloader is nothing more than a Mac OS application that loads the Linux kernel and gives it access to the full RAM, where it can (and as you see in the compatibility list, does not so well) access to the whole Macintosh hardware bypassing both Toolbox and System.
Not long ago some people discovered a way to substitute the System file (RAM portion of the OS) so the Toolbox loads directly a Linux kernel. This is buggy for a lot of reasons (that was never the intended way, in-ROM drivers may be too buggy, so on).
Apple UNIX (A/UX) on the other way provides a full System file (corresponding to Mac OS 7) and then loads its kernel, retaining the original table in memory for Mac OS applications compatibility and the GUI (yeah, while it's a UNIX and contains X11, native applications can be made that while being A/UX ones, use, calls and depend, on the Toolbox and System functions :D)
So unless an emulation is complete enough to make the Toolbox happily load a System file, it cannot be called a Macintosh emulator. It will be merely a custom-hardware-emulator capable of running Mac OS (BasiliskII) or Linux-m68k (nothing implemented right now).
Saying this of pure memory, BasiliskII patches (and so, does not emulate them really) the following devices: floppy (calls host disk images, not a floppy emulated device, whatever if the image is an hdd, floppy, or cd, it appears as a floppy to the OS), SCSI (there is no scsi emulated at all, the driver is patched to call to host ASPI devices), framebuffer (any combination is available independently of the Toolbox's expected one), NuBus (not present or patched at all), sound (not DAC at all), network (again, no network card at all), graphics accelerators (none emulated, requires NuBus), filesystem code (to make the host folder appear in desktop).
Btw, vMac is more loyal to real hardware emulation.
And the hardware, and the whole Toolbox and System are heavily documented up to II machines in the Inside Macintosh Volumes.
Quoted 1 line
Rob
Quoted 10 lines · Natalia Portillo
Quoted 6 lines
Quoted 3 lines
Linux requires the MMU and an almost complete hardware emulation.
Standard m68k emulations (UAE, Aranym and specially BasiliskII)
try to patch the OS to work.That's kinda sad. Is there a web page anywhere that elaborates on this?
It is a known thing that Linux requires MMU, it appears on the installation guide of all m68k distros. On how and how much they patch the OS, check their sources.
Actually coldfire was nommu and thus m68k was one of the first nommu platforms. But what I was talking about was patching the OS.
The aranym patches (that i saw) were adding new virtual device drivers.
(A bit like virtio, only different implementations.)
Quoted 7 lines
Quoted 6 lines
Quoted 3 lines
Indeed BasiliskII is anything but a real macintosh emulator, as it patches heavily the Toolbox and Mac OS (that's why Linux and A/UX will never work on it)
I believe toolbox is the ancient mac bios, correct? Does Linux need/use it at all?
Quoted 8 lines
Yes and no to both. Mac OS is a really complex operating system where everything is divided in little pieces that can be loaded individually and independently (the Grand Unified Model, the reason why resource forks exist). Toolbox is the most important part, the one that resides inside the ROM chip, provides the specific model drivers (and in the II models, loads the video driver from the NuBus card), and loads the rest of the system from the System file inside MacOS.
CP/M got split into the BIOS and BDOS halves when Imsai asked Digital Research to give them a driver pack they could tailor to their non-Altair hardware, and then the other half could be board-independent.
This seems similarly relevant?
Quoted 6 lines
It does not expect a boot loader, it's the OS itself, indeed in an specific model the whole OS is contained in ROM.
There is a table for OS functions that can be made to point to ROM (implemented on Toolbox) or in RAM (System file, bug or functionality updates).
Linux is an OS. It generally doesn't call much out of PC bios or openfirmware and so on after it boots up. You're saying m68k is different?
Quoted 4 lines
BasiliskII patches that table inserting their own functions (for example, the floppy driver is "enhanced" to provide access to the host disk images, instead of calling to the SWIM chip that will manage the floppy drive in a real macintosh).
I'm not even building the floppy driver in my kernel .config. Does Linux really have to use this table instead of having actual drivers that run the chips? (You're saying Linux calls the apple bios to access devices?)
Quoted 5 lines
The Linux bootloader is nothing more than a Mac OS application that loads the Linux kernel and gives it access to the full RAM, where it can (and as you see in the compatibility list, does not so well) access to the whole Macintosh hardware bypassing both Toolbox and System.
Real hardware needs bootloaders, yes. Read hardware tends to use uboot and grub and so on depending on your platform.
On qemu, we have the -kernel option that loads a kernel image into the emulator's ram, and jumps to its entry point.
Quoted 4 lines
Not long ago some people discovered a way to substitute the System file (RAM portion of the OS) so the Toolbox loads directly a Linux kernel. This is buggy for a lot of reasons (that was never the intended way, in-ROM drivers may be too buggy, so on).
Or you can go "qemu -kernel" so it can call load_elf() or similar.
Quoted 11 lines
Apple UNIX (A/UX) on the other way provides a full System file (corresponding to Mac OS 7) and then loads its kernel, retaining the original table in memory for Mac OS applications compatibility and the GUI (yeah, while it's a UNIX and contains X11, native applications can be made that while being A/UX ones, use, calls and depend, on the Toolbox and System functions :D)
So unless an emulation is complete enough to make the Toolbox happily load a System file, it cannot be called a Macintosh emulator. It will be merely a custom-hardware-emulator capable of running Mac OS (BasiliskII) or Linux-m68k (nothing implemented right now).
I'm looking for an emulator capable of running Linux-m68k, yes.
Quoted 4 lines
Saying this of pure memory, BasiliskII patches (and so, does not emulate them really) the following devices: floppy (calls host disk images, not a floppy emulated device, whatever if the image is an hdd, floppy, or cd, it appears as a floppy to the OS),
Linux can loopback mount floppy images, so all I really need is an arbitrary block device that's big and reasonably well performing. SCSI works.
Quoted 3 lines
SCSI (there is
no scsi emulated at all, the driver is patched to call to host ASPI devices),
Linux has drivers for rather a lot of scsi chips, we just need to map it at the right location for the driver to find it.
Quoted 2 lines
framebuffer (any combination is available independently of the Toolbox's expected one),
I'm using a serial console on all the other targets.
Quoted 2 lines
NuBus (not present or patched at all),
sound (not DAC at all),
Not expecting to use either.
Quoted 1 line
network (again, no network card at all),
Wikipedia is of the opinion there was one via fairly generic chip. Might even be true, who knows?
Quoted 2 lines
graphics accelerators (none emulated, requires NuBus), filesystem code (to make the host folder appear in desktop).
Linux has filesystem drivers.
Quoted 4 lines
Btw, vMac is more loyal to real hardware emulation.
And the hardware, and the whole Toolbox and System are heavily documented up to II machines in the Inside Macintosh Volumes.
Again, this is about running an ancient macos version I haven't got a license for. Half the OS was in ROM the other half was on disk. As far as QEMU is concerned both are files you load. (One as -rom one as -hda or similar... not my problem?)
Rob
Quoted 34 lines · Rob Landley
Quoted 10 lines · Natalia Portillo
Quoted 6 lines
Quoted 3 lines
Linux requires the MMU and an almost complete hardware emulation. Standard m68k emulations (UAE, Aranym and specially BasiliskII) try to patch the OS to work.
That's kinda sad. Is there a web page anywhere that elaborates on this?
It is a known thing that Linux requires MMU, it appears on the installation guide of all m68k distros. On how and how much they patch the OS, check their sources.
Actually coldfire was nommu and thus m68k was one of the first nommu platforms. But what I was talking about was patching the OS.
The aranym patches (that i saw) were adding new virtual device drivers. (A bit like virtio, only different implementations.)
Quoted 7 lines
Quoted 6 lines
Quoted 3 lines
Indeed BasiliskII is anything but a real macintosh emulator, as it patches heavily the Toolbox and Mac OS (that's why Linux and A/UX will never work on it)
I believe toolbox is the ancient mac bios, correct? Does Linux need/use it at all?
Quoted 8 lines
Yes and no to both. Mac OS is a really complex operating system where everything is divided in little pieces that can be loaded individually and independently (the Grand Unified Model, the reason why resource forks exist). Toolbox is the most important part, the one that resides inside the ROM chip, provides the specific model drivers (and in the II models, loads the video driver from the NuBus card), and loads the rest of the system from the System file inside MacOS.
Quoted 5 lines
CP/M got split into the BIOS and BDOS halves when Imsai asked Digital Research to give them a driver pack they could tailor to their non-Altair hardware, and then the other half could be board-independent.
This seems similarly relevant?
No, CP/M's BIOS just initializes the hardware.
BDOS contains the drivers.
PC BIOS do the same.
Toolbox initializes the drivers, contains the HAL, the kernel, the resource fork manager, the window manager, the mouse pointer, the quickdraw functions. It's like having Windows 3.1 in ROM and the explorer.exe on disk.
Quoted 9 lines
Quoted 6 lines
It does not expect a boot loader, it's the OS itself, indeed in an specific model the whole OS is contained in ROM.
There is a table for OS functions that can be made to point to ROM (implemented on Toolbox) or in RAM (System file, bug or functionality updates).
Linux is an OS. It generally doesn't call much out of PC bios or openfirmware and so on after it boots up. You're saying m68k is different?
Yes, Mac OS must load Linux, not a bootloader.
If Mac OS don't work, your chances of getting Linux to work (on a REAL macintosh emulator) are close to 0.
Quoted 9 lines
Quoted 4 lines
BasiliskII patches that table inserting their own functions (for example, the floppy driver is "enhanced" to provide access to the host disk images, instead of calling to the SWIM chip that will manage the floppy drive in a real macintosh).
I'm not even building the floppy driver in my kernel .config. Does Linux really have to use this table instead of having actual drivers that run the chips? (You're saying Linux calls the apple bios to access devices?)
Read it again, on Basilisk, Linux will find no storage device at all, no video device, no serial device, no nothing :p
Quoted 11 lines
Quoted 5 lines
The Linux bootloader is nothing more than a Mac OS application that loads the Linux kernel and gives it access to the full RAM, where it can (and as you see in the compatibility list, does not so well) access to the whole Macintosh hardware bypassing both Toolbox and System.
Real hardware needs bootloaders, yes. Read hardware tends to use uboot and grub and so on depending on your platform.
On qemu, we have the -kernel option that loads a kernel image into the emulator's ram, and jumps to its entry point.
That isn't so simple in Macs
Quoted 14 lines
Quoted 4 lines
Not long ago some people discovered a way to substitute the System file (RAM portion of the OS) so the Toolbox loads directly a Linux kernel. This is buggy for a lot of reasons (that was never the intended way, in-ROM drivers may be too buggy, so on).
Or you can go "qemu -kernel" so it can call
load_elf()or similar.Quoted 7 lines
Apple UNIX (A/UX) on the other way provides a full System file (corresponding to Mac OS 7) and then loads its kernel, retaining the original table in memory for Mac OS applications compatibility and the GUI (yeah, while it's a UNIX and contains X11, native applications can be made that while being A/UX ones, use, calls and depend, on the Toolbox and System functions :D)
Quoted 6 lines
Quoted 4 lines
So unless an emulation is complete enough to make the Toolbox happily load a System file, it cannot be called a Macintosh emulator. It will be merely a custom-hardware-emulator capable of running Mac OS (BasiliskII) or Linux-m68k (nothing implemented right now).
I'm looking for an emulator capable of running Linux-m68k, yes.
So the answer to your questions is simple:
You don't want a macintosh emulator. :p
Quoted 9 lines
Quoted 4 lines
Saying this of pure memory, BasiliskII patches (and so, does not emulate them really) the following devices: floppy (calls host disk images, not a floppy emulated device, whatever if the image is an hdd, floppy, or cd, it appears as a floppy to the OS),
Linux can loopback mount floppy images, so all I really need is an arbitrary block device that's big and reasonably well performing. SCSI works.
Quoted 6 lines
Quoted 3 lines
SCSI (there is
no scsi emulated at all, the driver is patched to call to host ASPI devices),Linux has drivers for rather a lot of scsi chips, we just need to map it at the right location for the driver to find it.
Check Linux-m68k, only one works on macs, whatever the other ones do have a driver or not, only one works :p
Quoted 22 lines
Quoted 2 lines
framebuffer (any combination is available independently of the Toolbox's expected one),
I'm using a serial console on all the other targets.
Quoted 2 lines
NuBus (not present or patched at all),
sound (not DAC at all),Not expecting to use either.
Quoted 1 line
network (again, no network card at all),
Wikipedia is of the opinion there was one via fairly generic chip. Might even be true, who knows?
Quoted 2 lines
graphics accelerators (none emulated, requires NuBus), filesystem code (to make the host folder appear in desktop).
Linux has filesystem drivers.
Quoted 2 lines
Btw, vMac is more loyal to real hardware emulation.
Quoted 7 lines
Quoted 2 lines
And the hardware, and the whole Toolbox and System are heavily documented up to II machines in the Inside Macintosh Volumes.
Again, this is about running an ancient macos version I haven't got a license for. Half the OS was in ROM the other half was on disk. As far as QEMU is concerned both are files you load. (One as -rom one as -hda or similar... not my problem?)
As far as Mac hardware is concerned, and Linux-mac-m68k is concerned, if you don't have both, it will not boot.
You can create a m68k target designed specifically for your Linux-m68k needs, but you have stated clear that a mac-m68k target is not what you need at all :p
(Have you read Linux-m68k compatibility pages? It's compatible with 5% of the models, 10% of the hardware at most.)
No offense I think you're confusing things.
If you just need to boot Linux-m68k, a development board is a simpler, easier, faster to implement, and more suited to your needs, than Amiga, Atari or Apple hardware emulators (existent or not).
Quoted 16 lines · Rob Landley
Quoted 7 lines · Natalia Portillo
Quoted 1 line
or ancient macintosh support
Most of the hardware (but a few required ones like SWIM) is already in QEMU, you need to glue everything, make Toolbox be VERY happy about its environment, make Mac OS boot so it can second-boot Linux (the direct-booter is so buggy it may introduce phantom bugs on the emulation) and implement the MMU.
I haven't got a copy of ancient MacOS.
Why is the direct booter buggy? I'm happy to track down and isolate phantom bugs, either in the kernel or in qemu. (One nice thing about emulators is you can get deterministic regression tests reasonably easily. :)
Quoted 4 lines
How do I _use_ the direct booter, anyway? I built
mac_defconfigin 3.0 but it only gave me a vmlinux, which faulted on the instruction at address 0. I tried m68k-objdump -O binary vmlinux vmlinux.bin but that wouldnt' bot at all (qemu -kernel refused to load it).
For the moment, q800 is not working.
Master branch is for m68k-linux-user target.
I'm working on m68k-softmmu on the macrom-branch by porting the basiliskII stuff.
[Natalia: this allows me to debug the CPU by comparing traces from BasiliskII and traces from qemu, I've found several in supervisor mode]
but a ROM will not be required to boot it as the bootloader has the role to collect information from the ROM to pass it the kernel. Qemu will be able to do it and boot directly the kernel (with option --kernel). We can cut&paste parts from the EMILE bootloader.
A real machine emulation will require a ROM. But for this part we can have a look to executore (https://github.com/ctm/executor).
Quoted 7 lines
Quoted 6 lines
Quoted 2 lines
that Linux could boot on? (I.E. I'm interested in Linux system emulation of non-coldfire m68k. So far that means "use aranym".)
Linux requires the MMU and an almost complete hardware emulation. Standard m68k emulations (UAE, Aranym and specially BasiliskII) try to patch the OS to work.
Quoted 8 lines
That's kinda sad. Is there a web page anywhere that elaborates on this?
Quoted 3 lines
Indeed BasiliskII is anything but a real macintosh emulator, as it patches heavily the Toolbox and Mac OS (that's why Linux and A/UX will never work on it)
I believe toolbox is the ancient mac bios, correct? Does Linux need/use it at all?
No
Regards,
Laurent
Quoted 22 lines · Laurent Vivier
Quoted 16 lines · Rob Landley
Quoted 7 lines · Natalia Portillo
Quoted 1 line
or ancient macintosh support
Most of the hardware (but a few required ones like SWIM) is already in QEMU, you need to glue everything, make Toolbox be VERY happy about its environment, make Mac OS boot so it can second-boot Linux (the direct-booter is so buggy it may introduce phantom bugs on the emulation) and implement the MMU.
I haven't got a copy of ancient MacOS.
Why is the direct booter buggy? I'm happy to track down and isolate phantom bugs, either in the kernel or in qemu. (One nice thing about emulators is you can get deterministic regression tests reasonably easily. :)
Quoted 4 lines
How do I _use_ the direct booter, anyway? I built
mac_defconfigin 3.0 but it only gave me a vmlinux, which faulted on the instruction at address 0. I tried m68k-objdump -O binary vmlinux vmlinux.bin but that wouldnt' bot at all (qemu -kernel refused to load it).
Quoted 8 lines
For the moment, q800 is not working.
Master branch is for m68k-linux-user target.
I'm working on m68k-softmmu on the macrom-branch by porting the basiliskII stuff.
[Natalia: this allows me to debug the CPU by comparing traces from BasiliskII and traces from qemu, I've found several in supervisor mode]
As always, at least there are not so many "secret opcodes" :p
Quoted 4 lines
but a ROM will not be required to boot it as the bootloader has the role to collect information from the ROM to pass it the kernel. Qemu will be able to do it and boot directly the kernel (with option --kernel). We can cut&paste parts from the EMILE bootloader.
But bypassing the ROM in all cases is not emulating a real Macintosh, is creating a special target for Linux that emulates the same hardware.
(Gz for your EMILE, but, buy a tripod :p)
Quoted 2 lines
A real machine emulation will require a ROM. But for this part we can have a look to executore (https://github.com/ctm/executor).
Last time I used Executor it only emulated an OS 6 Toolbox and with a compatibility scarce at best.
Quoted 22 lines
Quoted 7 lines
Quoted 6 lines
Quoted 2 lines
that Linux could boot on? (I.E. I'm interested in Linux system emulation of non-coldfire m68k. So far that means "use aranym".)
Linux requires the MMU and an almost complete hardware emulation. Standard m68k emulations (UAE, Aranym and specially BasiliskII) try to patch the OS to work.
Quoted 8 lines
That's kinda sad. Is there a web page anywhere that elaborates on this?
Quoted 3 lines
Indeed BasiliskII is anything but a real macintosh emulator, as it patches heavily the Toolbox and Mac OS (that's why Linux and A/UX will never work on it)
I believe toolbox is the ancient mac bios, correct? Does Linux need/use it at all?
No
Regards,
Laurent
Quoted 42 lines · Natalia Portillo
Quoted 40 lines · Rob Landley
Quoted 10 lines · Natalia Portillo
Quoted 6 lines
Quoted 3 lines
Linux requires the MMU and an almost complete hardware emulation. Standard m68k emulations (UAE, Aranym and specially BasiliskII) try to patch the OS to work.
That's kinda sad. Is there a web page anywhere that elaborates on this?
It is a known thing that Linux requires MMU, it appears on the installation guide of all m68k distros. On how and how much they patch the OS, check their sources.
Actually coldfire was nommu and thus m68k was one of the first nommu platforms. But what I was talking about was patching the OS.
The aranym patches (that i saw) were adding new virtual device drivers. (A bit like virtio, only different implementations.)
Quoted 7 lines
Quoted 6 lines
Quoted 3 lines
Indeed BasiliskII is anything but a real macintosh emulator, as it patches heavily the Toolbox and Mac OS (that's why Linux and A/UX will never work on it)
I believe toolbox is the ancient mac bios, correct? Does Linux need/use it at all?
Quoted 8 lines
Yes and no to both. Mac OS is a really complex operating system where everything is divided in little pieces that can be loaded individually and independently (the Grand Unified Model, the reason why resource forks exist). Toolbox is the most important part, the one that resides inside the ROM chip, provides the specific model drivers (and in the II models, loads the video driver from the NuBus card), and loads the rest of the system from the System file inside MacOS.
CP/M got split into the BIOS and BDOS halves when Imsai asked Digital Research to give them a driver pack they could tailor to their non-Altair hardware, and then the other half could be board-independent.
Quoted 4 lines
Quoted 1 line
This seems similarly relevant?
No, CP/M's BIOS just initializes the hardware. BDOS contains the drivers.
The bios contains the drivers necessary to talk to the hardware you need for booting. BDOS didn't duplicate drivers that were in the BIOS, there was no room. It continue to use them.
DOS started as a more or less clone of CP/M, and continued to call into the BIOS for things like disk access.
Linux, running on the same hardware, did not use the BIOS, or DOS, after boot. LOADLIN was one option for booting Linux, but not the only one.
Quoted 1 line
PC BIOS do the same.
DOS continues to make fairly extensive use of BIOS calls after boot. I used to program for DOS, I know this firsthand.
Quoted 4 lines
Toolbox initializes the drivers, contains the HAL, the kernel, the resource fork manager, the window manager, the mouse pointer, the quickdraw functions. It's like having Windows 3.1 in ROM and the explorer.exe on disk.
And Linux uses neither. Why would the mac be different?
I'm aware there was an early microkernel-based mac port in the early 90's back before Linux had its 1.0 release, but that wasn't what got merged into the kernel. Linux supports m68k on Atari and Amiga as well as old mac, it doesn't need MacOS installed on Atari or Amiga. It has drivers, which talk directly to chips.
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
It does not expect a boot loader, it's the OS itself, indeed in an specific model the whole OS is contained in ROM.
There is a table for OS functions that can be made to point to ROM (implemented on Toolbox) or in RAM (System file, bug or functionality updates).
Quoted 7 lines
Quoted 3 lines
Linux is an OS. It generally doesn't call much out of PC bios or openfirmware and so on after it boots up. You're saying m68k is different?
Yes, Mac OS must load Linux, not a bootloader. If Mac OS don't work, your chances of getting Linux to work (on a REAL macintosh emulator) are close to 0.
I don't want a real macintosh emulator then, I want qemu to emulate an m68k and give me a board I can get a shell prompt on. I don't care if it's closer to amiga, atari, or mac, since all three share the exact same binary identical root filesystem (at least when you're not using x11 and the drivers therein) and the only difference is kernel .config.
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
BasiliskII patches that table inserting their own functions (for example, the floppy driver is "enhanced" to provide access to the host disk images, instead of calling to the SWIM chip that will manage the floppy drive in a real macintosh).
Quoted 7 lines
Quoted 4 lines
I'm not even building the floppy driver in my kernel .config. Does Linux really have to use this table instead of having actual drivers that run the chips? (You're saying Linux calls the apple bios to access devices?)
Read it again, on Basilisk, Linux will find no storage device at all, no video device, no serial device, no nothing :p
Ctrl-alt-google, read the technical manual...
http://basilisk.cebix.net/TECH
Quote the technical manual at you:
More precisely spoken, MacOS under Basilisk II behaves like on a Mac Classic or Mac II because, apart from the CPU, the RAM and the ROM, absolutely no Mac hardware is emulated. Rather, Basilisk II provides replacements (usually in the form of MacOS drivers) for the parts of MacOS that access hardware.
The reason Linux does not find any devices is because basilisk does not emulate any devices. This is because Basilisk is not a real emulator, and when you say "on a REAL macintosh emulator" above, I do not think it means what you think it means.
http://tvtropes.org/pmwiki/pmwiki.php/Main/DidNotDoTheResearch
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
The Linux bootloader is nothing more than a Mac OS application that loads the Linux kernel and gives it access to the full RAM, where it can (and as you see in the compatibility list, does not so well) access to the whole Macintosh hardware bypassing both Toolbox and System.
Quoted 7 lines
Quoted 5 lines
Real hardware needs bootloaders, yes. Read hardware tends to use uboot and grub and so on depending on your platform.
On qemu, we have the -kernel option that loads a kernel image into the emulator's ram, and jumps to its entry point.
That isn't so simple in Macs
This is how hardware works.
Look, on power up, a timing circuit holds the processor's reset line until current supply and distribution stabilize, then it releases it to start executing code in a known (simple) state at a known location. The caches and MMU is generally disabled during this, and on SMP systems one processor is designated the boot processor and the rest remain halted. The physical address the boot processor starts executing code at has non-volatile memory mapped at that location containing bootstrapping code. (You can work around all this with a jtag and crank the bus by hand from an external source, but this is how self-contained systems boot.)
The boot processor starts by initializing the DRAM controller (unless the system has only SRAM, which is basically only really small embedded systems), sets it to the right timing and waits for it to stabilize, sometimes by interactively hunting for various parameters like voltage. (Last month the other guy in my office had to debug a fun one where the timing was too fast and 10% of the time the uboot search wouldn't converge.) Coreboot (formerly the Linux Bios Project) does a fun little trick where they set up a TLB entry and fault in a few cache lines, zero them out, and then set the stack pointer to the start of that cached memory, which lets them jump to C code early and set up the DRAM controller in C instead of assembly. QEMU doesn't need to do this becaue it doesn't emulate a DRAM controller, although getting uboot NOT to do this and then try to copy itself out of flash into dram was a pain for a long time...
At about THAT point you can start worry about finding the boot device, loading your OS from it, and performing device enumeration.
Macs aren't magic. The ones we're talking about are 30 year old technology, they're pretty simple by modern standards and work pretty much the same way everyting else does.
Quoted 5 lines
Quoted 1 line
I'm looking for an emulator capable of running Linux-m68k, yes.
So the answer to your questions is simple:
You don't want a macintosh emulator. :p
I want something that emulates the macintosh hardware, not just a CPU emulator hooked up to a hacked copy of the MacOS roms that doesn't emulating any of the actual underlying hardware, such as basilisk provides.
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
SCSI (there is no scsi emulated at all, the driver is patched to call to host ASPI devices),
Linux has drivers for rather a lot of scsi chips, we just need to map it at the right location for the driver to find it.
Check Linux-m68k, only one works on macs, whatever the other ones do have a driver or not, only one works :p
Largely because 68k macs stopped being sold 16 years ago and this is retrocomputing, you mean?
I want to get the Dec Alpha running too, but that's lower on the list. M68k used to be really widely deployed and some embedded systems use m68k variants. Alpha died when DEC was bought by a windows company that didn't make its own chips, and the chip design team was scooped up by AMD and went on to design the Athlon and Opteron.
Quoted 7 lines
Quoted 4 lines
Again, this is about running an ancient macos version I haven't got a license for. Half the OS was in ROM the other half was on disk. As far as QEMU is concerned both are files you load. (One as -rom one as -hda or similar... not my problem?)
As far as Mac hardware is concerned, and Linux-mac-m68k is concerned, if you don't have both, it will not boot.
I'm fairly certain this is not true, but if it is I might be able to fix it.
Quoted 3 lines
You can create a m68k target designed specifically for your Linux-m68k needs, but you have stated clear that a mac-m68k target is not what you need at all :p
Actually I'm pretty sure a mac-m68k target would work fine for my needs, I just don't care that much what m68k board QEMU gives me. An existing one is great, but a PC variant would work too, as would a bunch of virtio devices if that ever gets documented. (Virtconsole is still a black box that can't talk to qemu stdin/stdout.)
Quoted 4 lines
(Have you read Linux-m68k compatibility pages? It's compatible with 5% of the models, 10% of the hardware at most.)
No offense I think you're confusing things.
The m68k branch has the start of a quadra 800, but the actual board file is a powerpc board with just about everything "#if 0"ed out.
Mostly i want an existing board so I don't have to perform extensive surgery on Linux's kconfig to build a kernel for it. (Device trees should eventually make that suck less. I look forward to them.)
Quoted 3 lines
If you just need to boot Linux-m68k, a development board is a simpler, easier, faster to implement, and more suited to your needs, than Amiga, Atari or Apple hardware emulators (existent or not).
Care to suggest one? I'm not that familiar with what's available in m68k land, I just know how the other dozen hardware platforms I've used work.
Rob
Quoted 17 lines · Laurent Vivier
Quoted 16 lines · Rob Landley
Quoted 7 lines · Natalia Portillo
Quoted 1 line
or ancient macintosh support
Most of the hardware (but a few required ones like SWIM) is already in QEMU, you need to glue everything, make Toolbox be VERY happy about its environment, make Mac OS boot so it can second-boot Linux (the direct-booter is so buggy it may introduce phantom bugs on the emulation) and implement the MMU.
I haven't got a copy of ancient MacOS.
Why is the direct booter buggy? I'm happy to track down and isolate phantom bugs, either in the kernel or in qemu. (One nice thing about emulators is you can get deterministic regression tests reasonably easily. :)
Quoted 6 lines
Quoted 4 lines
How do I _use_ the direct booter, anyway? I built
mac_defconfigin 3.0 but it only gave me a vmlinux, which faulted on the instruction at address 0. I tried m68k-objdump -O binary vmlinux vmlinux.bin but that wouldnt' bot at all (qemu -kernel refused to load it).For the moment, q800 is not working.
I noticed. :)
Quoted 4 lines
Master branch is for m68k-linux-user target.
I'm working on m68k-softmmu on the macrom-branch by porting the basiliskII stuff.
That doesn't emulate real hardware according to the introduction of
http://basilisk.cebix.net/TECH so what is there to port? (Closer CPU emulation for the MMU stuff?)
Quoted 4 lines
but a ROM will not be required to boot it as the bootloader has the role to collect information from the ROM to pass it the kernel. Qemu will be able to do it and boot directly the kernel (with option --kernel). We can cut&paste parts from the EMILE bootloader.
If the platform wasn't mummified I'd suggest a device tree conversion... :)
Quoted 2 lines
A real machine emulation will require a ROM. But for this part we can have a look to executore (https://github.com/ctm/executor).
I just want to run Linux on the thing, via -kernel and -append.
Rob
Definitively you don't know how a Mac works, you don't want to know and you don't need to.
Quoted 4 lines · Rob Landley
Quoted 3 lines · Natalia Portillo
Quoted 1 line · Rob Landley
On 08/20/2011 07:23 PM, Natalia Portillo wrote:
I hate huge emails.
Anyway I can't answer a lot of things you said because of NDAs so doesn't matter.
Quoted 3 lines
Care to suggest one? I'm not that familiar with what's available in m68k land, I just know how the other dozen hardware platforms I've used work.
Sorry no, Google sure finds them, and, you can invent your own.
You can create your own virtual non-existent hardware (it's done extensively in this world) and patch Linux to boot of it inside qemu. Or you can check for Linux's support for development boards (sure there are one or two) and implement it on qemu based on what Linux's source says.
And FOR GOD'S SAKE CHECK THE ****** COMPATIBILITY LIST ON LINUX-M68K.
No Mac m68k suits your needs for Linux NONE NINGUNO AUCUN KEINER NESSUNO NENHUM.
Regards :p
Quoted 2 lines · Natalia Portillo
Definitively you don't know how a Mac works, you don't want to know and you don't need to.
I do not care about the half of MacOS that Apple burns into ROM which Linux does not use, true.
Quoted 4 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line · Natalia Portillo
I hate huge emails. Anyway I can't answer a lot of things you said because of NDAs so doesn't matter.
Right, so the emulator you suggested not actually emulating any real hardware devices is either "tl;dr", "I can't tell you because of NDA", or "you don't understand how macs work".
*shrug* Have fun with that.
Quoted 5 lines
You can create your own virtual non-existent hardware (it's done extensively in this world) and patch Linux to boot of it inside qemu. Or you can check for Linux's support for development boards (sure there are one or two) and implement it on qemu based on what Linux's source says.
I have, in fact, _seen_ Linux run on an m68k mac, although it was many moons ago. Obviously it _can_ be done.
(And I could play with coldfire now, but doing nommu in userspace is fiddly and irritating. Stuff like cris is higher on my todo list than that.)
Quoted 5 lines
And FOR GOD'S SAKE CHECK THE ****** COMPATIBILITY LIST ON LINUX-M68K.
No Mac m68k suits your needs for Linux NONE NINGUNO AUCUN KEINER NESSUNO NENHUM.
Which is of course why Linux has a mac_defconfig under the m68k directory specifying numerous drivers for actual hardware.
It seems unlikely that the powerpc mac99 and g3beige worked just fine for me, but before they swapped the CPU out it all ran by magic.
Rob
P.S. For context as to what counts as "intimidating" and "magic", Jeri Ellsworth reverse engineered the Amiga chips in an FPGA:
http://www.youtube.com/watch?v=5uaDzF99a80