Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/libstd/sys/sgx/abi/entry.S
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,14 @@ IMAGE_BASE:

/* We can store a bunch of data in the gap between MXCSR and the XSAVE header */

/* MXCSR initialization value for ABI */
.Lmxcsr_init:
.int 0x1f80

/* x87 FPU control word initialization value for ABI */
.Lfpucw_init:
.int 0x037f
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is setting one of the reserved bits (6th) to 1?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the default from the Intel SDM, Vol. 1, §8.1.5


/* The following symbols point at read-only data that will be filled in by the */
/* post-linker. */

Expand Down Expand Up @@ -173,6 +181,9 @@ sgx_entry:
mov %gs:tcsls_last_rsp,%r11
test %r11,%r11
jnz .Lusercall_ret
/* reset user state */
ldmxcsr .Lmxcsr_init(%rip)
fldcw .Lfpucw_init(%rip)
/* setup stack */
mov %gs:tcsls_tos,%rsp /* initially, RSP is not set to the correct value */
/* here. This is fixed below under "adjust stack". */
Expand Down