Commit | Line | Data |
---|---|---|
920dae64 AT |
1 | /* |
2 | * ========== Copyright Header Begin ========================================== | |
3 | * | |
4 | * OpenSPARC T2 Processor File: SS_PidContext.h | |
5 | * Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved. | |
6 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES. | |
7 | * | |
8 | * The above named program is free software; you can redistribute it and/or | |
9 | * modify it under the terms of the GNU General Public | |
10 | * License version 2 as published by the Free Software Foundation. | |
11 | * | |
12 | * The above named program is distributed in the hope that it will be | |
13 | * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
15 | * General Public License for more details. | |
16 | * | |
17 | * You should have received a copy of the GNU General Public | |
18 | * License along with this work; if not, write to the Free Software | |
19 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. | |
20 | * | |
21 | * ========== Copyright Header End ============================================ | |
22 | */ | |
23 | ||
24 | #ifndef __SS_PidContext_h__ | |
25 | #define __SS_PidContext_h__ | |
26 | ||
27 | #include "SS_Types.h" | |
28 | ||
29 | class SS_PidContext | |
30 | { | |
31 | private: | |
32 | enum | |
33 | { | |
34 | PRI_CTX = 1, | |
35 | SEC_CTX = 0, | |
36 | ||
37 | PRI_CTX0 = 3, | |
38 | PRI_CTX1 = 2, | |
39 | SEC_CTX0 = 1, | |
40 | SEC_CTX1 = 0, | |
41 | ||
42 | PID = 0 | |
43 | }; | |
44 | ||
45 | public: | |
46 | SS_PidContext() { pid_ctx.val = 0; } | |
47 | ||
48 | void init() { pid_ctx.val = 0; } | |
49 | ||
50 | void set_pri_ctx0( uint64_t ctx ) { pid_ctx.var[PRI_CTX0] = ctx; } | |
51 | void set_pri_ctx1( uint64_t ctx ) { pid_ctx.var[PRI_CTX1] = ctx; } | |
52 | ||
53 | void set_sec_ctx0( uint64_t ctx ) { pid_ctx.var[SEC_CTX0] = ctx; } | |
54 | void set_sec_ctx1( uint64_t ctx ) { pid_ctx.var[SEC_CTX1] = ctx; } | |
55 | ||
56 | void set_pid( uint_t pid ) { pid_ctx.var[PID] = pid; } | |
57 | ||
58 | uint64_t get() { return pid_ctx.val; } | |
59 | uint32_t get_pri() { return pid_ctx.ctx[PRI_CTX]; } | |
60 | uint32_t get_sec() { return pid_ctx.ctx[SEC_CTX]; } | |
61 | ||
62 | private: | |
63 | union Data | |
64 | { | |
65 | uint16_t var[4]; | |
66 | uint32_t ctx[2]; | |
67 | uint64_t val; | |
68 | }; | |
69 | ||
70 | Data pid_ctx; | |
71 | }; | |
72 | ||
73 | #endif | |
74 | ||
75 | ||
76 | ||
77 |