mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2024-12-20 17:32:13 +00:00
boot2: update for new sf semantics
This commit is contained in:
parent
57c197ec1c
commit
2801d00d98
4 changed files with 54 additions and 3 deletions
|
@ -176,7 +176,6 @@ extern "C" {
|
||||||
|
|
||||||
/* Redefine C++ exception handlers. Requires wrap linker flag. */
|
/* Redefine C++ exception handlers. Requires wrap linker flag. */
|
||||||
#define WRAP_ABORT_FUNC(func) void NORETURN __wrap_##func(void) { abort(); __builtin_unreachable(); }
|
#define WRAP_ABORT_FUNC(func) void NORETURN __wrap_##func(void) { abort(); __builtin_unreachable(); }
|
||||||
WRAP_ABORT_FUNC(__cxa_pure_virtual)
|
|
||||||
WRAP_ABORT_FUNC(__cxa_throw)
|
WRAP_ABORT_FUNC(__cxa_throw)
|
||||||
WRAP_ABORT_FUNC(__cxa_rethrow)
|
WRAP_ABORT_FUNC(__cxa_rethrow)
|
||||||
WRAP_ABORT_FUNC(__cxa_allocate_exception)
|
WRAP_ABORT_FUNC(__cxa_allocate_exception)
|
||||||
|
|
|
@ -26,3 +26,12 @@ namespace ams {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
|
|
||||||
|
/* Redefine C++ exception handlers. Requires wrap linker flag. */
|
||||||
|
#define WRAP_ABORT_FUNC(func) void NORETURN __wrap_##func(void) { abort(); __builtin_unreachable(); }
|
||||||
|
WRAP_ABORT_FUNC(__cxa_pure_virtual)
|
||||||
|
#undef WRAP_ABORT_FUNC
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -127,7 +127,7 @@ namespace ams::i2c::driver::impl {
|
||||||
auto &device = GetDevice().SafeCastTo<I2cDeviceProperty>();
|
auto &device = GetDevice().SafeCastTo<I2cDeviceProperty>();
|
||||||
|
|
||||||
/* Repeatedly try to execute the transaction. */
|
/* Repeatedly try to execute the transaction. */
|
||||||
int retry_count;
|
int retry_count = 0;
|
||||||
while (true) {
|
while (true) {
|
||||||
/* Execute the transaction. */
|
/* Execute the transaction. */
|
||||||
Result result;
|
Result result;
|
||||||
|
|
|
@ -21,7 +21,7 @@ extern "C" {
|
||||||
u32 __nx_applet_type = AppletType_None;
|
u32 __nx_applet_type = AppletType_None;
|
||||||
u32 __nx_fs_num_sessions = 1;
|
u32 __nx_fs_num_sessions = 1;
|
||||||
|
|
||||||
#define INNER_HEAP_SIZE 0x2000
|
#define INNER_HEAP_SIZE 0x0
|
||||||
size_t nx_inner_heap_size = INNER_HEAP_SIZE;
|
size_t nx_inner_heap_size = INNER_HEAP_SIZE;
|
||||||
char nx_inner_heap[INNER_HEAP_SIZE];
|
char nx_inner_heap[INNER_HEAP_SIZE];
|
||||||
|
|
||||||
|
@ -65,9 +65,32 @@ void __libnx_initheap(void) {
|
||||||
fake_heap_end = (char*)addr + size;
|
fake_heap_end = (char*)addr + size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
|
||||||
|
|
||||||
|
constinit u8 g_fs_heap_memory[2_KB];
|
||||||
|
lmem::HeapHandle g_fs_heap_handle;
|
||||||
|
|
||||||
|
void *AllocateForFs(size_t size) {
|
||||||
|
return lmem::AllocateFromExpHeap(g_fs_heap_handle, size);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DeallocateForFs(void *p, size_t size) {
|
||||||
|
return lmem::FreeToExpHeap(g_fs_heap_handle, p);
|
||||||
|
}
|
||||||
|
|
||||||
|
void InitializeFsHeap() {
|
||||||
|
g_fs_heap_handle = lmem::CreateExpHeap(g_fs_heap_memory, sizeof(g_fs_heap_memory), lmem::CreateOption_None);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void __appInit(void) {
|
void __appInit(void) {
|
||||||
hos::InitializeForStratosphere();
|
hos::InitializeForStratosphere();
|
||||||
|
|
||||||
|
InitializeFsHeap();
|
||||||
|
fs::SetAllocator(AllocateForFs, DeallocateForFs);
|
||||||
|
|
||||||
/* Initialize services we need. */
|
/* Initialize services we need. */
|
||||||
sm::DoWithSession([&]() {
|
sm::DoWithSession([&]() {
|
||||||
R_ABORT_UNLESS(fsInitialize());
|
R_ABORT_UNLESS(fsInitialize());
|
||||||
|
@ -94,6 +117,26 @@ void __appExit(void) {
|
||||||
fsExit();
|
fsExit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace ams {
|
||||||
|
|
||||||
|
void *Malloc(size_t size) {
|
||||||
|
AMS_ABORT("ams::Malloc was called");
|
||||||
|
}
|
||||||
|
|
||||||
|
void Free(void *ptr) {
|
||||||
|
AMS_ABORT("ams::Free was called");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void *operator new(size_t size) {
|
||||||
|
AMS_ABORT("operator new(size_t) was called");
|
||||||
|
}
|
||||||
|
|
||||||
|
void operator delete(void *p) {
|
||||||
|
AMS_ABORT("operator delete(void *) was called");
|
||||||
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
/* Set thread name. */
|
/* Set thread name. */
|
||||||
|
|
Loading…
Reference in a new issue