match MSL_C/abort_exit and MSL_C/mem

This commit is contained in:
CreateSource 2025-01-21 00:24:31 -05:00
parent a517ff0ae1
commit 627f9e4dd7
4 changed files with 42 additions and 4 deletions

View file

@ -1,5 +1,6 @@
#include "PowerPC_EABI_Support/Msl/MSL_C/MSL_Common/abort_exit.h"
#include "PowerPC_EABI_Support/Msl/MSL_C/MSL_Common/critical_regions.h"
#include "PowerPC_EABI_Support/Msl/MSL_C/MSL_Common/signal.h"
#include "stddef.h"
#include "PowerPC_EABI_Support/Runtime/NMWException.h"
@ -20,7 +21,19 @@ void (*__console_exit)(void) = 0;
void abort(void)
{
// TODO
void (**var_r31)(void);
raise(1);
__aborting = 1;
var_r31 = &__atexit_funcs[0];
while (__atexit_curr_func > 0) {
var_r31[--__atexit_curr_func]();
}
if (__console_exit != 0) {
__console_exit();
__console_exit = 0;
}
_ExitProcess();
}
void exit(int status)

View file

@ -60,6 +60,23 @@ void* memchr(const void* ptr, int ch, size_t count)
return NULL;
}
unsigned char* __memrchr(unsigned char* s, int c, size_t n){ // credit to CelestialAmber
int n_count;
size_t char_check;
char_check = (unsigned char)c;
s = &s[n];
n_count = n + 1;
while(--n_count){
if(*--s == char_check){
return s;
}
}
return 0;
}
int memcmp(const void* lhs, const void* rhs, size_t count)
{
const unsigned char* p1;