Luna/kernel/src/sys/UserMemory.cpp

10 lines
349 B
C++

#include "sys/UserMemory.h"
#include "std/string.h"
char* strdup_from_user(
const char* user_string) // FIXME: This function is a little hacky. Use the obtain_user_ref and similar functions.
{
uint64_t phys = VMM::get_physical((uint64_t)user_string);
if (phys == (uint64_t)-1) { return nullptr; }
return strdup((const char*)phys);
}