|
22 | 22 |
|
23 | 23 | // We have to use RWLock from rust repo, it is defined in: |
24 | 24 | // src/libstd/sys/sgx/rwlock.rs. |
25 | | -// rwlock.rs has compile time check to ensure sizeof(RWLock) = 144. |
| 25 | +// rwlock.rs has a compile time check to ensure the size and alignment matches |
| 26 | +// the Rust definition. |
26 | 27 | typedef struct { |
27 | | - unsigned char opaque[144]; |
| 28 | + void *opaque; |
28 | 29 | } RWLock; |
29 | 30 |
|
30 | | -// The below is obtained by printing initialized bytes |
31 | | -// for RWLock in rust repo: src/libstd/sys/sgx/rwlock.rs. |
32 | | -#define RWLOCK_INIT { { \ |
33 | | - /* 0x00 */ 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, \ |
34 | | - /* 0x10 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, \ |
35 | | - /* 0x20 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, \ |
36 | | - /* 0x30 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, \ |
37 | | - /* 0x40 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, \ |
38 | | - /* 0x50 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, \ |
39 | | - /* 0x60 */ 0x2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, \ |
40 | | - /* 0x70 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, \ |
41 | | - /* 0x80 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, \ |
42 | | - } } |
| 31 | +#define RWLOCK_INIT \ |
| 32 | + { (void *)0 } |
43 | 33 |
|
44 | 34 | // These are the functions exposed by SGX-Rust. |
45 | 35 | // The rust changes are available at: |
|
0 commit comments