kernel: user safe strlen

This commit is contained in:
Matheus
2022-12-13 23:41:40 -03:00
parent 9fc62579ea
commit c17a2f4c6c
5 changed files with 55 additions and 1 deletions
+19
View File
@@ -0,0 +1,19 @@
#include <kernel/ustring.h>
#include <arch/cls.h>
extern void arch_u_strlen_cont();
extern int arch_u_strlen(const char* str, size_t* len);
int u_strlen(const char* str, size_t* len){
arch_getcls()->thread->umemopfailaddr = arch_u_strlen_cont;
int ret = arch_u_strlen(str, len);
arch_getcls()->thread->umemopfailaddr = NULL;
return ret == 0 ? 0 : arch_getcls()->thread->umemoperror;
}