1 /* 2 * Copyright (C) 2023 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #ifndef NATIVE_BRIDGE_SUPPORT_LIBC_PROXY_MALLOC_TRANSLATION_H_ 18 #define NATIVE_BRIDGE_SUPPORT_LIBC_PROXY_MALLOC_TRANSLATION_H_ 19 20 #include <malloc.h> 21 22 #include "berberis/guest_state/guest_state_opaque.h" 23 #include "berberis/runtime_primitives/host_code.h" 24 25 // These symbols are not declared in any public bionic headers. 26 extern "C" void malloc_disable(); 27 extern "C" void malloc_enable(); 28 29 // valloc(3) and pvalloc(3) were removed from POSIX 2004. 30 // These symbols remain only in LP32 bionic for binary compatibility. 31 extern "C" void* pvalloc(size_t); 32 extern "C" void* valloc(size_t); 33 34 namespace berberis { 35 36 void DoCustomTrampoline_native_bridge_malloc_info_helper(HostCode callee, 37 ProcessState* state); 38 39 void DoCustomTrampoline_native_bridge_mallinfo(HostCode callee, 40 ProcessState* state); 41 42 void DoCustomTrampoline_native_bridge_malloc_iterate(HostCode callee, 43 ProcessState* state); 44 45 } // namespace berberis 46 47 #endif // NATIVE_BRIDGE_SUPPORT_LIBC_PROXY_MALLOC_TRANSLATION_H_ 48