Parcourir la source

[Pal/Linux-SGX] OCALL cleanup: remove ocall_print_string()

Dmitrii Kuvaiskii il y a 4 ans
Parent
commit
34168de464

+ 1 - 1
Pal/src/host/Linux-SGX/db_streams.c

@@ -47,7 +47,7 @@ typedef __kernel_pid_t pid_t;
 #include "enclave_pages.h"
 
 void _DkPrintConsole(const void* buf, int size) {
-    ocall_print_string(buf, size);
+    ocall_write(2 /*stderr*/, buf, size);
 }
 
 bool stataccess(struct stat* stat, int acc) {

+ 0 - 30
Pal/src/host/Linux-SGX/enclave_ocalls.c

@@ -35,36 +35,6 @@ noreturn void ocall_exit(int exitcode, int is_exitgroup)
     }
 }
 
-int ocall_print_string (const char * str, unsigned int length)
-{
-    int retval = 0;
-    ms_ocall_print_string_t * ms;
-
-    ms = sgx_alloc_on_ustack(sizeof(*ms));
-    if (!ms) {
-        sgx_reset_ustack();
-        return -EPERM;
-    }
-
-    if (!str || length <= 0) {
-        sgx_reset_ustack();
-        return -EPERM;
-    }
-
-    ms->ms_length = length;
-    ms->ms_str = sgx_copy_to_ustack(str, length);
-
-    if (!ms->ms_str) {
-        sgx_reset_ustack();
-        return -EPERM;
-    }
-
-    retval = sgx_ocall(OCALL_PRINT_STRING, ms);
-
-    sgx_reset_ustack();
-    return retval;
-}
-
 int ocall_alloc_untrusted (uint64_t size, void ** mem)
 {
     int retval = 0;

+ 0 - 2
Pal/src/host/Linux-SGX/enclave_ocalls.h

@@ -10,8 +10,6 @@
 
 noreturn void ocall_exit (int exitcode, int is_exitgroup);
 
-int ocall_print_string (const char * str, unsigned int length);
-
 int ocall_alloc_untrusted (uint64_t size, void ** mem);
 
 int ocall_map_untrusted (int fd, uint64_t offset,

+ 0 - 6
Pal/src/host/Linux-SGX/ocall_types.h

@@ -21,7 +21,6 @@ typedef int (*sgx_ocall_fn_t)(void*);
 
 enum {
     OCALL_EXIT = 0,
-    OCALL_PRINT_STRING,
     OCALL_ALLOC_UNTRUSTED,
     OCALL_MAP_UNTRUSTED,
     OCALL_UNMAP_UNTRUSTED,
@@ -68,11 +67,6 @@ typedef struct {
     int ms_is_exitgroup;
 } ms_ocall_exit_t;
 
-typedef struct {
-    const char * ms_str;
-    unsigned int ms_length;
-} ms_ocall_print_string_t;
-
 typedef struct {
     uint64_t ms_size;
     void * ms_mem;

+ 0 - 8
Pal/src/host/Linux-SGX/sgx_enclave.c

@@ -44,13 +44,6 @@ static int sgx_ocall_exit(void* pms)
     return 0;
 }
 
-static int sgx_ocall_print_string(void * pms)
-{
-    ms_ocall_print_string_t * ms = (ms_ocall_print_string_t *) pms;
-    INLINE_SYSCALL(write, 3, 2, ms->ms_str, ms->ms_length);
-    return 0;
-}
-
 static int sgx_ocall_alloc_untrusted(void * pms)
 {
     ms_ocall_alloc_untrusted_t * ms = (ms_ocall_alloc_untrusted_t *) pms;
@@ -696,7 +689,6 @@ static int sgx_ocall_get_attestation(void* pms) {
 
 sgx_ocall_fn_t ocall_table[OCALL_NR] = {
         [OCALL_EXIT]            = sgx_ocall_exit,
-        [OCALL_PRINT_STRING]    = sgx_ocall_print_string,
         [OCALL_ALLOC_UNTRUSTED] = sgx_ocall_alloc_untrusted,
         [OCALL_MAP_UNTRUSTED]   = sgx_ocall_map_untrusted,
         [OCALL_UNMAP_UNTRUSTED] = sgx_ocall_unmap_untrusted,