OpenCSD - CoreSight Trace Decode Library
1.8.3
Toggle main menu visibility
Loading...
Searching...
No Matches
include
common
ocsd_pe_context.h
Go to the documentation of this file.
1
/*
2
* \file ocsd_pe_context.h
3
* \brief OpenCSD : Wrapper class for PE context
4
*
5
* \copyright Copyright (c) 2016, ARM Limited. All Rights Reserved.
6
*/
7
8
/*
9
* Redistribution and use in source and binary forms, with or without modification,
10
* are permitted provided that the following conditions are met:
11
*
12
* 1. Redistributions of source code must retain the above copyright notice,
13
* this list of conditions and the following disclaimer.
14
*
15
* 2. Redistributions in binary form must reproduce the above copyright notice,
16
* this list of conditions and the following disclaimer in the documentation
17
* and/or other materials provided with the distribution.
18
*
19
* 3. Neither the name of the copyright holder nor the names of its contributors
20
* may be used to endorse or promote products derived from this software without
21
* specific prior written permission.
22
*
23
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND
24
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
25
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
26
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
27
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
30
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
32
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33
*/
34
#ifndef ARM_OCSD_PE_CONTEXT_H_INCLUDED
35
#define ARM_OCSD_PE_CONTEXT_H_INCLUDED
36
37
#include "
opencsd/ocsd_if_types.h
"
38
45
class
OcsdPeContext
46
{
47
public
:
48
OcsdPeContext
();
49
OcsdPeContext
(
const
ocsd_pe_context
*context);
50
~OcsdPeContext
() {};
51
52
OcsdPeContext
&
operator =
(
const
OcsdPeContext
&ctxt);
53
OcsdPeContext
&
operator =
(
const
ocsd_pe_context
*context);
54
55
void
resetCtxt
();
56
57
void
setSecLevel
(
const
ocsd_sec_level
sl) { m_context.security_level = sl; };
58
void
setEL
(
const
ocsd_ex_level
el) { m_context.exception_level = el; m_context.el_valid = el >
ocsd_EL_unknown
? 1 : 0; };
59
void
setCtxtID
(
const
uint32_t
id
) { m_context.context_id = id; m_context.ctxt_id_valid = 1; };
60
void
setVMID
(
const
uint32_t
id
) { m_context.vmid = id; m_context.vmid_valid = 1; };
61
void
set64bit
(
const
bool
is64bit) { m_context.bits64 = is64bit ? 1 : 0; };
62
63
const
ocsd_sec_level
getSecLevel
()
const
{
return
m_context.security_level; };
64
const
ocsd_ex_level
getEL
()
const
{
return
m_context.exception_level; };
65
const
bool
ELvalid
()
const
{
return
(m_context.el_valid == 1); };
66
const
uint32_t
getCtxtID
()
const
{
return
(m_context.ctxt_id_valid == 1) ? m_context.context_id : 0; };
67
const
bool
ctxtIDvalid
()
const
{
return
(m_context.ctxt_id_valid == 1); };
68
const
uint32_t
getVMID
()
const
{
return
(m_context.vmid_valid == 1) ? m_context.vmid : 0; };
69
const
bool
VMIDvalid
()
const
{
return
(m_context.vmid_valid == 1); };
70
71
// only allow an immutable copy of the structure out to C-API land.
72
operator
const
ocsd_pe_context
&()
const
{
return
m_context; };
73
74
private
:
75
ocsd_pe_context
m_context;
76
};
77
78
inline
OcsdPeContext::OcsdPeContext
()
79
{
80
resetCtxt
();
81
}
82
83
inline
OcsdPeContext::OcsdPeContext
(
const
ocsd_pe_context
*context)
84
{
85
m_context = *context;
86
}
87
88
inline
void
OcsdPeContext::resetCtxt
()
89
{
90
// initialise the context
91
m_context.
bits64
= 0;
92
m_context.context_id = 0;
93
m_context.ctxt_id_valid = 0;
94
m_context.el_valid = 0;
95
m_context.exception_level =
ocsd_EL_unknown
;
96
m_context.security_level =
ocsd_sec_secure
;
97
m_context.vmid = 0;
98
m_context.vmid_valid = 0;
99
}
100
101
inline
OcsdPeContext
&
OcsdPeContext::operator =
(
const
OcsdPeContext
&ctxt)
102
{
103
m_context = ctxt;
104
return
*
this
;
105
}
106
107
inline
OcsdPeContext
&
OcsdPeContext::operator =
(
const
ocsd_pe_context
*context)
108
{
109
m_context = *context;
110
return
*
this
;
111
}
112
113
114
#endif
// ARM_OCSD_PE_CONTEXT_H_INCLUDED
115
116
/* End of File ocsd_pe_context.h */
OcsdPeContext
Handler for the ocsd_pe_context structure.
Definition
ocsd_pe_context.h:46
OcsdPeContext::setCtxtID
void setCtxtID(const uint32_t id)
Definition
ocsd_pe_context.h:59
OcsdPeContext::setVMID
void setVMID(const uint32_t id)
Definition
ocsd_pe_context.h:60
OcsdPeContext::ELvalid
const bool ELvalid() const
Definition
ocsd_pe_context.h:65
OcsdPeContext::OcsdPeContext
OcsdPeContext()
Definition
ocsd_pe_context.h:78
OcsdPeContext::setEL
void setEL(const ocsd_ex_level el)
Definition
ocsd_pe_context.h:58
OcsdPeContext::getVMID
const uint32_t getVMID() const
Definition
ocsd_pe_context.h:68
OcsdPeContext::getEL
const ocsd_ex_level getEL() const
Definition
ocsd_pe_context.h:64
OcsdPeContext::ctxtIDvalid
const bool ctxtIDvalid() const
Definition
ocsd_pe_context.h:67
OcsdPeContext::set64bit
void set64bit(const bool is64bit)
Definition
ocsd_pe_context.h:61
OcsdPeContext::operator=
OcsdPeContext & operator=(const OcsdPeContext &ctxt)
Definition
ocsd_pe_context.h:101
OcsdPeContext::resetCtxt
void resetCtxt()
Definition
ocsd_pe_context.h:88
OcsdPeContext::setSecLevel
void setSecLevel(const ocsd_sec_level sl)
Definition
ocsd_pe_context.h:57
OcsdPeContext::~OcsdPeContext
~OcsdPeContext()
Definition
ocsd_pe_context.h:50
OcsdPeContext::VMIDvalid
const bool VMIDvalid() const
Definition
ocsd_pe_context.h:69
OcsdPeContext::getSecLevel
const ocsd_sec_level getSecLevel() const
Definition
ocsd_pe_context.h:63
OcsdPeContext::getCtxtID
const uint32_t getCtxtID() const
Definition
ocsd_pe_context.h:66
ocsd_sec_level
enum _ocsd_sec_level ocsd_sec_level
ocsd_pe_context
struct _ocsd_pe_context ocsd_pe_context
ocsd_ex_level
enum _ocsd_ex_level ocsd_ex_level
ocsd_EL_unknown
@ ocsd_EL_unknown
Definition
ocsd_if_types.h:347
ocsd_sec_secure
@ ocsd_sec_secure
Definition
ocsd_if_types.h:337
ocsd_if_types.h
OpenCSD : Standard Types used in the library interfaces.
_ocsd_pe_context::bits64
uint32_t bits64
Definition
ocsd_if_types.h:414
Generated on
for OpenCSD - CoreSight Trace Decode Library by
1.17.0