1# 2# Copyright (c) 2024, Google, Inc. All rights reserved 3# 4# Permission is hereby granted, free of charge, to any person obtaining 5# a copy of this software and associated documentation files 6# (the "Software"), to deal in the Software without restriction, 7# including without limitation the rights to use, copy, modify, merge, 8# publish, distribute, sublicense, and/or sell copies of the Software, 9# and to permit persons to whom the Software is furnished to do so, 10# subject to the following conditions: 11# 12# The above copyright notice and this permission notice shall be 13# included in all copies or substantial portions of the Software. 14# 15# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 19# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 20# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 21# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22# 23 24LOCAL_DIR := $(GET_LOCAL_DIR) 25 26MODULE := $(LOCAL_DIR) 27 28MODULE_CRATE_NAME := rust_support 29 30MODULE_SRCS := \ 31 $(LOCAL_DIR)/lib.rs \ 32 33# Don't make this module depend on itself. 34MODULE_ADD_IMPLICIT_DEPS := false 35 36MODULE_DEPS := \ 37 $(call FIND_CRATE,num-derive) \ 38 $(call FIND_CRATE,num-traits) \ 39 $(call FIND_CRATE,log) \ 40 trusty/user/base/lib/liballoc-rust \ 41 trusty/user/base/lib/libcompiler_builtins-rust \ 42 trusty/user/base/lib/libcore-rust \ 43 trusty/user/base/lib/trusty-std \ 44 $(LOCAL_DIR)/wrappers \ 45 46MODULE_BINDGEN_ALLOW_FUNCTIONS := \ 47 _panic \ 48 fflush \ 49 fputs \ 50 handle_close \ 51 handle_decref \ 52 handle_set_detach_ref \ 53 handle_set_attach \ 54 handle_set_create \ 55 handle_set_wait \ 56 handle_wait \ 57 ipc_get_msg \ 58 ipc_port_connect_async \ 59 ipc_put_msg \ 60 ipc_read_msg \ 61 ipc_send_msg \ 62 lk_stdin \ 63 lk_stdout \ 64 lk_stderr \ 65 mutex_acquire_timeout \ 66 mutex_destroy \ 67 mutex_init \ 68 mutex_release \ 69 thread_create \ 70 thread_resume \ 71 thread_sleep_ns \ 72 vaddr_to_paddr \ 73 vmm_alloc_physical_etc \ 74 vmm_alloc_contiguous \ 75 vmm_free_region \ 76 77MODULE_BINDGEN_ALLOW_TYPES := \ 78 Error \ 79 handle \ 80 handle_ref \ 81 iovec_kern \ 82 ipc_msg_.* \ 83 lk_init_.* \ 84 lk_time_.* \ 85 trusty_ipc_event_type \ 86 87MODULE_BINDGEN_ALLOW_VARS := \ 88 .*_PRIORITY \ 89 _kernel_aspace \ 90 ARCH_MMU_FLAG_.* \ 91 DEFAULT_STACK_SIZE \ 92 FILE \ 93 IPC_CONNECT_WAIT_FOR_PORT \ 94 IPC_HANDLE_POLL_.* \ 95 IPC_PORT_PATH_MAX \ 96 LK_LOGLEVEL_RUST \ 97 NUM_PRIORITIES \ 98 PAGE_SIZE \ 99 PAGE_SIZE_SHIFT \ 100 zero_uuid \ 101 102MODULE_BINDGEN_FLAGS := \ 103 --newtype-enum Error \ 104 --newtype-enum lk_init_level \ 105 --bitfield-enum lk_init_flags \ 106 --no-prepend-enum-name \ 107 --with-derive-custom Error=FromPrimitive \ 108 --with-derive-custom handle_waiter=Default \ 109 --with-derive-custom ipc_msg_info=Default \ 110 111MODULE_BINDGEN_SRC_HEADER := $(LOCAL_DIR)/bindings.h 112 113MODULE_RUSTFLAGS += \ 114 -A clippy::disallowed_names \ 115 -A clippy::type-complexity \ 116 -A clippy::unnecessary_fallible_conversions \ 117 -A clippy::unnecessary-wraps \ 118 -A clippy::unusual-byte-groupings \ 119 -A clippy::upper-case-acronyms \ 120 -D clippy::undocumented_unsafe_blocks \ 121 122MODULE_RUST_USE_CLIPPY := true 123 124include make/module.mk 125