| .. | .. |
|---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-or-later */ |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Kernel execution entry point code. |
|---|
| 3 | 4 | * |
|---|
| .. | .. |
|---|
| 21 | 22 | * debbie_chu@mvista.com |
|---|
| 22 | 23 | * Copyright 2002-2005 MontaVista Software, Inc. |
|---|
| 23 | 24 | * PowerPC 44x support, Matt Porter <mporter@kernel.crashing.org> |
|---|
| 24 | | - * |
|---|
| 25 | | - * This program is free software; you can redistribute it and/or modify it |
|---|
| 26 | | - * under the terms of the GNU General Public License as published by the |
|---|
| 27 | | - * Free Software Foundation; either version 2 of the License, or (at your |
|---|
| 28 | | - * option) any later version. |
|---|
| 29 | 25 | */ |
|---|
| 30 | 26 | |
|---|
| 31 | 27 | #include <linux/init.h> |
|---|
| 28 | +#include <linux/pgtable.h> |
|---|
| 32 | 29 | #include <asm/processor.h> |
|---|
| 33 | 30 | #include <asm/page.h> |
|---|
| 34 | 31 | #include <asm/mmu.h> |
|---|
| 35 | | -#include <asm/pgtable.h> |
|---|
| 36 | 32 | #include <asm/cputable.h> |
|---|
| 37 | 33 | #include <asm/thread_info.h> |
|---|
| 38 | 34 | #include <asm/ppc_asm.h> |
|---|
| .. | .. |
|---|
| 40 | 36 | #include <asm/ptrace.h> |
|---|
| 41 | 37 | #include <asm/synch.h> |
|---|
| 42 | 38 | #include <asm/export.h> |
|---|
| 39 | +#include <asm/code-patching-asm.h> |
|---|
| 43 | 40 | #include "head_booke.h" |
|---|
| 44 | 41 | |
|---|
| 45 | 42 | |
|---|
| .. | .. |
|---|
| 202 | 199 | /* |
|---|
| 203 | 200 | * Decide what sort of machine this is and initialize the MMU. |
|---|
| 204 | 201 | */ |
|---|
| 202 | +#ifdef CONFIG_KASAN |
|---|
| 203 | + bl kasan_early_init |
|---|
| 204 | +#endif |
|---|
| 205 | 205 | li r3,0 |
|---|
| 206 | 206 | mr r4,r31 |
|---|
| 207 | 207 | bl machine_init |
|---|
| .. | .. |
|---|
| 277 | 277 | FP_UNAVAILABLE_EXCEPTION |
|---|
| 278 | 278 | #else |
|---|
| 279 | 279 | EXCEPTION(0x2010, BOOKE_INTERRUPT_FP_UNAVAIL, \ |
|---|
| 280 | | - FloatingPointUnavailable, unknown_exception, EXC_XFER_EE) |
|---|
| 280 | + FloatingPointUnavailable, unknown_exception, EXC_XFER_STD) |
|---|
| 281 | 281 | #endif |
|---|
| 282 | 282 | /* System Call Interrupt */ |
|---|
| 283 | 283 | START_EXCEPTION(SystemCall) |
|---|
| 284 | | - NORMAL_EXCEPTION_PROLOG(BOOKE_INTERRUPT_SYSCALL) |
|---|
| 285 | | - EXC_XFER_EE_LITE(0x0c00, DoSyscall) |
|---|
| 284 | + SYSCALL_ENTRY 0xc00 BOOKE_INTERRUPT_SYSCALL |
|---|
| 286 | 285 | |
|---|
| 287 | 286 | /* Auxiliary Processor Unavailable Interrupt */ |
|---|
| 288 | 287 | EXCEPTION(0x2020, BOOKE_INTERRUPT_AP_UNAVAIL, \ |
|---|
| 289 | | - AuxillaryProcessorUnavailable, unknown_exception, EXC_XFER_EE) |
|---|
| 288 | + AuxillaryProcessorUnavailable, unknown_exception, EXC_XFER_STD) |
|---|
| 290 | 289 | |
|---|
| 291 | 290 | /* Decrementer Interrupt */ |
|---|
| 292 | 291 | DECREMENTER_EXCEPTION |
|---|
| .. | .. |
|---|
| 294 | 293 | /* Fixed Internal Timer Interrupt */ |
|---|
| 295 | 294 | /* TODO: Add FIT support */ |
|---|
| 296 | 295 | EXCEPTION(0x1010, BOOKE_INTERRUPT_FIT, FixedIntervalTimer, \ |
|---|
| 297 | | - unknown_exception, EXC_XFER_EE) |
|---|
| 296 | + unknown_exception, EXC_XFER_STD) |
|---|
| 298 | 297 | |
|---|
| 299 | 298 | /* Watchdog Timer Interrupt */ |
|---|
| 300 | 299 | /* TODO: Add watchdog support */ |
|---|
| .. | .. |
|---|
| 382 | 381 | /* Increment, rollover, and store TLB index */ |
|---|
| 383 | 382 | addi r13,r13,1 |
|---|
| 384 | 383 | |
|---|
| 384 | + patch_site 0f, patch__tlb_44x_hwater_D |
|---|
| 385 | 385 | /* Compare with watermark (instruction gets patched) */ |
|---|
| 386 | | - .globl tlb_44x_patch_hwater_D |
|---|
| 387 | | -tlb_44x_patch_hwater_D: |
|---|
| 388 | | - cmpwi 0,r13,1 /* reserve entries */ |
|---|
| 386 | +0: cmpwi 0,r13,1 /* reserve entries */ |
|---|
| 389 | 387 | ble 5f |
|---|
| 390 | 388 | li r13,0 |
|---|
| 391 | 389 | 5: |
|---|
| .. | .. |
|---|
| 478 | 476 | /* Increment, rollover, and store TLB index */ |
|---|
| 479 | 477 | addi r13,r13,1 |
|---|
| 480 | 478 | |
|---|
| 479 | + patch_site 0f, patch__tlb_44x_hwater_I |
|---|
| 481 | 480 | /* Compare with watermark (instruction gets patched) */ |
|---|
| 482 | | - .globl tlb_44x_patch_hwater_I |
|---|
| 483 | | -tlb_44x_patch_hwater_I: |
|---|
| 484 | | - cmpwi 0,r13,1 /* reserve entries */ |
|---|
| 481 | +0: cmpwi 0,r13,1 /* reserve entries */ |
|---|
| 485 | 482 | ble 5f |
|---|
| 486 | 483 | li r13,0 |
|---|
| 487 | 484 | 5: |
|---|
| .. | .. |
|---|
| 1020 | 1017 | |
|---|
| 1021 | 1018 | /* Now we can get our task struct and real stack pointer */ |
|---|
| 1022 | 1019 | |
|---|
| 1023 | | - /* Get current_thread_info and current */ |
|---|
| 1024 | | - lis r1,secondary_ti@ha |
|---|
| 1025 | | - lwz r1,secondary_ti@l(r1) |
|---|
| 1026 | | - lwz r2,TI_TASK(r1) |
|---|
| 1020 | + /* Get current's stack and current */ |
|---|
| 1021 | + lis r2,secondary_current@ha |
|---|
| 1022 | + lwz r2,secondary_current@l(r2) |
|---|
| 1023 | + lwz r1,TASK_STACK(r2) |
|---|
| 1027 | 1024 | |
|---|
| 1028 | 1025 | /* Current stack pointer */ |
|---|
| 1029 | 1026 | addi r1,r1,THREAD_SIZE-STACK_FRAME_OVERHEAD |
|---|