mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-27 14:58:30 +00:00
Upgrade to Cosmopolitan GCC 11.2.0 for x86_64
This commit is contained in:
parent
682b74ed88
commit
39f20dbb13
137 changed files with 48523 additions and 34001 deletions
266
third_party/intel/sgxintrin.internal.h
vendored
266
third_party/intel/sgxintrin.internal.h
vendored
|
@ -1,87 +1,31 @@
|
|||
/* clang-format off */
|
||||
#if defined(__x86_64__) && !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
#ifndef _SGXINTRIN_H_INCLUDED
|
||||
#define _SGXINTRIN_H_INCLUDED
|
||||
#ifdef __x86_64__
|
||||
|
||||
#ifndef __SGX__
|
||||
#pragma GCC push_options
|
||||
#pragma GCC target("sgx")
|
||||
#define __DISABLE_SGX__
|
||||
#endif /* __SGX__ */
|
||||
|
||||
#define __encls_bc(leaf, b, c, retval) \
|
||||
__asm__ __volatile__("encls\n\t" \
|
||||
: "=a"(retval) \
|
||||
: "a"(leaf), "b"(b), "c"(c) \
|
||||
: "cc")
|
||||
|
||||
#define __encls_bcd(leaf, b, c, d, retval) \
|
||||
__asm__ __volatile__("encls\n\t" \
|
||||
: "=a"(retval) \
|
||||
: "a"(leaf), "b"(b), "c"(c), "d"(d) \
|
||||
: "cc")
|
||||
|
||||
#define __encls_c(leaf, c, retval) \
|
||||
__asm__ __volatile__("encls\n\t" : "=a"(retval) : "a"(leaf), "c"(c) : "cc")
|
||||
|
||||
#define __encls_edbgrd(leaf, b, c, retval) \
|
||||
__asm__ __volatile__("encls\n\t" : "=a"(retval), "=b"(b) : "a"(leaf), "c"(c))
|
||||
|
||||
#define __encls_generic(leaf, b, c, d, retval) \
|
||||
__asm__ __volatile__("encls\n\t" \
|
||||
: "=a"(retval), "=b"(b), "=c"(c), "=d"(d) \
|
||||
: "a"(leaf), "b"(b), "c"(c), "d"(d) \
|
||||
: "cc")
|
||||
|
||||
#define __enclu_bc(leaf, b, c, retval) \
|
||||
__asm__ __volatile__("enclu\n\t" \
|
||||
: "=a"(retval) \
|
||||
: "a"(leaf), "b"(b), "c"(c) \
|
||||
: "cc")
|
||||
|
||||
#define __enclu_bcd(leaf, b, c, d, retval) \
|
||||
__asm__ __volatile__("enclu\n\t" \
|
||||
: "=a"(retval) \
|
||||
: "a"(leaf), "b"(b), "c"(c), "d"(d) \
|
||||
: "cc")
|
||||
|
||||
#define __enclu_eenter(leaf, b, c, retval) \
|
||||
__asm__ __volatile__("enclu\n\t" \
|
||||
: "=a"(retval), "=c"(c) \
|
||||
: "a"(leaf), "b"(b), "c"(c) \
|
||||
: "cc")
|
||||
|
||||
#define __enclu_eexit(leaf, b, c, retval) \
|
||||
__asm__ __volatile__("enclu\n\t" \
|
||||
: "=a"(retval), "=c"(c) \
|
||||
: "a"(leaf), "b"(b) \
|
||||
: "cc")
|
||||
|
||||
#define __enclu_generic(leaf, b, c, d, retval) \
|
||||
__asm__ __volatile__("enclu\n\t" \
|
||||
: "=a"(retval), "=b"(b), "=c"(c), "=d"(d) \
|
||||
: "a"(leaf), "b"(b), "c"(c), "d"(d) \
|
||||
: "cc")
|
||||
|
||||
#define __enclv_bc(leaf, b, c, retval) \
|
||||
__asm__ __volatile__("enclv\n\t" \
|
||||
: "=a"(retval) \
|
||||
: "a"(leaf), "b"(b), "c"(c) \
|
||||
: "cc")
|
||||
|
||||
#define __enclv_cd(leaf, c, d, retval) \
|
||||
__asm__ __volatile__("enclv\n\t" \
|
||||
: "=a"(retval) \
|
||||
: "a"(leaf), "c"(c), "d"(d) \
|
||||
: "cc")
|
||||
|
||||
#define __enclv_generic(leaf, b, c, d, retval) \
|
||||
__asm__ __volatile__("enclv\n\t" \
|
||||
: "=a"(retval), "=b"(b), "=c"(b), "=d"(d) \
|
||||
: "a"(leaf), "b"(b), "c"(c), "d"(d) \
|
||||
: "cc")
|
||||
|
||||
__funline unsigned int _encls_u32(const unsigned int __L, size_t __D[]) {
|
||||
enum __encls_type {
|
||||
#endif
|
||||
#define __encls_bc(leaf, b, c, retval) __asm__ __volatile__ ("encls\n\t" : "=a" (retval) : "a" (leaf), "b" (b), "c" (c) : "cc")
|
||||
#define __encls_bcd(leaf, b, c, d, retval) __asm__ __volatile__("encls\n\t" : "=a" (retval) : "a" (leaf), "b" (b), "c" (c), "d" (d) : "cc")
|
||||
#define __encls_c(leaf, c, retval) __asm__ __volatile__("encls\n\t" : "=a" (retval) : "a" (leaf), "c" (c) : "cc")
|
||||
#define __encls_edbgrd(leaf, b, c, retval) __asm__ __volatile__("encls\n\t" : "=a" (retval), "=b" (b) : "a" (leaf), "c" (c))
|
||||
#define __encls_generic(leaf, b, c, d, retval) __asm__ __volatile__("encls\n\t" : "=a" (retval), "=b" (b), "=c" (c), "=d" (d) : "a" (leaf), "b" (b), "c" (c), "d" (d) : "cc")
|
||||
#define __enclu_bc(leaf, b, c, retval) __asm__ __volatile__("enclu\n\t" : "=a" (retval) : "a" (leaf), "b" (b), "c" (c) : "cc")
|
||||
#define __enclu_bcd(leaf, b, c, d, retval) __asm__ __volatile__("enclu\n\t" : "=a" (retval) : "a" (leaf), "b" (b), "c" (c), "d" (d) : "cc")
|
||||
#define __enclu_eenter(leaf, b, c, retval) __asm__ __volatile__("enclu\n\t" : "=a" (retval), "=c" (c) : "a" (leaf), "b" (b), "c" (c) : "cc")
|
||||
#define __enclu_eexit(leaf, b, c, retval) __asm__ __volatile__("enclu\n\t" : "=a" (retval), "=c" (c) : "a" (leaf), "b" (b) : "cc")
|
||||
#define __enclu_generic(leaf, b, c, d, retval) __asm__ __volatile__("enclu\n\t" : "=a" (retval), "=b" (b), "=c" (c), "=d" (d) : "a" (leaf), "b" (b), "c" (c), "d" (d) : "cc")
|
||||
#define __enclv_bc(leaf, b, c, retval) __asm__ __volatile__("enclv\n\t" : "=a" (retval) : "a" (leaf), "b" (b), "c" (c) : "cc")
|
||||
#define __enclv_cd(leaf, c, d, retval) __asm__ __volatile__("enclv\n\t" : "=a" (retval) : "a" (leaf), "c" (c), "d" (d) : "cc")
|
||||
#define __enclv_generic(leaf, b, c, d, retval) __asm__ __volatile__("enclv\n\t" : "=a" (retval), "=b" (b), "=c" (b), "=d" (d) : "a" (leaf), "b" (b), "c" (c), "d" (d) : "cc")
|
||||
extern __inline unsigned int
|
||||
__attribute__((__gnu_inline__, __always_inline__, __artificial__))
|
||||
_encls_u32 (const unsigned int __L, size_t __D[])
|
||||
{
|
||||
enum __encls_type
|
||||
{
|
||||
__SGX_ECREATE = 0x00,
|
||||
__SGX_EADD = 0x01,
|
||||
__SGX_EINIT = 0x02,
|
||||
|
@ -105,46 +49,49 @@ __funline unsigned int _encls_u32(const unsigned int __L, size_t __D[]) {
|
|||
};
|
||||
enum __encls_type __T = (enum __encls_type)__L;
|
||||
unsigned int __R = 0;
|
||||
if (!__builtin_constant_p(__T))
|
||||
__encls_generic(__L, __D[0], __D[1], __D[2], __R);
|
||||
else
|
||||
switch (__T) {
|
||||
case __SGX_ECREATE:
|
||||
case __SGX_EADD:
|
||||
case __SGX_EDBGWR:
|
||||
case __SGX_EEXTEND:
|
||||
case __SGX_EPA:
|
||||
case __SGX_EMODPR:
|
||||
case __SGX_EMODT:
|
||||
case __SGX_EAUG:
|
||||
case __SGX_ERDINFO:
|
||||
__encls_bc(__L, __D[0], __D[1], __R);
|
||||
break;
|
||||
case __SGX_EINIT:
|
||||
case __SGX_ELDB:
|
||||
case __SGX_ELDU:
|
||||
case __SGX_EWB:
|
||||
case __SGX_ELDBC:
|
||||
case __SGX_ELDUC:
|
||||
__encls_bcd(__L, __D[0], __D[1], __D[2], __R);
|
||||
break;
|
||||
case __SGX_EREMOVE:
|
||||
case __SGX_EBLOCK:
|
||||
case __SGX_ETRACK:
|
||||
case __SGX_ETRACKC:
|
||||
__encls_c(__L, __D[1], __R);
|
||||
break;
|
||||
case __SGX_EDBGRD:
|
||||
__encls_edbgrd(__L, __D[0], __D[1], __R);
|
||||
break;
|
||||
default:
|
||||
__encls_generic(__L, __D[0], __D[1], __D[2], __R);
|
||||
if (!__builtin_constant_p (__T))
|
||||
__encls_generic (__L, __D[0], __D[1], __D[2], __R);
|
||||
else switch (__T)
|
||||
{
|
||||
case __SGX_ECREATE:
|
||||
case __SGX_EADD:
|
||||
case __SGX_EDBGWR:
|
||||
case __SGX_EEXTEND:
|
||||
case __SGX_EPA:
|
||||
case __SGX_EMODPR:
|
||||
case __SGX_EMODT:
|
||||
case __SGX_EAUG:
|
||||
case __SGX_ERDINFO:
|
||||
__encls_bc (__L, __D[0], __D[1], __R);
|
||||
break;
|
||||
case __SGX_EINIT:
|
||||
case __SGX_ELDB:
|
||||
case __SGX_ELDU:
|
||||
case __SGX_EWB:
|
||||
case __SGX_ELDBC:
|
||||
case __SGX_ELDUC:
|
||||
__encls_bcd (__L, __D[0], __D[1], __D[2], __R);
|
||||
break;
|
||||
case __SGX_EREMOVE:
|
||||
case __SGX_EBLOCK:
|
||||
case __SGX_ETRACK:
|
||||
case __SGX_ETRACKC:
|
||||
__encls_c (__L, __D[1], __R);
|
||||
break;
|
||||
case __SGX_EDBGRD:
|
||||
__encls_edbgrd (__L, __D[0], __D[1], __R);
|
||||
break;
|
||||
default:
|
||||
__encls_generic (__L, __D[0], __D[1], __D[2], __R);
|
||||
}
|
||||
return __R;
|
||||
}
|
||||
|
||||
__funline unsigned int _enclu_u32(const unsigned int __L, size_t __D[]) {
|
||||
enum __enclu_type {
|
||||
extern __inline unsigned int
|
||||
__attribute__((__gnu_inline__, __always_inline__, __artificial__))
|
||||
_enclu_u32 (const unsigned int __L, size_t __D[])
|
||||
{
|
||||
enum __enclu_type
|
||||
{
|
||||
__SGX_EREPORT = 0x00,
|
||||
__SGX_EGETKEY = 0x01,
|
||||
__SGX_EENTER = 0x02,
|
||||
|
@ -154,62 +101,63 @@ __funline unsigned int _enclu_u32(const unsigned int __L, size_t __D[]) {
|
|||
__SGX_EMODPE = 0x06,
|
||||
__SGX_EACCEPTCOPY = 0x07
|
||||
};
|
||||
enum __enclu_type __T = (enum __enclu_type)__L;
|
||||
enum __enclu_type __T = (enum __enclu_type) __L;
|
||||
unsigned int __R = 0;
|
||||
if (!__builtin_constant_p(__T))
|
||||
__enclu_generic(__L, __D[0], __D[1], __D[2], __R);
|
||||
else
|
||||
switch (__T) {
|
||||
case __SGX_EREPORT:
|
||||
case __SGX_EACCEPTCOPY:
|
||||
__enclu_bcd(__L, __D[0], __D[1], __D[2], __R);
|
||||
break;
|
||||
case __SGX_EGETKEY:
|
||||
case __SGX_ERESUME:
|
||||
case __SGX_EACCEPT:
|
||||
case __SGX_EMODPE:
|
||||
__enclu_bc(__L, __D[0], __D[1], __R);
|
||||
break;
|
||||
case __SGX_EENTER:
|
||||
__enclu_eenter(__L, __D[0], __D[1], __R);
|
||||
break;
|
||||
case __SGX_EEXIT:
|
||||
__enclu_eexit(__L, __D[0], __D[1], __R);
|
||||
break;
|
||||
default:
|
||||
__enclu_generic(__L, __D[0], __D[1], __D[2], __R);
|
||||
if (!__builtin_constant_p (__T))
|
||||
__enclu_generic (__L, __D[0], __D[1], __D[2], __R);
|
||||
else switch (__T)
|
||||
{
|
||||
case __SGX_EREPORT:
|
||||
case __SGX_EACCEPTCOPY:
|
||||
__enclu_bcd (__L, __D[0], __D[1], __D[2], __R);
|
||||
break;
|
||||
case __SGX_EGETKEY:
|
||||
case __SGX_ERESUME:
|
||||
case __SGX_EACCEPT:
|
||||
case __SGX_EMODPE:
|
||||
__enclu_bc (__L, __D[0], __D[1], __R);
|
||||
break;
|
||||
case __SGX_EENTER:
|
||||
__enclu_eenter (__L, __D[0], __D[1], __R);
|
||||
break;
|
||||
case __SGX_EEXIT:
|
||||
__enclu_eexit (__L, __D[0], __D[1], __R);
|
||||
break;
|
||||
default:
|
||||
__enclu_generic (__L, __D[0], __D[1], __D[2], __R);
|
||||
}
|
||||
return __R;
|
||||
}
|
||||
|
||||
__funline unsigned int _enclv_u32(const unsigned int __L, size_t __D[]) {
|
||||
enum __enclv_type {
|
||||
extern __inline unsigned int
|
||||
__attribute__((__gnu_inline__, __always_inline__, __artificial__))
|
||||
_enclv_u32 (const unsigned int __L, size_t __D[])
|
||||
{
|
||||
enum __enclv_type
|
||||
{
|
||||
__SGX_EDECVIRTCHILD = 0x00,
|
||||
__SGX_EINCVIRTCHILD = 0x01,
|
||||
__SGX_ESETCONTEXT = 0x02
|
||||
};
|
||||
unsigned int __R = 0;
|
||||
if (!__builtin_constant_p(__L))
|
||||
__enclv_generic(__L, __D[0], __D[1], __D[2], __R);
|
||||
else
|
||||
switch (__L) {
|
||||
case __SGX_EDECVIRTCHILD:
|
||||
case __SGX_EINCVIRTCHILD:
|
||||
__enclv_bc(__L, __D[0], __D[1], __R);
|
||||
break;
|
||||
case __SGX_ESETCONTEXT:
|
||||
__enclv_cd(__L, __D[1], __D[2], __R);
|
||||
break;
|
||||
default:
|
||||
__enclv_generic(__L, __D[0], __D[1], __D[2], __R);
|
||||
if (!__builtin_constant_p (__L))
|
||||
__enclv_generic (__L, __D[0], __D[1], __D[2], __R);
|
||||
else switch (__L)
|
||||
{
|
||||
case __SGX_EDECVIRTCHILD:
|
||||
case __SGX_EINCVIRTCHILD:
|
||||
__enclv_bc (__L, __D[0], __D[1], __R);
|
||||
break;
|
||||
case __SGX_ESETCONTEXT:
|
||||
__enclv_cd (__L, __D[1], __D[2], __R);
|
||||
break;
|
||||
default:
|
||||
__enclv_generic (__L, __D[0], __D[1], __D[2], __R);
|
||||
}
|
||||
return __R;
|
||||
}
|
||||
|
||||
#ifdef __DISABLE_SGX__
|
||||
#undef __DISABLE_SGX__
|
||||
#pragma GCC pop_options
|
||||
#endif /* __DISABLE_SGX__ */
|
||||
|
||||
#endif /* __x86_64__ */
|
||||
#endif /* _SGXINTRIN_H_INCLUDED */
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue