1 /* 2 * Copyright (c) 2013, Google, Inc. All rights reserved 3 * Copyright (c) 2012-2013, NVIDIA CORPORATION. All rights reserved 4 * 5 * Permission is hereby granted, free of charge, to any person obtaining 6 * a copy of this software and associated documentation files 7 * (the "Software"), to deal in the Software without restriction, 8 * including without limitation the rights to use, copy, modify, merge, 9 * publish, distribute, sublicense, and/or sell copies of the Software, 10 * and to permit persons to whom the Software is furnished to do so, 11 * subject to the following conditions: 12 * 13 * The above copyright notice and this permission notice shall be 14 * included in all copies or substantial portions of the Software. 15 * 16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 20 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 21 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 22 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 */ 24 #pragma once 25 26 #include <sys/types.h> 27 #include <uapi/trusty_app_manifest_types.h> 28 29 /* 30 * Layout of .trusty_app.manifest section in the trusted application is the 31 * required UUID followed by an abitrary number of configuration options. 32 */ 33 #define CONCAT(x, y) x##y 34 #define XCONCAT(x, y) CONCAT(x, y) 35 36 #define TRUSTY_APP_CONFIG_MIN_STACK_SIZE(sz) \ 37 TRUSTY_APP_CONFIG_KEY_MIN_STACK_SIZE, sz 38 39 #define TRUSTY_APP_CONFIG_MIN_HEAP_SIZE(sz) \ 40 TRUSTY_APP_CONFIG_KEY_MIN_HEAP_SIZE, sz 41 42 #define TRUSTY_APP_CONFIG_MAP_MEM(id, off, sz) \ 43 TRUSTY_APP_CONFIG_KEY_MAP_MEM, id, off, sz 44 45 #define TRUSTY_APP_CONFIG_MGMT_FLAGS(mgmt_flags) \ 46 TRUSTY_APP_CONFIG_KEY_MGMT_FLAGS, mgmt_flags 47 48 /* Valid flags: IPC_PORT_ALLOW_* */ 49 #define TRUSTY_APP_START_PORT(name, flags) \ 50 struct trusty_app_manifest_entry_port \ 51 __attribute((section(".trusty_app.manifest.entry"))) \ 52 XCONCAT(trusty_app_manifest_entry_port_, __COUNTER__) = { \ 53 .config_key = TRUSTY_APP_CONFIG_KEY_START_PORT, \ 54 .port_flags = flags, \ 55 .port_name_size = sizeof(name), \ 56 .port_name = name, \ 57 }; 58 59 /* manifest section attributes */ 60 #define TRUSTY_APP_MANIFEST_ATTRS \ 61 const __attribute((aligned(4))) \ 62 __attribute((section(".trusty_app.manifest"))) 63