2020-02-15 11:44:41 +00:00
|
|
|
/*
|
2021-10-04 19:59:10 +00:00
|
|
|
* Copyright (c) Atmosphère-NX
|
2020-02-15 11:44:41 +00:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify it
|
|
|
|
* under the terms and conditions of the GNU General Public License,
|
|
|
|
* version 2, as published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope 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 program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
namespace ams::kern {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
struct KAddressSpaceInfo {
|
|
|
|
public:
|
|
|
|
enum Type {
|
2020-07-22 01:54:08 +00:00
|
|
|
Type_MapSmall = 0,
|
|
|
|
Type_MapLarge = 1,
|
|
|
|
Type_Map39Bit = 2,
|
2020-02-15 11:44:41 +00:00
|
|
|
Type_Heap = 3,
|
|
|
|
Type_Stack = 4,
|
|
|
|
Type_Alias = 5,
|
|
|
|
|
|
|
|
Type_Count,
|
|
|
|
};
|
|
|
|
private:
|
2020-12-18 01:18:47 +00:00
|
|
|
size_t m_bit_width;
|
|
|
|
size_t m_address;
|
|
|
|
size_t m_size;
|
|
|
|
Type m_type;
|
2020-02-15 11:44:41 +00:00
|
|
|
public:
|
|
|
|
static uintptr_t GetAddressSpaceStart(size_t width, Type type);
|
|
|
|
static size_t GetAddressSpaceSize(size_t width, Type type);
|
|
|
|
|
2023-02-21 15:53:17 +00:00
|
|
|
static void SetAddressSpaceSize(size_t width, Type type, size_t size);
|
|
|
|
|
2020-12-18 01:18:47 +00:00
|
|
|
constexpr KAddressSpaceInfo(size_t bw, size_t a, size_t s, Type t) : m_bit_width(bw), m_address(a), m_size(s), m_type(t) { /* ... */ }
|
2020-02-15 11:44:41 +00:00
|
|
|
|
2020-12-18 01:18:47 +00:00
|
|
|
constexpr size_t GetWidth() const { return m_bit_width; }
|
|
|
|
constexpr size_t GetAddress() const { return m_address; }
|
|
|
|
constexpr size_t GetSize() const { return m_size; }
|
|
|
|
constexpr Type GetType() const { return m_type; }
|
2023-02-21 15:53:17 +00:00
|
|
|
|
|
|
|
constexpr void SetSize(size_t size) { m_size = size; }
|
2020-02-15 11:44:41 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|