<commit_before>/* traps.c: high-level exception handler for FR-V
 *
 * Copyright (C) 2003 Red Hat, Inc. All Rights Reserved.
 * Written by <NAME> (<EMAIL>)
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version
 * 2 of the License, or (at your option) any later version.
 */

#include <linux/sched.h>
#include <linux/signal.h>
#include <linux/kernel.h>
#include <linux/mm.h>
#include <linux/types.h>
#include <linux/user.h>
#include <linux/string.h>
#include <linux/linkage.h>
#include <linux/init.h>
#include <linux/module.h>

#include <asm/asm-offsets.h>
#include <asm/setup.h>
#include <asm/fpu.h>
#include <asm/system.h>
#include <asm/uaccess.h>
#include <asm/pgtable.h>
#include <asm/siginfo.h>
#include <asm/unaligned.h>

void show_backtrace(struct pt_regs *, unsigned long);

extern asmlinkage void __break_hijack_kernel_event(void);

/*****************************************************************************/
/*
 * instruction access error
 */
asmlinkage void insn_access_error(unsigned long esfr1, unsigned long epcr0, unsigned long esr0)
{
	siginfo_t info;

	die_if_kernel("-- Insn Access Error --\n"
		      "EPCR0 : %08lx\n"
		      "ESR0  : %08lx\n",
		      epcr0, esr0);

	info.si_signo	= SIGSEGV;
	info.si_code	= SEGV_ACCERR;
	info.si_errno	= 0;
	info.si_addr	= (void *) ((epcr0 & EPCR0_V) ? (epcr0 & EPCR0_PC) : __frame->pc);

	force_sig_info(info.si_signo, &info, current);
} /* end insn_access_error() */

/*****************************************************************************/
/*
 * handler for:
 * - illegal instruction
 * - privileged instruction
 * - unsupported trap
 * - debug exceptions
 */
asmlinkage void illegal_instruction(unsigned long esfr1, unsigned long epcr0, unsigned long esr0)
{
	siginfo_t info;

	die_if_kernel("-- Illegal Instruction --\n"
		      "EPCR0 : %08lx\n"
		      "ESR0  : %08lx\n"
		      "ESFR1 : %08lx\n",
		      epcr0, esr0, esfr1);

	info.si_errno	= 0;
	info.si_addr	= (void *) ((epcr0 & EPCR0_PC) ? (epcr0 & EPCR0_PC) : __frame->pc);

	switch (__frame->tbr & TBR_TT) {
	case TBR_TT_ILLEGAL_INSTR:
		info.si_signo	= SIGILL;
		info.si_code	= ILL_ILLOPC;
		break;
	case TBR_TT_PRIV_INSTR:
		info.si_signo	= SIGILL;
		info.si_code	= ILL_PRVOPC;
		break;<commit_msg>FRV: Correctly determine the address of an illegal instruction<commit_after>/* traps.c: high-level exception handler for FR-V
 *
 * Copyright (C) 2003 Red Hat, Inc. All Rights Reserved.
 * Written by <NAME> (<EMAIL>)
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version
 * 2 of the License, or (at your option) any later version.
 */

#include <linux/sched.h>
#include <linux/signal.h>
#include <linux/kernel.h>
#include <linux/mm.h>
#include <linux/types.h>
#include <linux/user.h>
#include <linux/string.h>
#include <linux/linkage.h>
#include <linux/init.h>
#include <linux/module.h>

#include <asm/asm-offsets.h>
#include <asm/setup.h>
#include <asm/fpu.h>
#include <asm/system.h>
#include <asm/uaccess.h>
#include <asm/pgtable.h>
#include <asm/siginfo.h>
#include <asm/unaligned.h>

void show_backtrace(struct pt_regs *, unsigned long);

extern asmlinkage void __break_hijack_kernel_event(void);

/*****************************************************************************/
/*
 * instruction access error
 */
asmlinkage void insn_access_error(unsigned long esfr1, unsigned long epcr0, unsigned long esr0)
{
	siginfo_t info;

	die_if_kernel("-- Insn Access Error --\n"
		      "EPCR0 : %08lx\n"
		      "ESR0  : %08lx\n",
		      epcr0, esr0);

	info.si_signo	= SIGSEGV;
	info.si_code	= SEGV_ACCERR;
	info.si_errno	= 0;
	info.si_addr	= (void *) ((epcr0 & EPCR0_V) ? (epcr0 & EPCR0_PC) : __frame->pc);

	force_sig_info(info.si_signo, &info, current);
} /* end insn_access_error() */

/*****************************************************************************/
/*
 * handler for:
 * - illegal instruction
 * - privileged instruction
 * - unsupported trap
 * - debug exceptions
 */
asmlinkage void illegal_instruction(unsigned long esfr1, unsigned long epcr0, unsigned long esr0)
{
	siginfo_t info;

	die_if_kernel("-- Illegal Instruction --\n"
		      "EPCR0 : %08lx\n"
		      "ESR0  : %08lx\n"
		      "ESFR1 : %08lx\n",
		      epcr0, esr0, esfr1);

	info.si_errno	= 0;
	info.si_addr	= (void *) ((epcr0 & EPCR0_V) ? (epcr0 & EPCR0_PC) : __frame->pc);

	switch (__frame->tbr & TBR_TT) {
	case TBR_TT_ILLEGAL_INSTR:
		info.si_signo	= SIGILL;
		info.si_code	= ILL_ILLOPC;
		break;
	case TBR_TT_PRIV_INSTR:
		info.si_signo	= SIGILL;
		info.si_code	= ILL_PRVOPC;
		break;
{'fraction_non_alphanumeric': 0.1918580375782881, 'fraction_numerical': 0.017118997912317326, 'mean_word_length': 4.027282266526758, 'pattern_counts': {'":': 0, '<': 43, '<?xml version=': 0, '>': 49, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2323040', 'n_tokens_mistral': 1887, 'n_tokens_neox': 1742, 'n_words': 433}