Commit 4182d0cd authored by Helge Deller's avatar Helge Deller

parisc: Initialize the fault vector earlier in the boot process.

A fault vector on parisc needs to be 2K aligned.  Furthermore the
checksum of the fault vector needs to sum up to 0 which is being
calculated and written at runtime.

Up to now we aligned both PA20 and PA11 fault vectors on the same 4K
page in order to easily write the checksum after having mapped the
kernel read-only (by mapping this page only as read-write).
But when we want to map the kernel text and data on huge pages this
makes things harder.
So, simplify it by aligning both fault vectors on 2K boundries and write
the checksum before we map the page read-only.
Signed-off-by: default avatarHelge Deller <deller@gmx.de>
parent 1f25ad26
...@@ -646,17 +646,12 @@ ...@@ -646,17 +646,12 @@
/* /*
* Align fault_vector_20 on 4K boundary so that both * Fault_vectors are architecturally required to be aligned on a 2K
* fault_vector_11 and fault_vector_20 are on the * boundary
* same page. This is only necessary as long as we
* write protect the kernel text, which we may stop
* doing once we use large page translations to cover
* the static part of the kernel address space.
*/ */
.text .text
.align 2048
.align 4096
ENTRY(fault_vector_20) ENTRY(fault_vector_20)
/* First vector is invalid (0) */ /* First vector is invalid (0) */
......
...@@ -377,6 +377,7 @@ arch_initcall(parisc_init); ...@@ -377,6 +377,7 @@ arch_initcall(parisc_init);
void start_parisc(void) void start_parisc(void)
{ {
extern void start_kernel(void); extern void start_kernel(void);
extern void early_trap_init(void);
int ret, cpunum; int ret, cpunum;
struct pdc_coproc_cfg coproc_cfg; struct pdc_coproc_cfg coproc_cfg;
...@@ -397,6 +398,8 @@ void start_parisc(void) ...@@ -397,6 +398,8 @@ void start_parisc(void)
panic("must have an fpu to boot linux"); panic("must have an fpu to boot linux");
} }
early_trap_init(); /* initialize checksum of fault_vector */
start_kernel(); start_kernel();
// not reached // not reached
} }
...@@ -807,7 +807,7 @@ void notrace handle_interruption(int code, struct pt_regs *regs) ...@@ -807,7 +807,7 @@ void notrace handle_interruption(int code, struct pt_regs *regs)
} }
int __init check_ivt(void *iva) void __init initialize_ivt(const void *iva)
{ {
extern u32 os_hpmc_size; extern u32 os_hpmc_size;
extern const u32 os_hpmc[]; extern const u32 os_hpmc[];
...@@ -818,8 +818,8 @@ int __init check_ivt(void *iva) ...@@ -818,8 +818,8 @@ int __init check_ivt(void *iva)
u32 *hpmcp; u32 *hpmcp;
u32 length; u32 length;
if (strcmp((char *)iva, "cows can fly")) if (strcmp((const char *)iva, "cows can fly"))
return -1; panic("IVT invalid");
ivap = (u32 *)iva; ivap = (u32 *)iva;
...@@ -839,28 +839,23 @@ int __init check_ivt(void *iva) ...@@ -839,28 +839,23 @@ int __init check_ivt(void *iva)
check += ivap[i]; check += ivap[i];
ivap[5] = -check; ivap[5] = -check;
return 0;
} }
#ifndef CONFIG_64BIT
extern const void fault_vector_11;
#endif
extern const void fault_vector_20;
void __init trap_init(void) /* early_trap_init() is called before we set up kernel mappings and
* write-protect the kernel */
void __init early_trap_init(void)
{ {
void *iva; extern const void fault_vector_20;
if (boot_cpu_data.cpu_type >= pcxu) #ifndef CONFIG_64BIT
iva = (void *) &fault_vector_20; extern const void fault_vector_11;
else initialize_ivt(&fault_vector_11);
#ifdef CONFIG_64BIT
panic("Can't boot 64-bit OS on PA1.1 processor!");
#else
iva = (void *) &fault_vector_11;
#endif #endif
if (check_ivt(iva)) initialize_ivt(&fault_vector_20);
panic("IVT invalid"); }
void __init trap_init(void)
{
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment