]> git.proxmox.com Git - mirror_qemu.git/blobdiff - target-m68k/helper.c
Get rid of _t suffix
[mirror_qemu.git] / target-m68k / helper.c
index 7f0139237b3f5b106d140f757ac73fd8e1319894..2a9f7e690678f00c9ade5f3fa007e6349eb3c85f 100644 (file)
@@ -15,8 +15,7 @@
  * General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #include <stdio.h>
@@ -26,6 +25,7 @@
 #include "cpu.h"
 #include "exec-all.h"
 #include "qemu-common.h"
+#include "gdbstub.h"
 
 #include "helpers.h"
 
@@ -38,14 +38,14 @@ enum m68k_cpuid {
     M68K_CPUID_ANY,
 };
 
-typedef struct m68k_def_t m68k_def_t;
+typedef struct m68k_def a_m68k_def;
 
-struct m68k_def_t {
+struct m68k_def {
     const char * name;
     enum m68k_cpuid id;
 };
 
-static m68k_def_t m68k_cpu_defs[] = {
+static a_m68k_def m68k_cpu_defs[] = {
     {"m5206", M68K_CPUID_M5206},
     {"m5208", M68K_CPUID_M5208},
     {"cfv4e", M68K_CPUID_CFV4E},
@@ -53,6 +53,42 @@ static m68k_def_t m68k_cpu_defs[] = {
     {NULL, 0},
 };
 
+void m68k_cpu_list(FILE *f, int (*cpu_fprintf)(FILE *f, const char *fmt, ...))
+{
+    unsigned int i;
+
+    for (i = 0; m68k_cpu_defs[i].name; i++) {
+        (*cpu_fprintf)(f, "%s\n", m68k_cpu_defs[i].name);
+    }
+}
+
+static int fpu_gdb_get_reg(CPUState *env, uint8_t *mem_buf, int n)
+{
+    if (n < 8) {
+        stfq_p(mem_buf, env->fregs[n]);
+        return 8;
+    }
+    if (n < 11) {
+        /* FP control registers (not implemented)  */
+        memset(mem_buf, 0, 4);
+        return 4;
+    }
+    return 0;
+}
+
+static int fpu_gdb_set_reg(CPUState *env, uint8_t *mem_buf, int n)
+{
+    if (n < 8) {
+        env->fregs[n] = ldfq_p(mem_buf);
+        return 8;
+    }
+    if (n < 11) {
+        /* FP control registers (not implemented)  */
+        return 4;
+    }
+    return 0;
+}
+
 static void m68k_set_feature(CPUM68KState *env, int feature)
 {
     env->features |= (1u << feature);
@@ -60,7 +96,7 @@ static void m68k_set_feature(CPUM68KState *env, int feature)
 
 static int cpu_m68k_set_model(CPUM68KState *env, const char *name)
 {
-    m68k_def_t *def;
+    a_m68k_def *def;
 
     for (def = m68k_cpu_defs; def->name; def++) {
         if (strcmp(def->name, name) == 0)
@@ -105,11 +141,21 @@ static int cpu_m68k_set_model(CPUM68KState *env, const char *name)
     }
 
     register_m68k_insns(env);
+    if (m68k_feature (env, M68K_FEATURE_CF_FPU)) {
+        gdb_register_coprocessor(env, fpu_gdb_get_reg, fpu_gdb_set_reg,
+                                 11, "cf-fp.xml", 18);
+    }
+    /* TODO: Add [E]MAC registers.  */
     return 0;
 }
 
 void cpu_reset(CPUM68KState *env)
 {
+    if (qemu_loglevel_mask(CPU_LOG_RESET)) {
+        qemu_log("CPU Reset (CPU %d)\n", env->cpu_index);
+        log_cpu_state(env, 0);
+    }
+
     memset(env, 0, offsetof(CPUM68KState, breakpoints));
 #if !defined (CONFIG_USER_ONLY)
     env->sr = 0x2700;
@@ -127,9 +173,7 @@ CPUM68KState *cpu_m68k_init(const char *cpu_model)
     CPUM68KState *env;
     static int inited;
 
-    env = malloc(sizeof(CPUM68KState));
-    if (!env)
-        return NULL;
+    env = qemu_mallocz(sizeof(CPUM68KState));
     cpu_exec_init(env);
     if (!inited) {
         inited = 1;
@@ -144,6 +188,7 @@ CPUM68KState *cpu_m68k_init(const char *cpu_model)
     }
 
     cpu_reset(env);
+    qemu_init_vcpu(env);
     return env;
 }
 
@@ -300,7 +345,7 @@ void m68k_switch_sp(CPUM68KState *env)
 /* MMU */
 
 /* TODO: This will need fixing once the MMU is implemented.  */
-target_phys_addr_t cpu_get_phys_page_debug(CPUState *env, target_ulong addr)
+a_target_phys_addr cpu_get_phys_page_debug(CPUState *env, target_ulong addr)
 {
     return addr;
 }
@@ -418,11 +463,6 @@ uint32_t HELPER(xflag_lt)(uint32_t a, uint32_t b)
     return a < b;
 }
 
-uint32_t HELPER(btest)(uint32_t x)
-{
-    return x != 0;
-}
-
 void HELPER(set_sr)(CPUState *env, uint32_t val)
 {
     env->sr = val & 0xffff;