/[dynamips]/trunk/jit_op.h
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /trunk/jit_op.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 12 - (show annotations)
Sat Oct 6 16:45:40 2007 UTC (11 years, 7 months ago) by dpavlin
File MIME type: text/plain
File size: 1677 byte(s)
make working copy

1 /*
2 * Cisco router simulation platform.
3 * Copyright (c) 2007 Christophe Fillot (cf@utc.fr)
4 */
5
6 #ifndef __JIT_OP_H__
7 #define __JIT_OP_H__
8
9 #include "utils.h"
10
11 /* Number of JIT pools */
12 #define JIT_OP_POOL_NR 8
13
14 /* Invalid register in op */
15 #define JIT_OP_INV_REG -1
16
17 /* All flags */
18 #define JIT_OP_PPC_ALL_FLAGS -1
19
20 /* All registers */
21 #define JIT_OP_ALL_REGS -1
22
23 /* JIT opcodes */
24 enum {
25 JIT_OP_INVALID = 0,
26 JIT_OP_INSN_OUTPUT,
27 JIT_OP_BRANCH_TARGET,
28 JIT_OP_BRANCH_JUMP,
29 JIT_OP_EOB,
30 JIT_OP_LOAD_GPR,
31 JIT_OP_STORE_GPR,
32 JIT_OP_UPDATE_FLAGS,
33 JIT_OP_REQUIRE_FLAGS,
34 JIT_OP_TRASH_FLAGS,
35 JIT_OP_ALTER_HOST_REG,
36 JIT_OP_MOVE_HOST_REG,
37 JIT_OP_SET_HOST_REG_IMM32,
38 };
39
40 /* JIT operation */
41 struct jit_op {
42 u_int opcode;
43 int param[3];
44 void *arg_ptr;
45 char *insn_name;
46 struct jit_op *next;
47
48 /* JIT output buffer */
49 u_int ob_size_index;
50 u_char *ob_final;
51 u_char *ob_ptr;
52 u_char ob_data[0];
53 };
54
55 extern u_int jit_op_blk_sizes[];
56
57 /* Find a specific opcode in a JIT op list */
58 static inline jit_op_t *jit_op_find_opcode(jit_op_t *op_list,u_int opcode)
59 {
60 jit_op_t *op;
61
62 for(op=op_list;op;op=op->next)
63 if (op->opcode == opcode)
64 return op;
65
66 return NULL;
67 }
68
69 /* Get a JIT op (allocate one if necessary) */
70 jit_op_t *jit_op_get(cpu_gen_t *cpu,int size_index,u_int opcode);
71
72 /* Release a JIT op */
73 void jit_op_free(cpu_gen_t *cpu,jit_op_t *op);
74
75 /* Free a list of JIT ops */
76 void jit_op_free_list(cpu_gen_t *cpu,jit_op_t *op_list);
77
78 /* Initialize JIT op pools for the specified CPU */
79 int jit_op_init_cpu(cpu_gen_t *cpu);
80
81 /* Free memory used by pools */
82 void jit_op_free_pools(cpu_gen_t *cpu);
83
84 #endif

  ViewVC Help
Powered by ViewVC 1.1.26