<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Hi, Jason. in Intel® Software Guard Extensions (Intel® SGX)</title>
    <link>https://community.intel.com/t5/Intel-Software-Guard-Extensions/How-to-understand-an-ECALL-with-out-parameter/m-p/1124747#M1692</link>
    <description>&lt;P&gt;&lt;SPAN style="font-size: 12px;"&gt;Hi, Jason.&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 12px;"&gt;ECall/OCall has nothing to do with In/Out. They are relative to different situation.&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 12px;"&gt;ECall/OCall is relative to enclave: ECall means jumping into enclave while OCall means jumping out of enclave.&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 12px;"&gt;In/Out is relative to the function: In means parameter passing into the function while Out means parameter returning from the function.&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 05 Jan 2017 01:25:08 GMT</pubDate>
    <dc:creator>Huorong_L_</dc:creator>
    <dc:date>2017-01-05T01:25:08Z</dc:date>
    <item>
      <title>How to understand an ECALL with [out] parameter?</title>
      <link>https://community.intel.com/t5/Intel-Software-Guard-Extensions/How-to-understand-an-ECALL-with-out-parameter/m-p/1124745#M1690</link>
      <description>&lt;P&gt;In Intel's SGX developer guide&amp;nbsp;&lt;A href="https://software.intel.com/en-us/node/696463"&gt;https://software.intel.com/en-us/node/696463&lt;/A&gt;, it mentions that:&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
	&lt;P class="ListParagraph_6" style="box-sizing: border-box; position: relative; left: 1em; padding-right: 1em; max-width: 100%; width: auto;"&gt;[out] – when [out] is specified for a pointer argument, the parameter is returned from the called procedure to the calling procedure. In an ECALL function an&amp;nbsp;&lt;CODE style="box-sizing: border-box; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; line-height: 1.6em;"&gt;out&lt;/CODE&gt;&amp;nbsp;parameter is passed from the enclave to the application and an OCALL function passes it from the application to the enclave.&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P class="ListParagraph_6" style="box-sizing: border-box; position: relative; left: 1em; padding-right: 1em; max-width: 100%; width: auto;"&gt;I am having some trouble understanding the ECALL with an &lt;EM&gt;[out]&amp;nbsp;&lt;/EM&gt;parameter. First of all, isn't ECALL defined to be a function call from &lt;STRONG&gt;outside &lt;/STRONG&gt;the enclave to a function &lt;STRONG&gt;inside&lt;/STRONG&gt;&amp;nbsp;the enclave? Then how could a parameter be passed from the enclave to the application?&lt;/P&gt;

&lt;P class="ListParagraph_6" style="box-sizing: border-box; position: relative; left: 1em; padding-right: 1em; max-width: 100%; width: auto;"&gt;Second of all, it said&amp;nbsp;&lt;EM&gt;the parameter is &lt;U&gt;returned&amp;nbsp;&lt;/U&gt;from the called procedure,&amp;nbsp;&lt;/EM&gt;how come a parameter can be&amp;nbsp;&lt;STRONG&gt;returned?&lt;/STRONG&gt;&lt;/P&gt;

&lt;P class="ListParagraph_6" style="box-sizing: border-box; position: relative; left: 1em; padding-right: 1em; max-width: 100%; width: auto;"&gt;&amp;nbsp;&lt;/P&gt;

&lt;P class="ListParagraph_6" style="box-sizing: border-box; position: relative; left: 1em; padding-right: 1em; max-width: 100%; width: auto;"&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Jan 2017 02:39:53 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Software-Guard-Extensions/How-to-understand-an-ECALL-with-out-parameter/m-p/1124745#M1690</guid>
      <dc:creator>jason_t_</dc:creator>
      <dc:date>2017-01-04T02:39:53Z</dc:date>
    </item>
    <item>
      <title>Hi, Jason.</title>
      <link>https://community.intel.com/t5/Intel-Software-Guard-Extensions/How-to-understand-an-ECALL-with-out-parameter/m-p/1124746#M1691</link>
      <description>&lt;P&gt;Hi, Jason.&lt;/P&gt;

