Revision c27004ec exec.c

b/exec.c
231 231
{
232 232
    VirtPageDesc **lp, *p;
233 233

  
234
    /* XXX: should not truncate for 64 bit addresses */
235
#if TARGET_LONG_BITS > 32
236
    index &= (L1_SIZE - 1);
237
#endif
234 238
    lp = &l1_virt_map[index >> L2_BITS];
235 239
    p = *lp;
236 240
    if (!p) {
......
597 601
    target_ulong phys_pc, phys_page2, virt_page2;
598 602
    int code_gen_size;
599 603

  
600
    phys_pc = get_phys_addr_code(env, (unsigned long)pc);
601
    tb = tb_alloc((unsigned long)pc);
604
    phys_pc = get_phys_addr_code(env, pc);
605
    tb = tb_alloc(pc);
602 606
    if (!tb) {
603 607
        /* flush must be done */
604 608
        tb_flush(env);
605 609
        /* cannot fail at this point */
606
        tb = tb_alloc((unsigned long)pc);
610
        tb = tb_alloc(pc);
607 611
    }
608 612
    tc_ptr = code_gen_ptr;
609 613
    tb->tc_ptr = tc_ptr;
......
614 618
    code_gen_ptr = (void *)(((unsigned long)code_gen_ptr + code_gen_size + CODE_GEN_ALIGN - 1) & ~(CODE_GEN_ALIGN - 1));
615 619
    
616 620
    /* check next page if needed */
617
    virt_page2 = ((unsigned long)pc + tb->size - 1) & TARGET_PAGE_MASK;
621
    virt_page2 = (pc + tb->size - 1) & TARGET_PAGE_MASK;
618 622
    phys_page2 = -1;
619
    if (((unsigned long)pc & TARGET_PAGE_MASK) != virt_page2) {
623
    if ((pc & TARGET_PAGE_MASK) != virt_page2) {
620 624
        phys_page2 = get_phys_addr_code(env, virt_page2);
621 625
    }
622 626
    tb_link_phys(tb, phys_pc, phys_page2);
......
884 888

  
885 889
/* Allocate a new translation block. Flush the translation buffer if
886 890
   too many translation blocks or too much generated code. */
887
TranslationBlock *tb_alloc(unsigned long pc)
891
TranslationBlock *tb_alloc(target_ulong pc)
888 892
{
889 893
    TranslationBlock *tb;
890 894

  
......
1063 1067
    tb_reset_jump_recursive2(tb, 1);
1064 1068
}
1065 1069

  
1070
#if defined(TARGET_I386) || defined(TARGET_PPC) || defined(TARGET_SPARC)
1066 1071
static void breakpoint_invalidate(CPUState *env, target_ulong pc)
1067 1072
{
1068 1073
    target_ulong phys_addr;
......
1070 1075
    phys_addr = cpu_get_phys_page_debug(env, pc);
1071 1076
    tb_invalidate_phys_page_range(phys_addr, phys_addr + 1, 0);
1072 1077
}
1078
#endif
1073 1079

  
1074 1080
/* add a breakpoint. EXCP_DEBUG is returned by the CPU loop if a
1075 1081
   breakpoint is reached */
......
1872 1878
#if !defined(CONFIG_USER_ONLY)
1873 1879
    tb_invalidate_phys_page_fast(phys_addr, 1);
1874 1880
#endif
1875
    stb_raw((uint8_t *)addr, val);
1881
    stb_p((uint8_t *)(long)addr, val);
1876 1882
    phys_ram_dirty[phys_addr >> TARGET_PAGE_BITS] = 1;
1877 1883
}
1878 1884

  
......
1884 1890
#if !defined(CONFIG_USER_ONLY)
1885 1891
    tb_invalidate_phys_page_fast(phys_addr, 2);
1886 1892
#endif
1887
    stw_raw((uint8_t *)addr, val);
1893
    stw_p((uint8_t *)(long)addr, val);
1888 1894
    phys_ram_dirty[phys_addr >> TARGET_PAGE_BITS] = 1;
1889 1895
}
1890 1896

  
......
1896 1902
#if !defined(CONFIG_USER_ONLY)
1897 1903
    tb_invalidate_phys_page_fast(phys_addr, 4);
1898 1904
#endif
1899
    stl_raw((uint8_t *)addr, val);
1905
    stl_p((uint8_t *)(long)addr, val);
1900 1906
    phys_ram_dirty[phys_addr >> TARGET_PAGE_BITS] = 1;
1901 1907
}
1902 1908

  
......
1914 1920

  
1915 1921
static void notdirty_mem_writeb(void *opaque, target_phys_addr_t addr, uint32_t val)
1916 1922
{
1917
    stb_raw((uint8_t *)addr, val);
1923
    stb_p((uint8_t *)(long)addr, val);
1918 1924
    tlb_set_dirty(addr, cpu_single_env->mem_write_vaddr);
1919 1925
}
1920 1926

  
1921 1927
static void notdirty_mem_writew(void *opaque, target_phys_addr_t addr, uint32_t val)
1922 1928
{
1923
    stw_raw((uint8_t *)addr, val);
1929
    stw_p((uint8_t *)(long)addr, val);
1924 1930
    tlb_set_dirty(addr, cpu_single_env->mem_write_vaddr);
1925 1931
}
1926 1932

  
1927 1933
static void notdirty_mem_writel(void *opaque, target_phys_addr_t addr, uint32_t val)
1928 1934
{
1929
    stl_raw((uint8_t *)addr, val);
1935
    stl_p((uint8_t *)(long)addr, val);
1930 1936
    tlb_set_dirty(addr, cpu_single_env->mem_write_vaddr);
1931 1937
}
1932 1938

  
......
2046 2052
                io_index = (pd >> IO_MEM_SHIFT) & (IO_MEM_NB_ENTRIES - 1);
