arch/tile: factor out <arch/opcode.h> header
The kernel code was using some <asm> headers that included a mix of hardware-specific information (typically found in Tilera <arch> headers) and structures, enums, and function declarations supporting the disassembly function of the tile-desc.c sources. This change refactors that code so that a hardware-specific, but OS- and application-agnostic header, is created: <arch/opcode.h>. This header is then exported to userspace along with the other <arch> headers and can be used to build userspace code; in particular, it is used by glibc as part of implementing the backtrace() function. The new header, together with a header that specifically describes the disassembly code (<asm/tile-desc.h> with _32 and _64 variants), replaces the old <asm/opcode-tile*.h> and <asm/opcode_constants*.h> headers. As part of this change, we are also renaming the 32-bit constants from TILE_xxx to TILEPRO_xxx to better reflect the fact that they are specific to the TILEPro architecture, and not to TILE-Gx and any successor "tile" architecture chips. Signed-off-by: Chris Metcalf <cmetcalf@tilera.com>
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010 Tilera Corporation. All Rights Reserved.
|
||||
* Copyright 2011 Tilera Corporation. All Rights Reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
@ -15,13 +15,11 @@
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/string.h>
|
||||
#include <asm/backtrace.h>
|
||||
#include <asm/opcode-tile.h>
|
||||
#include <asm/tile-desc.h>
|
||||
#include <arch/abi.h>
|
||||
|
||||
#ifdef __tilegx__
|
||||
#define tile_bundle_bits tilegx_bundle_bits
|
||||
#define TILE_MAX_INSTRUCTIONS_PER_BUNDLE TILEGX_MAX_INSTRUCTIONS_PER_BUNDLE
|
||||
#define TILE_BUNDLE_ALIGNMENT_IN_BYTES TILEGX_BUNDLE_ALIGNMENT_IN_BYTES
|
||||
#define tile_decoded_instruction tilegx_decoded_instruction
|
||||
#define tile_mnemonic tilegx_mnemonic
|
||||
#define parse_insn_tile parse_insn_tilegx
|
||||
@ -35,7 +33,18 @@
|
||||
#define OPCODE_STORE TILEGX_OPC_ST
|
||||
typedef long long bt_int_reg_t;
|
||||
#else
|
||||
#define OPCODE_STORE TILE_OPC_SW
|
||||
#define TILE_MAX_INSTRUCTIONS_PER_BUNDLE TILEPRO_MAX_INSTRUCTIONS_PER_BUNDLE
|
||||
#define tile_decoded_instruction tilepro_decoded_instruction
|
||||
#define tile_mnemonic tilepro_mnemonic
|
||||
#define parse_insn_tile parse_insn_tilepro
|
||||
#define TILE_OPC_IRET TILEPRO_OPC_IRET
|
||||
#define TILE_OPC_ADDI TILEPRO_OPC_ADDI
|
||||
#define TILE_OPC_ADDLI TILEPRO_OPC_ADDLI
|
||||
#define TILE_OPC_INFO TILEPRO_OPC_INFO
|
||||
#define TILE_OPC_INFOL TILEPRO_OPC_INFOL
|
||||
#define TILE_OPC_JRP TILEPRO_OPC_JRP
|
||||
#define TILE_OPC_MOVE TILEPRO_OPC_MOVE
|
||||
#define OPCODE_STORE TILEPRO_OPC_SW
|
||||
typedef int bt_int_reg_t;
|
||||
#endif
|
||||
|
||||
|
@ -20,9 +20,9 @@
|
||||
#include <linux/fs.h>
|
||||
#include <linux/string.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <asm/opcode-tile.h>
|
||||
#include <asm/pgtable.h>
|
||||
#include <asm/homecache.h>
|
||||
#include <arch/opcode.h>
|
||||
|
||||
#ifdef __tilegx__
|
||||
# define Elf_Rela Elf64_Rela
|
||||
|
@ -25,9 +25,8 @@
|
||||
#include <linux/types.h>
|
||||
#include <linux/err.h>
|
||||
#include <asm/cacheflush.h>
|
||||
#include <asm/opcode-tile.h>
|
||||
#include <asm/opcode_constants.h>
|
||||
#include <arch/abi.h>
|
||||
#include <arch/opcode.h>
|
||||
|
||||
#define signExtend17(val) sign_extend((val), 17)
|
||||
#define TILE_X1_MASK (0xffffffffULL << 31)
|
||||
@ -118,7 +117,7 @@ static tile_bundle_bits rewrite_load_store_unaligned(
|
||||
int val_reg, addr_reg, err, val;
|
||||
|
||||
/* Get address and value registers */
|
||||
if (bundle & TILE_BUNDLE_Y_ENCODING_MASK) {
|
||||
if (bundle & TILEPRO_BUNDLE_Y_ENCODING_MASK) {
|
||||
addr_reg = get_SrcA_Y2(bundle);
|
||||
val_reg = get_SrcBDest_Y2(bundle);
|
||||
} else if (mem_op == MEMOP_LOAD || mem_op == MEMOP_LOAD_POSTINCR) {
|
||||
@ -229,7 +228,7 @@ P("\n");
|
||||
}
|
||||
++unaligned_fixup_count;
|
||||
|
||||
if (bundle & TILE_BUNDLE_Y_ENCODING_MASK) {
|
||||
if (bundle & TILEPRO_BUNDLE_Y_ENCODING_MASK) {
|
||||
/* Convert the Y2 instruction to a prefetch. */
|
||||
bundle &= ~(create_SrcBDest_Y2(-1) |
|
||||
create_Opcode_Y2(-1));
|
||||
@ -389,7 +388,7 @@ void single_step_once(struct pt_regs *regs)
|
||||
state->branch_next_pc = 0;
|
||||
state->update = 0;
|
||||
|
||||
if (!(bundle & TILE_BUNDLE_Y_ENCODING_MASK)) {
|
||||
if (!(bundle & TILEPRO_BUNDLE_Y_ENCODING_MASK)) {
|
||||
/* two wide, check for control flow */
|
||||
int opcode = get_Opcode_X1(bundle);
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,3 +1,23 @@
|
||||
/* TILE-Gx opcode information.
|
||||
*
|
||||
* Copyright 2011 Tilera Corporation. All Rights Reserved.
|
||||
*
|
||||
* 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, version 2.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
|
||||
* NON INFRINGEMENT. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
/* This define is BFD_RELOC_##x for real bfd, or -1 for everyone else. */
|
||||
#define BFD_RELOC(x) -1
|
||||
|
||||
@ -6,10 +26,8 @@
|
||||
#define TREG_SN 56
|
||||
#define TREG_ZERO 63
|
||||
|
||||
/* FIXME: Rename this. */
|
||||
#include <asm/opcode-tile_64.h>
|
||||
|
||||
#include <linux/stddef.h>
|
||||
#include <asm/tile-desc.h>
|
||||
|
||||
const struct tilegx_opcode tilegx_opcodes[334] =
|
||||
{
|
||||
@ -2040,12 +2058,12 @@ const struct tilegx_operand tilegx_operands[35] =
|
||||
create_BrOff_X1, get_BrOff_X1
|
||||
},
|
||||
{
|
||||
TILEGX_OP_TYPE_IMMEDIATE, BFD_RELOC(NONE),
|
||||
TILEGX_OP_TYPE_IMMEDIATE, BFD_RELOC(TILEGX_MMSTART_X0),
|
||||
6, 0, 0, 0, 0, 0,
|
||||
create_BFStart_X0, get_BFStart_X0
|
||||
},
|
||||
{
|
||||
TILEGX_OP_TYPE_IMMEDIATE, BFD_RELOC(NONE),
|
||||
TILEGX_OP_TYPE_IMMEDIATE, BFD_RELOC(TILEGX_MMEND_X0),
|
||||
6, 0, 0, 0, 0, 0,
|
||||
create_BFEnd_X0, get_BFEnd_X0
|
||||
},
|
||||
|
@ -19,13 +19,12 @@
|
||||
#include <linux/reboot.h>
|
||||
#include <linux/uaccess.h>
|
||||
#include <linux/ptrace.h>
|
||||
#include <asm/opcode-tile.h>
|
||||
#include <asm/opcode_constants.h>
|
||||
#include <asm/stack.h>
|
||||
#include <asm/traps.h>
|
||||
|
||||
#include <arch/interrupts.h>
|
||||
#include <arch/spr_def.h>
|
||||
#include <arch/opcode.h>
|
||||
|
||||
void __init trap_init(void)
|
||||
{
|
||||
@ -135,7 +134,7 @@ static int special_ill(bundle_bits bundle, int *sigp, int *codep)
|
||||
if (get_UnaryOpcodeExtension_X1(bundle) != ILL_UNARY_OPCODE_X1)
|
||||
return 0;
|
||||
#else
|
||||
if (bundle & TILE_BUNDLE_Y_ENCODING_MASK)
|
||||
if (bundle & TILEPRO_BUNDLE_Y_ENCODING_MASK)
|
||||
return 0;
|
||||
if (get_Opcode_X1(bundle) != SHUN_0_OPCODE_X1)
|
||||
return 0;
|
||||
|
Reference in New Issue
Block a user