&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 12px;"&gt;I am having some trouble understanding the ECALL with an&amp;nbsp;&lt;/SPAN&gt;&lt;EM style="font-size: 12px;"&gt;[out]&amp;nbsp;&lt;/EM&gt;&lt;SPAN style="font-size: 12px;"&gt;parameter. First of all, isn't ECALL defined to be a function call from&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="font-weight: 700; font-size: 12px;"&gt;outside&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="font-size: 12px;"&gt;the enclave to a function&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="font-weight: 700; font-size: 12px;"&gt;inside&lt;/SPAN&gt;&lt;SPAN style="font-size: 12px;"&gt;&amp;nbsp;the enclave? Then how could a parameter be passed from the enclave to the application?&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 12px;"&gt;Second of all, it said&amp;nbsp;&lt;/SPAN&gt;&lt;EM style="font-size: 12px;"&gt;the parameter is returned&amp;nbsp;from the called procedure,&amp;nbsp;&lt;/EM&gt;&lt;SPAN style="font-size: 12px;"&gt;how come a parameter can be&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="font-weight: 700; font-size: 12px;"&gt;returned?&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 12px;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 12px;"&gt;An ECALL means that the function will be executed inside an enclave. The &lt;EM&gt;[out]&amp;nbsp;&lt;/EM&gt;parameter means that it will be returned to the function call outside the enclave. See the example below:&lt;/SPAN&gt;&lt;/P&gt;

&lt;PRE class="brush:cpp;"&gt;// enclave.edl file
enclave {
    trusted {
        public void sum_pointers([in] int *p_int1, [in] int *p_int2, [out] int *p_result);
    };
};

// enclave.cpp file
void sum_pointers( int *p_int1, int *p_int2, int *p_result)
{
    *p_result = *p_int1 + *p_int2;
}

//app.cpp file
...
int main(){
...
    int int1 = 5, int2 = 10, result;
    sum_pointers( &amp;amp;int1, &amp;amp;int2, &amp;amp;result);
    printf("%d + %d = %d", int1, int2, result);
}&lt;/PRE&gt;

&lt;P&gt;In this example, we have p_int1 and p_int2 as &lt;EM&gt;[in] &lt;/EM&gt;parameters, while p_result is an&amp;nbsp;&lt;EM&gt;[out]&lt;/EM&gt;&amp;nbsp;parameter. The function sum_pointers is an ECALL, therefore it will be executed inside the enclave. The parameters p_int1 and p_int2 are passed into the enclave, and the parameter p_result is passed from the enclave to the application after it is executed; it works as a return of the function.&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Jan 2017 17:35:20 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Software-Guard-Extensions/How-to-understand-an-ECALL-with-out-parameter/m-p/1124746#M1691</guid>
      <dc:creator>Rodolfo_S_</dc:creator>
      <dc:date>2017-01-04T17:35:20Z</dc:date>
    </item>
    <item>
      <title>Hi, Jason.</title>
      <link>https://community.intel.com/t5/Intel-Software-Guard-Extensions/How-to-understand-an-ECALL-with-out-parameter/m-p/1124747#M1692</link>
      <description>&lt;P&gt;&lt;SPAN style="font-size: 12px;"&gt;Hi, Jason.&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 12px;"&gt;ECall/OCall has nothing to do with In/Out. They are relative to different situation.&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 12px;"&gt;ECall/OCall is relative to enclave: ECall means jumping into enclave while OCall means jumping out of enclave.&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 12px;"&gt;In/Out is relative to the function: In means parameter passing into the function while Out means parameter returning from the function.&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 05 Jan 2017 01:25:08 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Software-Guard-Extensions/How-to-understand-an-ECALL-with-out-parameter/m-p/1124747#M1692</guid>
      <dc:creator>Huorong_L_</dc:creator>
      <dc:date>2017-01-05T01:25:08Z</dc:date>
    </item>
    <item>
      <title>I appreciate your answers, I</title>
      <link>https://community.intel.com/t5/Intel-Software-Guard-Extensions/How-to-understand-an-ECALL-with-out-parameter/m-p/1124748#M1693</link>
      <description>&lt;P&gt;I appreciate your answers, I understand it now.&lt;/P&gt;</description>
      <pubDate>Thu, 05 Jan 2017 01:34:08 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Software-Guard-Extensions/How-to-understand-an-ECALL-with-out-parameter/m-p/1124748#M1693</guid>
      <dc:creator>jason_t_</dc:creator>
      <dc:date>2017-01-05T01:34:08Z</dc:date>
    </item>
  </channel>
</rss>

