6 spapr_hcall_fn hypercall_table
[(MAX_HCALL_OPCODE
/ 4) + 1];
8 void spapr_register_hypercall(target_ulong opcode
, spapr_hcall_fn fn
)
10 spapr_hcall_fn old_fn
;
12 assert(opcode
<= MAX_HCALL_OPCODE
);
13 assert((opcode
& 0x3) == 0);
15 old_fn
= hypercall_table
[opcode
/ 4];
17 assert(!old_fn
|| (fn
== old_fn
));
19 hypercall_table
[opcode
/ 4] = fn
;
22 target_ulong
spapr_hypercall(CPUState
*env
, target_ulong opcode
,
26 hcall_dprintf("Hypercall made with MSR[PR]=1\n");
30 if ((opcode
<= MAX_HCALL_OPCODE
)
31 && ((opcode
& 0x3) == 0)) {
32 spapr_hcall_fn fn
= hypercall_table
[opcode
/ 4];
35 return fn(env
, spapr
, opcode
, args
);
39 hcall_dprintf("Unimplemented hcall 0x" TARGET_FMT_lx
"\n", opcode
);