1/* 2 * setjmp for the Blackfin processor 3 * 4 * Copyright (C) 2006 Analog Devices, Inc. 5 * 6 * The authors hereby grant permission to use, copy, modify, distribute, 7 * and license this software and its documentation for any purpose, provided 8 * that existing copyright notices are retained in all copies and that this 9 * notice is included verbatim in any distributions. No written agreement, 10 * license, or royalty fee is required for any of the authorized uses. 11 * Modifications to this software may be copyrighted by their authors 12 * and need not follow the licensing terms described here, provided that 13 * the new terms are clearly indicated on the first page of each file where 14 * they apply. 15 */ 16 17 18#include <picolibc.h> 19 20#define _ASM 21#define _SETJMP_H 22 23.text; 24.align 4; 25.globl _setjmp; 26.type _setjmp, STT_FUNC; 27 28_setjmp: 29 [--SP] = P0; /* Save P0 */ 30 P0 = R0; 31 R0 = [SP++]; 32 [P0 + 0x00] = R0; /* Save saved P0 */ 33 [P0 + 0x04] = P1; 34 [P0 + 0x08] = P2; 35 [P0 + 0x0C] = P3; 36 [P0 + 0x10] = P4; 37 [P0 + 0x14] = P5; 38 39 [P0 + 0x18] = FP; /* Frame Pointer */ 40 [P0 + 0x1C] = SP; /* Stack Pointer */ 41 42 [P0 + 0x20] = P0; /* Data Registers */ 43 [P0 + 0x24] = R1; 44 [P0 + 0x28] = R2; 45 [P0 + 0x2C] = R3; 46 [P0 + 0x30] = R4; 47 [P0 + 0x34] = R5; 48 [P0 + 0x38] = R6; 49 [P0 + 0x3C] = R7; 50 51 R0 = ASTAT; 52 [P0 + 0x40] = R0; 53 54 R0 = LC0; /* Loop Counters */ 55 [P0 + 0x44] = R0; 56 R0 = LC1; 57 [P0 + 0x48] = R0; 58 59 R0 = A0.W; /* Accumulators */ 60 [P0 + 0x4C] = R0; 61 R0 = A0.X; 62 [P0 + 0x50] = R0; 63 R0 = A1.W; 64 [P0 + 0x54] = R0; 65 R0 = A1.X; 66 [P0 + 0x58] = R0; 67 68 R0 = I0; /* Index Registers */ 69 [P0 + 0x5C] = R0; 70 R0 = I1; 71 [P0 + 0x60] = R0; 72 R0 = I2; 73 [P0 + 0x64] = R0; 74 R0 = I3; 75 [P0 + 0x68] = R0; 76 77 R0 = M0; /* Modifier Registers */ 78 [P0 + 0x6C] = R0; 79 R0 = M1; 80 [P0 + 0x70] = R0; 81 R0 = M2; 82 [P0 + 0x74] = R0; 83 R0 = M3; 84 [P0 + 0x78] = R0; 85 86 R0 = L0; /* Length Registers */ 87 [P0 + 0x7c] = R0; 88 R0 = L1; 89 [P0 + 0x80] = R0; 90 R0 = L2; 91 [P0 + 0x84] = R0; 92 R0 = L3; 93 [P0 + 0x88] = R0; 94 95 R0 = B0; /* Base Registers */ 96 [P0 + 0x8C] = R0; 97 R0 = B1; 98 [P0 + 0x90] = R0; 99 R0 = B2; 100 [P0 + 0x94] = R0; 101 R0 = B3; 102 [P0 + 0x98] = R0; 103 104 R0 = RETS; 105 [P0 + 0x9C] = R0; 106 107 R0 = 0; 108 109 RTS; 110.size _setjmp, .-_setjmp; 111