Revert the vm_machdep.c part of r205072.

This causes a panic in vm_thread_dispose() when it tries to add this kstack
to the kstack cache. This happens only when 'td_kstack' is not (PAGE_SIZE * 2)
bytes aligned and we have unmapped the page at that address in cpu_thread_alloc.

Pointed out by: nwhitehorn@
This commit is contained in:
neel 2010-04-14 01:29:31 +00:00
parent 007384b17e
commit 88551608b7

View File

@ -214,16 +214,6 @@ cpu_thread_swapin(struct thread *td)
{
pt_entry_t *pte;
int i;
vm_offset_t unused_kstack_page;
/*
* Unmap the unused kstack page.
*/
unused_kstack_page = td->td_kstack;
if (td->td_md.md_realstack == td->td_kstack)
unused_kstack_page += (KSTACK_PAGES - 1) * PAGE_SIZE;
pmap_kremove(unused_kstack_page);
/*
* The kstack may be at a different physical address now.
@ -249,19 +239,13 @@ cpu_thread_swapout(struct thread *td)
void
cpu_thread_alloc(struct thread *td)
{
vm_offset_t unused_kstack_page;
pt_entry_t *pte;
int i;
if (td->td_kstack & (1 << PAGE_SHIFT)) {
if (td->td_kstack & (1 << PAGE_SHIFT))
td->td_md.md_realstack = td->td_kstack + PAGE_SIZE;
unused_kstack_page = td->td_kstack;
} else {
else
td->td_md.md_realstack = td->td_kstack;
unused_kstack_page = td->td_kstack +
(KSTACK_PAGES - 1) * PAGE_SIZE;
}
pmap_kremove(unused_kstack_page);
td->td_pcb = (struct pcb *)(td->td_md.md_realstack +
(td->td_kstack_pages - 1) * PAGE_SIZE) - 1;