/* In Linux each process has its own kernel stack, so this happens a lot: we change stacks on each context switch.  */
void guest_set_stack(struct lg_cpu *cpu, u32 seg, u32 esp, unsigned int pages)
/* In Linux each process has its own kernel stack, so this happens a lot: we change stacks on each context switch.  */
void guest_set_stack(struct lg_cpu *cpu, u32 seg, u32 esp, unsigned int pages)
{
	if ((seg & 0x3) != GUEST_PL)
		kill_guest(cpu, "bad stack segment %i", seg);
	if (pages > 2)
		kill_guest(cpu, "bad stack pages %u", pages);
	cpu->ss1 = seg;
	cpu->esp1 = esp;
	cpu->lg->stack_pages = pages;
	pin_stack_pages(cpu);
}