--- nono/m680x0/m68030fpu.h 2026/04/29 17:04:28 1.1.1.1 +++ nono/m680x0/m68030fpu.h 2026/04/29 17:05:26 1.1.1.4 @@ -1,6 +1,7 @@ // // nono -// Copyright (C) 2018 isaki@NetBSD.org +// Copyright (C) 2020 nono project +// Licensed under nono-license.txt // #pragma once @@ -13,49 +14,45 @@ #define SIZE_D (5) #define SIZE_B (6) -// FPU 命令の FSAVE/FRESTORE 以外のグループ全員で実行開始時に必要な処理 -static inline void -fpu_op_start(m68kcpu *cpu) -{ - struct fpemu *fe = &cpu->fe; - - cpu->fpu_dirty = true; - - // 現在の FPCR/FPSR を fe 構造体にコピー。 - // - // fe->fe_{fpcr,fpsr} のほうはこの fpe 用の内部ワークなので破壊してよい。 - // 命令実行の結果、FPSR レジスタの値を更新する際は fpu_upd_fpsr() を - // 呼ぶこと。これを使わず独自に更新する場合は fe->fe_fpframe->fpf_fpsr - // (こっちがレジスタ値) と fe->fe_fpsr (FPE 用) を同時に更新すること。 - // FPCR のほうは FMOVE-to-FPCR 命令以外で変更されることはないはず。 - fe->fe_fpcr = RegFPCR; - fe->fe_fpsr = RegFPSR; -} - -extern void fpu_init(m68kcpu *cpu); - -extern void fpu_op_fgen_reg(m68kcpu *cpu); -extern void fpu_op_fgen_mem(m68kcpu *cpu); -extern void fpu_op_fmove_b_mem(m68kcpu *cpu); -extern void fpu_op_fmove_w_mem(m68kcpu *cpu); -extern void fpu_op_fmove_l_mem(m68kcpu *cpu); -extern void fpu_op_fmove_s_mem(m68kcpu *cpu); -extern void fpu_op_fmove_d_mem(m68kcpu *cpu); -extern void fpu_op_fmove_x_mem(m68kcpu *cpu); -extern void fpu_op_fmove_p_mem(m68kcpu *cpu); -extern void fpu_op_fmove_ea2ctl(m68kcpu *cpu); -extern void fpu_op_fmovem_ea2ctl(m68kcpu *cpu); -extern void fpu_op_fmove_ctl2ea(m68kcpu *cpu); -extern void fpu_op_fmovem_ctl2ea(m68kcpu *cpu); -extern void fpu_op_fmovem_ea2reg(m68kcpu *cpu); -extern void fpu_op_fmovem_reg2ea(m68kcpu *cpu); -extern void fpu_op_fscc(m68kcpu *cpu); -extern void fpu_op_fdbcc(m68kcpu *cpu); -extern void fpu_op_ftrapcc_w(m68kcpu *cpu); -extern void fpu_op_ftrapcc_l(m68kcpu *cpu); -extern void fpu_op_ftrapcc(m68kcpu *cpu); -extern void fpu_op_fbcc_w(m68kcpu *cpu); -extern void fpu_op_fbcc_l(m68kcpu *cpu); -extern void fpu_op_fsave(m68kcpu *cpu); -extern void fpu_op_frestore(m68kcpu *cpu); -extern void fpu_op_illg(m68kcpu *cpu); + void fpu_init(); + void fpu_reset(); + uint32 cea_fpu(int bytes); + void read_8(uint32 addr, uint32 *data); + void read_12(uint32 addr, uint32 *data); + void write_8(uint32 addr, const uint32 *data); + void write_12(uint32 addr, const uint32 *data); + bool readSRC(int size_id, struct fpn *); + + void fpu_op_illg(); + void fpu_op_illg2(); + + void fpu_op_fgen_reg(); + void fpu_op_fgen_mem(); + void fgen(); + void fpu_op_fmovecr(); + void fpu_op_fmove_b_mem(); + void fpu_op_fmove_w_mem(); + void fpu_op_fmove_l_mem(); + void fpu_op_fmove_s_mem(); + void fpu_op_fmove_d_mem(); + void fpu_op_fmove_x_mem(); + void fpu_op_fmove_p_mem(); + void fpu_op_fmove_ea2ctl(); + void fpu_op_fmovem_ea2ctl(); + void fpu_op_fmove_ctl2ea(); + void fpu_op_fmovem_ctl2ea(); + void fpu_op_fmovem_ea2reg(); + void fpu_op_fmovem_reg2ea(); + void fpu_op_fscc(); + void fpu_op_fdbcc(); + void fpu_op_ftrapcc_w(); + void fpu_op_ftrapcc_l(); + void fpu_op_ftrapcc(); + void fpu_op_fbcc_w(); + void fpu_op_fbcc_l(); + void fpu_op_fsave(); + void fpu_op_frestore(); + + static struct fpframe initial_fpframe; + static const uint32 fsave_frame_null[1]; + static const uint32 fsave_frame_idle[7];