source: mainline/uspace/lib/c/arch/ia64/include/libarch/fibril_context.h@ d2f75eb

lfn serial ticket/834-toolchain-update topic/msim-upgrade topic/simplify-dev-export
Last change on this file since d2f75eb was d2f75eb, checked in by GitHub <noreply@…>, 7 years ago

Replace autogen.py with something simpler. (#30)

Instead of generating headers for certain structures, the headers are written manually and we automate checking correctness instead. Checking is performed by generating a C source with a bunch of static asserts, using a simple awk script. This is then treated as a normal source file.

The primary motivation for this change is to reduce the complexity of the build process. Also, the .ag files we used previously are more difficult to understand than regular C code, and at least one IDE (GNOME Builder) completely refuses to open them.

  • Property mode set to 100644
File size: 4.3 KB
Line 
1/* Copyright (c) 2014 Jakub Jermar
2 * All rights preserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 *
8 * - Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * - Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * - The name of the author may not be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28#ifndef LIBC_ARCH_FIBRIL_CONTEXT_H_
29#define LIBC_ARCH_FIBRIL_CONTEXT_H_
30
31#define CONTEXT_OFFSET_AR_PFS 0x000
32#define CONTEXT_OFFSET_AR_UNAT_CALLER 0x008
33#define CONTEXT_OFFSET_AR_UNAT_CALLEE 0x010
34#define CONTEXT_OFFSET_AR_RSC 0x018
35#define CONTEXT_OFFSET_BSP 0x020
36#define CONTEXT_OFFSET_AR_RNAT 0x028
37#define CONTEXT_OFFSET_AR_LC 0x030
38#define CONTEXT_OFFSET_R1 0x038
39#define CONTEXT_OFFSET_R4 0x040
40#define CONTEXT_OFFSET_R5 0x048
41#define CONTEXT_OFFSET_R6 0x050
42#define CONTEXT_OFFSET_R7 0x058
43#define CONTEXT_OFFSET_SP 0x060
44#define CONTEXT_OFFSET_TP 0x068
45#define CONTEXT_OFFSET_PC 0x070
46#define CONTEXT_OFFSET_B1 0x078
47#define CONTEXT_OFFSET_B2 0x080
48#define CONTEXT_OFFSET_B3 0x088
49#define CONTEXT_OFFSET_B4 0x090
50#define CONTEXT_OFFSET_B5 0x098
51#define CONTEXT_OFFSET_PR 0x0a0
52#define CONTEXT_OFFSET_F2 0x0b0
53#define CONTEXT_OFFSET_F3 0x0c0
54#define CONTEXT_OFFSET_F4 0x0d0
55#define CONTEXT_OFFSET_F5 0x0e0
56#define CONTEXT_OFFSET_F16 0x0f0
57#define CONTEXT_OFFSET_F17 0x100
58#define CONTEXT_OFFSET_F18 0x110
59#define CONTEXT_OFFSET_F19 0x120
60#define CONTEXT_OFFSET_F20 0x130
61#define CONTEXT_OFFSET_F21 0x140
62#define CONTEXT_OFFSET_F22 0x150
63#define CONTEXT_OFFSET_F23 0x160
64#define CONTEXT_OFFSET_F24 0x170
65#define CONTEXT_OFFSET_F25 0x180
66#define CONTEXT_OFFSET_F26 0x190
67#define CONTEXT_OFFSET_F27 0x1a0
68#define CONTEXT_OFFSET_F28 0x1b0
69#define CONTEXT_OFFSET_F29 0x1c0
70#define CONTEXT_OFFSET_F30 0x1d0
71#define CONTEXT_OFFSET_F31 0x1e0
72#define CONTEXT_SIZE 0x1f0
73
74#ifndef __ASSEMBLER__
75
76#include <stdint.h>
77
78// Only save registers that must be preserved across function calls.
79typedef struct context {
80 // Application registers.
81 uint64_t ar_pfs;
82 uint64_t ar_unat_caller;
83 uint64_t ar_unat_callee;
84 uint64_t ar_rsc;
85 // ar_bsp
86 uint64_t bsp;
87 uint64_t ar_rnat;
88 uint64_t ar_lc;
89
90 // General registers.
91 uint64_t r1;
92 uint64_t r4;
93 uint64_t r5;
94 uint64_t r6;
95 uint64_t r7;
96 // r12
97 uint64_t sp;
98 // r13
99 uint64_t tp;
100
101 // Branch registers.
102 // b0
103 uint64_t pc;
104 uint64_t b1;
105 uint64_t b2;
106 uint64_t b3;
107 uint64_t b4;
108 uint64_t b5;
109
110 // Predicate registers.
111 uint64_t pr;
112 uint128_t f2;
113 uint128_t f3;
114 uint128_t f4;
115 uint128_t f5;
116 uint128_t f16;
117 uint128_t f17;
118 uint128_t f18;
119 uint128_t f19;
120 uint128_t f20;
121 uint128_t f21;
122 uint128_t f22;
123 uint128_t f23;
124 uint128_t f24;
125 uint128_t f25;
126 uint128_t f26;
127 uint128_t f27;
128 uint128_t f28;
129 uint128_t f29;
130 uint128_t f30;
131 uint128_t f31;
132} context_t;
133
134#endif /* __ASSEMBLER__ */
135#endif
136
Note: See TracBrowser for help on using the repository browser.