[SOLVED + PATCH] Re: Anybody got 2.4.0 running on a 386 ?

Robert Kaiser
2001-01-15T19:02:09Z

Hi everybody,

I finally found the reason why 386es have trouble booting the 2.4.0 kernel:

In routine pagetable_init() in arch/i386/mm/init.c, a pte gets installed before
it actually has been filled with valid entries. This causes the kernel text
segment to be temporarily unmapped. Pentiums are only lucky to not crash
because they have a bigger TLB than 386s.

Here is a patch to fix this:

--- init.c.orig Wed Nov 29 07:43:39 2000
+++ init.c Mon Jan 15 18:36:08 2001
@@ -317,7 +317,7 @@
pgd_t *pgd, *pgd_base;
int i, j, k;
pmd_t *pmd;
- pte_t *pte;
+ pte_t *pte, *pte_base;

/*
* This can be zero as well - no problem, in that case we exit
@@ -366,11 +366,7 @@
continue;
}

- pte = (pte_t *) alloc_bootmem_low_pages(PAGE_SIZE);
- set_pmd(pmd, __pmd(_KERNPG_TABLE + __pa(pte)));
-
- if (pte != pte_offset(pmd, 0))
- BUG();
+ pte_base = pte = (pte_t *) alloc_bootmem_low_pages(PAGE_SIZE);

for (k = 0; k < PTRS_PER_PTE; pte++, k++) {
vaddr = i*PGDIR_SIZE + j*PMD_SIZE + k*PAGE_SIZE;
@@ -378,6 +374,10 @@
break;
*pte = mk_pte_phys(__pa(vaddr), PAGE_KERNEL);
}
+ set_pmd(pmd, __pmd(_KERNPG_TABLE + __pa(pte_base)));
+ if (pte_base != pte_offset(pmd, 0))
+ BUG();
+
}
}

Thanks to everybody who helped with ideas and suggestions, especially Ingo
Molnar!

Cheers

Rob

----------------------------------------------------------------
Robert Kaiser email: rkaiser@sysgo.de
SYSGO RTS GmbH
Am Pfaffenstein 14 phone: (49) 6136 9948-762
D-55270 Klein-Winternheim / Germany fax: (49) 6136 9948-10