/* * Copyright (C) 2021 Andy Nguyen * Copyright (C) 2022 Rinnegatamante * Copyright (C) 2022-2023 Volodymyr Atamanenko * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file for details. */ #include "reimpl/mem.h" #include "utils/logger.h" #include #include #include void *sceClibMemclr(void *dst, size_t len) { return sceClibMemset(dst, 0, len); } void *mmap(void *addr, size_t length, int prot, int flags, int fd, off_t offs) { l_warn("mmap(%p, %i, %i, %i, %i, %li)", addr, length, prot, flags, fd, offs); if (!length) { return MAP_FAILED; } void *ret = malloc(length); if (!ret) { l_error("mmap allocation failed for %u bytes", (unsigned)length); return MAP_FAILED; } memset(ret, 0, length); return ret; } int munmap(void *addr, size_t length) { if (addr) free(addr); return 0; }