1 /* 2 * Copyright (C) 2022 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 #pragma once 17 18 #include <lk/compiler.h> 19 20 __BEGIN_CDECLS 21 22 /** 23 * vmm_obj_map_ro() - Map the vmm_obj the read-only object from the remote 24 * service at the given port and return the base and size 25 * of the mapping. 26 * @port: Service port to connect to. 27 * @base_out: Pointer to location to store base address into. 28 * @size_out: Pointer to location to store size into. This will hold 29 * the size in bytes of the buffer pointed to by @base_out. 30 * 31 * The function maps the object into the current process using mmap(). 32 * The caller is responsible for unmapping that memory with munmap(). 33 * Both pointers must be valid, otherwise the function returns 34 * %ERR_INVALID_ARGS. 35 * 36 * Return: %NO_ERROR in case of success, error code otherwise. 37 */ 38 int vmm_obj_map_ro(const char* port, const void** base_out, size_t* size_out); 39 40 __END_CDECLS 41