| author | |
| committer | |
| log | 75f78bfb77d62ee3e143cb7718a21f492a0d4fa6 |
| tree | fb326f89a0d56340272c26ede45a5ff308f32ff6 |
| parent | cd5f673cae598decce04bc1d0e85775698ea48d9 |
| parent | 0ad97b41229805fac0e20d88cb24118535fbf056 |
| signature |
`std.os.linux`: Fix VDSO for mips, add VDSO for riscv5 files changed, 13 insertions(+), 7 deletions(-)
lib/std/os/linux.zig+1-1| ... | @@ -1397,7 +1397,7 @@ const VdsoClockGettime = *align(1) const fn (clockid_t, *timespec) callconv(.C) | ... | @@ -1397,7 +1397,7 @@ const VdsoClockGettime = *align(1) const fn (clockid_t, *timespec) callconv(.C) |
| 1397 | var vdso_clock_gettime: ?VdsoClockGettime = &init_vdso_clock_gettime; | 1397 | var vdso_clock_gettime: ?VdsoClockGettime = &init_vdso_clock_gettime; |
| 1398 | 1398 | ||
| 1399 | pub fn clock_gettime(clk_id: clockid_t, tp: *timespec) usize { | 1399 | pub fn clock_gettime(clk_id: clockid_t, tp: *timespec) usize { |
| 1400 | if (@hasDecl(VDSO, "CGT_SYM")) { | 1400 | if (VDSO != void) { |
| 1401 | const ptr = @atomicLoad(?VdsoClockGettime, &vdso_clock_gettime, .unordered); | 1401 | const ptr = @atomicLoad(?VdsoClockGettime, &vdso_clock_gettime, .unordered); |
| 1402 | if (ptr) |f| { | 1402 | if (ptr) |f| { |
| 1403 | const rc = f(clk_id, tp); | 1403 | const rc = f(clk_id, tp); |
lib/std/os/linux/mips.zig+2-2| ... | @@ -242,8 +242,8 @@ pub const F = struct { | ... | @@ -242,8 +242,8 @@ pub const F = struct { |
| 242 | pub const MMAP2_UNIT = 4096; | 242 | pub const MMAP2_UNIT = 4096; |
| 243 | 243 | ||
| 244 | pub const VDSO = struct { | 244 | pub const VDSO = struct { |
| 245 | pub const CGT_SYM = "__kernel_clock_gettime"; | 245 | pub const CGT_SYM = "__vdso_clock_gettime"; |
| 246 | pub const CGT_VER = "LINUX_2.6.39"; | 246 | pub const CGT_VER = "LINUX_2.6"; |
| 247 | }; | 247 | }; |
| 248 | 248 | ||
| 249 | pub const Flock = extern struct { | 249 | pub const Flock = extern struct { |
lib/std/os/linux/mips64.zig+2-2| ... | @@ -227,8 +227,8 @@ pub const F = struct { | ... | @@ -227,8 +227,8 @@ pub const F = struct { |
| 227 | pub const MMAP2_UNIT = 4096; | 227 | pub const MMAP2_UNIT = 4096; |
| 228 | 228 | ||
| 229 | pub const VDSO = struct { | 229 | pub const VDSO = struct { |
| 230 | pub const CGT_SYM = "__kernel_clock_gettime"; | 230 | pub const CGT_SYM = "__vdso_clock_gettime"; |
| 231 | pub const CGT_VER = "LINUX_2.6.39"; | 231 | pub const CGT_VER = "LINUX_2.6"; |
| 232 | }; | 232 | }; |
| 233 | 233 | ||
| 234 | pub const Flock = extern struct { | 234 | pub const Flock = extern struct { |
lib/std/os/linux/riscv32.zig+4-1| ... | @@ -188,7 +188,10 @@ pub const Elf_Symndx = u32; | ... | @@ -188,7 +188,10 @@ pub const Elf_Symndx = u32; |
| 188 | 188 | ||
| 189 | pub const MMAP2_UNIT = 4096; | 189 | pub const MMAP2_UNIT = 4096; |
| 190 | 190 | ||
| 191 | pub const VDSO = struct {}; | 191 | pub const VDSO = struct { |
| 192 | pub const CGT_SYM = "__vdso_clock_gettime"; | ||
| 193 | pub const CGT_VER = "LINUX_4.15"; | ||
| 194 | }; | ||
| 192 | 195 | ||
| 193 | /// TODO | 196 | /// TODO |
| 194 | pub const ucontext_t = void; | 197 | pub const ucontext_t = void; |
lib/std/os/linux/riscv64.zig+4-1| ... | @@ -215,7 +215,10 @@ pub const Stat = extern struct { | ... | @@ -215,7 +215,10 @@ pub const Stat = extern struct { |
| 215 | 215 | ||
| 216 | pub const Elf_Symndx = u32; | 216 | pub const Elf_Symndx = u32; |
| 217 | 217 | ||
| 218 | pub const VDSO = struct {}; | 218 | pub const VDSO = struct { |
| 219 | pub const CGT_SYM = "__vdso_clock_gettime"; | ||
| 220 | pub const CGT_VER = "LINUX_4.15"; | ||
| 221 | }; | ||
| 219 | 222 | ||
| 220 | /// TODO | 223 | /// TODO |
| 221 | pub const ucontext_t = void; | 224 | pub const ucontext_t = void; |