Lines Matching full: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()
121 cpu->pending_notify = args->arg1; in do_hcall()
125 if (lguest_arch_do_hcall(cpu, args)) in do_hcall()
126 kill_guest(cpu, "Bad hypercall %li\n", args->arg0); in do_hcall()
139 static void do_async_hcalls(struct lg_cpu *cpu) in do_async_hcalls() argument
145 if (copy_from_user(&st, &cpu->lg->lguest_data->hcall_status, sizeof(st))) in do_async_hcalls()
156 unsigned int n = cpu->next_hcall; in do_async_hcalls()
166 if (++cpu->next_hcall == LHCALL_RING_SIZE) in do_async_hcalls()
167 cpu->next_hcall = 0; in do_async_hcalls()
173 if (copy_from_user(&args, &cpu->lg->lguest_data->hcalls[n], in do_async_hcalls()
175 kill_guest(cpu, "Fetching async hypercalls"); in do_async_hcalls()
180 do_hcall(cpu, &args); in do_async_hcalls()
183 if (put_user(0xFF, &cpu->lg->lguest_data->hcall_status[n])) { in do_async_hcalls()
184 kill_guest(cpu, "Writing result for async hypercall"); in do_async_hcalls()
192 if (cpu->pending_notify) in do_async_hcalls()
201 static void initialize(struct lg_cpu *cpu) in initialize() argument
207 if (cpu->hcall->arg0 != LHCALL_LGUEST_INIT) { in initialize()
208 kill_guest(cpu, "hypercall %li before INIT", cpu->hcall->arg0); in initialize()
212 if (lguest_arch_init_hypercalls(cpu)) in initialize()
213 kill_guest(cpu, "bad guest page %p", cpu->lg->lguest_data); in initialize()
219 if (get_user(cpu->lg->noirq_start, &cpu->lg->lguest_data->noirq_start) in initialize()
220 || get_user(cpu->lg->noirq_end, &cpu->lg->lguest_data->noirq_end)) in initialize()
221 kill_guest(cpu, "bad guest page %p", cpu->lg->lguest_data); in initialize()
227 write_timestamp(cpu); in initialize()
230 page_table_guest_data_init(cpu); in initialize()
238 guest_pagetable_clear_all(cpu); in initialize()
260 void do_hypercalls(struct lg_cpu *cpu) in do_hypercalls() argument
263 if (unlikely(!cpu->lg->lguest_data)) { in do_hypercalls()
265 initialize(cpu); in do_hypercalls()
267 cpu->hcall = NULL; in do_hypercalls()
276 do_async_hcalls(cpu); in do_hypercalls()
283 if (!cpu->pending_notify) { in do_hypercalls()
284 do_hcall(cpu, cpu->hcall); in do_hypercalls()
297 cpu->hcall = NULL; in do_hypercalls()
305 void write_timestamp(struct lg_cpu *cpu) in write_timestamp() argument
309 if (copy_to_user(&cpu->lg->lguest_data->time, in write_timestamp()
311 kill_guest(cpu, "Writing timestamp"); in write_timestamp()