License cleanup: add SPDX GPL-2.0 license identifier to files with no license
Many source files in the tree are missing licensing information, which
makes it harder for compliance tools to determine the correct license.
By default all files without license information are under the default
license of the kernel, which is GPL version 2.
Update the files which contain no license information with the 'GPL-2.0'
SPDX license identifier. The SPDX identifier is a legally binding
shorthand, which can be used instead of the full boiler plate text.
This patch is based on work done by Thomas Gleixner and Kate Stewart and
Philippe Ombredanne.
How this work was done:
Patches were generated and checked against linux-4.14-rc6 for a subset of
the use cases:
- file had no licensing information it it.
- file was a */uapi/* one with no licensing information in it,
- file was a */uapi/* one with existing licensing information,
Further patches will be generated in subsequent months to fix up cases
where non-standard license headers were used, and references to license
had to be inferred by heuristics based on keywords.
The analysis to determine which SPDX License Identifier to be applied to
a file was done in a spreadsheet of side by side results from of the
output of two independent scanners (ScanCode & Windriver) producing SPDX
tag:value files created by Philippe Ombredanne. Philippe prepared the
base worksheet, and did an initial spot review of a few 1000 files.
The 4.13 kernel was the starting point of the analysis with 60,537 files
assessed. Kate Stewart did a file by file comparison of the scanner
results in the spreadsheet to determine which SPDX license identifier(s)
to be applied to the file. She confirmed any determination that was not
immediately clear with lawyers working with the Linux Foundation.
Criteria used to select files for SPDX license identifier tagging was:
- Files considered eligible had to be source code files.
- Make and config files were included as candidates if they contained >5
lines of source
- File already had some variant of a license header in it (even if <5
lines).
All documentation files were explicitly excluded.
The following heuristics were used to determine which SPDX license
identifiers to apply.
- when both scanners couldn't find any license traces, file was
considered to have no license information in it, and the top level
COPYING file license applied.
For non */uapi/* files that summary was:
SPDX license identifier # files
---------------------------------------------------|-------
GPL-2.0 11139
and resulted in the first patch in this series.
If that file was a */uapi/* path one, it was "GPL-2.0 WITH
Linux-syscall-note" otherwise it was "GPL-2.0". Results of that was:
SPDX license identifier # files
---------------------------------------------------|-------
GPL-2.0 WITH Linux-syscall-note 930
and resulted in the second patch in this series.
- if a file had some form of licensing information in it, and was one
of the */uapi/* ones, it was denoted with the Linux-syscall-note if
any GPL family license was found in the file or had no licensing in
it (per prior point). Results summary:
SPDX license identifier # files
---------------------------------------------------|------
GPL-2.0 WITH Linux-syscall-note 270
GPL-2.0+ WITH Linux-syscall-note 169
((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) 21
((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) 17
LGPL-2.1+ WITH Linux-syscall-note 15
GPL-1.0+ WITH Linux-syscall-note 14
((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause) 5
LGPL-2.0+ WITH Linux-syscall-note 4
LGPL-2.1 WITH Linux-syscall-note 3
((GPL-2.0 WITH Linux-syscall-note) OR MIT) 3
((GPL-2.0 WITH Linux-syscall-note) AND MIT) 1
and that resulted in the third patch in this series.
- when the two scanners agreed on the detected license(s), that became
the concluded license(s).
- when there was disagreement between the two scanners (one detected a
license but the other didn't, or they both detected different
licenses) a manual inspection of the file occurred.
- In most cases a manual inspection of the information in the file
resulted in a clear resolution of the license that should apply (and
which scanner probably needed to revisit its heuristics).
- When it was not immediately clear, the license identifier was
confirmed with lawyers working with the Linux Foundation.
- If there was any question as to the appropriate license identifier,
the file was flagged for further research and to be revisited later
in time.
In total, over 70 hours of logged manual review was done on the
spreadsheet to determine the SPDX license identifiers to apply to the
source files by Kate, Philippe, Thomas and, in some cases, confirmation
by lawyers working with the Linux Foundation.
Kate also obtained a third independent scan of the 4.13 code base from
FOSSology, and compared selected files where the other two scanners
disagreed against that SPDX file, to see if there was new insights. The
Windriver scanner is based on an older version of FOSSology in part, so
they are related.
Thomas did random spot checks in about 500 files from the spreadsheets
for the uapi headers and agreed with SPDX license identifier in the
files he inspected. For the non-uapi files Thomas did random spot checks
in about 15000 files.
In initial set of patches against 4.14-rc6, 3 files were found to have
copy/paste license identifier errors, and have been fixed to reflect the
correct identifier.
Additionally Philippe spent 10 hours this week doing a detailed manual
inspection and review of the 12,461 patched files from the initial patch
version early this week with:
- a full scancode scan run, collecting the matched texts, detected
license ids and scores
- reviewing anything where there was a license detected (about 500+
files) to ensure that the applied SPDX license was correct
- reviewing anything where there was no detection but the patch license
was not GPL-2.0 WITH Linux-syscall-note to ensure that the applied
SPDX license was correct
This produced a worksheet with 20 files needing minor correction. This
worksheet was then exported into 3 different .csv files for the
different types of files to be modified.
These .csv files were then reviewed by Greg. Thomas wrote a script to
parse the csv files and add the proper SPDX tag to the file, in the
format that the file expected. This script was further refined by Greg
based on the output to detect more types of files automatically and to
distinguish between header and source .c files (which need different
comment types.) Finally Greg ran the script using the .csv files to
generate the patches.
Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org>
Reviewed-by: Philippe Ombredanne <pombredanne@nexb.com>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-01 21:07:57 +07:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0 */
|
2008-05-20 06:52:27 +07:00
|
|
|
/*
|
2005-04-17 05:20:36 +07:00
|
|
|
* etrap.S: Preparing for entry into the kernel on Sparc V9.
|
|
|
|
*
|
|
|
|
* Copyright (C) 1996, 1997 David S. Miller (davem@caip.rutgers.edu)
|
|
|
|
* Copyright (C) 1997, 1998, 1999 Jakub Jelinek (jj@ultra.linux.cz)
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#include <asm/asi.h>
|
|
|
|
#include <asm/pstate.h>
|
|
|
|
#include <asm/ptrace.h>
|
|
|
|
#include <asm/page.h>
|
|
|
|
#include <asm/spitfire.h>
|
|
|
|
#include <asm/head.h>
|
|
|
|
#include <asm/processor.h>
|
|
|
|
#include <asm/mmu.h>
|
|
|
|
|
|
|
|
#define TASK_REGOFF (THREAD_SIZE-TRACEREG_SZ-STACKFRAME_SZ)
|
2008-10-30 11:25:00 +07:00
|
|
|
#define ETRAP_PSTATE1 (PSTATE_TSO | PSTATE_PRIV)
|
2005-04-17 05:20:36 +07:00
|
|
|
#define ETRAP_PSTATE2 \
|
2008-10-30 11:25:00 +07:00
|
|
|
(PSTATE_TSO | PSTATE_PEF | PSTATE_PRIV | PSTATE_IE)
|
2005-04-17 05:20:36 +07:00
|
|
|
|
|
|
|
/*
|
|
|
|
* On entry, %g7 is return address - 0x4.
|
|
|
|
* %g4 and %g5 will be preserved %l4 and %l5 respectively.
|
|
|
|
*/
|
|
|
|
|
|
|
|
.text
|
|
|
|
.align 64
|
sparc: Fix debugger syscall restart interactions.
So, forever, we've had this ptrace_signal_deliver implementation
which tries to handle all of the nasties that can occur when the
debugger looks at a process about to take a signal. It's meant
to address all of these issues inside of the kernel so that the
debugger need not be mindful of such things.
Problem is, this doesn't work.
The idea was that we should do the syscall restart business first, so
that the debugger captures that state. Otherwise, if the debugger for
example saves the child's state, makes the child execute something
else, then restores the saved state, we won't handle the syscall
restart properly because we lose the "we're in a syscall" state.
The code here worked for most cases, but if the debugger actually
passes the signal through to the child unaltered, it's possible that
we would do a syscall restart when we shouldn't have.
In particular this breaks the case of debugging a process under a gdb
which is being debugged by yet another gdb. gdb uses sigsuspend
to wait for SIGCHLD of the inferior, but if gdb itself is being
debugged by a top-level gdb we get a ptrace_stop(). The top-level gdb
does a PTRACE_CONT with SIGCHLD to let the inferior gdb see the
signal. But ptrace_signal_deliver() assumed the debugger would cancel
out the signal and therefore did a syscall restart, because the return
error was ERESTARTNOHAND.
Fix this by simply making ptrace_signal_deliver() a nop, and providing
a way for the debugger to control system call restarting properly:
1) Report a "in syscall" software bit in regs->{tstate,psr}.
It is set early on in trap entry to a system call and is fully
visible to the debugger via ptrace() and regsets.
2) Test this bit right before doing a syscall restart. We have
to do a final recheck right after get_signal_to_deliver() in
case the debugger cleared the bit during ptrace_stop().
3) Clear the bit in trap return so we don't accidently try to set
that bit in the real register.
As a result we also get a ptrace_{is,clear}_syscall() for sparc32 just
like sparc64 has.
M68K has this same exact bug, and is now the only other user of the
ptrace_signal_deliver hook. It needs to be fixed in the same exact
way as sparc.
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-05-11 16:07:19 +07:00
|
|
|
.globl etrap_syscall, etrap, etrap_irq, etraptl1
|
2005-04-17 05:20:36 +07:00
|
|
|
etrap: rdpr %pil, %g2
|
sparc: Fix debugger syscall restart interactions.
So, forever, we've had this ptrace_signal_deliver implementation
which tries to handle all of the nasties that can occur when the
debugger looks at a process about to take a signal. It's meant
to address all of these issues inside of the kernel so that the
debugger need not be mindful of such things.
Problem is, this doesn't work.
The idea was that we should do the syscall restart business first, so
that the debugger captures that state. Otherwise, if the debugger for
example saves the child's state, makes the child execute something
else, then restores the saved state, we won't handle the syscall
restart properly because we lose the "we're in a syscall" state.
The code here worked for most cases, but if the debugger actually
passes the signal through to the child unaltered, it's possible that
we would do a syscall restart when we shouldn't have.
In particular this breaks the case of debugging a process under a gdb
which is being debugged by yet another gdb. gdb uses sigsuspend
to wait for SIGCHLD of the inferior, but if gdb itself is being
debugged by a top-level gdb we get a ptrace_stop(). The top-level gdb
does a PTRACE_CONT with SIGCHLD to let the inferior gdb see the
signal. But ptrace_signal_deliver() assumed the debugger would cancel
out the signal and therefore did a syscall restart, because the return
error was ERESTARTNOHAND.
Fix this by simply making ptrace_signal_deliver() a nop, and providing
a way for the debugger to control system call restarting properly:
1) Report a "in syscall" software bit in regs->{tstate,psr}.
It is set early on in trap entry to a system call and is fully
visible to the debugger via ptrace() and regsets.
2) Test this bit right before doing a syscall restart. We have
to do a final recheck right after get_signal_to_deliver() in
case the debugger cleared the bit during ptrace_stop().
3) Clear the bit in trap return so we don't accidently try to set
that bit in the real register.
As a result we also get a ptrace_{is,clear}_syscall() for sparc32 just
like sparc64 has.
M68K has this same exact bug, and is now the only other user of the
ptrace_signal_deliver hook. It needs to be fixed in the same exact
way as sparc.
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-05-11 16:07:19 +07:00
|
|
|
etrap_irq: clr %g3
|
|
|
|
etrap_syscall: TRAP_LOAD_THREAD_REG(%g6, %g1)
|
2005-04-17 05:20:36 +07:00
|
|
|
rdpr %tstate, %g1
|
sparc: Fix debugger syscall restart interactions.
So, forever, we've had this ptrace_signal_deliver implementation
which tries to handle all of the nasties that can occur when the
debugger looks at a process about to take a signal. It's meant
to address all of these issues inside of the kernel so that the
debugger need not be mindful of such things.
Problem is, this doesn't work.
The idea was that we should do the syscall restart business first, so
that the debugger captures that state. Otherwise, if the debugger for
example saves the child's state, makes the child execute something
else, then restores the saved state, we won't handle the syscall
restart properly because we lose the "we're in a syscall" state.
The code here worked for most cases, but if the debugger actually
passes the signal through to the child unaltered, it's possible that
we would do a syscall restart when we shouldn't have.
In particular this breaks the case of debugging a process under a gdb
which is being debugged by yet another gdb. gdb uses sigsuspend
to wait for SIGCHLD of the inferior, but if gdb itself is being
debugged by a top-level gdb we get a ptrace_stop(). The top-level gdb
does a PTRACE_CONT with SIGCHLD to let the inferior gdb see the
signal. But ptrace_signal_deliver() assumed the debugger would cancel
out the signal and therefore did a syscall restart, because the return
error was ERESTARTNOHAND.
Fix this by simply making ptrace_signal_deliver() a nop, and providing
a way for the debugger to control system call restarting properly:
1) Report a "in syscall" software bit in regs->{tstate,psr}.
It is set early on in trap entry to a system call and is fully
visible to the debugger via ptrace() and regsets.
2) Test this bit right before doing a syscall restart. We have
to do a final recheck right after get_signal_to_deliver() in
case the debugger cleared the bit during ptrace_stop().
3) Clear the bit in trap return so we don't accidently try to set
that bit in the real register.
As a result we also get a ptrace_{is,clear}_syscall() for sparc32 just
like sparc64 has.
M68K has this same exact bug, and is now the only other user of the
ptrace_signal_deliver hook. It needs to be fixed in the same exact
way as sparc.
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-05-11 16:07:19 +07:00
|
|
|
or %g1, %g3, %g1
|
2005-04-17 05:20:36 +07:00
|
|
|
sllx %g2, 20, %g3
|
|
|
|
andcc %g1, TSTATE_PRIV, %g0
|
|
|
|
or %g1, %g3, %g1
|
|
|
|
bne,pn %xcc, 1f
|
|
|
|
sub %sp, STACKFRAME_SZ+TRACEREG_SZ-STACK_BIAS, %g2
|
2017-08-19 02:40:36 +07:00
|
|
|
661: wrpr %g0, 7, %cleanwin
|
|
|
|
.section .fast_win_ctrl_1insn_patch, "ax"
|
|
|
|
.word 661b
|
|
|
|
.word 0x85880000 ! allclean
|
|
|
|
.previous
|
2005-04-17 05:20:36 +07:00
|
|
|
|
|
|
|
sethi %hi(TASK_REGOFF), %g2
|
|
|
|
sethi %hi(TSTATE_PEF), %g3
|
|
|
|
or %g2, %lo(TASK_REGOFF), %g2
|
|
|
|
and %g1, %g3, %g3
|
|
|
|
brnz,pn %g3, 1f
|
|
|
|
add %g6, %g2, %g2
|
|
|
|
wr %g0, 0, %fprs
|
|
|
|
1: rdpr %tpc, %g3
|
|
|
|
|
|
|
|
stx %g1, [%g2 + STACKFRAME_SZ + PT_V9_TSTATE]
|
|
|
|
rdpr %tnpc, %g1
|
|
|
|
stx %g3, [%g2 + STACKFRAME_SZ + PT_V9_TPC]
|
|
|
|
rd %y, %g3
|
|
|
|
stx %g1, [%g2 + STACKFRAME_SZ + PT_V9_TNPC]
|
2008-04-24 12:52:13 +07:00
|
|
|
rdpr %tt, %g1
|
2005-04-17 05:20:36 +07:00
|
|
|
st %g3, [%g2 + STACKFRAME_SZ + PT_V9_Y]
|
2008-04-24 12:52:13 +07:00
|
|
|
sethi %hi(PT_REGS_MAGIC), %g3
|
|
|
|
or %g3, %g1, %g1
|
|
|
|
st %g1, [%g2 + STACKFRAME_SZ + PT_V9_MAGIC]
|
2006-02-04 15:10:01 +07:00
|
|
|
|
|
|
|
rdpr %cansave, %g1
|
|
|
|
brnz,pt %g1, etrap_save
|
|
|
|
nop
|
|
|
|
|
|
|
|
rdpr %cwp, %g1
|
|
|
|
add %g1, 2, %g1
|
|
|
|
wrpr %g1, %cwp
|
|
|
|
be,pt %xcc, etrap_user_spill
|
|
|
|
mov ASI_AIUP, %g3
|
|
|
|
|
|
|
|
rdpr %otherwin, %g3
|
|
|
|
brz %g3, etrap_kernel_spill
|
|
|
|
mov ASI_AIUS, %g3
|
|
|
|
|
|
|
|
etrap_user_spill:
|
|
|
|
|
|
|
|
wr %g3, 0x0, %asi
|
|
|
|
ldx [%g6 + TI_FLAGS], %g3
|
|
|
|
and %g3, _TIF_32BIT, %g3
|
|
|
|
brnz,pt %g3, etrap_user_spill_32bit
|
|
|
|
nop
|
|
|
|
ba,a,pt %xcc, etrap_user_spill_64bit
|
|
|
|
|
|
|
|
etrap_save: save %g2, -STACK_BIAS, %sp
|
2005-04-17 05:20:36 +07:00
|
|
|
mov %g6, %l6
|
|
|
|
|
|
|
|
bne,pn %xcc, 3f
|
|
|
|
mov PRIMARY_CONTEXT, %l4
|
2017-08-19 02:40:36 +07:00
|
|
|
661: rdpr %canrestore, %g3
|
|
|
|
.section .fast_win_ctrl_1insn_patch, "ax"
|
|
|
|
.word 661b
|
|
|
|
nop
|
|
|
|
.previous
|
|
|
|
|
2005-04-17 05:20:36 +07:00
|
|
|
rdpr %wstate, %g2
|
2017-08-19 02:40:36 +07:00
|
|
|
661: wrpr %g0, 0, %canrestore
|
|
|
|
.section .fast_win_ctrl_1insn_patch, "ax"
|
|
|
|
.word 661b
|
|
|
|
nop
|
|
|
|
.previous
|
2005-04-17 05:20:36 +07:00
|
|
|
sll %g2, 3, %g2
|
2012-09-26 12:21:14 +07:00
|
|
|
|
|
|
|
/* Set TI_SYS_FPDEPTH to 1 and clear TI_SYS_NOERROR. */
|
2005-04-17 05:20:36 +07:00
|
|
|
mov 1, %l5
|
2012-09-26 12:21:14 +07:00
|
|
|
sth %l5, [%l6 + TI_SYS_NOERROR]
|
2005-04-17 05:20:36 +07:00
|
|
|
|
2017-08-19 02:40:36 +07:00
|
|
|
661: wrpr %g3, 0, %otherwin
|
|
|
|
.section .fast_win_ctrl_1insn_patch, "ax"
|
|
|
|
.word 661b
|
|
|
|
.word 0x87880000 ! otherw
|
|
|
|
.previous
|
|
|
|
|
2005-04-17 05:20:36 +07:00
|
|
|
wrpr %g2, 0, %wstate
|
2005-10-05 05:23:20 +07:00
|
|
|
sethi %hi(sparc64_kern_pri_context), %g2
|
|
|
|
ldx [%g2 + %lo(sparc64_kern_pri_context)], %g3
|
2006-02-08 13:13:05 +07:00
|
|
|
|
|
|
|
661: stxa %g3, [%l4] ASI_DMMU
|
|
|
|
.section .sun4v_1insn_patch, "ax"
|
|
|
|
.word 661b
|
|
|
|
stxa %g3, [%l4] ASI_MMU
|
|
|
|
.previous
|
|
|
|
|
2006-02-01 09:33:00 +07:00
|
|
|
sethi %hi(KERNBASE), %l4
|
|
|
|
flush %l4
|
2006-02-06 11:47:26 +07:00
|
|
|
mov ASI_AIUS, %l7
|
|
|
|
2: mov %g4, %l4
|
2005-04-17 05:20:36 +07:00
|
|
|
mov %g5, %l5
|
2006-02-06 11:47:26 +07:00
|
|
|
add %g7, 4, %l2
|
2006-02-06 12:29:28 +07:00
|
|
|
|
|
|
|
/* Go to trap time globals so we can save them. */
|
|
|
|
661: wrpr %g0, ETRAP_PSTATE1, %pstate
|
2006-02-07 15:00:16 +07:00
|
|
|
.section .sun4v_1insn_patch, "ax"
|
2006-02-06 12:29:28 +07:00
|
|
|
.word 661b
|
|
|
|
SET_GL(0)
|
|
|
|
.previous
|
|
|
|
|
2005-04-17 05:20:36 +07:00
|
|
|
stx %g1, [%sp + PTREGS_OFF + PT_V9_G1]
|
|
|
|
stx %g2, [%sp + PTREGS_OFF + PT_V9_G2]
|
2006-02-06 11:47:26 +07:00
|
|
|
sllx %l7, 24, %l7
|
2005-04-17 05:20:36 +07:00
|
|
|
stx %g3, [%sp + PTREGS_OFF + PT_V9_G3]
|
2006-02-06 11:47:26 +07:00
|
|
|
rdpr %cwp, %l0
|
2005-04-17 05:20:36 +07:00
|
|
|
stx %g4, [%sp + PTREGS_OFF + PT_V9_G4]
|
|
|
|
stx %g5, [%sp + PTREGS_OFF + PT_V9_G5]
|
|
|
|
stx %g6, [%sp + PTREGS_OFF + PT_V9_G6]
|
|
|
|
stx %g7, [%sp + PTREGS_OFF + PT_V9_G7]
|
2006-02-06 11:47:26 +07:00
|
|
|
or %l7, %l0, %l7
|
2018-02-24 05:46:41 +07:00
|
|
|
661: sethi %hi(TSTATE_TSO | TSTATE_PEF), %l0
|
|
|
|
/* If userspace is using ADI, it could potentially pass
|
|
|
|
* a pointer with version tag embedded in it. To maintain
|
|
|
|
* the ADI security, we must enable PSTATE.mcde. Userspace
|
|
|
|
* would have already set TTE.mcd in an earlier call to
|
|
|
|
* kernel and set the version tag for the address being
|
|
|
|
* dereferenced. Setting PSTATE.mcde would ensure any
|
|
|
|
* access to userspace data through a system call honors
|
|
|
|
* ADI and does not allow a rogue app to bypass ADI by
|
|
|
|
* using system calls. Setting PSTATE.mcde only affects
|
|
|
|
* accesses to virtual addresses that have TTE.mcd set.
|
|
|
|
* Set PMCDPER to ensure any exceptions caused by ADI
|
|
|
|
* version tag mismatch are exposed before system call
|
|
|
|
* returns to userspace. Setting PMCDPER affects only
|
|
|
|
* writes to virtual addresses that have TTE.mcd set and
|
|
|
|
* have a version tag set as well.
|
|
|
|
*/
|
|
|
|
.section .sun_m7_1insn_patch, "ax"
|
|
|
|
.word 661b
|
|
|
|
sethi %hi(TSTATE_TSO | TSTATE_PEF | TSTATE_MCDE), %l0
|
|
|
|
.previous
|
|
|
|
661: nop
|
|
|
|
.section .sun_m7_1insn_patch, "ax"
|
|
|
|
.word 661b
|
|
|
|
.word 0xaf902001 /* wrpr %g0, 1, %pmcdper */
|
|
|
|
.previous
|
2006-02-06 11:47:26 +07:00
|
|
|
or %l7, %l0, %l7
|
|
|
|
wrpr %l2, %tnpc
|
|
|
|
wrpr %l7, (TSTATE_PRIV | TSTATE_IE), %tstate
|
2005-04-17 05:20:36 +07:00
|
|
|
stx %i0, [%sp + PTREGS_OFF + PT_V9_I0]
|
|
|
|
stx %i1, [%sp + PTREGS_OFF + PT_V9_I1]
|
|
|
|
stx %i2, [%sp + PTREGS_OFF + PT_V9_I2]
|
|
|
|
stx %i3, [%sp + PTREGS_OFF + PT_V9_I3]
|
|
|
|
stx %i4, [%sp + PTREGS_OFF + PT_V9_I4]
|
|
|
|
stx %i5, [%sp + PTREGS_OFF + PT_V9_I5]
|
|
|
|
stx %i6, [%sp + PTREGS_OFF + PT_V9_I6]
|
|
|
|
mov %l6, %g6
|
2006-02-06 11:47:26 +07:00
|
|
|
stx %i7, [%sp + PTREGS_OFF + PT_V9_I7]
|
2006-02-03 12:55:10 +07:00
|
|
|
LOAD_PER_CPU_BASE(%g5, %g6, %g4, %g3, %l1)
|
2006-02-06 11:47:26 +07:00
|
|
|
ldx [%g6 + TI_TASK], %g4
|
|
|
|
done
|
2005-04-17 05:20:36 +07:00
|
|
|
|
2006-02-06 11:47:26 +07:00
|
|
|
3: mov ASI_P, %l7
|
|
|
|
ldub [%l6 + TI_FPDEPTH], %l5
|
2005-04-17 05:20:36 +07:00
|
|
|
add %l6, TI_FPSAVED + 1, %l4
|
|
|
|
srl %l5, 1, %l3
|
|
|
|
add %l5, 2, %l5
|
2012-09-26 12:21:14 +07:00
|
|
|
|
|
|
|
/* Set TI_SYS_FPDEPTH to %l5 and clear TI_SYS_NOERROR. */
|
|
|
|
sth %l5, [%l6 + TI_SYS_NOERROR]
|
2005-04-17 05:20:36 +07:00
|
|
|
ba,pt %xcc, 2b
|
|
|
|
stb %g0, [%l4 + %l3]
|
|
|
|
nop
|
|
|
|
|
|
|
|
etraptl1: /* Save tstate/tpc/tnpc of TL 1-->4 and the tl register itself.
|
|
|
|
* We place this right after pt_regs on the trap stack.
|
|
|
|
* The layout is:
|
|
|
|
* 0x00 TL1's TSTATE
|
|
|
|
* 0x08 TL1's TPC
|
|
|
|
* 0x10 TL1's TNPC
|
|
|
|
* 0x18 TL1's TT
|
|
|
|
* ...
|
|
|
|
* 0x58 TL4's TT
|
|
|
|
* 0x60 TL
|
|
|
|
*/
|
2006-02-03 12:55:10 +07:00
|
|
|
TRAP_LOAD_THREAD_REG(%g6, %g1)
|
2005-04-17 05:20:36 +07:00
|
|
|
sub %sp, ((4 * 8) * 4) + 8, %g2
|
|
|
|
rdpr %tl, %g1
|
|
|
|
|
|
|
|
wrpr %g0, 1, %tl
|
|
|
|
rdpr %tstate, %g3
|
|
|
|
stx %g3, [%g2 + STACK_BIAS + 0x00]
|
|
|
|
rdpr %tpc, %g3
|
|
|
|
stx %g3, [%g2 + STACK_BIAS + 0x08]
|
|
|
|
rdpr %tnpc, %g3
|
|
|
|
stx %g3, [%g2 + STACK_BIAS + 0x10]
|
|
|
|
rdpr %tt, %g3
|
|
|
|
stx %g3, [%g2 + STACK_BIAS + 0x18]
|
|
|
|
|
|
|
|
wrpr %g0, 2, %tl
|
|
|
|
rdpr %tstate, %g3
|
|
|
|
stx %g3, [%g2 + STACK_BIAS + 0x20]
|
|
|
|
rdpr %tpc, %g3
|
|
|
|
stx %g3, [%g2 + STACK_BIAS + 0x28]
|
|
|
|
rdpr %tnpc, %g3
|
|
|
|
stx %g3, [%g2 + STACK_BIAS + 0x30]
|
|
|
|
rdpr %tt, %g3
|
|
|
|
stx %g3, [%g2 + STACK_BIAS + 0x38]
|
|
|
|
|
2006-02-16 16:41:41 +07:00
|
|
|
sethi %hi(is_sun4v), %g3
|
|
|
|
lduw [%g3 + %lo(is_sun4v)], %g3
|
|
|
|
brnz,pn %g3, finish_tl1_capture
|
|
|
|
nop
|
|
|
|
|
2005-04-17 05:20:36 +07:00
|
|
|
wrpr %g0, 3, %tl
|
|
|
|
rdpr %tstate, %g3
|
|
|
|
stx %g3, [%g2 + STACK_BIAS + 0x40]
|
|
|
|
rdpr %tpc, %g3
|
|
|
|
stx %g3, [%g2 + STACK_BIAS + 0x48]
|
|
|
|
rdpr %tnpc, %g3
|
|
|
|
stx %g3, [%g2 + STACK_BIAS + 0x50]
|
|
|
|
rdpr %tt, %g3
|
|
|
|
stx %g3, [%g2 + STACK_BIAS + 0x58]
|
|
|
|
|
|
|
|
wrpr %g0, 4, %tl
|
|
|
|
rdpr %tstate, %g3
|
|
|
|
stx %g3, [%g2 + STACK_BIAS + 0x60]
|
|
|
|
rdpr %tpc, %g3
|
|
|
|
stx %g3, [%g2 + STACK_BIAS + 0x68]
|
|
|
|
rdpr %tnpc, %g3
|
|
|
|
stx %g3, [%g2 + STACK_BIAS + 0x70]
|
|
|
|
rdpr %tt, %g3
|
|
|
|
stx %g3, [%g2 + STACK_BIAS + 0x78]
|
|
|
|
|
|
|
|
stx %g1, [%g2 + STACK_BIAS + 0x80]
|
|
|
|
|
2006-02-16 16:41:41 +07:00
|
|
|
finish_tl1_capture:
|
2006-02-06 12:29:28 +07:00
|
|
|
wrpr %g0, 1, %tl
|
|
|
|
661: nop
|
2006-02-07 15:00:16 +07:00
|
|
|
.section .sun4v_1insn_patch, "ax"
|
2006-02-06 12:29:28 +07:00
|
|
|
.word 661b
|
|
|
|
SET_GL(1)
|
|
|
|
.previous
|
|
|
|
|
2005-04-17 05:20:36 +07:00
|
|
|
rdpr %tstate, %g1
|
|
|
|
sub %g2, STACKFRAME_SZ + TRACEREG_SZ - STACK_BIAS, %g2
|
|
|
|
ba,pt %xcc, 1b
|
|
|
|
andcc %g1, TSTATE_PRIV, %g0
|
|
|
|
|
|
|
|
#undef TASK_REGOFF
|
|
|
|
#undef ETRAP_PSTATE1
|