-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathapi_untrusted.h
More file actions
115 lines (86 loc) · 4.62 KB
/
api_untrusted.h
File metadata and controls
115 lines (86 loc) · 4.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
#ifndef API_UNSTRUSTED_H
#define API_UNSTRUSTED_H
#include "api_types.h"
#include "api_util.h"
static inline api_result_t sm_enclave_create (enclave_id_t enclave_id, uintptr_t ev_base, uintptr_t ev_mask, uint64_t num_mailboxes, bool debug) {
return SM_API_CALL(SM_ENCLAVE_CREATE, enclave_id, ev_base, ev_mask, num_mailboxes, debug, 0, 0);
}
static inline api_result_t sm_enclave_delete (enclave_id_t enclave_id) {
return SM_API_CALL(SM_ENCLAVE_DELETE, enclave_id, 0, 0, 0, 0, 0, 0);
}
static inline api_result_t sm_enclave_enter (enclave_id_t enclave_id, thread_id_t thread_id) {
return SM_API_CALL(SM_ENCLAVE_ENTER, enclave_id, thread_id, 0, 0, 0, 0, 0);
}
static inline api_result_t sm_enclave_init (enclave_id_t enclave_id) {
return SM_API_CALL(SM_ENCLAVE_INIT, enclave_id, 0, 0, 0, 0, 0, 0);
}
static inline api_result_t sm_enclave_load_handler (enclave_id_t enclave_id, uintptr_t phys_addr) {
return SM_API_CALL(SM_ENCLAVE_LOAD_HANDLER, enclave_id, phys_addr, 0, 0, 0, 0, 0);
}
static inline api_result_t sm_enclave_load_page_table (enclave_id_t enclave_id, phys_ptr_t phys_addr, uintptr_t virtual_addr, uint64_t level, uintptr_t acl) {
return SM_API_CALL(SM_ENCLAVE_LOAD_PAGE_TABLE, enclave_id, phys_addr, virtual_addr, level, acl, 0, 0);
}
static inline api_result_t sm_enclave_load_page (enclave_id_t enclave_id, uintptr_t phys_addr, uintptr_t virtual_addr, uintptr_t os_addr, uintptr_t acl) {
return SM_API_CALL(SM_ENCLAVE_LOAD_PAGE, enclave_id, phys_addr, virtual_addr, os_addr, acl, 0, 0);
}
static inline uint64_t sm_enclave_metadata_pages (uint64_t num_mailboxes) {
return SM_API_CALL(SM_ENCLAVE_METADATA_PAGES, num_mailboxes, 0, 0, 0, 0, 0, 0);
}
static inline api_result_t sm_enclave_get_attest (enclave_id_t enclave_id, void * addr_measurement, void * addr_pk, void * addr_sig) {
return SM_API_CALL(SM_ENCLAVE_GET_ATTEST, enclave_id, addr_measurement, addr_pk, addr_sig, 0, 0, 0);
}
static inline api_result_t sm_get_public_field (public_field_t field, void * addr) {
return SM_API_CALL(SM_GET_PUBLIC_FIELD, field, addr, 0, 0, 0, 0, 0);
}
static inline api_result_t sm_mail_accept(mailbox_id_t mailbox_id, enclave_id_t expected_sender) {
return SM_API_CALL(SM_MAIL_ACCEPT, mailbox_id, expected_sender, 0, 0, 0, 0, 0);
}
static inline api_result_t sm_mail_receive(mailbox_id_t mailbox_id, void *out_message, void *out_sender_measurement) {
return SM_API_CALL(SM_MAIL_RECEIVE, mailbox_id, out_message, out_sender_measurement, 0, 0, 0, 0);
}
static inline api_result_t sm_mail_send(enclave_id_t enclave_id, mailbox_id_t mailbox_id, void * addr) {
return SM_API_CALL(SM_MAIL_SEND, enclave_id, mailbox_id, addr, 0, 0, 0, 0);
}
static inline api_result_t sm_region_assign (region_id_t id, enclave_id_t new_owner) {
return SM_API_CALL(SM_REGION_ASSIGN, id, new_owner, 0, 0, 0, 0, 0);
}
static inline api_result_t sm_region_block (region_id_t id) {
return SM_API_CALL(SM_REGION_BLOCK, id, 0, 0, 0, 0, 0, 0);
}
static inline api_result_t sm_region_update () {
return SM_API_CALL(SM_REGION_UPDATE, 0, 0, 0, 0, 0, 0, 0);
}
static inline api_result_t sm_region_free (region_id_t id) {
return SM_API_CALL(SM_REGION_FREE, id, 0, 0, 0, 0, 0, 0);
}
static inline api_result_t sm_region_metadata_create (region_id_t dram_region) {
return SM_API_CALL(SM_REGION_METADATA_CREATE, dram_region, 0, 0, 0, 0, 0, 0);
}
static inline uint64_t sm_region_metadata_pages(void) {
return SM_API_CALL(SM_REGION_METADATA_PAGES, 0, 0, 0, 0, 0, 0, 0);
}
static inline uint64_t sm_region_metadata_start(void) {
return SM_API_CALL(SM_REGION_METADATA_START, 0, 0, 0, 0, 0, 0, 0);
}
static inline enclave_id_t sm_region_owner (region_id_t id) {
return SM_API_CALL(SM_REGION_OWNER, id, 0, 0, 0, 0, 0, 0);
}
static inline region_state_t sm_region_state (region_id_t id) {
return SM_API_CALL(SM_REGION_STATE, id, 0, 0, 0, 0, 0, 0);
}
static inline api_result_t sm_region_cache_partitioning ( cache_partition_t *part ) {
return SM_API_CALL(SM_REGION_CACHE_PART, part, 0, 0, 0, 0, 0, 0);
}
static inline api_result_t sm_region_flush ( region_id_t id ) {
return SM_API_CALL(SM_REGION_FLUSH, id, 0, 0, 0, 0, 0, 0);
}
static inline api_result_t sm_thread_delete (thread_id_t thread_id) {
return SM_API_CALL(SM_THREAD_DELETE, thread_id, 0, 0, 0, 0, 0, 0);
}
static inline api_result_t sm_thread_load (enclave_id_t enclave_id, thread_id_t thread_id, uintptr_t entry_pc, uintptr_t entry_stack, uint64_t timer_limit) {
return SM_API_CALL(SM_THREAD_LOAD, enclave_id, thread_id, entry_pc, entry_stack, timer_limit, 0, 0);
}
static inline uint64_t sm_thread_metadata_pages(void) {
return SM_API_CALL(SM_THREAD_METADATA_PAGES, 0, 0, 0, 0, 0, 0, 0);
}
#endif // API_UNSTRUSTED_H