| ... | @@ -1,4 +1,5 @@ | ... | @@ -1,4 +1,5 @@ |
| 1 | const std = @import("std"); | 1 | const std = @import("std"); |
| | 2 | const builtin = @import("builtin"); |
| 2 | | 3 | |
| 3 | export var _tls_index: u32 = std.os.windows.TLS_OUT_OF_INDEXES; | 4 | export var _tls_index: u32 = std.os.windows.TLS_OUT_OF_INDEXES; |
| 4 | export var _tls_start: u8 linksection(".tls") = 0; | 5 | export var _tls_start: u8 linksection(".tls") = 0; |
| ... | @@ -6,6 +7,17 @@ export var _tls_end: u8 linksection(".tls$ZZZ") = 0; | ... | @@ -6,6 +7,17 @@ export var _tls_end: u8 linksection(".tls$ZZZ") = 0; |
| 6 | export var __xl_a: std.os.windows.PIMAGE_TLS_CALLBACK linksection(".CRT$XLA") = null; | 7 | export var __xl_a: std.os.windows.PIMAGE_TLS_CALLBACK linksection(".CRT$XLA") = null; |
| 7 | export var __xl_z: std.os.windows.PIMAGE_TLS_CALLBACK linksection(".CRT$XLZ") = null; | 8 | export var __xl_z: std.os.windows.PIMAGE_TLS_CALLBACK linksection(".CRT$XLZ") = null; |
| 8 | | 9 | |
| | 10 | comptime { |
| | 11 | if (builtin.arch == .i386) { |
| | 12 | // The __tls_array is the offset of the ThreadLocalStoragePointer field |
| | 13 | // in the TEB block whose base address held in the %fs segment. |
| | 14 | asm ( |
| | 15 | \\ .global __tls_array |
| | 16 | \\ __tls_array = 0x2C |
| | 17 | ); |
| | 18 | } |
| | 19 | } |
| | 20 | |
| 9 | // TODO this is how I would like it to be expressed | 21 | // TODO this is how I would like it to be expressed |
| 10 | // TODO also note, ReactOS has a +1 on StartAddressOfRawData and AddressOfCallBacks. Investigate | 22 | // TODO also note, ReactOS has a +1 on StartAddressOfRawData and AddressOfCallBacks. Investigate |
| 11 | // why they do that. | 23 | // why they do that. |