Commit Graph

11 Commits

Author SHA1 Message Date
zongmin.gu
de2fcc9bc1 Fix the cpuid test case issue 2021-09-09 14:09:03 +08:00
He Sun
4260a8defc Fix two cpuid bugs
1. >> has higher precedence than &. Use parentheses to conduct & first;
2. In the latest Intel software developer's manual, cpuid leaf 06H EDX
is related to the logical processor.
2020-11-12 15:48:04 +08:00
Hui, Chunyang
32fa9fe4aa Fix cpuid test case to check SGX support accurately 2020-08-11 12:07:23 +08:00
Hui, Chunyang
5b695c9539 Format c/c++ files in src, tools and test 2020-05-27 07:09:18 +00:00
Hui, Chunyang
5bd5e1bc68 Fix cpuid failed for unprivileged user
Add "-1" to display information only for the current CPU.
2020-05-15 02:59:16 +00:00
Hui, Chunyang
3034cb992b Fix cpuid test for non-SGX platforms 2020-04-14 09:43:11 +00:00
He Sun
2357f8ed1c Refactor THROW_ERROR macro in tests
1. Rename the macro name as all uppercase letters
2. Rewrite the macro in `do { ... } while (0)` instead of `while (1) { ... }`
2019-11-28 11:10:23 +00:00
Tate, Hongliang Tian
00949d9741 Introduce GCC-base toolchain and use it by default 2019-09-06 13:02:45 +00:00
LI Qing
f37eb34038 Rewrite cpuid and rdtsc exception handlers
1. Rewrite cpuid and rdtsc exception handle in Rust
2. Rewrite cpuid test cases
3. Update Dockerfile to install cpuid tool for test
2019-09-05 13:50:34 +00:00
Tate, Hongliang Tian
c096e7d0b9 Inform Intel SGX SDK about Occlum-defined stacks
There are two types of stacks: the kernel ones and the user ones. The kernel
stacks are used by Occlum and managed by Intel SGX SDK itself, while the user
stacks are used by the threads created and managed by Occlum. These user stacks
are transparent to Intel SGX SDK so far.

The problem is that Intel SGX SDK needs to be aware of the user stacks.
SGX exception handlers will check whether the rsp value---when the exception
happened---is within the stack of the current SGX thread. If the check fails,
the registered exception handler will not be triggered. But when exceptions are
triggered by the threads running upon Occlum, the rsp value points to the user
stacks, which Intel SGX SDK are completely unware of. So the check always
fails.

Therefore, we extend Intel SGX SDK with two new APIs:

  int sgx_enable_user_stack(size_t stack_base, size_t stack_limit);
  void sgx_disable_user_stack(void);

And this commit uses the two APIs to inform Intel SGX SDK about the
Occlum-managed stacks. And the rsp checks in SGX exception handlers will
check whether rsp is within the user stacks.
2019-07-18 07:16:17 +00:00
散樗
2553298b1d Handle cpuid and rdtsc instruction
Init support for cpuid and rdtsc instruction handling in occlum.

This patch includes:
1. cpuid exception handler for all information leaves;
2. rdtsc exception handler;
3. handler registration;
4. cpuid test;
5. rdtsc test.

Signed-off-by: 散樗 <kailun.qkl@antfin.com>
2019-07-18 13:51:50 +08:00