Switch atmosphere's build target to C++20. (#952)

* ams: update to build with gcc10/c++20

* remove mno-outline-atomics

* ams: take care of most TODO C++20s

* fusee/sept: update for gcc10

* whoosh, your code now uses pre-compiled headers

* make: dependency fixes
This commit is contained in:
SciresM 2020-05-11 15:02:10 -07:00 committed by GitHub
parent 17b6bcfd37
commit 3a1ccdd919
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
258 changed files with 723 additions and 804 deletions

View file

@ -156,6 +156,8 @@ $(OUTPUT).bin : $(OUTPUT).elf
$(OUTPUT).elf : $(OFILES) $(OUTPUT).elf : $(OFILES)
my_libc.o: CFLAGS += -fno-builtin
%.elf: %.elf:
@echo linking $(notdir $@) @echo linking $(notdir $@)
$(LD) $(LDFLAGS) $(OFILES) $(LIBPATHS) $(LIBS) -o $@ $(LD) $(LDFLAGS) $(OFILES) $(LIBPATHS) $(LIBS) -o $@

View file

@ -13,7 +13,7 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef EXOSPHERE_MMU_H #ifndef EXOSPHERE_MMU_H
#define EXOSPHERE_MMU_H #define EXOSPHERE_MMU_H
@ -134,7 +134,7 @@
#define TCR_EL2_RSVD (BIT(31) | BIT(23)) #define TCR_EL2_RSVD (BIT(31) | BIT(23))
#define TCR_EL3_RSVD (BIT(31) | BIT(23)) #define TCR_EL3_RSVD (BIT(31) | BIT(23))
static inline void mmu_init_table(uintptr_t *tbl, size_t num_entries) { static inline void mmu_init_table(volatile uintptr_t *tbl, size_t num_entries) {
for(size_t i = 0; i < num_entries / 8; i++) { for(size_t i = 0; i < num_entries / 8; i++) {
tbl[i] = MMU_PTE_TYPE_FAULT; tbl[i] = MMU_PTE_TYPE_FAULT;
} }

View file

@ -75,7 +75,7 @@ __libc_fini_array (void)
{ {
size_t count; size_t count;
size_t i; size_t i;
count = __fini_array_end - __fini_array_start; count = __fini_array_end - __fini_array_start;
for (i = count; i > 0; i--) for (i = count; i > 0; i--)
__fini_array_start[i-1] (); __fini_array_start[i-1] ();
@ -170,7 +170,7 @@ memmove (void *dst_void,
} }
else else
{ {
/* Use optimizing algorithm for a non-destructive copy to closely /* Use optimizing algorithm for a non-destructive copy to closely
match memcpy. If the size is small or either SRC or DST is unaligned, match memcpy. If the size is small or either SRC or DST is unaligned,
then punt into the byte copy loop. This should be rare. */ then punt into the byte copy loop. This should be rare. */
if (!TOO_SMALL(length) && !UNALIGNED (src, dst)) if (!TOO_SMALL(length) && !UNALIGNED (src, dst))
@ -561,7 +561,7 @@ memcmp (const void *m1,
s2++; s2++;
} }
return 0; return 0;
#else #else
unsigned char *s1 = (unsigned char *) m1; unsigned char *s1 = (unsigned char *) m1;
unsigned char *s2 = (unsigned char *) m2; unsigned char *s2 = (unsigned char *) m2;
unsigned long *a1; unsigned long *a1;
@ -572,13 +572,13 @@ memcmp (const void *m1,
not turn up in inner loops. */ not turn up in inner loops. */
if (!TOO_SMALL(n) && !UNALIGNED(s1,s2)) if (!TOO_SMALL(n) && !UNALIGNED(s1,s2))
{ {
/* Otherwise, load and compare the blocks of memory one /* Otherwise, load and compare the blocks of memory one
word at a time. */ word at a time. */
a1 = (unsigned long*) s1; a1 = (unsigned long*) s1;
a2 = (unsigned long*) s2; a2 = (unsigned long*) s2;
while (n >= LBLOCKSIZE) while (n >= LBLOCKSIZE)
{ {
if (*a1 != *a2) if (*a1 != *a2)
break; break;
a1++; a1++;
a2++; a2++;
@ -703,7 +703,7 @@ strchr (const char *s1,
/* /*
FUNCTION FUNCTION
<<strcmp>>---character string compare <<strcmp>>---character string compare
INDEX INDEX
strcmp strcmp
SYNOPSIS SYNOPSIS
@ -736,7 +736,7 @@ QUICKREF
int int
strcmp (const char *s1, strcmp (const char *s1,
const char *s2) const char *s2)
{ {
#if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__) #if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__)
while (*s1 != '\0' && *s1 == *s2) while (*s1 != '\0' && *s1 == *s2)
{ {
@ -751,7 +751,7 @@ strcmp (const char *s1,
/* If s1 or s2 are unaligned, then compare bytes. */ /* If s1 or s2 are unaligned, then compare bytes. */
if (!UNALIGNED (s1, s2)) if (!UNALIGNED (s1, s2))
{ {
/* If s1 and s2 are word-aligned, compare them a word at a time. */ /* If s1 and s2 are word-aligned, compare them a word at a time. */
a1 = (unsigned long*)s1; a1 = (unsigned long*)s1;
a2 = (unsigned long*)s2; a2 = (unsigned long*)s2;
@ -915,7 +915,7 @@ strlen (const char *str)
/* /*
FUNCTION FUNCTION
<<strncmp>>---character string compare <<strncmp>>---character string compare
INDEX INDEX
strncmp strncmp
SYNOPSIS SYNOPSIS
@ -944,7 +944,7 @@ QUICKREF
#define UNALIGNED(X, Y) \ #define UNALIGNED(X, Y) \
(((long)X & (sizeof (long) - 1)) | ((long)Y & (sizeof (long) - 1))) (((long)X & (sizeof (long) - 1)) | ((long)Y & (sizeof (long) - 1)))
int int
strncmp (const char *s1, strncmp (const char *s1,
const char *s2, const char *s2,
size_t n) size_t n)
@ -1103,10 +1103,10 @@ strncpy (char *__restrict dst0,
#endif /* not PREFER_SIZE_OVER_SPEED */ #endif /* not PREFER_SIZE_OVER_SPEED */
} }
/* /*
FUNCTION FUNCTION
<<strnlen>>---character string length <<strnlen>>---character string length
INDEX INDEX
strnlen strnlen
SYNOPSIS SYNOPSIS

View file

@ -119,7 +119,7 @@ all: check_rebootstub $(BUILD)
check_rebootstub: check_rebootstub:
@$(MAKE) -C $(AMS)/exosphere/rebootstub all @$(MAKE) -C $(AMS)/exosphere/rebootstub all
$(BUILD): $(BUILD): check_rebootstub
@[ -d $@ ] || mkdir -p $@ @[ -d $@ ] || mkdir -p $@
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile @$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile

View file

@ -23,13 +23,16 @@ FATFS sd_fs;
static bool g_sd_mounted = false; static bool g_sd_mounted = false;
static bool g_sd_initialized = false; static bool g_sd_initialized = false;
static bool g_ahb_redirect_enabled = false; static bool g_ahb_redirect_enabled = false;
sdmmc_t g_sd_sdmmc;
sdmmc_device_t g_sd_device;
bool mount_sd(void) bool mount_sd(void)
{ {
/* Already mounted. */ /* Already mounted. */
if (g_sd_mounted) if (g_sd_mounted)
return true; return true;
/* Enable AHB redirection if necessary. */ /* Enable AHB redirection if necessary. */
if (!g_ahb_redirect_enabled) { if (!g_ahb_redirect_enabled) {
mc_enable_ahb_redirect(); mc_enable_ahb_redirect();
@ -41,7 +44,7 @@ bool mount_sd(void)
if (sdmmc_device_sd_init(&g_sd_device, &g_sd_sdmmc, SDMMC_BUS_WIDTH_4BIT, SDMMC_SPEED_UHS_SDR104)) if (sdmmc_device_sd_init(&g_sd_device, &g_sd_sdmmc, SDMMC_BUS_WIDTH_4BIT, SDMMC_SPEED_UHS_SDR104))
{ {
g_sd_initialized = true; g_sd_initialized = true;
/* Mount SD. */ /* Mount SD. */
if (f_mount(&sd_fs, "", 1) == FR_OK) { if (f_mount(&sd_fs, "", 1) == FR_OK) {
print(SCREEN_LOG_LEVEL_INFO, "Mounted SD card!\n"); print(SCREEN_LOG_LEVEL_INFO, "Mounted SD card!\n");
@ -63,7 +66,7 @@ void unmount_sd(void)
sdmmc_device_finish(&g_sd_device); sdmmc_device_finish(&g_sd_device);
g_sd_mounted = false; g_sd_mounted = false;
} }
/* Disable AHB redirection if necessary. */ /* Disable AHB redirection if necessary. */
if (g_ahb_redirect_enabled) { if (g_ahb_redirect_enabled) {
mc_disable_ahb_redirect(); mc_disable_ahb_redirect();
@ -81,13 +84,13 @@ uint32_t get_file_size(const char *filename)
FIL f; FIL f;
if (f_open(&f, filename, FA_READ) != FR_OK) if (f_open(&f, filename, FA_READ) != FR_OK)
return 0; return 0;
/* Get the file size. */ /* Get the file size. */
uint32_t file_size = f_size(&f); uint32_t file_size = f_size(&f);
/* Close the file. */ /* Close the file. */
f_close(&f); f_close(&f);
return file_size; return file_size;
} }
@ -101,10 +104,10 @@ int read_from_file(void *dst, uint32_t dst_size, const char *filename)
FIL f; FIL f;
if (f_open(&f, filename, FA_READ) != FR_OK) if (f_open(&f, filename, FA_READ) != FR_OK)
return 0; return 0;
/* Sync. */ /* Sync. */
f_sync(&f); f_sync(&f);
/* Read from file. */ /* Read from file. */
UINT br = 0; UINT br = 0;
int res = f_read(&f, dst, dst_size, &br); int res = f_read(&f, dst, dst_size, &br);
@ -118,7 +121,7 @@ int write_to_file(void *src, uint32_t src_size, const char *filename)
/* SD card hasn't been mounted yet. */ /* SD card hasn't been mounted yet. */
if (!g_sd_mounted) if (!g_sd_mounted)
return 0; return 0;
/* Open the file for writing. */ /* Open the file for writing. */
FIL f; FIL f;
if (f_open(&f, filename, FA_CREATE_ALWAYS | FA_WRITE) != FR_OK) if (f_open(&f, filename, FA_CREATE_ALWAYS | FA_WRITE) != FR_OK)

View file

@ -13,7 +13,7 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef FUSEE_FS_UTILS_H #ifndef FUSEE_FS_UTILS_H
#define FUSEE_FS_UTILS_H #define FUSEE_FS_UTILS_H
@ -23,8 +23,8 @@
#include "sdmmc/sdmmc.h" #include "sdmmc/sdmmc.h"
#include "utils.h" #include "utils.h"
sdmmc_t g_sd_sdmmc; extern sdmmc_t g_sd_sdmmc;
sdmmc_device_t g_sd_device; extern sdmmc_device_t g_sd_device;
bool mount_sd(void); bool mount_sd(void);
void unmount_sd(void); void unmount_sd(void);

View file

@ -70,7 +70,10 @@ static char* find_chars_or_comment(const char* s, const char* chars)
/* Version of strncpy that ensures dest (size bytes) is null-terminated. */ /* Version of strncpy that ensures dest (size bytes) is null-terminated. */
static char* strncpy0(char* dest, const char* src, size_t size) static char* strncpy0(char* dest, const char* src, size_t size)
{ {
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wstringop-truncation"
strncpy(dest, src, size - 1); strncpy(dest, src, size - 1);
#pragma GCC diagnostic pop
dest[size - 1] = '\0'; dest[size - 1] = '\0';
return dest; return dest;
} }

View file

@ -70,7 +70,10 @@ static char* find_chars_or_comment(const char* s, const char* chars)
/* Version of strncpy that ensures dest (size bytes) is null-terminated. */ /* Version of strncpy that ensures dest (size bytes) is null-terminated. */
static char* strncpy0(char* dest, const char* src, size_t size) static char* strncpy0(char* dest, const char* src, size_t size)
{ {
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wstringop-truncation"
strncpy(dest, src, size - 1); strncpy(dest, src, size - 1);
#pragma GCC diagnostic pop
dest[size - 1] = '\0'; dest[size - 1] = '\0';
return dest; return dest;
} }

View file

@ -119,10 +119,16 @@ static int emummc_ini_handler(void *user, const char *section, const char *name,
} else if (strcmp(name, EMUMMC_ID_KEY) == 0) { } else if (strcmp(name, EMUMMC_ID_KEY) == 0) {
sscanf(value, "%lx", &emummc_cfg->id); sscanf(value, "%lx", &emummc_cfg->id);
} else if (strcmp(name, EMUMMC_PATH_KEY) == 0) { } else if (strcmp(name, EMUMMC_PATH_KEY) == 0) {
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wstringop-truncation"
strncpy(emummc_cfg->path, value, sizeof(emummc_cfg->path) - 1); strncpy(emummc_cfg->path, value, sizeof(emummc_cfg->path) - 1);
#pragma GCC diagnostic pop
emummc_cfg->path[sizeof(emummc_cfg->path) - 1] = '\0'; emummc_cfg->path[sizeof(emummc_cfg->path) - 1] = '\0';
} else if (strcmp(name, EMUMMC_NINTENDO_PATH_KEY) == 0) { } else if (strcmp(name, EMUMMC_NINTENDO_PATH_KEY) == 0) {
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wstringop-truncation"
strncpy(emummc_cfg->nintendo_path, value, sizeof(emummc_cfg->nintendo_path) - 1); strncpy(emummc_cfg->nintendo_path, value, sizeof(emummc_cfg->nintendo_path) - 1);
#pragma GCC diagnostic pop
emummc_cfg->nintendo_path[sizeof(emummc_cfg->nintendo_path) - 1] = '\0'; emummc_cfg->nintendo_path[sizeof(emummc_cfg->nintendo_path) - 1] = '\0';
} else { } else {
return 0; return 0;
@ -356,7 +362,10 @@ static bool nxboot_configure_emummc(exo_emummc_config_t *exo_emummc_config) {
/* Initialize values from emummc config. */ /* Initialize values from emummc config. */
exo_emummc_config->base_cfg.id = emummc_cfg.id; exo_emummc_config->base_cfg.id = emummc_cfg.id;
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wstringop-truncation"
strncpy(exo_emummc_config->emu_dir_path, emummc_cfg.nintendo_path, sizeof(exo_emummc_config->emu_dir_path)); strncpy(exo_emummc_config->emu_dir_path, emummc_cfg.nintendo_path, sizeof(exo_emummc_config->emu_dir_path));
#pragma GCC diagnostic pop
exo_emummc_config->emu_dir_path[sizeof(exo_emummc_config->emu_dir_path) - 1] = '\0'; exo_emummc_config->emu_dir_path[sizeof(exo_emummc_config->emu_dir_path) - 1] = '\0';
if (emummc_cfg.enabled) { if (emummc_cfg.enabled) {
@ -370,7 +379,10 @@ static bool nxboot_configure_emummc(exo_emummc_config_t *exo_emummc_config) {
} }
} else if (is_valid_folder(emummc_cfg.path)) { } else if (is_valid_folder(emummc_cfg.path)) {
exo_emummc_config->base_cfg.type = EMUMMC_TYPE_FILES; exo_emummc_config->base_cfg.type = EMUMMC_TYPE_FILES;
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wstringop-truncation"
strncpy(exo_emummc_config->file_cfg.path, emummc_cfg.path, sizeof(exo_emummc_config->file_cfg.path)); strncpy(exo_emummc_config->file_cfg.path, emummc_cfg.path, sizeof(exo_emummc_config->file_cfg.path));
#pragma GCC diagnostic pop
exo_emummc_config->file_cfg.path[sizeof(exo_emummc_config->file_cfg.path) - 1] = '\0'; exo_emummc_config->file_cfg.path[sizeof(exo_emummc_config->file_cfg.path) - 1] = '\0';
int num_parts = 0; int num_parts = 0;

View file

@ -18,7 +18,7 @@ export ATMOSPHERE_DEFINES := -DATMOSPHERE
export ATMOSPHERE_SETTINGS := -fPIE -g export ATMOSPHERE_SETTINGS := -fPIE -g
export ATMOSPHERE_CFLAGS := -Wall -ffunction-sections -fdata-sections -fno-strict-aliasing -fwrapv \ export ATMOSPHERE_CFLAGS := -Wall -ffunction-sections -fdata-sections -fno-strict-aliasing -fwrapv \
-fno-asynchronous-unwind-tables -fno-unwind-tables -fno-stack-protector -fno-asynchronous-unwind-tables -fno-unwind-tables -fno-stack-protector
export ATMOSPHERE_CXXFLAGS := -fno-rtti -fno-exceptions -std=gnu++17 export ATMOSPHERE_CXXFLAGS := -fno-rtti -fno-exceptions -std=gnu++20
export ATMOSPHERE_ASFLAGS := export ATMOSPHERE_ASFLAGS :=

View file

@ -6,8 +6,7 @@ include $(dir $(abspath $(lastword $(MAKEFILE_LIST))))/../config/common.mk
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
# options for code generation # options for code generation
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
#PRECOMPILED_HEADERS := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))/include/mesosphere.hpp PRECOMPILED_HEADERS := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))/include/mesosphere.hpp
PRECOMPILED_HEADERS :=
DEFINES := $(ATMOSPHERE_DEFINES) -DATMOSPHERE_IS_MESOSPHERE DEFINES := $(ATMOSPHERE_DEFINES) -DATMOSPHERE_IS_MESOSPHERE
SETTINGS := $(ATMOSPHERE_SETTINGS) -O2 -mgeneral-regs-only -ffixed-x18 -Werror -fno-non-call-exceptions SETTINGS := $(ATMOSPHERE_SETTINGS) -O2 -mgeneral-regs-only -ffixed-x18 -Werror -fno-non-call-exceptions
@ -122,6 +121,8 @@ $(filter-out kern_svc_tables.o, $(OFILES)) : $(GCH_FILES)
$(OFILES_SRC) : $(HFILES_BIN) $(OFILES_SRC) : $(HFILES_BIN)
kern_libc_generic.o: CFLAGS += -fno-builtin
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
%_bin.h %.bin.o : %.bin %_bin.h %.bin.o : %.bin
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------

View file

@ -72,7 +72,7 @@ namespace ams::kern::arch::arm64 {
SgirTargetListFilter_Reserved = (3 << 24), SgirTargetListFilter_Reserved = (3 << 24),
}; };
}; };
static_assert(std::is_pod<GicDistributor>::value); static_assert(util::is_pod<GicDistributor>::value);
static_assert(sizeof(GicDistributor) == 0x1000); static_assert(sizeof(GicDistributor) == 0x1000);
struct GicCpuInterface { struct GicCpuInterface {
@ -98,7 +98,7 @@ namespace ams::kern::arch::arm64 {
u32 dir; u32 dir;
u32 _0x1004[1023]; u32 _0x1004[1023];
}; };
static_assert(std::is_pod<GicCpuInterface>::value); static_assert(util::is_pod<GicCpuInterface>::value);
static_assert(sizeof(GicCpuInterface) == 0x2000); static_assert(sizeof(GicCpuInterface) == 0x2000);
struct KInterruptController { struct KInterruptController {
@ -164,11 +164,11 @@ namespace ams::kern::arch::arm64 {
} }
void SetTarget(s32 irq, s32 core_id) const { void SetTarget(s32 irq, s32 core_id) const {
this->gicd->itargetsr.bytes[irq] |= GetGicMask(core_id); this->gicd->itargetsr.bytes[irq] = this->gicd->itargetsr.bytes[irq] | GetGicMask(core_id);
} }
void ClearTarget(s32 irq, s32 core_id) const { void ClearTarget(s32 irq, s32 core_id) const {
this->gicd->itargetsr.bytes[irq] &= ~GetGicMask(core_id); this->gicd->itargetsr.bytes[irq] = this->gicd->itargetsr.bytes[irq] & ~GetGicMask(core_id);
} }
void SetPriorityLevel(s32 irq, s32 level) const { void SetPriorityLevel(s32 irq, s32 level) const {

View file

@ -32,7 +32,7 @@ namespace ams::kern::init {
u32 init_array_offset; u32 init_array_offset;
u32 init_array_end_offset; u32 init_array_end_offset;
}; };
static_assert(std::is_pod<KernelLayout>::value); static_assert(util::is_pod<KernelLayout>::value);
static_assert(sizeof(KernelLayout) == 0x30); static_assert(sizeof(KernelLayout) == 0x30);
} }

View file

@ -185,10 +185,7 @@ namespace ams::kern {
T *obj; T *obj;
private: private:
constexpr ALWAYS_INLINE void Swap(KScopedAutoObject &rhs) { constexpr ALWAYS_INLINE void Swap(KScopedAutoObject &rhs) {
/* TODO: C++20 constexpr std::swap */ std::swap(this->obj, rhs.obj);
T *tmp = rhs.obj;
rhs.obj = this->obj;
this->obj = tmp;
} }
public: public:
constexpr ALWAYS_INLINE KScopedAutoObject() : obj(nullptr) { /* ... */ } constexpr ALWAYS_INLINE KScopedAutoObject() : obj(nullptr) { /* ... */ }

View file

@ -64,7 +64,7 @@ namespace ams::kern {
static constexpr u32 GetCapabilityId(CapabilityType type) { static constexpr u32 GetCapabilityId(CapabilityType type) {
const u32 flag = GetCapabilityFlag(type); const u32 flag = GetCapabilityFlag(type);
if (true /* C++20: std::is_constant_evaluated() */) { if (std::is_constant_evaluated()) {
return CountTrailingZero(flag); return CountTrailingZero(flag);
} else { } else {
return static_cast<u32>(__builtin_ctz(flag)); return static_cast<u32>(__builtin_ctz(flag));
@ -84,7 +84,7 @@ namespace ams::kern {
template<CapabilityType Type> template<CapabilityType Type>
static constexpr inline u32 CapabilityId = []() -> u32 { static constexpr inline u32 CapabilityId = []() -> u32 {
const u32 flag = static_cast<u32>(Type) + 1; const u32 flag = static_cast<u32>(Type) + 1;
if (true /* C++20: std::is_constant_evaluated() */) { if (std::is_constant_evaluated()) {
for (u32 i = 0; i < BITSIZEOF(u32); i++) { for (u32 i = 0; i < BITSIZEOF(u32); i++) {
if (flag & (1u << i)) { if (flag & (1u << i)) {
return i; return i;

View file

@ -31,8 +31,10 @@ namespace ams::kern {
s32 core_id; s32 core_id;
void *exception_stack_top; void *exception_stack_top;
}; };
static_assert(std::is_pod<KCurrentContext>::value); static_assert(std::is_standard_layout<KCurrentContext>::value && std::is_trivially_destructible<KCurrentContext>::value);
static_assert(sizeof(KCurrentContext) <= cpu::DataCacheLineSize); static_assert(sizeof(KCurrentContext) <= cpu::DataCacheLineSize);
static_assert(sizeof(std::atomic<KThread *>) == sizeof(KThread *));
static_assert(sizeof(std::atomic<KProcess *>) == sizeof(KProcess *));
namespace impl { namespace impl {

View file

@ -65,7 +65,7 @@ namespace ams::kern {
Node *next; Node *next;
u8 buffer[PageSize - sizeof(Node *)]; u8 buffer[PageSize - sizeof(Node *)];
}; };
static_assert(std::is_pod<Node>::value); static_assert(util::is_pod<Node>::value);
private: private:
Node *root; Node *root;
public: public:

View file

@ -18,39 +18,34 @@
namespace ams::kern { namespace ams::kern {
/* template<typename T>
TODO: C++20 concept KPriorityQueueAffinityMask = !std::is_reference<T>::value && requires (T &t) {
{ t.GetAffinityMask() } -> std::convertible_to<u64>;
{ t.SetAffinityMask(std::declval<u64>()) };
template<typename T> { t.GetAffinity(std::declval<int32_t>()) } -> std::same_as<bool>;
concept KPriorityQueueAffinityMask = !std::is_reference<T>::value && requires (T &t) { { t.SetAffinity(std::declval<int32_t>(), std::declval<bool>()) };
{ t.GetAffinityMask() } -> std::convertible_to<u64>; { t.SetAll() };
{ t.SetAffinityMask(std::declval<u64>()) }; };
{ t.GetAffinity(std::declval<int32_t>()) } -> std::same_as<bool>; template<typename T>
{ t.SetAffinity(std::declval<int32_t>(), std::declval<bool>()) }; concept KPriorityQueueMember = !std::is_reference<T>::value && requires (T &t) {
{ t.SetAll() }; { typename T::QueueEntry() };
}; { (typename T::QueueEntry()).Initialize() };
{ (typename T::QueueEntry()).SetPrev(std::addressof(t)) };
{ (typename T::QueueEntry()).SetNext(std::addressof(t)) };
{ (typename T::QueueEntry()).GetNext() } -> std::same_as<T*>;
{ (typename T::QueueEntry()).GetPrev() } -> std::same_as<T*>;
{ t.GetPriorityQueueEntry(std::declval<s32>()) } -> std::same_as<typename T::QueueEntry &>;
template<typename T> { t.GetAffinityMask() };
concept KPriorityQueueMember = !std::is_reference<T>::value && requires (T &t) { { typename std::remove_cvref<decltype(t.GetAffinityMask())>::type() } -> KPriorityQueueAffinityMask;
{ typename T::QueueEntry() };
{ (typename T::QueueEntry()).Initialize() };
{ (typename T::QueueEntry()).SetPrev(std::addressof(t)) };
{ (typename T::QueueEntry()).SetNext(std::addressof(t)) };
{ (typename T::QueueEntry()).GetNext() } -> std::same_as<T*>;
{ (typename T::QueueEntry()).GetPrev() } -> std::same_as<T*>;
{ t.GetPriorityQueueEntry(std::declval<s32>()) } -> std::same_as<typename T::QueueEntry &>;
{ t.GetAffinityMask() }; { t.GetActiveCore() } -> std::convertible_to<s32>;
{ typename std::remove_cvref<decltype(t.GetAffinityMask())>::type() } -> KPriorityQueueAffinityMask; { t.GetPriority() } -> std::convertible_to<s32>;
};
{ t.GetActiveCore() } -> std::convertible_to<s32>; template<typename Member, size_t _NumCores, int LowestPriority, int HighestPriority> requires KPriorityQueueMember<Member>
{ t.GetPriority() } -> std::convertible_to<s32>;
};
*/
template<typename Member, size_t _NumCores, int LowestPriority, int HighestPriority> /* TODO C++20: requires KPriorityQueueMember<Member> */
class KPriorityQueue { class KPriorityQueue {
public: public:
using AffinityMaskType = typename std::remove_cv<typename std::remove_reference<decltype(std::declval<Member>().GetAffinityMask())>::type>::type; using AffinityMaskType = typename std::remove_cv<typename std::remove_reference<decltype(std::declval<Member>().GetAffinityMask())>::type>::type;

View file

@ -33,8 +33,6 @@ namespace ams::kern {
NON_COPYABLE(KScheduler); NON_COPYABLE(KScheduler);
NON_MOVEABLE(KScheduler); NON_MOVEABLE(KScheduler);
public: public:
using LockType = KAbstractSchedulerLock<KScheduler>;
static constexpr s32 HighestCoreMigrationAllowedPriority = 2; static constexpr s32 HighestCoreMigrationAllowedPriority = 2;
static_assert(ams::svc::LowestThreadPriority >= HighestCoreMigrationAllowedPriority); static_assert(ams::svc::LowestThreadPriority >= HighestCoreMigrationAllowedPriority);
static_assert(ams::svc::HighestThreadPriority <= HighestCoreMigrationAllowedPriority); static_assert(ams::svc::HighestThreadPriority <= HighestCoreMigrationAllowedPriority);
@ -50,9 +48,6 @@ namespace ams::kern {
private: private:
friend class KScopedSchedulerLock; friend class KScopedSchedulerLock;
friend class KScopedSchedulerLockAndSleep; friend class KScopedSchedulerLockAndSleep;
static bool s_scheduler_update_needed;
static LockType s_scheduler_lock;
static KSchedulerPriorityQueue s_priority_queue;
private: private:
SchedulingState state; SchedulingState state;
bool is_active; bool is_active;
@ -160,6 +155,12 @@ namespace ams::kern {
} }
NOINLINE u64 UpdateHighestPriorityThread(KThread *thread); NOINLINE u64 UpdateHighestPriorityThread(KThread *thread);
public:
using LockType = KAbstractSchedulerLock<KScheduler>;
private:
static bool s_scheduler_update_needed;
static KSchedulerPriorityQueue s_priority_queue;
static LockType s_scheduler_lock;
}; };
class KScopedSchedulerLock : KScopedLock<KScheduler::LockType> { class KScopedSchedulerLock : KScopedLock<KScheduler::LockType> {

View file

@ -23,19 +23,14 @@ namespace ams::kern {
class KThread; class KThread;
/* template<typename T>
TODO: C++20 concept KSchedulerLockable = !std::is_reference<T>::value && requires(T) {
{ T::DisableScheduling() } -> std::same_as<void>;
{ T::EnableScheduling(std::declval<u64>()) } -> std::same_as<void>;
{ T::UpdateHighestPriorityThreads() } -> std::convertible_to<u64>;
};
template<typename T> template<typename SchedulerType> requires KSchedulerLockable<SchedulerType>
concept KSchedulerLockable = !std::is_reference<T>::value && requires {
{ T::DisableScheduling() } -> std::same_as<void>;
{ T::EnableScheduling(std::declval<u64>()) } -> std::same_as<void>;
{ T::UpdateHighestPriorityThreads() } -> std::convertible_to<u64>;
};
*/
template<typename SchedulerType> /* TODO C++20: requires KSchedulerLockable<SchedulerType> */
class KAbstractSchedulerLock { class KAbstractSchedulerLock {
private: private:
KAlignedSpinLock spin_lock; KAlignedSpinLock spin_lock;

View file

@ -18,18 +18,13 @@
namespace ams::kern { namespace ams::kern {
/* template<typename T>
TODO: C++20 concept KLockable = !std::is_reference<T>::value && requires (T &t) {
{ t.Lock() } -> std::same_as<void>;
{ t.Unlock() } -> std::same_as<void>;
};
template<typename T> template<typename T> requires KLockable<T>
concept KLockable = !std::is_reference<T>::value && requires (T &t) {
{ t.Lock() } -> std::same_as<void>;
{ t.Unlock() } -> std::same_as<void>;
};
*/
template<typename T> /* TODO C++20: requires KLockable<T> */
class KScopedLock { class KScopedLock {
NON_COPYABLE(KScopedLock); NON_COPYABLE(KScopedLock);
NON_MOVEABLE(KScopedLock); NON_MOVEABLE(KScopedLock);

View file

@ -22,47 +22,35 @@ namespace ams::kern::svc {
namespace impl { namespace impl {
/* TODO: C++20 template<typename T>
template<typename T> concept Pointer = std::is_pointer<T>::value;
concept Pointer = std::is_pointer<T>::value;
template<typename T>
concept NonConstPointer = Pointer<T> && !std::is_const<typename std::remove_pointer<T>::type>::value;
template<typename T>
concept ConstPointer = Pointer<T> && std::is_const<typename std::remove_pointer<T>::type>::value;
template<typename T, size_t N>
concept AlignedNPointer = Pointer<T> && alignof(typename std::remove_pointer<T>::type) >= N && util::IsAligned(sizeof(typename std::remove_pointer<T>::type), N);
template<typename T>
concept Aligned8Pointer = AlignedNPointer<T, sizeof(u8)>;
template<typename T>
concept Aligned16Pointer = AlignedNPointer<T, sizeof(u16)> && Aligned8<T>;
template<typename T>
concept Aligned32Pointer = AlignedNPointer<T, sizeof(u32)> && Aligned16<T>;
template<typename T>
concept Aligned64Pointer = AlignedNPointer<T, sizeof(u64)> && Aligned32<T>;
*/
template<typename T> template<typename T>
constexpr inline bool IsPointer = std::is_pointer<T>::value; concept NonConstPointer = Pointer<T> && !std::is_const<typename std::remove_pointer<T>::type>::value;
template<typename T> template<typename T>
constexpr inline bool IsConstPointer = IsPointer<T> && std::is_const<typename std::remove_pointer<T>::type>::value; concept ConstPointer = Pointer<T> && std::is_const<typename std::remove_pointer<T>::type>::value;
template<typename T>
constexpr inline bool IsNonConstPointer = IsPointer<T> && !std::is_const<typename std::remove_pointer<T>::type>::value;
template<typename T, size_t N> template<typename T, size_t N>
constexpr inline bool IsAlignedNPointer = IsPointer<T> && alignof(typename std::remove_pointer<T>::type) >= N && util::IsAligned(sizeof(typename std::remove_pointer<T>::type), N); concept AlignedNPointer = Pointer<T> && alignof(typename std::remove_pointer<T>::type) >= N && util::IsAligned(sizeof(typename std::remove_pointer<T>::type), N);
template<typename _T, typename = void> /* requires Aligned8Pointer<_T> */ template<typename T>
class KUserPointerImplTraits { concept Aligned8Pointer = AlignedNPointer<T, sizeof(u8)>;
static_assert(IsAlignedNPointer<_T, sizeof(u8)>);
template<typename T>
concept Aligned16Pointer = AlignedNPointer<T, sizeof(u16)> && Aligned8Pointer<T>;
template<typename T>
concept Aligned32Pointer = AlignedNPointer<T, sizeof(u32)> && Aligned16Pointer<T>;
template<typename T>
concept Aligned64Pointer = AlignedNPointer<T, sizeof(u64)> && Aligned32Pointer<T>;
template<typename _T>
class KUserPointerImplTraits;
template<typename _T> requires Aligned8Pointer<_T>
class KUserPointerImplTraits<_T> {
public: public:
using T = typename std::remove_const<typename std::remove_pointer<_T>::type>::type; using T = typename std::remove_const<typename std::remove_pointer<_T>::type>::type;
public: public:
@ -77,9 +65,8 @@ namespace ams::kern::svc {
} }
}; };
template<typename _T> /* requires Aligned32Pointer<_T> */ template<typename _T> requires Aligned32Pointer<_T>
class KUserPointerImplTraits<_T, typename std::enable_if<IsAlignedNPointer<_T, sizeof(u32)> && !IsAlignedNPointer<_T, sizeof(u64)>>::type> { class KUserPointerImplTraits<_T> {
static_assert(IsAlignedNPointer<_T, sizeof(u32)>);
public: public:
using T = typename std::remove_const<typename std::remove_pointer<_T>::type>::type; using T = typename std::remove_const<typename std::remove_pointer<_T>::type>::type;
public: public:
@ -94,9 +81,8 @@ namespace ams::kern::svc {
} }
}; };
template<typename _T> /* requires Aligned64Pointer<_T> */ template<typename _T> requires Aligned64Pointer<_T>
class KUserPointerImplTraits<_T, typename std::enable_if<IsAlignedNPointer<_T, sizeof(u64)>>::type> { class KUserPointerImplTraits<_T> {
static_assert(IsAlignedNPointer<_T, sizeof(u64)>);
public: public:
using T = typename std::remove_const<typename std::remove_pointer<_T>::type>::type; using T = typename std::remove_const<typename std::remove_pointer<_T>::type>::type;
public: public:
@ -111,8 +97,11 @@ namespace ams::kern::svc {
} }
}; };
template<typename _T> /* requires Aligned8Pointer<_T> */ template<typename _T>
class KUserPointerImpl : impl::KUserPointerTag { class KUserPointerImpl;
template<typename _T> requires Aligned8Pointer<_T>
class KUserPointerImpl<_T> : impl::KUserPointerTag {
private: private:
using Traits = KUserPointerImplTraits<_T>; using Traits = KUserPointerImplTraits<_T>;
protected: protected:
@ -170,11 +159,11 @@ namespace ams::kern::svc {
} }
template<typename T, typename = void> template<typename T>
class KUserPointer; struct KUserPointer;
template<typename T> /* requires impl::ConstPointer<T> */ template<typename T> requires impl::ConstPointer<T>
struct KUserPointer<T, typename std::enable_if<impl::IsConstPointer<T>>::type> : public impl::KUserPointerImpl<T> { struct KUserPointer<T> : public impl::KUserPointerImpl<T> {
public: public:
static constexpr bool IsInput = true; static constexpr bool IsInput = true;
public: public:
@ -186,8 +175,8 @@ namespace ams::kern::svc {
using impl::KUserPointerImpl<T>::GetUnsafePointer; using impl::KUserPointerImpl<T>::GetUnsafePointer;
}; };
template<typename T> /* requires impl::NonConstPointer<T> */ template<typename T> requires impl::NonConstPointer<T>
struct KUserPointer<T, typename std::enable_if<impl::IsNonConstPointer<T>>::type> : public impl::KUserPointerImpl<T> { struct KUserPointer<T> : public impl::KUserPointerImpl<T> {
public: public:
static constexpr bool IsInput = false; static constexpr bool IsInput = false;
public: public:

View file

@ -22,19 +22,19 @@ namespace ams::kern {
constexpr uintptr_t Invalid = std::numeric_limits<uintptr_t>::max(); constexpr uintptr_t Invalid = std::numeric_limits<uintptr_t>::max();
constexpr KAddressSpaceInfo AddressSpaceInfos[] = { constexpr KAddressSpaceInfo AddressSpaceInfos[] = {
{ .bit_width = 32, .address = 2_MB, .size = 1_GB - 2_MB, KAddressSpaceInfo::Type_32Bit, }, { .bit_width = 32, .address = 2_MB, .size = 1_GB - 2_MB, .type = KAddressSpaceInfo::Type_32Bit, },
{ .bit_width = 32, .address = 1_GB, .size = 4_GB - 1_GB, KAddressSpaceInfo::Type_Small64Bit, }, { .bit_width = 32, .address = 1_GB, .size = 4_GB - 1_GB, .type = KAddressSpaceInfo::Type_Small64Bit, },
{ .bit_width = 32, .address = Invalid, .size = 1_GB, KAddressSpaceInfo::Type_Heap, }, { .bit_width = 32, .address = Invalid, .size = 1_GB, .type = KAddressSpaceInfo::Type_Heap, },
{ .bit_width = 32, .address = Invalid, .size = 1_GB, KAddressSpaceInfo::Type_Alias, }, { .bit_width = 32, .address = Invalid, .size = 1_GB, .type = KAddressSpaceInfo::Type_Alias, },
{ .bit_width = 36, .address = 128_MB, .size = 2_GB - 128_MB, KAddressSpaceInfo::Type_32Bit, }, { .bit_width = 36, .address = 128_MB, .size = 2_GB - 128_MB, .type = KAddressSpaceInfo::Type_32Bit, },
{ .bit_width = 36, .address = 2_GB, .size = 64_GB - 2_GB, KAddressSpaceInfo::Type_Small64Bit, }, { .bit_width = 36, .address = 2_GB, .size = 64_GB - 2_GB, .type = KAddressSpaceInfo::Type_Small64Bit, },
{ .bit_width = 36, .address = Invalid, .size = 6_GB, KAddressSpaceInfo::Type_Heap, }, { .bit_width = 36, .address = Invalid, .size = 6_GB, .type = KAddressSpaceInfo::Type_Heap, },
{ .bit_width = 36, .address = Invalid, .size = 6_GB, KAddressSpaceInfo::Type_Alias, }, { .bit_width = 36, .address = Invalid, .size = 6_GB, .type = KAddressSpaceInfo::Type_Alias, },
{ .bit_width = 39, .address = 128_MB, .size = 512_GB - 128_MB, KAddressSpaceInfo::Type_Large64Bit, }, { .bit_width = 39, .address = 128_MB, .size = 512_GB - 128_MB, .type = KAddressSpaceInfo::Type_Large64Bit, },
{ .bit_width = 39, .address = Invalid, .size = 64_GB, KAddressSpaceInfo::Type_32Bit, }, { .bit_width = 39, .address = Invalid, .size = 64_GB, .type = KAddressSpaceInfo::Type_32Bit, },
{ .bit_width = 39, .address = Invalid, .size = 6_GB, KAddressSpaceInfo::Type_Heap, }, { .bit_width = 39, .address = Invalid, .size = 6_GB, .type = KAddressSpaceInfo::Type_Heap, },
{ .bit_width = 39, .address = Invalid, .size = 64_GB, KAddressSpaceInfo::Type_Alias, }, { .bit_width = 39, .address = Invalid, .size = 64_GB, .type = KAddressSpaceInfo::Type_Alias, },
{ .bit_width = 39, .address = Invalid, .size = 2_GB, KAddressSpaceInfo::Type_Stack, }, { .bit_width = 39, .address = Invalid, .size = 2_GB, .type = KAddressSpaceInfo::Type_Stack, },
}; };
constexpr bool IsAllowedIndexForAddress(size_t index) { constexpr bool IsAllowedIndexForAddress(size_t index) {

View file

@ -19,9 +19,8 @@ namespace ams::kern {
namespace { namespace {
/* TODO: C++20 constinit */ constinit KLightLock g_object_list_lock;
KLightLock g_object_list_lock; constinit KObjectName::List g_object_list;
KObjectName::List g_object_list;
} }

View file

@ -15,6 +15,8 @@ include $(DEVKITPRO)/libnx/switch_rules
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
# options for code generation # options for code generation
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
PRECOMPILED_HEADERS := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))/include/stratosphere.hpp
DEFINES := $(ATMOSPHERE_DEFINES) -DATMOSPHERE_IS_STRATOSPHERE -D_GNU_SOURCE DEFINES := $(ATMOSPHERE_DEFINES) -DATMOSPHERE_IS_STRATOSPHERE -D_GNU_SOURCE
SETTINGS := $(ATMOSPHERE_SETTINGS) -O2 SETTINGS := $(ATMOSPHERE_SETTINGS) -O2
CFLAGS := $(ATMOSPHERE_CFLAGS) $(SETTINGS) $(DEFINES) $(INCLUDE) CFLAGS := $(ATMOSPHERE_CFLAGS) $(SETTINGS) $(DEFINES) $(INCLUDE)
@ -40,7 +42,7 @@ LIBDIRS := $(PORTLIBS) $(LIBNX) $(ATMOSPHERE_LIBRARIES_DIR)/libvapours
ifneq ($(BUILD),$(notdir $(CURDIR))) ifneq ($(BUILD),$(notdir $(CURDIR)))
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \ export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) $(CURDIR)/include \
$(foreach dir,$(DATA),$(CURDIR)/$(dir)) $(foreach dir,$(DATA),$(CURDIR)/$(dir))
CFILES := $(foreach dir,$(SOURCES),$(filter-out $(notdir $(wildcard $(dir)/*.arch.*.c)) $(notdir $(wildcard $(dir)/*.board.*.c)) $(notdir $(wildcard $(dir)/*.os.*.c)), \ CFILES := $(foreach dir,$(SOURCES),$(filter-out $(notdir $(wildcard $(dir)/*.arch.*.c)) $(notdir $(wildcard $(dir)/*.board.*.c)) $(notdir $(wildcard $(dir)/*.os.*.c)), \
@ -77,6 +79,7 @@ endif
export OFILES_BIN := $(addsuffix .o,$(BINFILES)) export OFILES_BIN := $(addsuffix .o,$(BINFILES))
export OFILES_SRC := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o) export OFILES_SRC := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
export GCH_FILES := $(foreach hdr,$(PRECOMPILED_HEADERS:.hpp=.gch),$(notdir $(hdr)))
export OFILES := $(OFILES_BIN) $(OFILES_SRC) export OFILES := $(OFILES_BIN) $(OFILES_SRC)
export HFILES_BIN := $(addsuffix .h,$(subst .,_,$(BINFILES))) export HFILES_BIN := $(addsuffix .h,$(subst .,_,$(BINFILES)))
@ -125,6 +128,8 @@ DEPENDS := $(OFILES:.o=.d)
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
$(OUTPUT) : $(OFILES) $(OUTPUT) : $(OFILES)
$(OFILES) : $(GCH_FILES)
$(OFILES_SRC) : $(HFILES_BIN) $(OFILES_SRC) : $(HFILES_BIN)
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------

View file

@ -104,7 +104,7 @@ namespace ams {
}; };
static_assert(sizeof(FatalErrorContext) == 0x450, "sizeof(FatalErrorContext)"); static_assert(sizeof(FatalErrorContext) == 0x450, "sizeof(FatalErrorContext)");
static_assert(std::is_pod<FatalErrorContext>::value, "FatalErrorContext"); static_assert(util::is_pod<FatalErrorContext>::value, "FatalErrorContext");
#ifdef ATMOSPHERE_GIT_BRANCH #ifdef ATMOSPHERE_GIT_BRANCH
NX_CONSTEXPR const char *GetGitBranch() { NX_CONSTEXPR const char *GetGitBranch() {

View file

@ -41,6 +41,6 @@ namespace ams::capsrv {
}; };
static_assert(sizeof(ScreenShotDecodeOption) == 0x20); static_assert(sizeof(ScreenShotDecodeOption) == 0x20);
static_assert(sizeof(ScreenShotDecodeOption) == sizeof(::CapsScreenShotDecodeOption)); static_assert(sizeof(ScreenShotDecodeOption) == sizeof(::CapsScreenShotDecodeOption));
static_assert(std::is_pod<ScreenShotDecodeOption>::value); static_assert(util::is_pod<ScreenShotDecodeOption>::value);
} }

View file

@ -49,7 +49,7 @@ namespace ams::cfg {
}; };
static_assert(sizeof(OverrideStatus) == 0x10, "sizeof(OverrideStatus)"); static_assert(sizeof(OverrideStatus) == 0x10, "sizeof(OverrideStatus)");
static_assert(std::is_pod<OverrideStatus>::value, "std::is_pod<OverrideStatus>::value"); static_assert(util::is_pod<OverrideStatus>::value, "util::is_pod<OverrideStatus>::value");
constexpr inline bool operator==(const OverrideStatus &lhs, const OverrideStatus &rhs) { constexpr inline bool operator==(const OverrideStatus &lhs, const OverrideStatus &rhs) {
return std::memcmp(&lhs, &rhs, sizeof(lhs)) == 0; return std::memcmp(&lhs, &rhs, sizeof(lhs)) == 0;

View file

@ -36,7 +36,7 @@ namespace ams::dmnt::cheat {
u8 main_nso_build_id[0x20]; u8 main_nso_build_id[0x20];
}; };
static_assert(std::is_pod<CheatProcessMetadata>::value && sizeof(CheatProcessMetadata) == 0x70, "CheatProcessMetadata definition!"); static_assert(util::is_pod<CheatProcessMetadata>::value && sizeof(CheatProcessMetadata) == 0x70, "CheatProcessMetadata definition!");
struct CheatDefinition : sf::LargeData, sf::PrefersMapAliasTransferMode { struct CheatDefinition : sf::LargeData, sf::PrefersMapAliasTransferMode {
char readable_name[0x40]; char readable_name[0x40];
@ -50,8 +50,8 @@ namespace ams::dmnt::cheat {
CheatDefinition definition; CheatDefinition definition;
}; };
static_assert(std::is_pod<CheatDefinition>::value, "CheatDefinition"); static_assert(util::is_pod<CheatDefinition>::value, "CheatDefinition");
static_assert(std::is_pod<CheatEntry>::value, "CheatEntry"); static_assert(util::is_pod<CheatEntry>::value, "CheatEntry");
struct FrozenAddressValue { struct FrozenAddressValue {
u64 value; u64 value;

View file

@ -108,7 +108,7 @@ namespace ams::erpt {
}; };
using ReportFlagSet = util::BitFlagSet<BITSIZEOF(u32), ReportFlag>; using ReportFlagSet = util::BitFlagSet<BITSIZEOF(u32), ReportFlag>;
static_assert(std::is_pod<ReportFlagSet>::value); static_assert(util::is_pod<ReportFlagSet>::value);
static_assert(sizeof(ReportFlagSet) == sizeof(u32)); static_assert(sizeof(ReportFlagSet) == sizeof(u32));
struct ReportInfo { struct ReportInfo {
@ -149,7 +149,7 @@ namespace ams::erpt {
}; };
using AttachmentFlagSet = util::BitFlagSet<BITSIZEOF(u32), AttachmentFlag>; using AttachmentFlagSet = util::BitFlagSet<BITSIZEOF(u32), AttachmentFlag>;
static_assert(std::is_pod<AttachmentFlagSet>::value); static_assert(util::is_pod<AttachmentFlagSet>::value);
static_assert(sizeof(AttachmentFlagSet) == sizeof(u32)); static_assert(sizeof(AttachmentFlagSet) == sizeof(u32));
constexpr inline u32 AttachmentNameSizeMax = 0x20; constexpr inline u32 AttachmentNameSizeMax = 0x20;

View file

@ -75,44 +75,44 @@ namespace ams::fatal {
static constexpr size_t MaxStackTraceDepth = 0x20; static constexpr size_t MaxStackTraceDepth = 0x20;
static constexpr const char *RegisterNameStrings[RegisterName_Count] = { static constexpr const char *RegisterNameStrings[RegisterName_Count] = {
u8"X0", "X0",
u8"X1", "X1",
u8"X2", "X2",
u8"X3", "X3",
u8"X4", "X4",
u8"X5", "X5",
u8"X6", "X6",
u8"X7", "X7",
u8"X8", "X8",
u8"X9", "X9",
u8"X10", "X10",
u8"X11", "X11",
u8"X12", "X12",
u8"X13", "X13",
u8"X14", "X14",
u8"X15", "X15",
u8"X16", "X16",
u8"X17", "X17",
u8"X18", "X18",
u8"X19", "X19",
u8"X20", "X20",
u8"X21", "X21",
u8"X22", "X22",
u8"X23", "X23",
u8"X24", "X24",
u8"X25", "X25",
u8"X26", "X26",
u8"X27", "X27",
u8"X28", "X28",
u8"FP", "FP",
u8"LR", "LR",
u8"SP", "SP",
u8"PC", "PC",
u8"PState", "PState",
u8"Afsr0", "Afsr0",
u8"Afsr1", "Afsr1",
u8"Esr", "Esr",
u8"Far", "Far",
}; };
/* Registers, exception context. N left names for these fields in fatal .rodata. */ /* Registers, exception context. N left names for these fields in fatal .rodata. */
@ -209,27 +209,27 @@ namespace ams::fatal {
static constexpr size_t MaxStackTraceDepth = 0x20; static constexpr size_t MaxStackTraceDepth = 0x20;
static constexpr const char *RegisterNameStrings[RegisterName_Count] = { static constexpr const char *RegisterNameStrings[RegisterName_Count] = {
u8"R0", "R0",
u8"R1", "R1",
u8"R2", "R2",
u8"R3", "R3",
u8"R4", "R4",
u8"R5", "R5",
u8"R6", "R6",
u8"R7", "R7",
u8"R8", "R8",
u8"R9", "R9",
u8"R10", "R10",
u8"FP", "FP",
u8"IP", "IP",
u8"LR", "LR",
u8"SP", "SP",
u8"PC", "PC",
u8"PState", "PState",
u8"Afsr0", "Afsr0",
u8"Afsr1", "Afsr1",
u8"Esr", "Esr",
u8"Far", "Far",
}; };
/* Registers, exception context. N left names for these fields in fatal .rodata. */ /* Registers, exception context. N left names for these fields in fatal .rodata. */
@ -311,9 +311,9 @@ namespace ams::fatal {
} }
}; };
static_assert(std::is_pod<aarch64::CpuContext>::value && sizeof(aarch64::CpuContext) == 0x248, "aarch64::CpuContext definition!"); static_assert(util::is_pod<aarch64::CpuContext>::value && sizeof(aarch64::CpuContext) == 0x248, "aarch64::CpuContext definition!");
static_assert(std::is_pod<aarch32::CpuContext>::value && sizeof(aarch32::CpuContext) == 0xE0, "aarch32::CpuContext definition!"); static_assert(util::is_pod<aarch32::CpuContext>::value && sizeof(aarch32::CpuContext) == 0xE0, "aarch32::CpuContext definition!");
static_assert(std::is_pod<CpuContext>::value && sizeof(CpuContext) == 0x250, "CpuContext definition!"); static_assert(util::is_pod<CpuContext>::value && sizeof(CpuContext) == 0x250, "CpuContext definition!");
namespace srv { namespace srv {

View file

@ -43,6 +43,6 @@ namespace ams::fs {
return this->Get(); return this->Get();
} }
}; };
static_assert(std::is_pod<Int64>::value); static_assert(util::is_pod<Int64>::value);
} }

View file

@ -28,7 +28,7 @@ namespace ams::fs {
Position next_dir; Position next_dir;
Position next_file; Position next_file;
}; };
static_assert(std::is_pod<FindPosition>::value); static_assert(util::is_pod<FindPosition>::value);
using DirectoryInfo = RomDirectoryInfo; using DirectoryInfo = RomDirectoryInfo;
using FileInfo = RomFileInfo; using FileInfo = RomFileInfo;
@ -56,13 +56,13 @@ namespace ams::fs {
Position dir; Position dir;
Position file; Position file;
}; };
static_assert(std::is_pod<RomDirectoryEntry>::value); static_assert(util::is_pod<RomDirectoryEntry>::value);
struct RomFileEntry { struct RomFileEntry {
Position next; Position next;
FileInfo info; FileInfo info;
}; };
static_assert(std::is_pod<RomFileEntry>::value); static_assert(util::is_pod<RomFileEntry>::value);
static constexpr inline u32 MaxKeyLength = RomPathTool::MaxPathLength; static constexpr inline u32 MaxKeyLength = RomPathTool::MaxPathLength;
@ -109,7 +109,7 @@ namespace ams::fs {
return RomPathTool::IsEqualPath(reinterpret_cast<const RomPathChar *>(aux_lhs), reinterpret_cast<const RomPathChar *>(aux_rhs), aux_lhs_size / sizeof(RomPathChar)); return RomPathTool::IsEqualPath(reinterpret_cast<const RomPathChar *>(aux_lhs), reinterpret_cast<const RomPathChar *>(aux_rhs), aux_lhs_size / sizeof(RomPathChar));
} }
}; };
static_assert(std::is_pod<RomEntryKey>::value); static_assert(util::is_pod<RomEntryKey>::value);
struct EntryKey { struct EntryKey {
RomEntryKey key; RomEntryKey key;
@ -126,7 +126,7 @@ namespace ams::fs {
return hash; return hash;
} }
}; };
static_assert(std::is_pod<EntryKey>::value); static_assert(util::is_pod<EntryKey>::value);
using DirectoryEntryMapTable = EntryMapTable<RomEntryKey, EntryKey, RomDirectoryEntry>; using DirectoryEntryMapTable = EntryMapTable<RomEntryKey, EntryKey, RomDirectoryEntry>;
using FileEntryMapTable = EntryMapTable<RomEntryKey, EntryKey, RomFileEntry>; using FileEntryMapTable = EntryMapTable<RomEntryKey, EntryKey, RomFileEntry>;

View file

@ -31,7 +31,7 @@ namespace ams::fs {
BucketIndex ind; BucketIndex ind;
Position pos; Position pos;
}; };
static_assert(std::is_pod<FindIndex>::value); static_assert(util::is_pod<FindIndex>::value);
private: private:
static constexpr inline Position InvalidPosition = ~Position(); static constexpr inline Position InvalidPosition = ~Position();
@ -41,7 +41,7 @@ namespace ams::fs {
Position next; Position next;
u32 size; u32 size;
}; };
static_assert(std::is_pod<Element>::value); static_assert(util::is_pod<Element>::value);
private: private:
s64 bucket_count; s64 bucket_count;
SubStorage bucket_storage; SubStorage bucket_storage;

View file

@ -26,7 +26,7 @@ namespace ams::fs {
size_t length; size_t length;
const RomPathChar *path; const RomPathChar *path;
}; };
static_assert(std::is_pod<RomEntryName>::value); static_assert(util::is_pod<RomEntryName>::value);
constexpr void InitializeRomEntryName(RomEntryName *entry) { constexpr void InitializeRomEntryName(RomEntryName *entry) {
AMS_ABORT_UNLESS(entry != nullptr); AMS_ABORT_UNLESS(entry != nullptr);

View file

@ -34,19 +34,19 @@ namespace ams::fs {
s64 file_entry_size; s64 file_entry_size;
s64 body_offset; s64 body_offset;
}; };
static_assert(std::is_pod<RomFileSystemInformation>::value); static_assert(util::is_pod<RomFileSystemInformation>::value);
static_assert(sizeof(RomFileSystemInformation) == 0x50); static_assert(sizeof(RomFileSystemInformation) == 0x50);
struct RomDirectoryInfo { struct RomDirectoryInfo {
/* ... */ /* ... */
}; };
static_assert(std::is_pod<RomDirectoryInfo>::value); static_assert(util::is_pod<RomDirectoryInfo>::value);
struct RomFileInfo { struct RomFileInfo {
Int64 offset; Int64 offset;
Int64 size; Int64 size;
}; };
static_assert(std::is_pod<RomFileInfo>::value); static_assert(util::is_pod<RomFileInfo>::value);
namespace RomStringTraits { namespace RomStringTraits {

View file

@ -34,7 +34,7 @@ namespace ams::fs {
return !(lhs == rhs); return !(lhs == rhs);
} }
static_assert(std::is_pod<ReadOption>::value && sizeof(ReadOption) == sizeof(u32)); static_assert(util::is_pod<ReadOption>::value && sizeof(ReadOption) == sizeof(u32));
struct WriteOption { struct WriteOption {
u32 value; u32 value;
@ -58,7 +58,7 @@ namespace ams::fs {
return !(lhs == rhs); return !(lhs == rhs);
} }
static_assert(std::is_pod<WriteOption>::value && sizeof(WriteOption) == sizeof(u32)); static_assert(util::is_pod<WriteOption>::value && sizeof(WriteOption) == sizeof(u32));
struct FileHandle { struct FileHandle {
void *handle; void *handle;

View file

@ -42,7 +42,7 @@ namespace ams::fs {
template<typename T> template<typename T>
std::unique_ptr<T, Deleter> MakeUnique() { std::unique_ptr<T, Deleter> MakeUnique() {
static_assert(std::is_pod<T>::value); static_assert(util::is_pod<T>::value);
return std::unique_ptr<T, Deleter>(static_cast<T *>(::ams::fs::impl::Allocate(sizeof(T))), Deleter(sizeof(T))); return std::unique_ptr<T, Deleter>(static_cast<T *>(::ams::fs::impl::Allocate(sizeof(T))), Deleter(sizeof(T)));
} }

View file

@ -36,7 +36,7 @@ namespace ams::fs {
} }
}; };
static_assert(std::is_pod<QueryRangeInfo>::value); static_assert(util::is_pod<QueryRangeInfo>::value);
static_assert(sizeof(QueryRangeInfo) == 0x40); static_assert(sizeof(QueryRangeInfo) == 0x40);
static_assert(sizeof(QueryRangeInfo) == sizeof(::FsRangeInfo)); static_assert(sizeof(QueryRangeInfo) == sizeof(::FsRangeInfo));

View file

@ -23,7 +23,7 @@ namespace ams::fs {
u64 data64[2]; u64 data64[2];
}; };
static_assert(sizeof(RightsId) == 0x10); static_assert(sizeof(RightsId) == 0x10);
static_assert(std::is_pod<RightsId>::value); static_assert(util::is_pod<RightsId>::value);
inline bool operator==(const RightsId &lhs, const RightsId &rhs) { inline bool operator==(const RightsId &lhs, const RightsId &rhs) {
return std::memcmp(std::addressof(lhs), std::addressof(rhs), sizeof(RightsId)) == 0; return std::memcmp(std::addressof(lhs), std::addressof(rhs), sizeof(RightsId)) == 0;

View file

@ -51,7 +51,7 @@ namespace ams::fs {
struct UserId { struct UserId {
u64 data[2]; u64 data[2];
}; };
static_assert(std::is_pod<UserId>::value); static_assert(util::is_pod<UserId>::value);
constexpr inline bool operator<(const UserId &lhs, const UserId &rhs) { constexpr inline bool operator<(const UserId &lhs, const UserId &rhs) {
if (lhs.data[0] < rhs.data[0]) { if (lhs.data[0] < rhs.data[0]) {
@ -92,7 +92,7 @@ namespace ams::fs {
bool pseudo; bool pseudo;
u8 reserved[0x1A]; u8 reserved[0x1A];
}; };
static_assert(std::is_pod<SaveDataCreationInfo>::value); static_assert(util::is_pod<SaveDataCreationInfo>::value);
static_assert(sizeof(SaveDataCreationInfo) == 0x40); static_assert(sizeof(SaveDataCreationInfo) == 0x40);
struct SaveDataAttribute { struct SaveDataAttribute {
@ -154,6 +154,6 @@ namespace ams::fs {
u8 unused[0x190]; u8 unused[0x190];
}; };
static_assert(sizeof(SaveDataExtraData) == 0x200); static_assert(sizeof(SaveDataExtraData) == 0x200);
static_assert(std::is_pod<SaveDataExtraData>::value); static_assert(util::is_pod<SaveDataExtraData>::value);
} }

View file

@ -43,7 +43,7 @@ namespace ams::fssrv::sf {
} }
}; };
static_assert(std::is_pod<Path>::value && sizeof(Path) == FS_MAX_PATH); static_assert(util::is_pod<Path>::value && sizeof(Path) == FS_MAX_PATH);
using FspPath = Path; using FspPath = Path;

View file

@ -30,7 +30,7 @@ namespace ams::fssystem {
class PageList; class PageList;
struct PageEntry { PageEntry *next; }; struct PageEntry { PageEntry *next; };
static_assert(std::is_pod<PageEntry>::value); static_assert(util::is_pod<PageEntry>::value);
static_assert(sizeof(PageEntry) <= BlockSizeMin); static_assert(sizeof(PageEntry) <= BlockSizeMin);
class PageList : public ::ams::fs::impl::Newable { class PageList : public ::ams::fs::impl::Newable {

View file

@ -35,7 +35,7 @@ namespace ams::fssystem {
Position next_dir; Position next_dir;
Position next_file; Position next_file;
}; };
static_assert(std::is_pod<FindPosition>::value); static_assert(util::is_pod<FindPosition>::value);
using DirectoryInfo = RomDirectoryInfo; using DirectoryInfo = RomDirectoryInfo;
using FileInfo = RomFileInfo; using FileInfo = RomFileInfo;
@ -63,13 +63,13 @@ namespace ams::fssystem {
Position dir; Position dir;
Position file; Position file;
}; };
static_assert(std::is_pod<RomDirectoryEntry>::value); static_assert(util::is_pod<RomDirectoryEntry>::value);
struct RomFileEntry { struct RomFileEntry {
Position next; Position next;
FileInfo info; FileInfo info;
}; };
static_assert(std::is_pod<RomFileEntry>::value); static_assert(util::is_pod<RomFileEntry>::value);
static constexpr inline u32 MaxKeyLength = RomPathTool::MaxPathLength; static constexpr inline u32 MaxKeyLength = RomPathTool::MaxPathLength;
@ -115,7 +115,7 @@ namespace ams::fssystem {
return RomPathTool::IsEqualPath(reinterpret_cast<const RomPathChar *>(aux_lhs), reinterpret_cast<const RomPathChar *>(aux_rhs), aux_lhs_size / sizeof(RomPathChar)); return RomPathTool::IsEqualPath(reinterpret_cast<const RomPathChar *>(aux_lhs), reinterpret_cast<const RomPathChar *>(aux_rhs), aux_lhs_size / sizeof(RomPathChar));
} }
}; };
static_assert(std::is_pod<RomEntryKey>::value); static_assert(util::is_pod<RomEntryKey>::value);
struct EntryKey { struct EntryKey {
RomEntryKey key; RomEntryKey key;
@ -132,7 +132,7 @@ namespace ams::fssystem {
return hash; return hash;
} }
}; };
static_assert(std::is_pod<EntryKey>::value); static_assert(util::is_pod<EntryKey>::value);
using DirectoryEntryMapTable = EntryMapTable<DirectoryBucketStorage, DirectoryEntryStorage, RomEntryKey, EntryKey, RomDirectoryEntry>; using DirectoryEntryMapTable = EntryMapTable<DirectoryBucketStorage, DirectoryEntryStorage, RomEntryKey, EntryKey, RomDirectoryEntry>;
using FileEntryMapTable = EntryMapTable<FileBucketStorage, FileEntryStorage, RomEntryKey, EntryKey, RomFileEntry>; using FileEntryMapTable = EntryMapTable<FileBucketStorage, FileEntryStorage, RomEntryKey, EntryKey, RomFileEntry>;

View file

@ -37,7 +37,7 @@ namespace ams::fssystem {
BucketIndex ind; BucketIndex ind;
Position pos; Position pos;
}; };
static_assert(std::is_pod<FindIndex>::value); static_assert(util::is_pod<FindIndex>::value);
private: private:
static constexpr inline Position InvalidPosition = ~Position(); static constexpr inline Position InvalidPosition = ~Position();
@ -47,7 +47,7 @@ namespace ams::fssystem {
Position next; Position next;
u32 size; u32 size;
}; };
static_assert(std::is_pod<Element>::value); static_assert(util::is_pod<Element>::value);
private: private:
s64 bucket_offset; s64 bucket_offset;
u32 bucket_count; u32 bucket_count;

View file

@ -26,7 +26,7 @@ namespace ams::fssystem {
size_t length; size_t length;
const RomPathChar *path; const RomPathChar *path;
}; };
static_assert(std::is_pod<RomEntryName>::value); static_assert(util::is_pod<RomEntryName>::value);
constexpr void InitializeRomEntryName(RomEntryName *entry) { constexpr void InitializeRomEntryName(RomEntryName *entry) {
entry->length = 0; entry->length = 0;

View file

@ -34,19 +34,19 @@ namespace ams::fssystem {
s64 file_entry_size; s64 file_entry_size;
s64 body_offset; s64 body_offset;
}; };
static_assert(std::is_pod<RomFileSystemInformation>::value); static_assert(util::is_pod<RomFileSystemInformation>::value);
static_assert(sizeof(RomFileSystemInformation) == 0x50); static_assert(sizeof(RomFileSystemInformation) == 0x50);
struct RomDirectoryInfo { struct RomDirectoryInfo {
/* ... */ /* ... */
}; };
static_assert(std::is_pod<RomDirectoryInfo>::value); static_assert(util::is_pod<RomDirectoryInfo>::value);
struct RomFileInfo { struct RomFileInfo {
fs::Int64 offset; fs::Int64 offset;
fs::Int64 size; fs::Int64 size;
}; };
static_assert(std::is_pod<RomFileInfo>::value); static_assert(util::is_pod<RomFileInfo>::value);
namespace RomStringTraits { namespace RomStringTraits {

View file

@ -29,7 +29,7 @@ namespace ams::fssystem {
u32 name_offset; u32 name_offset;
u32 reserved; u32 reserved;
}; };
static_assert(std::is_pod<PartitionEntry>::value); static_assert(util::is_pod<PartitionEntry>::value);
#pragma pack(pop) #pragma pack(pop)
static constexpr const char VersionSignature[] = { 'P', 'F', 'S', '0' }; static constexpr const char VersionSignature[] = { 'P', 'F', 'S', '0' };
@ -52,7 +52,7 @@ namespace ams::fssystem {
u64 hash_target_offset; u64 hash_target_offset;
char hash[HashSize]; char hash[HashSize];
}; };
static_assert(std::is_pod<PartitionEntry>::value); static_assert(util::is_pod<PartitionEntry>::value);
#pragma pack(pop) #pragma pack(pop)
static constexpr const char VersionSignature[] = { 'H', 'F', 'S', '0' }; static constexpr const char VersionSignature[] = { 'H', 'F', 'S', '0' };

View file

@ -186,7 +186,7 @@ namespace ams::kvdb {
template<class Key, size_t Capacity> template<class Key, size_t Capacity>
class FileKeyValueCache { class FileKeyValueCache {
static_assert(std::is_pod<Key>::value, "FileKeyValueCache Key must be pod!"); static_assert(util::is_pod<Key>::value, "FileKeyValueCache Key must be pod!");
static_assert(sizeof(Key) <= FileKeyValueStore::MaxKeySize, "FileKeyValueCache Key is too big!"); static_assert(sizeof(Key) <= FileKeyValueStore::MaxKeySize, "FileKeyValueCache Key is too big!");
public: public:
using LeastRecentlyUsedList = impl::LruList<Key, Capacity>; using LeastRecentlyUsedList = impl::LruList<Key, Capacity>;

View file

@ -38,7 +38,7 @@ namespace ams::kvdb {
size_t key_size; size_t key_size;
size_t value_size; size_t value_size;
}; };
static_assert(std::is_pod<Entry>::value, "FileKeyValueStore::Entry definition!"); static_assert(util::is_pod<Entry>::value, "FileKeyValueStore::Entry definition!");
class Cache { class Cache {
private: private:
@ -83,13 +83,13 @@ namespace ams::kvdb {
/* Niceties. */ /* Niceties. */
template<typename Key> template<typename Key>
Result Get(size_t *out_size, void *out_value, size_t max_out_size, const Key &key) { Result Get(size_t *out_size, void *out_value, size_t max_out_size, const Key &key) {
static_assert(std::is_pod<Key>::value && sizeof(Key) <= MaxKeySize, "Invalid FileKeyValueStore Key!"); static_assert(util::is_pod<Key>::value && sizeof(Key) <= MaxKeySize, "Invalid FileKeyValueStore Key!");
return this->Get(out_size, out_value, max_out_size, &key, sizeof(Key)); return this->Get(out_size, out_value, max_out_size, &key, sizeof(Key));
} }
template<typename Key, typename Value> template<typename Key, typename Value>
Result Get(Value *out_value, const Key &key) { Result Get(Value *out_value, const Key &key) {
static_assert(std::is_pod<Value>::value && !std::is_pointer<Value>::value, "Invalid FileKeyValueStore Value!"); static_assert(util::is_pod<Value>::value && !std::is_pointer<Value>::value, "Invalid FileKeyValueStore Value!");
size_t size = 0; size_t size = 0;
R_TRY(this->Get(&size, out_value, sizeof(Value), key)); R_TRY(this->Get(&size, out_value, sizeof(Value), key));
AMS_ABORT_UNLESS(size >= sizeof(Value)); AMS_ABORT_UNLESS(size >= sizeof(Value));
@ -103,13 +103,13 @@ namespace ams::kvdb {
template<typename Key> template<typename Key>
Result Set(const Key &key, const void *value, size_t value_size) { Result Set(const Key &key, const void *value, size_t value_size) {
static_assert(std::is_pod<Key>::value && sizeof(Key) <= MaxKeySize, "Invalid FileKeyValueStore Key!"); static_assert(util::is_pod<Key>::value && sizeof(Key) <= MaxKeySize, "Invalid FileKeyValueStore Key!");
return this->Set(&key, sizeof(Key), value, value_size); return this->Set(&key, sizeof(Key), value, value_size);
} }
template<typename Key, typename Value> template<typename Key, typename Value>
Result Set(const Key &key, const Value &value) { Result Set(const Key &key, const Value &value) {
static_assert(std::is_pod<Value>::value && !std::is_pointer<Value>::value, "Invalid FileKeyValueStore Value!"); static_assert(util::is_pod<Value>::value && !std::is_pointer<Value>::value, "Invalid FileKeyValueStore Value!");
return this->Set(key, &value, sizeof(Value)); return this->Set(key, &value, sizeof(Value));
} }

View file

@ -26,7 +26,7 @@ namespace ams::kvdb {
template<class Key> template<class Key>
class MemoryKeyValueStore { class MemoryKeyValueStore {
static_assert(std::is_pod<Key>::value, "KeyValueStore Keys must be pod!"); static_assert(util::is_pod<Key>::value, "KeyValueStore Keys must be pod!");
NON_COPYABLE(MemoryKeyValueStore); NON_COPYABLE(MemoryKeyValueStore);
NON_MOVEABLE(MemoryKeyValueStore); NON_MOVEABLE(MemoryKeyValueStore);
public: public:
@ -49,7 +49,7 @@ namespace ams::kvdb {
if constexpr (!std::is_same<Value, void>::value) { if constexpr (!std::is_same<Value, void>::value) {
AMS_ABORT_UNLESS(sizeof(Value) <= this->value_size); AMS_ABORT_UNLESS(sizeof(Value) <= this->value_size);
/* Ensure we only get pod. */ /* Ensure we only get pod. */
static_assert(std::is_pod<Value>::value, "KeyValueStore Values must be pod"); static_assert(util::is_pod<Value>::value, "KeyValueStore Values must be pod");
} }
return reinterpret_cast<Value *>(this->value); return reinterpret_cast<Value *>(this->value);
} }
@ -60,7 +60,7 @@ namespace ams::kvdb {
if constexpr (!std::is_same<Value, void>::value) { if constexpr (!std::is_same<Value, void>::value) {
AMS_ABORT_UNLESS(sizeof(Value) <= this->value_size); AMS_ABORT_UNLESS(sizeof(Value) <= this->value_size);
/* Ensure we only get pod. */ /* Ensure we only get pod. */
static_assert(std::is_pod<Value>::value, "KeyValueStore Values must be pod"); static_assert(util::is_pod<Value>::value, "KeyValueStore Values must be pod");
} }
return reinterpret_cast<Value *>(this->value); return reinterpret_cast<Value *>(this->value);
} }
@ -366,14 +366,14 @@ namespace ams::kvdb {
template<typename Value> template<typename Value>
Result Set(const Key &key, const Value &value) { Result Set(const Key &key, const Value &value) {
/* Only allow setting pod. */ /* Only allow setting pod. */
static_assert(std::is_pod<Value>::value, "KeyValueStore Values must be pod"); static_assert(util::is_pod<Value>::value, "KeyValueStore Values must be pod");
return this->Set(key, &value, sizeof(Value)); return this->Set(key, &value, sizeof(Value));
} }
template<typename Value> template<typename Value>
Result Set(const Key &key, const Value *value) { Result Set(const Key &key, const Value *value) {
/* Only allow setting pod. */ /* Only allow setting pod. */
static_assert(std::is_pod<Value>::value, "KeyValueStore Values must be pod"); static_assert(util::is_pod<Value>::value, "KeyValueStore Values must be pod");
return this->Set(key, value, sizeof(Value)); return this->Set(key, value, sizeof(Value));
} }

View file

@ -35,7 +35,7 @@ namespace ams::ldr {
u32 aci_fah_size; u32 aci_fah_size;
u8 ac_buffer[0x3E0]; u8 ac_buffer[0x3E0];
}; };
static_assert(std::is_pod<ProgramInfo>::value && sizeof(ProgramInfo) == 0x400, "ProgramInfo definition!"); static_assert(util::is_pod<ProgramInfo>::value && sizeof(ProgramInfo) == 0x400, "ProgramInfo definition!");
enum ProgramInfoFlag { enum ProgramInfoFlag {
ProgramInfoFlag_SystemModule = (0 << 0), ProgramInfoFlag_SystemModule = (0 << 0),
@ -71,7 +71,7 @@ namespace ams::ldr {
inline bool operator!=(const PinId &lhs, const PinId &rhs) { inline bool operator!=(const PinId &lhs, const PinId &rhs) {
return lhs.value != rhs.value; return lhs.value != rhs.value;
} }
static_assert(sizeof(PinId) == sizeof(u64) && std::is_pod<PinId>::value, "PinId definition!"); static_assert(sizeof(PinId) == sizeof(u64) && util::is_pod<PinId>::value, "PinId definition!");
/* Import ModuleInfo from libnx. */ /* Import ModuleInfo from libnx. */
using ModuleInfo = ::LoaderModuleInfo; using ModuleInfo = ::LoaderModuleInfo;
@ -142,7 +142,7 @@ namespace ams::ldr {
}; };
}; };
}; };
static_assert(sizeof(NsoHeader) == 0x100 && std::is_pod<NsoHeader>::value, "NsoHeader definition!"); static_assert(sizeof(NsoHeader) == 0x100 && util::is_pod<NsoHeader>::value, "NsoHeader definition!");
/* NPDM types. */ /* NPDM types. */
struct Aci { struct Aci {
@ -160,7 +160,7 @@ namespace ams::ldr {
u32 kac_size; u32 kac_size;
u8 reserved_38[0x8]; u8 reserved_38[0x8];
}; };
static_assert(sizeof(Aci) == 0x40 && std::is_pod<Aci>::value, "Aci definition!"); static_assert(sizeof(Aci) == 0x40 && util::is_pod<Aci>::value, "Aci definition!");
struct Acid { struct Acid {
static constexpr u32 Magic = util::FourCC<'A','C','I','D'>::Code; static constexpr u32 Magic = util::FourCC<'A','C','I','D'>::Code;
@ -199,7 +199,7 @@ namespace ams::ldr {
u32 kac_size; u32 kac_size;
u8 reserved_238[0x8]; u8 reserved_238[0x8];
}; };
static_assert(sizeof(Acid) == 0x240 && std::is_pod<Acid>::value, "Acid definition!"); static_assert(sizeof(Acid) == 0x240 && util::is_pod<Acid>::value, "Acid definition!");
struct Npdm { struct Npdm {
static constexpr u32 Magic = util::FourCC<'M','E','T','A'>::Code; static constexpr u32 Magic = util::FourCC<'M','E','T','A'>::Code;
@ -239,6 +239,6 @@ namespace ams::ldr {
u32 acid_offset; u32 acid_offset;
u32 acid_size; u32 acid_size;
}; };
static_assert(sizeof(Npdm) == 0x80 && std::is_pod<Npdm>::value, "Npdm definition!"); static_assert(sizeof(Npdm) == 0x80 && util::is_pod<Npdm>::value, "Npdm definition!");
} }

View file

@ -56,6 +56,6 @@ namespace ams::lr {
} }
}; };
static_assert(std::is_pod<Path>::value && sizeof(Path) == fs::EntryNameLengthMax); static_assert(util::is_pod<Path>::value && sizeof(Path) == fs::EntryNameLengthMax);
} }

View file

@ -65,6 +65,6 @@ namespace ams::mem::impl {
size_t alloc_size; size_t alloc_size;
size_t hash; size_t hash;
}; };
static_assert(std::is_pod<HeapHash>::value); static_assert(util::is_pod<HeapHash>::value);
} }

View file

@ -55,7 +55,7 @@ namespace ams::ncm {
} }
}; };
static_assert(sizeof(std::is_pod<ContentInfo>::value)); static_assert(sizeof(util::is_pod<ContentInfo>::value));
static_assert(sizeof(ContentInfo) == 0x18); static_assert(sizeof(ContentInfo) == 0x18);
} }

View file

@ -65,7 +65,7 @@ namespace ams::ncm {
u32 flags; u32 flags;
fs::SaveDataSpaceId space_id; fs::SaveDataSpaceId space_id;
}; };
static_assert(std::is_pod<SystemSaveDataInfo>::value); static_assert(util::is_pod<SystemSaveDataInfo>::value);
class ContentManagerImpl final : public IContentManager { class ContentManagerImpl final : public IContentManager {
private: private:

View file

@ -27,7 +27,7 @@ namespace ams::ncm {
return { .program_id = program_id, .storage_id = static_cast<u8>(storage_id), }; return { .program_id = program_id, .storage_id = static_cast<u8>(storage_id), };
} }
}; };
static_assert(sizeof(ProgramLocation) == 0x10 && std::is_pod<ProgramLocation>::value); static_assert(sizeof(ProgramLocation) == 0x10 && util::is_pod<ProgramLocation>::value);
static_assert(sizeof(ProgramLocation) == sizeof(::NcmProgramLocation) && alignof(ProgramLocation) == alignof(::NcmProgramLocation), "ProgramLocation Libnx Compatibility"); static_assert(sizeof(ProgramLocation) == sizeof(::NcmProgramLocation) && alignof(ProgramLocation) == alignof(::NcmProgramLocation), "ProgramLocation Libnx Compatibility");

View file

@ -25,7 +25,7 @@ namespace ams::ncm {
u8 reserved[7]; u8 reserved[7];
}; };
static_assert(sizeof(RightsId) == 0x18); static_assert(sizeof(RightsId) == 0x18);
static_assert(std::is_pod<RightsId>::value); static_assert(util::is_pod<RightsId>::value);
inline bool operator==(const RightsId &lhs, const RightsId &rhs) { inline bool operator==(const RightsId &lhs, const RightsId &rhs) {
return std::tie(lhs.id, lhs.key_generation) == std::tie(rhs.id, rhs.key_generation); return std::tie(lhs.id, lhs.key_generation) == std::tie(rhs.id, rhs.key_generation);

View file

@ -36,7 +36,7 @@ namespace ams::os {
}; };
util::BitPack32 counter; util::BitPack32 counter;
}; };
static_assert(std::is_pod<LockCount>::value); static_assert(util::is_pod<LockCount>::value);
static_assert(std::is_trivial<LockCount>::value); static_assert(std::is_trivial<LockCount>::value);
union { union {

View file

@ -52,6 +52,6 @@ namespace ams::pgl {
}; };
} }
}; };
static_assert(sizeof(ContentMetaInfo) == 0x10 && std::is_pod<ContentMetaInfo>::value); static_assert(sizeof(ContentMetaInfo) == 0x10 && util::is_pod<ContentMetaInfo>::value);
} }

View file

@ -97,6 +97,6 @@ namespace ams::pm {
u32 event; u32 event;
os::ProcessId process_id; os::ProcessId process_id;
}; };
static_assert(sizeof(ProcessEventInfo) == 0x10 && std::is_pod<ProcessEventInfo>::value, "ProcessEventInfo definition!"); static_assert(sizeof(ProcessEventInfo) == 0x10 && util::is_pod<ProcessEventInfo>::value, "ProcessEventInfo definition!");
} }

View file

@ -36,7 +36,7 @@ namespace ams::reg {
} }
inline void SetBits(volatile u32 *reg, u32 mask) { inline void SetBits(volatile u32 *reg, u32 mask) {
*reg |= mask; *reg = *reg | mask;
} }
inline void SetBits(uintptr_t reg, u32 mask) { inline void SetBits(uintptr_t reg, u32 mask) {
@ -44,7 +44,7 @@ namespace ams::reg {
} }
inline void ClearBits(volatile u32 *reg, u32 mask) { inline void ClearBits(volatile u32 *reg, u32 mask) {
*reg &= ~mask; *reg = *reg & ~mask;
} }
inline void ClearBits(uintptr_t reg, u32 mask) { inline void ClearBits(uintptr_t reg, u32 mask) {
@ -52,7 +52,7 @@ namespace ams::reg {
} }
inline void MaskBits(volatile u32 *reg, u32 mask) { inline void MaskBits(volatile u32 *reg, u32 mask) {
*reg &= mask; *reg = *reg & mask;
} }
inline void MaskBits(uintptr_t reg, u32 mask) { inline void MaskBits(uintptr_t reg, u32 mask) {

View file

@ -22,18 +22,18 @@ namespace ams::settings::factory {
u8 data[0x180]; u8 data[0x180];
}; };
static_assert(sizeof(EccP256DeviceCertificate) == 0x180); static_assert(sizeof(EccP256DeviceCertificate) == 0x180);
static_assert(std::is_pod<EccP256DeviceCertificate>::value); static_assert(util::is_pod<EccP256DeviceCertificate>::value);
struct EccB233DeviceCertificate { struct EccB233DeviceCertificate {
u8 data[0x180]; u8 data[0x180];
}; };
static_assert(sizeof(EccB233DeviceCertificate) == 0x180); static_assert(sizeof(EccB233DeviceCertificate) == 0x180);
static_assert(std::is_pod<EccB233DeviceCertificate>::value); static_assert(util::is_pod<EccB233DeviceCertificate>::value);
struct Rsa2048DeviceCertificate { struct Rsa2048DeviceCertificate {
u8 data[0x240]; u8 data[0x240];
}; };
static_assert(sizeof(Rsa2048DeviceCertificate) == 0x240); static_assert(sizeof(Rsa2048DeviceCertificate) == 0x240);
static_assert(std::is_pod<Rsa2048DeviceCertificate>::value); static_assert(util::is_pod<Rsa2048DeviceCertificate>::value);
} }

View file

@ -22,6 +22,6 @@ namespace ams::settings::factory {
char str[0x18]; char str[0x18];
}; };
static_assert(sizeof(SerialNumber) == 0x18); static_assert(sizeof(SerialNumber) == 0x18);
static_assert(std::is_pod<SerialNumber>::value); static_assert(util::is_pod<SerialNumber>::value);
} }

View file

@ -27,12 +27,12 @@ namespace ams::settings::fwdbg {
char value[util::AlignUp(SettingsNameLengthMax + 1, alignof(u64))]; char value[util::AlignUp(SettingsNameLengthMax + 1, alignof(u64))];
}; };
static_assert(std::is_pod<SettingsName>::value && sizeof(SettingsName) > SettingsNameLengthMax); static_assert(util::is_pod<SettingsName>::value && sizeof(SettingsName) > SettingsNameLengthMax);
struct SettingsItemKey : sf::LargeData { struct SettingsItemKey : sf::LargeData {
char value[util::AlignUp(SettingsItemKeyLengthMax + 1, alignof(u64))]; char value[util::AlignUp(SettingsItemKeyLengthMax + 1, alignof(u64))];
}; };
static_assert(std::is_pod<SettingsItemKey>::value && sizeof(SettingsItemKey) > SettingsItemKeyLengthMax); static_assert(util::is_pod<SettingsItemKey>::value && sizeof(SettingsItemKey) > SettingsItemKeyLengthMax);
} }

View file

@ -152,7 +152,7 @@ namespace ams::settings {
return impl::IsValidLanguageCode(lc, std::make_index_sequence<Language_Count>{}); return impl::IsValidLanguageCode(lc, std::make_index_sequence<Language_Count>{});
} }
static_assert(std::is_pod<LanguageCode>::value); static_assert(util::is_pod<LanguageCode>::value);
static_assert(sizeof(LanguageCode) == sizeof(u64)); static_assert(sizeof(LanguageCode) == sizeof(u64));
/* Not an official type, but convenient. */ /* Not an official type, but convenient. */
@ -193,7 +193,7 @@ namespace ams::settings {
} }
}; };
static_assert(std::is_pod<FirmwareVersion>::value); static_assert(util::is_pod<FirmwareVersion>::value);
static_assert(sizeof(FirmwareVersion) == sizeof(::SetSysFirmwareVersion)); static_assert(sizeof(FirmwareVersion) == sizeof(::SetSysFirmwareVersion));
constexpr inline bool operator==(const FirmwareVersion &lhs, const FirmwareVersion &rhs) { constexpr inline bool operator==(const FirmwareVersion &lhs, const FirmwareVersion &rhs) {

View file

@ -63,7 +63,7 @@ namespace ams::sf::cmif {
} }
}; };
static_assert(std::is_pod<ServerMessageRuntimeMetadata>::value, "std::is_pod<ServerMessageRuntimeMetadata>::value"); static_assert(util::is_pod<ServerMessageRuntimeMetadata>::value, "util::is_pod<ServerMessageRuntimeMetadata>::value");
static_assert(sizeof(ServerMessageRuntimeMetadata) == sizeof(u64), "sizeof(ServerMessageRuntimeMetadata)"); static_assert(sizeof(ServerMessageRuntimeMetadata) == sizeof(u64), "sizeof(ServerMessageRuntimeMetadata)");
class ServerMessageProcessor { class ServerMessageProcessor {

View file

@ -61,7 +61,7 @@ namespace ams::sf::cmif {
return this->handler; return this->handler;
} }
}; };
static_assert(std::is_pod<ServiceCommandMeta>::value && sizeof(ServiceCommandMeta) == 0x18, "sizeof(ServiceCommandMeta)"); static_assert(util::is_pod<ServiceCommandMeta>::value && sizeof(ServiceCommandMeta) == 0x18, "sizeof(ServiceCommandMeta)");
namespace impl { namespace impl {

View file

@ -77,7 +77,7 @@ namespace ams::sf {
class Out<std::shared_ptr<ServiceImpl>> : public impl::OutObjectTag { class Out<std::shared_ptr<ServiceImpl>> : public impl::OutObjectTag {
static_assert(std::is_base_of<sf::IServiceObject, ServiceImpl>::value, "Out<std::shared_ptr<ServiceImpl>> requires ServiceObject base."); static_assert(std::is_base_of<sf::IServiceObject, ServiceImpl>::value, "Out<std::shared_ptr<ServiceImpl>> requires ServiceObject base.");
template<typename, typename> template<typename>
friend class Out; friend class Out;
public: public:
@ -308,11 +308,7 @@ namespace ams::sf::impl {
/* Use insertion sort, which is stable and optimal for small numbers of parameters. */ /* Use insertion sort, which is stable and optimal for small numbers of parameters. */
for (size_t i = 1; i < sizeof...(Ts); i++) { for (size_t i = 1; i < sizeof...(Ts); i++) {
for (size_t j = i; j > 0 && values[map[j-1]] > values[map[j]]; j--) { for (size_t j = i; j > 0 && values[map[j-1]] > values[map[j]]; j--) {
/* std::swap is not constexpr until c++20 :( */ std::swap(map[j], map[j-1]);
/* TODO: std::swap(map[j], map[j-1]); */
const size_t tmp = map[j];
map[j] = map[j-1];
map[j-1] = tmp;
} }
} }
} }
@ -1042,7 +1038,7 @@ namespace ams::sf::impl {
}; };
constexpr Result GetCmifOutHeaderPointer(CmifOutHeader **out_header_ptr, cmif::PointerAndSize &out_raw_data) { constexpr Result GetCmifOutHeaderPointer(CmifOutHeader **out_header_ptr, cmif::PointerAndSize &out_raw_data) {
CmifOutHeader *header = reinterpret_cast<CmifOutHeader *>(out_raw_data.GetPointer()); CmifOutHeader *header = static_cast<CmifOutHeader *>(out_raw_data.GetPointer());
R_UNLESS(out_raw_data.GetSize() >= sizeof(*header), sf::cmif::ResultInvalidHeaderSize()); R_UNLESS(out_raw_data.GetSize() >= sizeof(*header), sf::cmif::ResultInvalidHeaderSize());
out_raw_data = cmif::PointerAndSize(out_raw_data.GetAddress() + sizeof(*header), out_raw_data.GetSize() - sizeof(*header)); out_raw_data = cmif::PointerAndSize(out_raw_data.GetAddress() + sizeof(*header), out_raw_data.GetSize() - sizeof(*header));
*out_header_ptr = header; *out_header_ptr = header;

View file

@ -33,9 +33,9 @@ namespace ams::sf {
struct IsOutForceEnabled<::ams::Result> : public std::true_type{}; struct IsOutForceEnabled<::ams::Result> : public std::true_type{};
template<typename T> template<typename T>
using IsOutEnabled = typename std::enable_if<std::is_trivial<T>::value || IsOutForceEnabled<T>::value>::type; concept OutEnabled = (std::is_trivial<T>::value || IsOutForceEnabled<T>::value) && !std::is_pointer<T>::value;
template<typename T, typename = IsOutEnabled<T>> template<typename T> requires OutEnabled<T>
class Out : public impl::OutBaseTag { class Out : public impl::OutBaseTag {
public: public:
static constexpr size_t TypeSize = sizeof(T); static constexpr size_t TypeSize = sizeof(T);

View file

@ -13,7 +13,6 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <stratosphere.hpp> #include <stratosphere.hpp>
namespace ams::emummc { namespace ams::emummc {

View file

@ -13,7 +13,6 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <stratosphere.hpp> #include <stratosphere.hpp>
#include "ams_bpc.h" #include "ams_bpc.h"
@ -182,6 +181,9 @@ extern "C" {
/* Custom abort handler, so that std::abort will trigger these. */ /* Custom abort handler, so that std::abort will trigger these. */
void abort() { void abort() {
static ams::os::Mutex abort_lock(true);
std::scoped_lock lk(abort_lock);
ams::AbortImpl(); ams::AbortImpl();
__builtin_unreachable(); __builtin_unreachable();
} }

View file

@ -13,7 +13,6 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <stratosphere.hpp> #include <stratosphere.hpp>
#include <stratosphere/spl.hpp> #include <stratosphere/spl.hpp>
#include <stratosphere/spl/smc/spl_smc.hpp> #include <stratosphere/spl/smc/spl_smc.hpp>

View file

@ -23,6 +23,6 @@ namespace ams::capsrv::server {
}; };
static_assert(sizeof(DecoderWorkMemory) == SoftwareJpegDecoderWorkMemorySize); static_assert(sizeof(DecoderWorkMemory) == SoftwareJpegDecoderWorkMemorySize);
static_assert(alignof(DecoderWorkMemory) == os::MemoryPageSize); static_assert(alignof(DecoderWorkMemory) == os::MemoryPageSize);
static_assert(std::is_pod<DecoderWorkMemory>::value); static_assert(util::is_pod<DecoderWorkMemory>::value);
} }

View file

@ -13,7 +13,6 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <stratosphere.hpp> #include <stratosphere.hpp>
namespace ams::cfg { namespace ams::cfg {

View file

@ -13,7 +13,6 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <stratosphere.hpp> #include <stratosphere.hpp>
namespace ams::cfg { namespace ams::cfg {

View file

@ -13,7 +13,6 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <stratosphere.hpp> #include <stratosphere.hpp>
namespace ams::cfg { namespace ams::cfg {

View file

@ -13,7 +13,6 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <stratosphere.hpp> #include <stratosphere.hpp>
namespace ams::cfg { namespace ams::cfg {

View file

@ -23,7 +23,7 @@ namespace ams::fs::impl {
struct FilePathHash : public Newable { struct FilePathHash : public Newable {
u8 data[FilePathHashSize]; u8 data[FilePathHashSize];
}; };
static_assert(std::is_pod<FilePathHash>::value); static_assert(util::is_pod<FilePathHash>::value);
inline bool operator==(const FilePathHash &lhs, const FilePathHash &rhs) { inline bool operator==(const FilePathHash &lhs, const FilePathHash &rhs) {
return std::memcmp(lhs.data, rhs.data, FilePathHashSize) == 0; return std::memcmp(lhs.data, rhs.data, FilePathHashSize) == 0;

View file

@ -21,6 +21,6 @@ namespace ams::fs {
struct MountName { struct MountName {
char str[MountNameLengthMax + 1]; char str[MountNameLengthMax + 1];
}; };
static_assert(std::is_pod<MountName>::value); static_assert(util::is_pod<MountName>::value);
} }

View file

@ -24,7 +24,7 @@ namespace ams::fssystem {
u32 name_table_size; u32 name_table_size;
u32 reserved; u32 reserved;
}; };
static_assert(std::is_pod<PartitionFileSystemMeta::PartitionFileSystemHeader>::value); static_assert(util::is_pod<PartitionFileSystemMeta::PartitionFileSystemHeader>::value);
static_assert(sizeof(PartitionFileSystemMeta::PartitionFileSystemHeader) == 0x10); static_assert(sizeof(PartitionFileSystemMeta::PartitionFileSystemHeader) == 0x10);
template <typename Format> template <typename Format>

View file

@ -37,7 +37,7 @@ namespace ams::fssystem {
virtual ~RomFsFile() { /* ... */ } virtual ~RomFsFile() { /* ... */ }
public: public:
virtual Result ReadImpl(size_t *out, s64 offset, void *buffer, size_t size, const fs::ReadOption &option) override { virtual Result ReadImpl(size_t *out, s64 offset, void *buffer, size_t size, const fs::ReadOption &option) override {
R_TRY(buffers::DoContinuouslyUntilBufferIsAllocated([=]() -> Result { R_TRY(buffers::DoContinuouslyUntilBufferIsAllocated([=, this]() -> Result {
size_t read_size = 0; size_t read_size = 0;
R_TRY(this->DryRead(std::addressof(read_size), offset, size, option, fs::OpenMode_Read)); R_TRY(this->DryRead(std::addressof(read_size), offset, size, option, fs::OpenMode_Read));
@ -84,7 +84,7 @@ namespace ams::fssystem {
operate_size = this->GetSize() - offset; operate_size = this->GetSize() - offset;
} }
R_TRY(buffers::DoContinuouslyUntilBufferIsAllocated([=]() -> Result { R_TRY(buffers::DoContinuouslyUntilBufferIsAllocated([=, this]() -> Result {
R_TRY(this->parent->GetBaseStorage()->OperateRange(dst, dst_size, op_id, this->start + offset, operate_size, src, src_size)); R_TRY(this->parent->GetBaseStorage()->OperateRange(dst, dst_size, op_id, this->start + offset, operate_size, src, src_size));
return ResultSuccess(); return ResultSuccess();
}, AMS_CURRENT_FUNCTION_NAME)); }, AMS_CURRENT_FUNCTION_NAME));
@ -113,7 +113,7 @@ namespace ams::fssystem {
virtual ~RomFsDirectory() override { /* ... */ } virtual ~RomFsDirectory() override { /* ... */ }
public: public:
virtual Result ReadImpl(s64 *out_count, fs::DirectoryEntry *out_entries, s64 max_entries) { virtual Result ReadImpl(s64 *out_count, fs::DirectoryEntry *out_entries, s64 max_entries) {
R_TRY(buffers::DoContinuouslyUntilBufferIsAllocated([=]() -> Result { R_TRY(buffers::DoContinuouslyUntilBufferIsAllocated([=, this]() -> Result {
return this->ReadImpl(out_count, std::addressof(this->current_find), out_entries, max_entries); return this->ReadImpl(out_count, std::addressof(this->current_find), out_entries, max_entries);
}, AMS_CURRENT_FUNCTION_NAME)); }, AMS_CURRENT_FUNCTION_NAME));
return ResultSuccess(); return ResultSuccess();
@ -278,7 +278,7 @@ namespace ams::fssystem {
} }
Result RomFsFileSystem::GetFileInfo(RomFileTable::FileInfo *out, const char *path) { Result RomFsFileSystem::GetFileInfo(RomFileTable::FileInfo *out, const char *path) {
R_TRY(buffers::DoContinuouslyUntilBufferIsAllocated([=]() -> Result { R_TRY(buffers::DoContinuouslyUntilBufferIsAllocated([=, this]() -> Result {
R_TRY_CATCH(this->rom_file_table.OpenFile(out, path)) { R_TRY_CATCH(this->rom_file_table.OpenFile(out, path)) {
R_CONVERT(fs::ResultDbmNotFound, fs::ResultPathNotFound()); R_CONVERT(fs::ResultDbmNotFound, fs::ResultPathNotFound());
} R_END_TRY_CATCH; } R_END_TRY_CATCH;
@ -325,7 +325,7 @@ namespace ams::fssystem {
} }
Result RomFsFileSystem::GetEntryTypeImpl(fs::DirectoryEntryType *out, const char *path) { Result RomFsFileSystem::GetEntryTypeImpl(fs::DirectoryEntryType *out, const char *path) {
R_TRY(buffers::DoContinuouslyUntilBufferIsAllocated([=]() -> Result { R_TRY(buffers::DoContinuouslyUntilBufferIsAllocated([=, this]() -> Result {
RomDirectoryInfo dir_info; RomDirectoryInfo dir_info;
R_TRY_CATCH(this->rom_file_table.GetDirectoryInformation(std::addressof(dir_info), path)) { R_TRY_CATCH(this->rom_file_table.GetDirectoryInformation(std::addressof(dir_info), path)) {

View file

@ -13,7 +13,6 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <stratosphere.hpp> #include <stratosphere.hpp>
namespace ams::kvdb { namespace ams::kvdb {
@ -42,7 +41,7 @@ namespace ams::kvdb {
return header; return header;
} }
}; };
static_assert(sizeof(ArchiveHeader) == 0xC && std::is_pod<ArchiveHeader>::value, "ArchiveHeader definition!"); static_assert(sizeof(ArchiveHeader) == 0xC && util::is_pod<ArchiveHeader>::value, "ArchiveHeader definition!");
struct ArchiveEntryHeader { struct ArchiveEntryHeader {
u8 magic[sizeof(ArchiveEntryMagic)]; u8 magic[sizeof(ArchiveEntryMagic)];
@ -62,7 +61,7 @@ namespace ams::kvdb {
return header; return header;
} }
}; };
static_assert(sizeof(ArchiveEntryHeader) == 0xC && std::is_pod<ArchiveEntryHeader>::value, "ArchiveEntryHeader definition!"); static_assert(sizeof(ArchiveEntryHeader) == 0xC && util::is_pod<ArchiveEntryHeader>::value, "ArchiveEntryHeader definition!");
} }

View file

@ -13,7 +13,6 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <stratosphere.hpp> #include <stratosphere.hpp>
namespace ams::kvdb { namespace ams::kvdb {

View file

@ -13,7 +13,6 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <stratosphere.hpp> #include <stratosphere.hpp>
namespace ams::map { namespace ams::map {

View file

@ -160,7 +160,7 @@ namespace ams::mem::impl::heap {
template<typename T> template<typename T>
static ALWAYS_INLINE T *AlignUpPage(T *ptr) { static ALWAYS_INLINE T *AlignUpPage(T *ptr) {
static_assert(std::is_pod<T>::value); static_assert(util::is_pod<T>::value);
static_assert(util::IsAligned(PageSize, alignof(T))); static_assert(util::IsAligned(PageSize, alignof(T)));
return reinterpret_cast<T *>(AlignUpPage(reinterpret_cast<uintptr_t>(ptr))); return reinterpret_cast<T *>(AlignUpPage(reinterpret_cast<uintptr_t>(ptr)));
} }
@ -171,7 +171,7 @@ namespace ams::mem::impl::heap {
template<typename T> template<typename T>
static ALWAYS_INLINE T *AlignDownPage(T *ptr) { static ALWAYS_INLINE T *AlignDownPage(T *ptr) {
static_assert(std::is_pod<T>::value); static_assert(util::is_pod<T>::value);
static_assert(util::IsAligned(PageSize, alignof(T))); static_assert(util::IsAligned(PageSize, alignof(T)));
return reinterpret_cast<T *>(AlignDownPage(reinterpret_cast<uintptr_t>(ptr))); return reinterpret_cast<T *>(AlignDownPage(reinterpret_cast<uintptr_t>(ptr)));
} }
@ -182,7 +182,7 @@ namespace ams::mem::impl::heap {
template<typename T> template<typename T>
static ALWAYS_INLINE T *AlignUpPhysicalPage(T *ptr) { static ALWAYS_INLINE T *AlignUpPhysicalPage(T *ptr) {
static_assert(std::is_pod<T>::value); static_assert(util::is_pod<T>::value);
static_assert(util::IsAligned(PhysicalPageSize, alignof(T))); static_assert(util::IsAligned(PhysicalPageSize, alignof(T)));
return reinterpret_cast<T *>(AlignUpPhysicalPage(reinterpret_cast<uintptr_t>(ptr))); return reinterpret_cast<T *>(AlignUpPhysicalPage(reinterpret_cast<uintptr_t>(ptr)));
} }
@ -193,7 +193,7 @@ namespace ams::mem::impl::heap {
template<typename T> template<typename T>
static ALWAYS_INLINE T *AlignDownPhysicalPage(T *ptr) { static ALWAYS_INLINE T *AlignDownPhysicalPage(T *ptr) {
static_assert(std::is_pod<T>::value); static_assert(util::is_pod<T>::value);
static_assert(util::IsAligned(PhysicalPageSize, alignof(T))); static_assert(util::IsAligned(PhysicalPageSize, alignof(T)));
return reinterpret_cast<T *>(AlignDownPhysicalPage(reinterpret_cast<uintptr_t>(ptr))); return reinterpret_cast<T *>(AlignDownPhysicalPage(reinterpret_cast<uintptr_t>(ptr)));
} }

View file

@ -451,7 +451,7 @@ namespace ams::ncm {
/* Ensure this type of key has an owner. */ /* Ensure this type of key has an owner. */
R_UNLESS(key.type == ContentMetaType::Application || key.type == ContentMetaType::Patch || key.type == ContentMetaType::AddOnContent, ncm::ResultInvalidContentMetaKey()); R_UNLESS(key.type == ContentMetaType::Application || key.type == ContentMetaType::Patch || key.type == ContentMetaType::AddOnContent, ncm::ResultInvalidContentMetaKey());
/* Applications are their own owner. */ /* Applications are their own owner. */
if (key.type == ContentMetaType::Application) { if (key.type == ContentMetaType::Application) {
out_id.SetValue({key.id}); out_id.SetValue({key.id});

View file

@ -18,7 +18,6 @@
namespace ams::os::impl { namespace ams::os::impl {
/* TODO: C++20 constinit */ constinit TYPED_STORAGE(OsResourceManager) ResourceManagerHolder::s_resource_manager_storage = {};
TYPED_STORAGE(OsResourceManager) ResourceManagerHolder::s_resource_manager_storage = {};
} }

View file

@ -13,6 +13,7 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <stratosphere.hpp>
#include "os_waitable_manager_impl.hpp" #include "os_waitable_manager_impl.hpp"
#include "os_waitable_object_list.hpp" #include "os_waitable_object_list.hpp"
#include "os_tick_manager.hpp" #include "os_tick_manager.hpp"

View file

@ -13,6 +13,7 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <stratosphere.hpp>
#include "impl/os_timeout_helper.hpp" #include "impl/os_timeout_helper.hpp"
#include "impl/os_waitable_object_list.hpp" #include "impl/os_waitable_object_list.hpp"
#include "impl/os_waitable_holder_impl.hpp" #include "impl/os_waitable_holder_impl.hpp"

View file

@ -13,6 +13,7 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <stratosphere.hpp>
#include "impl/os_interrupt_event_impl.hpp" #include "impl/os_interrupt_event_impl.hpp"
#include "impl/os_waitable_object_list.hpp" #include "impl/os_waitable_object_list.hpp"

View file

@ -13,6 +13,7 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <stratosphere.hpp>
#include "impl/os_waitable_object_list.hpp" #include "impl/os_waitable_object_list.hpp"
#include "impl/os_timeout_helper.hpp" #include "impl/os_timeout_helper.hpp"

View file

@ -13,6 +13,7 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <stratosphere.hpp>
#include "impl/os_waitable_object_list.hpp" #include "impl/os_waitable_object_list.hpp"
#include "impl/os_timeout_helper.hpp" #include "impl/os_timeout_helper.hpp"

View file

@ -27,7 +27,7 @@ namespace ams::pgl::srv {
os::ProcessId process_id; os::ProcessId process_id;
u32 flags; u32 flags;
}; };
static_assert(std::is_pod<ProcessData>::value); static_assert(util::is_pod<ProcessData>::value);
enum ProcessDataFlag : u32 { enum ProcessDataFlag : u32 {
ProcessDataFlag_None = 0, ProcessDataFlag_None = 0,

View file

@ -13,6 +13,7 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <stratosphere.hpp>
#include "sm_utils.hpp" #include "sm_utils.hpp"
namespace ams::sm { namespace ams::sm {

View file

@ -13,6 +13,7 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <stratosphere.hpp>
#include "sm_utils.hpp" #include "sm_utils.hpp"
#include "smm_ams.h" #include "smm_ams.h"

View file

@ -13,6 +13,7 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <stratosphere.hpp>
#include "sm_utils.hpp" #include "sm_utils.hpp"
namespace ams::sm::mitm { namespace ams::sm::mitm {

View file

@ -13,6 +13,7 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <stratosphere.hpp>
#include "sm_utils.hpp" #include "sm_utils.hpp"
namespace ams::sm::impl { namespace ams::sm::impl {

View file

@ -13,8 +13,6 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <switch.h>
#include <stratosphere.hpp> #include <stratosphere.hpp>
#include <stratosphere/updater.hpp> #include <stratosphere/updater.hpp>

View file

@ -13,6 +13,7 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <stratosphere.hpp>
#include "updater_bis_management.hpp" #include "updater_bis_management.hpp"
namespace ams::updater { namespace ams::updater {

Some files were not shown because too many files have changed in this diff Show more