translate.c (92f1f83e34f0454b98f3a7fc082636c38cafa115) translate.c (4448a83606b5861cfa11528c0395868fc2b0e99e)
1/*
2 * SH4 translation
3 *
4 * Copyright (c) 2005 Samuel Tardieu
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either

--- 1816 unchanged lines hidden (view full) ---

1825 /* We don't know if the delayed pc came from a dynamic or static branch,
1826 so assume it is a dynamic branch. */
1827 ctx.delayed_pc = -1; /* use delayed pc from env pointer */
1828 ctx.tb = tb;
1829 ctx.singlestep_enabled = cs->singlestep_enabled;
1830 ctx.features = env->features;
1831 ctx.has_movcal = (ctx.tbflags & TB_FLAG_PENDING_MOVCA);
1832
1/*
2 * SH4 translation
3 *
4 * Copyright (c) 2005 Samuel Tardieu
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either

--- 1816 unchanged lines hidden (view full) ---

1825 /* We don't know if the delayed pc came from a dynamic or static branch,
1826 so assume it is a dynamic branch. */
1827 ctx.delayed_pc = -1; /* use delayed pc from env pointer */
1828 ctx.tb = tb;
1829 ctx.singlestep_enabled = cs->singlestep_enabled;
1830 ctx.features = env->features;
1831 ctx.has_movcal = (ctx.tbflags & TB_FLAG_PENDING_MOVCA);
1832
1833 num_insns = 0;
1834 max_insns = tb->cflags & CF_COUNT_MASK;
1835 if (max_insns == 0) {
1836 max_insns = CF_COUNT_MASK;
1837 }
1833 max_insns = tb->cflags & CF_COUNT_MASK;
1834 if (max_insns == 0) {
1835 max_insns = CF_COUNT_MASK;
1836 }
1838 if (max_insns > TCG_MAX_INSNS) {
1839 max_insns = TCG_MAX_INSNS;
1837 max_insns = MIN(max_insns, TCG_MAX_INSNS);
1838
1839 /* Since the ISA is fixed-width, we can bound by the number
1840 of instructions remaining on the page. */
1841 num_insns = -(ctx.pc | TARGET_PAGE_MASK) / 2;
1842 max_insns = MIN(max_insns, num_insns);
1843
1844 /* Single stepping means just that. */
1845 if (ctx.singlestep_enabled || singlestep) {
1846 max_insns = 1;
1840 }
1841
1842 gen_tb_start(tb);
1847 }
1848
1849 gen_tb_start(tb);
1843 while (ctx.bstate == BS_NONE && !tcg_op_buf_full()) {
1850 num_insns = 0;
1851
1852 while (ctx.bstate == BS_NONE
1853 && num_insns < max_insns
1854 && !tcg_op_buf_full()) {
1844 tcg_gen_insn_start(ctx.pc, ctx.envflags);
1845 num_insns++;
1846
1847 if (unlikely(cpu_breakpoint_test(cs, ctx.pc, BP_ANY))) {
1848 /* We have hit a breakpoint - make sure PC is up-to-date */
1849 gen_save_cpu_state(&ctx, true);
1850 gen_helper_debug(cpu_env);
1851 ctx.bstate = BS_EXCP;

--- 7 unchanged lines hidden (view full) ---

1859
1860 if (num_insns == max_insns && (tb->cflags & CF_LAST_IO)) {
1861 gen_io_start();
1862 }
1863
1864 ctx.opcode = cpu_lduw_code(env, ctx.pc);
1865 decode_opc(&ctx);
1866 ctx.pc += 2;
1855 tcg_gen_insn_start(ctx.pc, ctx.envflags);
1856 num_insns++;
1857
1858 if (unlikely(cpu_breakpoint_test(cs, ctx.pc, BP_ANY))) {
1859 /* We have hit a breakpoint - make sure PC is up-to-date */
1860 gen_save_cpu_state(&ctx, true);
1861 gen_helper_debug(cpu_env);
1862 ctx.bstate = BS_EXCP;

--- 7 unchanged lines hidden (view full) ---

1870
1871 if (num_insns == max_insns && (tb->cflags & CF_LAST_IO)) {
1872 gen_io_start();
1873 }
1874
1875 ctx.opcode = cpu_lduw_code(env, ctx.pc);
1876 decode_opc(&ctx);
1877 ctx.pc += 2;
1867 if ((ctx.pc & (TARGET_PAGE_SIZE - 1)) == 0)
1868 break;
1869 if (cs->singlestep_enabled) {
1870 break;
1871 }
1872 if (num_insns >= max_insns)
1873 break;
1874 if (singlestep)
1875 break;
1876 }
1878 }
1877 if (tb->cflags & CF_LAST_IO)
1879 if (tb->cflags & CF_LAST_IO) {
1878 gen_io_end();
1880 gen_io_end();
1881 }
1879 if (cs->singlestep_enabled) {
1880 gen_save_cpu_state(&ctx, true);
1881 gen_helper_debug(cpu_env);
1882 } else {
1883 switch (ctx.bstate) {
1884 case BS_STOP:
1885 gen_save_cpu_state(&ctx, true);
1886 tcg_gen_exit_tb(0);

--- 39 unchanged lines hidden ---
1882 if (cs->singlestep_enabled) {
1883 gen_save_cpu_state(&ctx, true);
1884 gen_helper_debug(cpu_env);
1885 } else {
1886 switch (ctx.bstate) {
1887 case BS_STOP:
1888 gen_save_cpu_state(&ctx, true);
1889 tcg_gen_exit_tb(0);

--- 39 unchanged lines hidden ---