strat: update for revised libnx weak alloc funcs

This commit is contained in:
Michael Scire 2021-01-22 03:52:10 -08:00
parent f8f987aa8d
commit 3389aaefc3
14 changed files with 178 additions and 55 deletions

View file

@ -38,8 +38,9 @@ extern "C" {
u64 __nx_exception_stack_size = sizeof(__nx_exception_stack); u64 __nx_exception_stack_size = sizeof(__nx_exception_stack);
void __libnx_exception_handler(ThreadExceptionDump *ctx); void __libnx_exception_handler(ThreadExceptionDump *ctx);
void *__libnx_thread_alloc(size_t size); void *__libnx_alloc(size_t size);
void __libnx_thread_free(void *mem); void *__libnx_aligned_alloc(size_t alignment, size_t size);
void __libnx_free(void *mem);
} }
namespace ams { namespace ams {
@ -110,12 +111,16 @@ void __appExit(void) {
fsExit(); fsExit();
} }
void *__libnx_thread_alloc(size_t size) { void *__libnx_alloc(size_t size) {
AMS_ABORT("__libnx_thread_alloc was called"); AMS_ABORT("__libnx_alloc was called");
} }
void __libnx_thread_free(void *mem) { void *__libnx_aligned_alloc(size_t alignment, size_t size) {
AMS_ABORT("__libnx_thread_free was called"); AMS_ABORT("__libnx_aligned_alloc was called");
}
void __libnx_free(void *mem) {
AMS_ABORT("__libnx_free was called");
} }
int main(int argc, char **argv) { int main(int argc, char **argv) {

View file

@ -49,8 +49,9 @@ extern "C" {
u64 __nx_exception_stack_size = sizeof(__nx_exception_stack); u64 __nx_exception_stack_size = sizeof(__nx_exception_stack);
void __libnx_exception_handler(ThreadExceptionDump *ctx); void __libnx_exception_handler(ThreadExceptionDump *ctx);
void *__libnx_thread_alloc(size_t size); void *__libnx_alloc(size_t size);
void __libnx_thread_free(void *mem); void *__libnx_aligned_alloc(size_t alignment, size_t size);
void __libnx_free(void *mem);
} }
namespace ams { namespace ams {
@ -160,12 +161,16 @@ namespace ams {
} }
void *__libnx_thread_alloc(size_t size) { void *__libnx_alloc(size_t size) {
AMS_ABORT("__libnx_thread_alloc was called"); AMS_ABORT("__libnx_alloc was called");
} }
void __libnx_thread_free(void *mem) { void *__libnx_aligned_alloc(size_t alignment, size_t size) {
AMS_ABORT("__libnx_thread_free was called"); AMS_ABORT("__libnx_aligned_alloc was called");
}
void __libnx_free(void *mem) {
AMS_ABORT("__libnx_free was called");
} }
void *operator new(size_t size) { void *operator new(size_t size) {

View file

@ -33,6 +33,10 @@ extern "C" {
alignas(16) u8 __nx_exception_stack[ams::os::MemoryPageSize]; alignas(16) u8 __nx_exception_stack[ams::os::MemoryPageSize];
u64 __nx_exception_stack_size = sizeof(__nx_exception_stack); u64 __nx_exception_stack_size = sizeof(__nx_exception_stack);
void __libnx_exception_handler(ThreadExceptionDump *ctx); void __libnx_exception_handler(ThreadExceptionDump *ctx);
void *__libnx_alloc(size_t size);
void *__libnx_aligned_alloc(size_t alignment, size_t size);
void __libnx_free(void *mem);
} }
namespace ams { namespace ams {
@ -137,6 +141,18 @@ void operator delete(void *p) {
AMS_ABORT("operator delete(void *) was called"); AMS_ABORT("operator delete(void *) was called");
} }
void *__libnx_alloc(size_t size) {
AMS_ABORT("__libnx_alloc was called");
}
void *__libnx_aligned_alloc(size_t alignment, size_t size) {
AMS_ABORT("__libnx_aligned_alloc was called");
}
void __libnx_free(void *mem) {
AMS_ABORT("__libnx_free was called");
}
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
/* Set thread name. */ /* Set thread name. */

View file

@ -36,6 +36,10 @@ extern "C" {
alignas(16) u8 __nx_exception_stack[ams::os::MemoryPageSize]; alignas(16) u8 __nx_exception_stack[ams::os::MemoryPageSize];
u64 __nx_exception_stack_size = sizeof(__nx_exception_stack); u64 __nx_exception_stack_size = sizeof(__nx_exception_stack);
void __libnx_exception_handler(ThreadExceptionDump *ctx); void __libnx_exception_handler(ThreadExceptionDump *ctx);
void *__libnx_alloc(size_t size);
void *__libnx_aligned_alloc(size_t alignment, size_t size);
void __libnx_free(void *mem);
} }
namespace ams { namespace ams {
@ -126,6 +130,18 @@ void operator delete(void *p) {
AMS_ABORT("operator delete(void *) was called"); AMS_ABORT("operator delete(void *) was called");
} }
void *__libnx_alloc(size_t size) {
AMS_ABORT("__libnx_alloc was called");
}
void *__libnx_aligned_alloc(size_t alignment, size_t size) {
AMS_ABORT("__libnx_aligned_alloc was called");
}
void __libnx_free(void *mem) {
AMS_ABORT("__libnx_free was called");
}
namespace { namespace {
constinit creport::CrashReport g_crash_report; constinit creport::CrashReport g_crash_report;

View file

@ -32,8 +32,9 @@ extern "C" {
void __appInit(void); void __appInit(void);
void __appExit(void); void __appExit(void);
void *__libnx_thread_alloc(size_t size); void *__libnx_alloc(size_t size);
void __libnx_thread_free(void *mem); void *__libnx_aligned_alloc(size_t alignment, size_t size);
void __libnx_free(void *mem);
} }
namespace ams { namespace ams {
@ -175,12 +176,16 @@ void operator delete(void *p) {
AMS_ABORT("operator delete(void *) was called"); AMS_ABORT("operator delete(void *) was called");
} }
void *__libnx_thread_alloc(size_t size) { void *__libnx_alloc(size_t size) {
AMS_ABORT("__libnx_thread_alloc was called"); AMS_ABORT("__libnx_alloc was called");
} }
void __libnx_thread_free(void *mem) { void *__libnx_aligned_alloc(size_t alignment, size_t size) {
AMS_ABORT("__libnx_thread_free was called"); AMS_ABORT("__libnx_aligned_alloc was called");
}
void __libnx_free(void *mem) {
AMS_ABORT("__libnx_free was called");
} }
int main(int argc, char **argv) int main(int argc, char **argv)

View file

@ -34,9 +34,9 @@ extern "C" {
u64 __nx_exception_stack_size = sizeof(__nx_exception_stack); u64 __nx_exception_stack_size = sizeof(__nx_exception_stack);
void __libnx_exception_handler(ThreadExceptionDump *ctx); void __libnx_exception_handler(ThreadExceptionDump *ctx);
void *__libnx_thread_alloc(size_t size); void *__libnx_alloc(size_t size);
void __libnx_thread_free(void *mem); void *__libnx_aligned_alloc(size_t alignment, size_t size);
void __libnx_free(void *mem);
} }
namespace ams { namespace ams {
@ -145,12 +145,16 @@ void operator delete(void *p) {
AMS_ABORT("operator delete(void *) was called"); AMS_ABORT("operator delete(void *) was called");
} }
void *__libnx_thread_alloc(size_t size) { void *__libnx_alloc(size_t size) {
AMS_ABORT("__libnx_thread_alloc was called"); AMS_ABORT("__libnx_alloc was called");
} }
void __libnx_thread_free(void *mem) { void *__libnx_aligned_alloc(size_t alignment, size_t size) {
AMS_ABORT("__libnx_thread_free was called"); AMS_ABORT("__libnx_aligned_alloc was called");
}
void __libnx_free(void *mem) {
AMS_ABORT("__libnx_free was called");
} }
int main(int argc, char **argv) int main(int argc, char **argv)

View file

@ -41,8 +41,9 @@ extern "C" {
u64 __nx_exception_stack_size = sizeof(__nx_exception_stack); u64 __nx_exception_stack_size = sizeof(__nx_exception_stack);
void __libnx_exception_handler(ThreadExceptionDump *ctx); void __libnx_exception_handler(ThreadExceptionDump *ctx);
void *__libnx_thread_alloc(size_t size); void *__libnx_alloc(size_t size);
void __libnx_thread_free(void *mem); void *__libnx_aligned_alloc(size_t alignment, size_t size);
void __libnx_free(void *mem);
} }
namespace ams { namespace ams {
@ -191,12 +192,16 @@ void operator delete(void *p) {
AMS_ABORT("operator delete(void *) was called"); AMS_ABORT("operator delete(void *) was called");
} }
void *__libnx_thread_alloc(size_t size) { void *__libnx_alloc(size_t size) {
AMS_ABORT("__libnx_thread_alloc was called"); AMS_ABORT("__libnx_alloc was called");
} }
void __libnx_thread_free(void *mem) { void *__libnx_aligned_alloc(size_t alignment, size_t size) {
AMS_ABORT("__libnx_thread_free was called"); AMS_ABORT("__libnx_aligned_alloc was called");
}
void __libnx_free(void *mem) {
AMS_ABORT("__libnx_free was called");
} }
int main(int argc, char **argv) int main(int argc, char **argv)

View file

@ -36,8 +36,9 @@ extern "C" {
u64 __nx_exception_stack_size = sizeof(__nx_exception_stack); u64 __nx_exception_stack_size = sizeof(__nx_exception_stack);
void __libnx_exception_handler(ThreadExceptionDump *ctx); void __libnx_exception_handler(ThreadExceptionDump *ctx);
void *__libnx_thread_alloc(size_t size); void *__libnx_alloc(size_t size);
void __libnx_thread_free(void *mem); void *__libnx_aligned_alloc(size_t alignment, size_t size);
void __libnx_free(void *mem);
} }
namespace ams { namespace ams {
@ -188,12 +189,16 @@ void operator delete(void *p) {
return ldr::Deallocate(p, 0); return ldr::Deallocate(p, 0);
} }
void *__libnx_thread_alloc(size_t size) { void *__libnx_alloc(size_t size) {
AMS_ABORT("__libnx_thread_alloc was called"); AMS_ABORT("__libnx_alloc was called");
} }
void __libnx_thread_free(void *mem) { void *__libnx_aligned_alloc(size_t alignment, size_t size) {
AMS_ABORT("__libnx_thread_free was called"); AMS_ABORT("__libnx_aligned_alloc was called");
}
void __libnx_free(void *mem) {
AMS_ABORT("__libnx_free was called");
} }
int main(int argc, char **argv) int main(int argc, char **argv)

View file

@ -34,8 +34,9 @@ extern "C" {
u64 __nx_exception_stack_size = sizeof(__nx_exception_stack); u64 __nx_exception_stack_size = sizeof(__nx_exception_stack);
void __libnx_exception_handler(ThreadExceptionDump *ctx); void __libnx_exception_handler(ThreadExceptionDump *ctx);
void *__libnx_thread_alloc(size_t size); void *__libnx_alloc(size_t size);
void __libnx_thread_free(void *mem); void *__libnx_aligned_alloc(size_t alignment, size_t size);
void __libnx_free(void *mem);
} }
namespace ams { namespace ams {
@ -124,12 +125,16 @@ namespace ams {
} }
void *__libnx_thread_alloc(size_t size) { void *__libnx_alloc(size_t size) {
AMS_ABORT("__libnx_thread_alloc was called"); AMS_ABORT("__libnx_alloc was called");
} }
void __libnx_thread_free(void *mem) { void *__libnx_aligned_alloc(size_t alignment, size_t size) {
AMS_ABORT("__libnx_thread_free was called"); AMS_ABORT("__libnx_aligned_alloc was called");
}
void __libnx_free(void *mem) {
AMS_ABORT("__libnx_free was called");
} }
void *operator new(size_t size) { void *operator new(size_t size) {

View file

@ -34,8 +34,9 @@ extern "C" {
u64 __nx_exception_stack_size = sizeof(__nx_exception_stack); u64 __nx_exception_stack_size = sizeof(__nx_exception_stack);
void __libnx_exception_handler(ThreadExceptionDump *ctx); void __libnx_exception_handler(ThreadExceptionDump *ctx);
void *__libnx_thread_alloc(size_t size); void *__libnx_alloc(size_t size);
void __libnx_thread_free(void *mem); void *__libnx_aligned_alloc(size_t alignment, size_t size);
void __libnx_free(void *mem);
} }
namespace ams { namespace ams {
@ -172,12 +173,16 @@ void operator delete(void *p) {
return pgl::Deallocate(p, 0); return pgl::Deallocate(p, 0);
} }
void *__libnx_thread_alloc(size_t size) { void *__libnx_alloc(size_t size) {
AMS_ABORT("__libnx_thread_alloc was called"); AMS_ABORT("__libnx_alloc was called");
} }
void __libnx_thread_free(void *mem) { void *__libnx_aligned_alloc(size_t alignment, size_t size) {
AMS_ABORT("__libnx_thread_free was called"); AMS_ABORT("__libnx_aligned_alloc was called");
}
void __libnx_free(void *mem) {
AMS_ABORT("__libnx_free was called");
} }
int main(int argc, char **argv) int main(int argc, char **argv)

View file

@ -39,8 +39,9 @@ extern "C" {
u64 __nx_exception_stack_size = sizeof(__nx_exception_stack); u64 __nx_exception_stack_size = sizeof(__nx_exception_stack);
void __libnx_exception_handler(ThreadExceptionDump *ctx); void __libnx_exception_handler(ThreadExceptionDump *ctx);
void *__libnx_thread_alloc(size_t size); void *__libnx_alloc(size_t size);
void __libnx_thread_free(void *mem); void *__libnx_aligned_alloc(size_t alignment, size_t size);
void __libnx_free(void *mem);
} }
namespace ams { namespace ams {
@ -239,12 +240,16 @@ void operator delete(void *p) {
AMS_ABORT("operator delete(void *) was called"); AMS_ABORT("operator delete(void *) was called");
} }
void *__libnx_thread_alloc(size_t size) { void *__libnx_alloc(size_t size) {
AMS_ABORT("__libnx_thread_alloc was called"); AMS_ABORT("__libnx_alloc was called");
} }
void __libnx_thread_free(void *mem) { void *__libnx_aligned_alloc(size_t alignment, size_t size) {
AMS_ABORT("__libnx_thread_free was called"); AMS_ABORT("__libnx_aligned_alloc was called");
}
void __libnx_free(void *mem) {
AMS_ABORT("__libnx_free was called");
} }
int main(int argc, char **argv) int main(int argc, char **argv)

View file

@ -30,6 +30,10 @@ extern "C" {
void __libnx_initheap(void); void __libnx_initheap(void);
void __appInit(void); void __appInit(void);
void __appExit(void); void __appExit(void);
void *__libnx_alloc(size_t size);
void *__libnx_aligned_alloc(size_t alignment, size_t size);
void __libnx_free(void *mem);
} }
namespace ams { namespace ams {
@ -190,6 +194,18 @@ void operator delete(void *p) {
AMS_ABORT("operator delete(void *) was called"); AMS_ABORT("operator delete(void *) was called");
} }
void *__libnx_alloc(size_t size) {
AMS_ABORT("__libnx_alloc was called");
}
void *__libnx_aligned_alloc(size_t alignment, size_t size) {
AMS_ABORT("__libnx_aligned_alloc was called");
}
void __libnx_free(void *mem) {
AMS_ABORT("__libnx_free was called");
}
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
/* Set thread name. */ /* Set thread name. */

View file

@ -38,6 +38,9 @@ extern "C" {
u64 __nx_exception_stack_size = sizeof(__nx_exception_stack); u64 __nx_exception_stack_size = sizeof(__nx_exception_stack);
void __libnx_exception_handler(ThreadExceptionDump *ctx); void __libnx_exception_handler(ThreadExceptionDump *ctx);
void *__libnx_alloc(size_t size);
void *__libnx_aligned_alloc(size_t alignment, size_t size);
void __libnx_free(void *mem);
} }
namespace ams { namespace ams {
@ -129,6 +132,18 @@ void operator delete(void *p) {
AMS_ABORT("operator delete(void *) was called"); AMS_ABORT("operator delete(void *) was called");
} }
void *__libnx_alloc(size_t size) {
AMS_ABORT("__libnx_alloc was called");
}
void *__libnx_aligned_alloc(size_t alignment, size_t size) {
AMS_ABORT("__libnx_aligned_alloc was called");
}
void __libnx_free(void *mem) {
AMS_ABORT("__libnx_free was called");
}
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
/* Set thread name. */ /* Set thread name. */

View file

@ -43,6 +43,10 @@ extern "C" {
alignas(16) u8 __nx_exception_stack[ams::os::MemoryPageSize]; alignas(16) u8 __nx_exception_stack[ams::os::MemoryPageSize];
u64 __nx_exception_stack_size = sizeof(__nx_exception_stack); u64 __nx_exception_stack_size = sizeof(__nx_exception_stack);
void __libnx_exception_handler(ThreadExceptionDump *ctx); void __libnx_exception_handler(ThreadExceptionDump *ctx);
void *__libnx_alloc(size_t size);
void *__libnx_aligned_alloc(size_t alignment, size_t size);
void __libnx_free(void *mem);
} }
namespace ams { namespace ams {
@ -190,6 +194,18 @@ void operator delete(void *p) {
AMS_ABORT("operator delete(void *) was called"); AMS_ABORT("operator delete(void *) was called");
} }
void *__libnx_alloc(size_t size) {
AMS_ABORT("__libnx_alloc was called");
}
void *__libnx_aligned_alloc(size_t alignment, size_t size) {
AMS_ABORT("__libnx_aligned_alloc was called");
}
void __libnx_free(void *mem) {
AMS_ABORT("__libnx_free was called");
}
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
/* Set thread name. */ /* Set thread name. */