Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / sam / cpus / vonk / ss / lib / cpu / src / SS_PidContext.h
/*
* ========== Copyright Header Begin ==========================================
*
* OpenSPARC T2 Processor File: SS_PidContext.h
* Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES.
*
* The above named program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License version 2 as published by the Free Software Foundation.
*
* The above named program is distributed in the hope that it will be
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this work; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*
* ========== Copyright Header End ============================================
*/
#ifndef __SS_PidContext_h__
#define __SS_PidContext_h__
#include "SS_Types.h"
class SS_PidContext
{
private:
enum
{
PRI_CTX = 1,
SEC_CTX = 0,
PRI_CTX0 = 3,
PRI_CTX1 = 2,
SEC_CTX0 = 1,
SEC_CTX1 = 0,
PID = 0
};
public:
SS_PidContext() { pid_ctx.val = 0; }
void init() { pid_ctx.val = 0; }
void set_pri_ctx0( uint64_t ctx ) { pid_ctx.var[PRI_CTX0] = ctx; }
void set_pri_ctx1( uint64_t ctx ) { pid_ctx.var[PRI_CTX1] = ctx; }
void set_sec_ctx0( uint64_t ctx ) { pid_ctx.var[SEC_CTX0] = ctx; }
void set_sec_ctx1( uint64_t ctx ) { pid_ctx.var[SEC_CTX1] = ctx; }
void set_pid( uint_t pid ) { pid_ctx.var[PID] = pid; }
uint64_t get() { return pid_ctx.val; }
uint32_t get_pri() { return pid_ctx.ctx[PRI_CTX]; }
uint32_t get_sec() { return pid_ctx.ctx[SEC_CTX]; }
private:
union Data
{
uint16_t var[4];
uint32_t ctx[2];
uint64_t val;
};
Data pid_ctx;
};
#endif