| .. | .. |
|---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-or-later */ |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * FPU support code, moved here from head.S so that it can be used |
|---|
| 3 | 4 | * by chips which use other head-whatever.S files. |
|---|
| .. | .. |
|---|
| 6 | 7 | * Copyright (C) 1996 Cort Dougan <cort@cs.nmt.edu> |
|---|
| 7 | 8 | * Copyright (C) 1996 Paul Mackerras. |
|---|
| 8 | 9 | * Copyright (C) 1997 Dan Malek (dmalek@jlc.net). |
|---|
| 9 | | - * |
|---|
| 10 | | - * This program is free software; you can redistribute it and/or |
|---|
| 11 | | - * modify it under the terms of the GNU General Public License |
|---|
| 12 | | - * as published by the Free Software Foundation; either version |
|---|
| 13 | | - * 2 of the License, or (at your option) any later version. |
|---|
| 14 | | - * |
|---|
| 15 | 10 | */ |
|---|
| 16 | 11 | |
|---|
| 17 | 12 | #include <asm/reg.h> |
|---|
| 18 | 13 | #include <asm/page.h> |
|---|
| 19 | 14 | #include <asm/mmu.h> |
|---|
| 20 | | -#include <asm/pgtable.h> |
|---|
| 21 | 15 | #include <asm/cputable.h> |
|---|
| 22 | 16 | #include <asm/cache.h> |
|---|
| 23 | 17 | #include <asm/thread_info.h> |
|---|
| .. | .. |
|---|
| 63 | 57 | REST_32FPVSRS(0, R4, R3) |
|---|
| 64 | 58 | blr |
|---|
| 65 | 59 | EXPORT_SYMBOL(load_fp_state) |
|---|
| 60 | +_ASM_NOKPROBE_SYMBOL(load_fp_state); /* used by restore_math */ |
|---|
| 66 | 61 | |
|---|
| 67 | 62 | /* |
|---|
| 68 | 63 | * Store FP state into memory, including FPSCR |
|---|
| .. | .. |
|---|
| 92 | 87 | oris r5,r5,MSR_VSX@h |
|---|
| 93 | 88 | END_FTR_SECTION_IFSET(CPU_FTR_VSX) |
|---|
| 94 | 89 | #endif |
|---|
| 95 | | - SYNC |
|---|
| 96 | 90 | MTMSRD(r5) /* enable use of fpu now */ |
|---|
| 97 | 91 | isync |
|---|
| 98 | 92 | /* enable use of FP after return */ |
|---|
| 99 | 93 | #ifdef CONFIG_PPC32 |
|---|
| 100 | 94 | mfspr r5,SPRN_SPRG_THREAD /* current task's THREAD (phys) */ |
|---|
| 95 | +#ifdef CONFIG_VMAP_STACK |
|---|
| 96 | + tovirt(r5, r5) |
|---|
| 97 | +#endif |
|---|
| 101 | 98 | lwz r4,THREAD_FPEXC_MODE(r5) |
|---|
| 102 | 99 | ori r9,r9,MSR_FP /* enable FP for current */ |
|---|
| 103 | 100 | or r9,r9,r4 |
|---|
| .. | .. |
|---|
| 109 | 106 | or r12,r12,r4 |
|---|
| 110 | 107 | std r12,_MSR(r1) |
|---|
| 111 | 108 | #endif |
|---|
| 112 | | - /* Don't care if r4 overflows, this is desired behaviour */ |
|---|
| 113 | | - lbz r4,THREAD_LOAD_FP(r5) |
|---|
| 114 | | - addi r4,r4,1 |
|---|
| 109 | + li r4,1 |
|---|
| 115 | 110 | stb r4,THREAD_LOAD_FP(r5) |
|---|
| 116 | 111 | addi r10,r5,THREAD_FPSTATE |
|---|
| 117 | 112 | lfd fr0,FPSTATE_FPSCR(r10) |
|---|
| .. | .. |
|---|
| 120 | 115 | /* restore registers and return */ |
|---|
| 121 | 116 | /* we haven't used ctr or xer or lr */ |
|---|
| 122 | 117 | blr |
|---|
| 118 | +_ASM_NOKPROBE_SYMBOL(load_up_fpu) |
|---|
| 123 | 119 | |
|---|
| 124 | 120 | /* |
|---|
| 125 | 121 | * save_fpu(tsk) |
|---|
| .. | .. |
|---|
| 136 | 132 | 2: SAVE_32FPVSRS(0, R4, R6) |
|---|
| 137 | 133 | mffs fr0 |
|---|
| 138 | 134 | stfd fr0,FPSTATE_FPSCR(r6) |
|---|
| 139 | | - blr |
|---|
| 140 | | - |
|---|
| 141 | | -/* |
|---|
| 142 | | - * These are used in the alignment trap handler when emulating |
|---|
| 143 | | - * single-precision loads and stores. |
|---|
| 144 | | - */ |
|---|
| 145 | | - |
|---|
| 146 | | -_GLOBAL(cvt_fd) |
|---|
| 147 | | - lfs 0,0(r3) |
|---|
| 148 | | - stfd 0,0(r4) |
|---|
| 149 | | - blr |
|---|
| 150 | | - |
|---|
| 151 | | -_GLOBAL(cvt_df) |
|---|
| 152 | | - lfd 0,0(r3) |
|---|
| 153 | | - stfs 0,0(r4) |
|---|
| 154 | 135 | blr |
|---|