Lines Matching refs:cpu
37 static void do_hcall(struct lg_cpu *cpu, struct hcall_args *args) in do_hcall() argument
57 kill_guest(cpu, "already have lguest_data"); in do_hcall()
68 __lgread(cpu, msg, args->arg1, sizeof(msg)); in do_hcall()
70 kill_guest(cpu, "CRASH: %s", msg); in do_hcall()
72 cpu->lg->dead = ERR_PTR(-ERESTART); in do_hcall()
78 guest_pagetable_clear_all(cpu); in do_hcall()
80 guest_pagetable_flush_user(cpu); in do_hcall()
88 guest_new_pagetable(cpu, args->arg1); in do_hcall()
91 guest_set_stack(cpu, args->arg1, args->arg2, args->arg3); in do_hcall()
95 guest_set_pte(cpu, args->arg1, args->arg2, in do_hcall()
98 guest_set_pte(cpu, args->arg1, args->arg2, __pte(args->arg3)); in do_hcall()
102 guest_set_pgd(cpu->lg, args->arg1, args->arg2); in do_hcall()
106 guest_set_pmd(cpu->lg, args->arg1, args->arg2); in do_hcall()
110 guest_set_clockevent(cpu, args->arg1); in do_hcall()
114 cpu->ts = args->arg1; in do_hcall()
118 cpu->halted = 1; in do_hcall()
122 if (lguest_arch_do_hcall(cpu, args)) in do_hcall()
123 kill_guest(cpu, "Bad hypercall %li\n", args->arg0); in do_hcall()
136 static void do_async_hcalls(struct lg_cpu *cpu) in do_async_hcalls() argument
142 if (copy_from_user(&st, &cpu->lg->lguest_data->hcall_status, sizeof(st))) in do_async_hcalls()
153 unsigned int n = cpu->next_hcall; in do_async_hcalls()
163 if (++cpu->next_hcall == LHCALL_RING_SIZE) in do_async_hcalls()
164 cpu->next_hcall = 0; in do_async_hcalls()
170 if (copy_from_user(&args, &cpu->lg->lguest_data->hcalls[n], in do_async_hcalls()
172 kill_guest(cpu, "Fetching async hypercalls"); in do_async_hcalls()
177 do_hcall(cpu, &args); in do_async_hcalls()
180 if (put_user(0xFF, &cpu->lg->lguest_data->hcall_status[n])) { in do_async_hcalls()
181 kill_guest(cpu, "Writing result for async hypercall"); in do_async_hcalls()
189 if (cpu->pending.trap) in do_async_hcalls()
198 static void initialize(struct lg_cpu *cpu) in initialize() argument
204 if (cpu->hcall->arg0 != LHCALL_LGUEST_INIT) { in initialize()
205 kill_guest(cpu, "hypercall %li before INIT", cpu->hcall->arg0); in initialize()
209 if (lguest_arch_init_hypercalls(cpu)) in initialize()
210 kill_guest(cpu, "bad guest page %p", cpu->lg->lguest_data); in initialize()
216 if (get_user(cpu->lg->noirq_iret, &cpu->lg->lguest_data->noirq_iret)) in initialize()
217 kill_guest(cpu, "bad guest page %p", cpu->lg->lguest_data); in initialize()
223 write_timestamp(cpu); in initialize()
226 page_table_guest_data_init(cpu); in initialize()
234 guest_pagetable_clear_all(cpu); in initialize()
256 void do_hypercalls(struct lg_cpu *cpu) in do_hypercalls() argument
259 if (unlikely(!cpu->lg->lguest_data)) { in do_hypercalls()
261 initialize(cpu); in do_hypercalls()
263 cpu->hcall = NULL; in do_hypercalls()
272 do_async_hcalls(cpu); in do_hypercalls()
279 if (!cpu->pending.trap) { in do_hypercalls()
280 do_hcall(cpu, cpu->hcall); in do_hypercalls()
293 cpu->hcall = NULL; in do_hypercalls()
301 void write_timestamp(struct lg_cpu *cpu) in write_timestamp() argument
305 if (copy_to_user(&cpu->lg->lguest_data->time, in write_timestamp()
307 kill_guest(cpu, "Writing timestamp"); in write_timestamp()