Statistics
| Branch: | Revision:

root / target-cris / op_helper.c @ 89fc88da

History | View | Annotate | Download (2.3 kB)

1
/*
2
 *  CRIS helper routines
3
 *
4
 *  Copyright (c) 2007 AXIS Communications
5
 *  Written by Edgar E. Iglesias
6
 *
7
 * This library is free software; you can redistribute it and/or
8
 * modify it under the terms of the GNU Lesser General Public
9
 * License as published by the Free Software Foundation; either
10
 * version 2 of the License, or (at your option) any later version.
11
 *
12
 * This library is distributed in the hope that it will be useful,
13
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15
 * Lesser General Public License for more details.
16
 *
17
 * You should have received a copy of the GNU Lesser General Public
18
 * License along with this library; if not, write to the Free Software
19
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
20
 */
21

    
22
#include <assert.h>
23
#include "exec.h"
24

    
25
#define MMUSUFFIX _mmu
26
#define GETPC() (__builtin_return_address(0))
27

    
28
#define SHIFT 0
29
#include "softmmu_template.h"
30

    
31
#define SHIFT 1
32
#include "softmmu_template.h"
33

    
34
#define SHIFT 2
35
#include "softmmu_template.h"
36

    
37
#define SHIFT 3
38
#include "softmmu_template.h"
39

    
40
/* Try to fill the TLB and return an exception if error. If retaddr is
41
   NULL, it means that the function was called in C code (i.e. not
42
   from generated code or from helper.c) */
43
/* XXX: fix it to restore all registers */
44
void tlb_fill (target_ulong addr, int is_write, int is_user, void *retaddr)
45
{
46
    TranslationBlock *tb;
47
    CPUState *saved_env;
48
    target_phys_addr_t pc;
49
    int ret;
50

    
51
    /* XXX: hack to restore env in all cases, even if not called from
52
       generated code */
53
    saved_env = env;
54
    env = cpu_single_env;
55
    ret = cpu_cris_handle_mmu_fault(env, addr, is_write, is_user, 1);
56
    if (__builtin_expect(ret, 0)) {
57
        if (retaddr) {
58
            /* now we have a real cpu fault */
59
            pc = (target_phys_addr_t)retaddr;
60
            tb = tb_find_pc(pc);
61
            if (tb) {
62
                /* the PC is inside the translated code. It means that we have
63
                   a virtual CPU fault */
64
                cpu_restore_state(tb, env, pc, NULL);
65
            }
66
        }
67
        cpu_loop_exit();
68
    }
69
    env = saved_env;
70
}
71

    
72
void do_unassigned_access(target_phys_addr_t addr, int is_write, int is_exec,
73
                          int is_asi)
74
{
75

    
76
}