x86/head/64: Move early exception dispatch to C code
Move the assembly coded dispatch between page-faults and all other exceptions to C code to make it easier to maintain and extend. Also change the return-type of early_make_pgtable() to bool and make it static. Signed-off-by: Joerg Roedel <jroedel@suse.de> Signed-off-by: Borislav Petkov <bp@suse.de> Link: https://lkml.kernel.org/r/20200907131613.12703-36-joro@8bytes.org
This commit is contained in:

committed by
Borislav Petkov

parent
097ee5b778
commit
4b47cdbda6
@@ -38,6 +38,8 @@
|
||||
#include <asm/fixmap.h>
|
||||
#include <asm/realmode.h>
|
||||
#include <asm/desc.h>
|
||||
#include <asm/extable.h>
|
||||
#include <asm/trapnr.h>
|
||||
|
||||
/*
|
||||
* Manage page tables very early on.
|
||||
@@ -317,7 +319,7 @@ static void __init reset_early_page_tables(void)
|
||||
}
|
||||
|
||||
/* Create a new PMD entry */
|
||||
int __init __early_make_pgtable(unsigned long address, pmdval_t pmd)
|
||||
bool __init __early_make_pgtable(unsigned long address, pmdval_t pmd)
|
||||
{
|
||||
unsigned long physaddr = address - __PAGE_OFFSET;
|
||||
pgdval_t pgd, *pgd_p;
|
||||
@@ -327,7 +329,7 @@ int __init __early_make_pgtable(unsigned long address, pmdval_t pmd)
|
||||
|
||||
/* Invalid address or early pgt is done ? */
|
||||
if (physaddr >= MAXMEM || read_cr3_pa() != __pa_nodebug(early_top_pgt))
|
||||
return -1;
|
||||
return false;
|
||||
|
||||
again:
|
||||
pgd_p = &early_top_pgt[pgd_index(address)].pgd;
|
||||
@@ -384,10 +386,10 @@ again:
|
||||
}
|
||||
pmd_p[pmd_index(address)] = pmd;
|
||||
|
||||
return 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
int __init early_make_pgtable(unsigned long address)
|
||||
static bool __init early_make_pgtable(unsigned long address)
|
||||
{
|
||||
unsigned long physaddr = address - __PAGE_OFFSET;
|
||||
pmdval_t pmd;
|
||||
@@ -397,6 +399,15 @@ int __init early_make_pgtable(unsigned long address)
|
||||
return __early_make_pgtable(address, pmd);
|
||||
}
|
||||
|
||||
void __init do_early_exception(struct pt_regs *regs, int trapnr)
|
||||
{
|
||||
if (trapnr == X86_TRAP_PF &&
|
||||
early_make_pgtable(native_read_cr2()))
|
||||
return;
|
||||
|
||||
early_fixup_exception(regs, trapnr);
|
||||
}
|
||||
|
||||
/* Don't add a printk in there. printk relies on the PDA which is not initialized
|
||||
yet. */
|
||||
static void __init clear_bss(void)
|
||||
|
Reference in New Issue
Block a user