diff options
| author | Chris Metcalf <cmetcalf@tilera.com> | 2011-11-02 23:02:17 -0400 |
|---|---|---|
| committer | Chris Metcalf <cmetcalf@tilera.com> | 2011-11-03 16:58:54 -0400 |
| commit | eb7c792da5afa3b9ec3e802c30952f82d2e9722b (patch) | |
| tree | db796193297d4cc14bdb4d2b8001750a1f515f17 | |
| parent | aeddea5d37d86d38c7a347110d8a052e9f45d955 (diff) | |
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>
| -rw-r--r-- | arch/tile/include/arch/opcode.h (renamed from arch/tile/include/asm/opcode_constants.h) | 17 | ||||
| -rw-r--r-- | arch/tile/include/arch/opcode_tilegx.h (renamed from arch/tile/include/asm/opcode_constants_64.h) | 806 | ||||
| -rw-r--r-- | arch/tile/include/arch/opcode_tilepro.h | 1471 | ||||
| -rw-r--r-- | arch/tile/include/asm/opcode-tile_32.h | 1513 | ||||
| -rw-r--r-- | arch/tile/include/asm/opcode-tile_64.h | 1248 | ||||
| -rw-r--r-- | arch/tile/include/asm/opcode_constants_32.h | 480 | ||||
| -rw-r--r-- | arch/tile/include/asm/tile-desc.h (renamed from arch/tile/include/asm/opcode-tile.h) | 19 | ||||
| -rw-r--r-- | arch/tile/include/asm/tile-desc_32.h | 553 | ||||
| -rw-r--r-- | arch/tile/include/asm/tile-desc_64.h | 483 | ||||
| -rw-r--r-- | arch/tile/kernel/backtrace.c | 19 | ||||
| -rw-r--r-- | arch/tile/kernel/module.c | 2 | ||||
| -rw-r--r-- | arch/tile/kernel/single_step.c | 9 | ||||
| -rw-r--r-- | arch/tile/kernel/tile-desc_32.c | 2242 | ||||
| -rw-r--r-- | arch/tile/kernel/tile-desc_64.c | 28 | ||||
| -rw-r--r-- | arch/tile/kernel/traps.c | 5 |
15 files changed, 4536 insertions, 4359 deletions
diff --git a/arch/tile/include/asm/opcode_constants.h b/arch/tile/include/arch/opcode.h index 37a9f2958cb1..92d15229ecec 100644 --- a/arch/tile/include/asm/opcode_constants.h +++ b/arch/tile/include/arch/opcode.h | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * Copyright 2010 Tilera Corporation. All Rights Reserved. | 2 | * Copyright 2011 Tilera Corporation. All Rights Reserved. |
| 3 | * | 3 | * |
| 4 | * This program is free software; you can redistribute it and/or | 4 | * This program is free software; you can redistribute it and/or |
| 5 | * modify it under the terms of the GNU General Public License | 5 | * modify it under the terms of the GNU General Public License |
| @@ -12,15 +12,10 @@ | |||
| 12 | * more details. | 12 | * more details. |
| 13 | */ | 13 | */ |
| 14 | 14 | ||
| 15 | #ifndef _ASM_TILE_OPCODE_CONSTANTS_H | 15 | #if defined(__tilepro__) |
| 16 | #define _ASM_TILE_OPCODE_CONSTANTS_H | 16 | #include <arch/opcode_tilepro.h> |
| 17 | 17 | #elif defined(__tilegx__) | |
| 18 | #include <arch/chip.h> | 18 | #include <arch/opcode_tilegx.h> |
| 19 | |||
| 20 | #if CHIP_WORD_SIZE() == 64 | ||
| 21 | #include <asm/opcode_constants_64.h> | ||
| 22 | #else | 19 | #else |
| 23 | #include <asm/opcode_constants_32.h> | 20 | #error Unexpected Tilera chip type |
| 24 | #endif | 21 | #endif |
| 25 | |||
| 26 | #endif /* _ASM_TILE_OPCODE_CONSTANTS_H */ | ||
diff --git a/arch/tile/include/asm/opcode_constants_64.h b/arch/tile/include/arch/opcode_tilegx.h index 710192869476..c14d02c81600 100644 --- a/arch/tile/include/asm/opcode_constants_64.h +++ b/arch/tile/include/arch/opcode_tilegx.h | |||
| @@ -1,4 +1,5 @@ | |||
| 1 | /* | 1 | /* TILE-Gx opcode information. |
| 2 | * | ||
| 2 | * Copyright 2011 Tilera Corporation. All Rights Reserved. | 3 | * Copyright 2011 Tilera Corporation. All Rights Reserved. |
| 3 | * | 4 | * |
| 4 | * This program is free software; you can redistribute it and/or | 5 | * This program is free software; you can redistribute it and/or |
| @@ -10,13 +11,805 @@ | |||
| 10 | * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or | 11 | * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or |
| 11 | * NON INFRINGEMENT. See the GNU General Public License for | 12 | * NON INFRINGEMENT. See the GNU General Public License for |
| 12 | * more details. | 13 | * more details. |
| 14 | * | ||
| 15 | * | ||
| 16 | * | ||
| 17 | * | ||
| 18 | * | ||
| 13 | */ | 19 | */ |
| 14 | 20 | ||
| 15 | /* This file is machine-generated; DO NOT EDIT! */ | 21 | #ifndef __ARCH_OPCODE_H__ |
| 22 | #define __ARCH_OPCODE_H__ | ||
| 23 | |||
| 24 | #ifndef __ASSEMBLER__ | ||
| 25 | |||
| 26 | typedef unsigned long long tilegx_bundle_bits; | ||
| 27 | |||
| 28 | /* These are the bits that determine if a bundle is in the X encoding. */ | ||
| 29 | #define TILEGX_BUNDLE_MODE_MASK ((tilegx_bundle_bits)3 << 62) | ||
| 30 | |||
| 31 | enum | ||
| 32 | { | ||
| 33 | /* Maximum number of instructions in a bundle (2 for X, 3 for Y). */ | ||
| 34 | TILEGX_MAX_INSTRUCTIONS_PER_BUNDLE = 3, | ||
| 35 | |||
| 36 | /* How many different pipeline encodings are there? X0, X1, Y0, Y1, Y2. */ | ||
| 37 | TILEGX_NUM_PIPELINE_ENCODINGS = 5, | ||
| 38 | |||
| 39 | /* Log base 2 of TILEGX_BUNDLE_SIZE_IN_BYTES. */ | ||
| 40 | TILEGX_LOG2_BUNDLE_SIZE_IN_BYTES = 3, | ||
| 41 | |||
| 42 | /* Instructions take this many bytes. */ | ||
| 43 | TILEGX_BUNDLE_SIZE_IN_BYTES = 1 << TILEGX_LOG2_BUNDLE_SIZE_IN_BYTES, | ||
| 44 | |||
| 45 | /* Log base 2 of TILEGX_BUNDLE_ALIGNMENT_IN_BYTES. */ | ||
| 46 | TILEGX_LOG2_BUNDLE_ALIGNMENT_IN_BYTES = 3, | ||
| 47 | |||
| 48 | /* Bundles should be aligned modulo this number of bytes. */ | ||
| 49 | TILEGX_BUNDLE_ALIGNMENT_IN_BYTES = | ||
| 50 | (1 << TILEGX_LOG2_BUNDLE_ALIGNMENT_IN_BYTES), | ||
| 51 | |||
| 52 | /* Number of registers (some are magic, such as network I/O). */ | ||
| 53 | TILEGX_NUM_REGISTERS = 64, | ||
| 54 | }; | ||
| 55 | |||
| 56 | /* Make a few "tile_" variables to simplify common code between | ||
| 57 | architectures. */ | ||
| 58 | |||
| 59 | typedef tilegx_bundle_bits tile_bundle_bits; | ||
| 60 | #define TILE_BUNDLE_SIZE_IN_BYTES TILEGX_BUNDLE_SIZE_IN_BYTES | ||
| 61 | #define TILE_BUNDLE_ALIGNMENT_IN_BYTES TILEGX_BUNDLE_ALIGNMENT_IN_BYTES | ||
| 62 | #define TILE_LOG2_BUNDLE_ALIGNMENT_IN_BYTES \ | ||
| 63 | TILEGX_LOG2_BUNDLE_ALIGNMENT_IN_BYTES | ||
| 64 | |||
| 65 | /* 64-bit pattern for a { bpt ; nop } bundle. */ | ||
| 66 | #define TILEGX_BPT_BUNDLE 0x286a44ae51485000ULL | ||
| 67 | |||
| 68 | static __inline unsigned int | ||
| 69 | get_BFEnd_X0(tilegx_bundle_bits num) | ||
| 70 | { | ||
| 71 | const unsigned int n = (unsigned int)num; | ||
| 72 | return (((n >> 12)) & 0x3f); | ||
| 73 | } | ||
| 74 | |||
| 75 | static __inline unsigned int | ||
| 76 | get_BFOpcodeExtension_X0(tilegx_bundle_bits num) | ||
| 77 | { | ||
| 78 | const unsigned int n = (unsigned int)num; | ||
| 79 | return (((n >> 24)) & 0xf); | ||
| 80 | } | ||
| 81 | |||
| 82 | static __inline unsigned int | ||
| 83 | get_BFStart_X0(tilegx_bundle_bits num) | ||
| 84 | { | ||
| 85 | const unsigned int n = (unsigned int)num; | ||
| 86 | return (((n >> 18)) & 0x3f); | ||
| 87 | } | ||
| 88 | |||
| 89 | static __inline unsigned int | ||
| 90 | get_BrOff_X1(tilegx_bundle_bits n) | ||
| 91 | { | ||
| 92 | return (((unsigned int)(n >> 31)) & 0x0000003f) | | ||
| 93 | (((unsigned int)(n >> 37)) & 0x0001ffc0); | ||
| 94 | } | ||
| 95 | |||
| 96 | static __inline unsigned int | ||
| 97 | get_BrType_X1(tilegx_bundle_bits n) | ||
| 98 | { | ||
| 99 | return (((unsigned int)(n >> 54)) & 0x1f); | ||
| 100 | } | ||
| 101 | |||
| 102 | static __inline unsigned int | ||
| 103 | get_Dest_Imm8_X1(tilegx_bundle_bits n) | ||
| 104 | { | ||
| 105 | return (((unsigned int)(n >> 31)) & 0x0000003f) | | ||
| 106 | (((unsigned int)(n >> 43)) & 0x000000c0); | ||
| 107 | } | ||
| 108 | |||
| 109 | static __inline unsigned int | ||
| 110 | get_Dest_X0(tilegx_bundle_bits num) | ||
| 111 | { | ||
| 112 | const unsigned int n = (unsigned int)num; | ||
| 113 | return (((n >> 0)) & 0x3f); | ||
| 114 | } | ||
| 115 | |||
| 116 | static __inline unsigned int | ||
| 117 | get_Dest_X1(tilegx_bundle_bits n) | ||
| 118 | { | ||
| 119 | return (((unsigned int)(n >> 31)) & 0x3f); | ||
| 120 | } | ||
| 121 | |||
| 122 | static __inline unsigned int | ||
| 123 | get_Dest_Y0(tilegx_bundle_bits num) | ||
| 124 | { | ||
| 125 | const unsigned int n = (unsigned int)num; | ||
| 126 | return (((n >> 0)) & 0x3f); | ||
| 127 | } | ||
| 128 | |||
| 129 | static __inline unsigned int | ||
| 130 | get_Dest_Y1(tilegx_bundle_bits n) | ||
| 131 | { | ||
| 132 | return (((unsigned int)(n >> 31)) & 0x3f); | ||
| 133 | } | ||
| 134 | |||
| 135 | static __inline unsigned int | ||
| 136 | get_Imm16_X0(tilegx_bundle_bits num) | ||
| 137 | { | ||
| 138 | const unsigned int n = (unsigned int)num; | ||
| 139 | return (((n >> 12)) & 0xffff); | ||
| 140 | } | ||
| 141 | |||
| 142 | static __inline unsigned int | ||
| 143 | get_Imm16_X1(tilegx_bundle_bits n) | ||
| 144 | |||
