<?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 Several notes: in Intel® Software Guard Extensions (Intel® SGX)</title>
    <link>https://community.intel.com/t5/Intel-Software-Guard-Extensions/Intel-SGX-custom-exception-handler/m-p/1110364#M1271</link>
    <description>&lt;P&gt;Several notes:&lt;BR /&gt;
	1. OCalls are not allowed in exception handlers. &amp;nbsp;The "printf" function is assumed to be supported as an OCall since I/O instructions are not supported within an enclave.&lt;/P&gt;

&lt;P&gt;2. For the exception handler itself, "ex_handler", the return value should be:&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;SPAN style="font-size: 1em; line-height: 1.5;"&gt;#define EXCEPTION_CONTINUE_SEARCH&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="font-size: 1em; line-height: 1.5;"&gt;#define EXCEPTION_CONTINUE_EXECUTION&amp;nbsp;&amp;nbsp;&amp;nbsp; -1&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 15 Mar 2016 15:54:25 GMT</pubDate>
    <dc:creator>Derek_B_Intel</dc:creator>
    <dc:date>2016-03-15T15:54:25Z</dc:date>
    <item>
      <title>Intel SGX custom exception handler</title>
      <link>https://community.intel.com/t5/Intel-Software-Guard-Extensions/Intel-SGX-custom-exception-handler/m-p/1110363#M1270</link>
      <description>&lt;P&gt;Hello, I tried to use a custom exception handler inside an enclave with real hardware, but it wasn't called. #include "sgx_trts_exception.h" int ex_handler(sgx_exception_info_t *info) { printf("vec: %d, type: %d, eip: %u\n", info-&amp;gt;exception_vector, info-&amp;gt;exception_type, info-&amp;gt;cpu_context.eip); return 1; } ... void init() { ... void *handler = sgx_register_exception_handler(0 /* and 1 */, &amp;amp;ex_handler); printf("handler: %u\n", handler); ... // divide by zero } sgx_register_exception_handler returned a non-zero value, but when the enclave executed a DIV0 instruction, it was just killed without calling the custom exception handler. Are there any other procedures to register a custom exception handler?&lt;/P&gt;</description>
      <pubDate>Mon, 14 Mar 2016 23:31:45 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Software-Guard-Extensions/Intel-SGX-custom-exception-handler/m-p/1110363#M1270</guid>
      <dc:creator>Sangho_L_</dc:creator>
      <dc:date>2016-03-14T23:31:45Z</dc:date>
    </item>
    <item>
      <title>Several notes:</title>
      <link>https://community.intel.com/t5/Intel-Software-Guard-Extensions/Intel-SGX-custom-exception-handler/m-p/1110364#M1271</link>
      <description>&lt;P&gt;Several notes:&lt;BR /&gt;
	1. OCalls are not allowed in exception handlers. &amp;nbsp;The "printf" function is assumed to be supported as an OCall since I/O instructions are not supported within an enclave.&lt;/P&gt;

&lt;P&gt;2. For the exception handler itself, "ex_handler", the return value should be:&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;SPAN style="font-size: 1em; line-height: 1.5;"&gt;#define EXCEPTION_CONTINUE_SEARCH&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="font-size: 1em; line-height: 1.5;"&gt;#define EXCEPTION_CONTINUE_EXECUTION&amp;nbsp;&amp;nbsp;&amp;nbsp; -1&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Mar 2016 15:54:25 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Software-Guard-Extensions/Intel-SGX-custom-exception-handler/m-p/1110364#M1271</guid>
      <dc:creator>Derek_B_Intel</dc:creator>
      <dc:date>2016-03-15T15:54:25Z</dc:date>
    </item>
    <item>
      <title>Thanks for your answer.</title>
      <link>https://community.intel.com/t5/Intel-Software-Guard-Extensions/Intel-SGX-custom-exception-handler/m-p/1110365#M1272</link>
      <description>Thanks for your answer.

Now I want to advance RIP to ignore the faulting instruction, but I can't find a way to access TCS or SSA to change the stored RIP.
Could you let me know how can I access such data structures?</description>
      <pubDate>Wed, 16 Mar 2016 18:54:24 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Software-Guard-Extensions/Intel-SGX-custom-exception-handler/m-p/1110365#M1272</guid>
      <dc:creator>Sangho_L_</dc:creator>
      <dc:date>2016-03-16T18:54:24Z</dc:date>
    </item>
    <item>
      <title>The exception handler has one</title>
      <link>https://community.intel.com/t5/Intel-Software-Guard-Extensions/Intel-SGX-custom-exception-handler/m-p/1110366#M1273</link>
      <description>&lt;P&gt;The exception handler has one parameter, a pointer to sgx_exception_info_t.&lt;/P&gt;

&lt;P&gt;The sgx_cpu_context_t part of this parameter is loaded with the CPU registers from the SSA frame.&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 1em; line-height: 1.5;"&gt;After the exception handler returns and only if it returns &lt;/SPAN&gt;&lt;SPAN style="font-size: 1em; line-height: 1.5;"&gt;EXCEPTION_CONTINUE_EXECUTION, which indicates the exception has been handled, the updated CPU context values will be stored back into the SSA frame.&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Mar 2016 18:29:26 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Software-Guard-Extensions/Intel-SGX-custom-exception-handler/m-p/1110366#M1273</guid>
      <dc:creator>Juan_d_Intel</dc:creator>
      <dc:date>2016-03-30T18:29:26Z</dc:date>
    </item>
  </channel>
</rss>

