0

我正在尝试了解如何创建自己的 sgx 应用程序,因此我正在仔细检查 SDK 示例。我想知道 SGX_CDECL 的用途是什么?

在下面的示例中以及一般情况下

/* Application entry */
int SGX_CDECL main(int argc, char *argv[])
{
    (void)(argc);
    (void)(argv);


    /* Initialize the enclave */
    if(initialize_enclave() < 0){
        printf("Enter a character before exit ...\n");
        getchar();
        return -1;
    }

    /* Utilize edger8r attributes */
    edger8r_array_attributes();
    edger8r_pointer_attributes();
    edger8r_type_attributes();
    edger8r_function_attributes();

    /* Utilize trusted libraries */
    ecall_libc_functions();
    ecall_libcxx_functions();
    ecall_thread_functions();

    /* Destroy the enclave */
    sgx_destroy_enclave(global_eid);

    printf("Info: SampleEnclave successfully returned.\n");

    printf("Enter a character before exit ...\n");
    getchar();
    return 0;
}
4

1 回答 1

0

看看https://en.wikipedia.org/wiki/X86_calling_conventions#cdecl

cdecl,子程序参数在堆栈上传递。EAX 寄存器中返回整数值和内存地址,ST0 x87 寄存器中返回浮点值。寄存器 EAX、ECX 和 EDX 是调用者保存的,其余的是被调用者保存的。

于 2019-04-06T23:24:26.380 回答