2047 2053
                if (l >= 4 && ((addr & 3) == 0)) {
2048 2054
                    /* 32 bit read access */
2049
                    val = ldl_raw(buf);
2055
                    val = ldl_p(buf);
2050 2056
                    io_mem_write[io_index][2](io_mem_opaque[io_index], addr, val);
2051 2057
                    l = 4;
2052 2058
                } else if (l >= 2 && ((addr & 1) == 0)) {
2053 2059
                    /* 16 bit read access */
2054
                    val = lduw_raw(buf);
2060
                    val = lduw_p(buf);
2055 2061
                    io_mem_write[io_index][1](io_mem_opaque[io_index], addr, val);
2056 2062
                    l = 2;
2057 2063
                } else {
2058 2064
                    /* 8 bit access */
2059
                    val = ldub_raw(buf);
2065
                    val = ldub_p(buf);
2060 2066
                    io_mem_write[io_index][0](io_mem_opaque[io_index], addr, val);
2061 2067
                    l = 1;
2062 2068
                }
......
2079 2085
                if (l >= 4 && ((addr & 3) == 0)) {
2080 2086
                    /* 32 bit read access */
2081 2087
                    val = io_mem_read[io_index][2](io_mem_opaque[io_index], addr);
2082
                    stl_raw(buf, val);
2088
                    stl_p(buf, val);
2083 2089
                    l = 4;
2084 2090
                } else if (l >= 2 && ((addr & 1) == 0)) {
2085 2091
                    /* 16 bit read access */
2086 2092
                    val = io_mem_read[io_index][1](io_mem_opaque[io_index], addr);
2087
                    stw_raw(buf, val);
2093
                    stw_p(buf, val);
2088 2094
                    l = 2;
2089 2095
                } else {
2090 2096
                    /* 8 bit access */
2091 2097
                    val = io_mem_read[io_index][0](io_mem_opaque[io_index], addr);
2092
                    stb_raw(buf, val);
2098
                    stb_p(buf, val);
2093 2099
                    l = 1;
2094 2100
                }
2095 2101
            } else {

Also available in: Unified diff