Back to home page

LXR

 
 

    


File indexing completed on 2025-05-11 08:24:09

0001 /* SPDX-License-Identifier: BSD-2-Clause */
0002 
0003 /*
0004  * trap_table.S
0005  *
0006  * trap code for Sparc64 RTEMS.
0007  *
0008  *  COPYRIGHT (c) 2010 Gedare Bloom.
0009  *
0010  * Redistribution and use in source and binary forms, with or without
0011  * modification, are permitted provided that the following conditions
0012  * are met:
0013  * 1. Redistributions of source code must retain the above copyright
0014  *    notice, this list of conditions and the following disclaimer.
0015  * 2. Redistributions in binary form must reproduce the above copyright
0016  *    notice, this list of conditions and the following disclaimer in the
0017  *    documentation and/or other materials provided with the distribution.
0018  *
0019  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
0020  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
0021  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
0022  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
0023  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
0024  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
0025  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
0026  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
0027  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
0028  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
0029  * POSSIBILITY OF SUCH DAMAGE.
0030  * 
0031  *  This code defines the space for the trap table used by sun4u.
0032  */
0033 
0034 #include <rtems/asm.h>
0035 #include <rtems/score/cpu.h>
0036 #include <traptable.h>
0037 
0038 .register %g2, #scratch
0039 
0040 .macro JUMP_TO_TRAP offset
0041   sethi %hi(real_trap_table), %g1;
0042   sethi %hi(\offset), %g2;
0043   or    %g1, %lo(real_trap_table), %g1;
0044   or    %g2, %lo(\offset), %g2;          ! g2 = offset
0045   ldx   [%g1], %g1;                      ! g1 = real_trap_table
0046   add   %g1, %g2, %g1;                   ! g1 = real_trap_table[offset]
0047   jmpl  %g1, %g0;
0048   nop;
0049 .endm
0050 
0051 ! space to save a pointer to the real trap table
0052 .section  .data
0053   .align 8
0054   .global real_trap_table
0055   SYM(real_trap_table):
0056   .space 8
0057 
0058 .section .text
0059   .align (TABLE_SIZE)
0060 PUBLIC(trap_table)
0061   SYM(trap_table):
0062 
0063   .irp idx, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, \
0064     11, 12, 13, 14, 15, 16, 17, 18, 19, 20, \
0065     21, 22, 23, 24, 25, 26, 27, 28, 29, 30, \
0066     31, 32, 33, 34, 35, 36, 37, 38, 39, 40, \
0067     41, 42, 43, 44, 45, 46, 47, 48, 49, 50, \
0068     51, 52, 53, 54, 55, 56, 57, 58, 59, 60, \
0069     61, 62, 63, 64, 65, 66, 67, 68, 69, 70, \
0070     71, 72, 73, 74, 75, 76, 77, 78, 79, 80, \
0071     81, 82, 83, 84, 85, 86, 87, 88, 89, 90, \
0072     91, 92, 93, 94, 95, 96, 97, 98, 99, 100, \
0073     101, 102, 103, 104, 105, 106, 107, 108, 109, 110, \
0074     111, 112, 113, 114, 115, 116, 117, 118, 119, 120, \
0075     121, 122, 123, 124, 125, 126, 127, 128, 129, 130, \
0076     131, 132, 133, 134, 135, 136, 137, 138, 139, 140, \
0077     141, 142, 143, 144, 145, 146, 147, 148, 149, 150, \
0078     151, 152, 153, 154, 155, 156, 157, 158, 159, 160, \
0079     161, 162, 163, 164, 165, 166, 167, 168, 169, 170, \
0080     171, 172, 173, 174, 175, 176, 177, 178, 179, 180, \
0081     181, 182, 183, 184, 185, 186, 187, 188, 189, 190, \
0082     191, 192, 193, 194, 195, 196, 197, 198, 199, 200, \
0083     201, 202, 203, 204, 205, 206, 207, 208, 209, 210, \
0084     211, 212, 213, 214, 215, 216, 217, 218, 219, 220, \
0085     221, 222, 223, 224, 225, 226, 227, 228, 229, 230, \
0086     231, 232, 233, 234, 235, 236, 237, 238, 239, 240, \
0087     241, 242, 243, 244, 245, 246, 247, 248, 249, 250, \
0088     251, 252, 253, 254, 255, 256, 257, 258, 259, 260, \
0089     261, 262, 263, 264, 265, 266, 267, 268, 269, 270, \
0090     271, 272, 273, 274, 275, 276, 277, 278, 279, 280, \
0091     281, 282, 283, 284, 285, 286, 287, 288, 289, 290, \
0092     291, 292, 293, 294, 295, 296, 297, 298, 299, 300, \
0093     301, 302, 303, 304, 305, 306, 307, 308, 309, 310, \
0094     311, 312, 313, 314, 315, 316, 317, 318, 319, 320, \
0095     321, 322, 323, 324, 325, 326, 327, 328, 329, 330, \
0096     331, 332, 333, 334, 335, 336, 337, 338, 339, 340, \
0097     341, 342, 343, 344, 345, 346, 347, 348, 349, 350, \
0098     351, 352, 353, 354, 355, 356, 357, 358, 359, 360, \
0099     361, 362, 363, 364, 365, 366, 367, 368, 369, 370, \
0100     371, 372, 373, 374, 375, 376, 377, 378, 379, 380, \
0101     381, 382, 383, 384, 385, 386, 387, 388, 389, 390, \
0102     391, 392, 393, 394, 395, 396, 397, 398, 399, 400, \
0103     401, 402, 403, 404, 405, 406, 407, 408, 409, 410, \
0104     411, 412, 413, 414, 415, 416, 417, 418, 419, 420, \
0105     421, 422, 423, 424, 425, 426, 427, 428, 429, 430, \
0106     431, 432, 433, 434, 435, 436, 437, 438, 439, 440, \
0107     441, 442, 443, 444, 445, 446, 447, 448, 449, 450, \
0108     451, 452, 453, 454, 455, 456, 457, 458, 459, 460, \
0109     461, 462, 463, 464, 465, 466, 467, 468, 469, 470, \
0110     471, 472, 473, 474, 475, 476, 477, 478, 479, 480, \
0111     481, 482, 483, 484, 485, 486, 487, 488, 489, 490, \
0112     491, 492, 493, 494, 495, 496, 497, 498, 499, 500, \
0113     501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511
0114 
0115     .org trap_table + ((\idx)*32)
0116       JUMP_TO_TRAP( ((\idx)*32) );
0117   .endr
0118 
0119   .irp idx, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, \
0120     11, 12, 13, 14, 15, 16, 17, 18, 19, 20, \
0121     21, 22, 23, 24, 25, 26, 27, 28, 29, 30, \
0122     31, 32, 33, 34, 35, 36, 37, 38, 39, 40, \
0123     41, 42, 43, 44, 45, 46, 47, 48, 49, 50, \
0124     51, 52, 53, 54, 55, 56, 57, 58, 59, 60, \
0125     61, 62, 63, 64, 65, 66, 67, 68, 69, 70, \
0126     71, 72, 73, 74, 75, 76, 77, 78, 79, 80, \
0127     81, 82, 83, 84, 85, 86, 87, 88, 89, 90, \
0128     91, 92, 93, 94, 95, 96, 97, 98, 99, 100, \
0129     101, 102, 103, 104, 105, 106, 107, 108, 109, 110, \
0130     111, 112, 113, 114, 115, 116, 117, 118, 119, 120, \
0131     121, 122, 123, 124, 125, 126, 127, 128, 129, 130, \
0132     131, 132, 133, 134, 135, 136, 137, 138, 139, 140, \
0133     141, 142, 143, 144, 145, 146, 147, 148, 149, 150, \
0134     151, 152, 153, 154, 155, 156, 157, 158, 159, 160, \
0135     161, 162, 163, 164, 165, 166, 167, 168, 169, 170, \
0136     171, 172, 173, 174, 175, 176, 177, 178, 179, 180, \
0137     181, 182, 183, 184, 185, 186, 187, 188, 189, 190, \
0138     191, 192, 193, 194, 195, 196, 197, 198, 199, 200, \
0139     201, 202, 203, 204, 205, 206, 207, 208, 209, 210, \
0140     211, 212, 213, 214, 215, 216, 217, 218, 219, 220, \
0141     221, 222, 223, 224, 225, 226, 227, 228, 229, 230, \
0142     231, 232, 233, 234, 235, 236, 237, 238, 239, 240, \
0143     241, 242, 243, 244, 245, 246, 247, 248, 249, 250, \
0144     251, 252, 253, 254, 255, 256, 257, 258, 259, 260, \
0145     261, 262, 263, 264, 265, 266, 267, 268, 269, 270, \
0146     271, 272, 273, 274, 275, 276, 277, 278, 279, 280, \
0147     281, 282, 283, 284, 285, 286, 287, 288, 289, 290, \
0148     291, 292, 293, 294, 295, 296, 297, 298, 299, 300, \
0149     301, 302, 303, 304, 305, 306, 307, 308, 309, 310, \
0150     311, 312, 313, 314, 315, 316, 317, 318, 319, 320, \
0151     321, 322, 323, 324, 325, 326, 327, 328, 329, 330, \
0152     331, 332, 333, 334, 335, 336, 337, 338, 339, 340, \
0153     341, 342, 343, 344, 345, 346, 347, 348, 349, 350, \
0154     351, 352, 353, 354, 355, 356, 357, 358, 359, 360, \
0155     361, 362, 363, 364, 365, 366, 367, 368, 369, 370, \
0156     371, 372, 373, 374, 375, 376, 377, 378, 379, 380, \
0157     381, 382, 383, 384, 385, 386, 387, 388, 389, 390, \
0158     391, 392, 393, 394, 395, 396, 397, 398, 399, 400, \
0159     401, 402, 403, 404, 405, 406, 407, 408, 409, 410, \
0160     411, 412, 413, 414, 415, 416, 417, 418, 419, 420, \
0161     421, 422, 423, 424, 425, 426, 427, 428, 429, 430, \
0162     431, 432, 433, 434, 435, 436, 437, 438, 439, 440, \
0163     441, 442, 443, 444, 445, 446, 447, 448, 449, 450, \
0164     451, 452, 453, 454, 455, 456, 457, 458, 459, 460, \
0165     461, 462, 463, 464, 465, 466, 467, 468, 469, 470, \
0166     471, 472, 473, 474, 475, 476, 477, 478, 479, 480, \
0167     481, 482, 483, 484, 485, 486, 487, 488, 489, 490, \
0168     491, 492, 493, 494, 495, 496, 497, 498, 499, 500, \
0169     501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511
0170 
0171     .org trap_table + 512*32 + ((\idx)*32)
0172       JUMP_TO_TRAP( 512*32 + ((\idx)*32) );
0173   .endr
0174