regutils.hh (10915:71ace17ccb3d) regutils.hh (11313:89fd4a775287)
1/*
1/*
2 * Copyright (c) 2014-2015 ARM Limited
2 * Copyright (c) 2014-2016 ARM Limited
3 * All rights reserved
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *

--- 79 unchanged lines hidden (view full) ---

90static inline RegAddr
91getJobSlotAddr(const RegAddr &addr)
92{
93 const unsigned slot_no(getJobSlotNo(addr));
94 const RegAddr slot_base(RegAddr(JOB_SLOT0 + slot_no * 0x80));
95 return addr - slot_base;
96}
97
3 * All rights reserved
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *

--- 79 unchanged lines hidden (view full) ---

90static inline RegAddr
91getJobSlotAddr(const RegAddr &addr)
92{
93 const unsigned slot_no(getJobSlotNo(addr));
94 const RegAddr slot_base(RegAddr(JOB_SLOT0 + slot_no * 0x80));
95 return addr - slot_base;
96}
97
98
98/** Number of registers per job slot */
99static const unsigned JSn_NO_REGS = 0x20;
100
99/** Number of registers per job slot */
100static const unsigned JSn_NO_REGS = 0x20;
101
102/**
103 * Does this MMU register belong to an address space block?
104 *
105 * @return 1 if the address maps to a valid address space block, 0
106 * otherwise.
107 */
108static inline bool
109isAddrSpaceReg(const RegAddr &addr)
110{
111 return addr.value >= MMU_AS0 && addr.value <= 0x7FF;
101}
102
112}
113
114/**
115 * Get the address space number owning an address within the MMU
116 * block.
117 *
118 * @param addr Address relative to the JobControl block.
119 */
120static inline unsigned
121getAddrSpaceNo(const RegAddr &addr)
122{
123 assert(isAddrSpaceReg(addr));
124 return (addr.value - MMU_AS0) >> 6;
125}
126
127/**
128 * Get a AS-relative address from a MMU-relative
129 * address.
130 *
131 * @param addr Address relative to the MMU block.
132 * @return Address relative the start of the address space block.
133 */
134static inline RegAddr
135getAddrSpaceAddr(const RegAddr &addr)
136{
137 const unsigned as_no(getAddrSpaceNo(addr));
138 const RegAddr as_base(RegAddr(MMU_AS0 + as_no * 0x40));
139 return addr - as_base;
140}
141
142/** Number of registers per address space */
143static const unsigned ASn_NO_REGS = 0x10;
144
145}
146
103#endif //_LIBNOMALIMODEL_REGUTILS_HH
147#endif //_LIBNOMALIMODEL_REGUTILS_HH