Forráskód Böngészése

[PAL/Linux-SGX] Use PRESET_PAGESIZE instead of hardcoded "4096"

Change applies to the ocall_read, ocall_write, ocall_sock_recv,
and ocall_sock_send functions.
smherwig 5 éve
szülő
commit
ac692e1544
1 módosított fájl, 4 hozzáadás és 4 törlés
  1. 4 4
      Pal/src/host/Linux-SGX/enclave_ocalls.c

+ 4 - 4
Pal/src/host/Linux-SGX/enclave_ocalls.c

@@ -219,7 +219,7 @@ int ocall_read (int fd, void * buf, unsigned int count)
     int retval = 0;
     void * obuf = NULL;
 
-    if (count > 4096) {
+    if (count > PRESET_PAGESIZE) {
         retval = ocall_alloc_untrusted(ALLOC_ALIGNUP(count), &obuf);
         if (IS_ERR(retval))
             return retval;
@@ -252,7 +252,7 @@ int ocall_write (int fd, const void * buf, unsigned int count)
     int retval = 0;
     void * obuf = NULL;
 
-    if (count > 4096) {
+    if (count > PRESET_PAGESIZE) {
         retval = ocall_alloc_untrusted(ALLOC_ALIGNUP(count), &obuf);
         if (IS_ERR(retval))
             return retval;
@@ -584,7 +584,7 @@ int ocall_sock_recv (int sockfd, void * buf, unsigned int count,
     void *obuf = NULL;
     unsigned int len = addrlen ? *addrlen : 0;
 
-    if ((count + len) > 4096) {
+    if ((count + len) > PRESET_PAGESIZE) {
         retval = ocall_alloc_untrusted(ALLOC_ALIGNUP(count), &obuf);
         if (retval < 0)
             return retval;
@@ -631,7 +631,7 @@ int ocall_sock_send (int sockfd, const void * buf, unsigned int count,
     int retval = 0;
     void *obuf = NULL;
 
-    if ((count + addrlen) > 4096) {
+    if ((count + addrlen) > PRESET_PAGESIZE) {
         retval = ocall_alloc_untrusted(ALLOC_ALIGNUP(count), &obuf);
         if (retval < 0)
             return retval;