mirror of
https://github.com/odin-lang/Odin.git
synced 2026-02-13 06:43:35 +00:00
add osx support
This commit is contained in:
@@ -416,4 +416,4 @@ syscall_chdir :: #force_inline proc(path: cstring) -> c.int {
|
||||
|
||||
syscall_fchdir :: #force_inline proc(fd: c.int, path: cstring) -> c.int {
|
||||
return cast(c.int)intrinsics.syscall(unix_offset_syscall(.getentropy), uintptr(fd), transmute(uintptr)path)
|
||||
}
|
||||
}
|
||||
|
||||
23
core/time/tsc_darwin.odin
Normal file
23
core/time/tsc_darwin.odin
Normal file
@@ -0,0 +1,23 @@
|
||||
//+private
|
||||
//+build darwin
|
||||
package time
|
||||
|
||||
import "core:sys/darwin"
|
||||
|
||||
_get_tsc_frequency :: proc "contextless" () -> u64 {
|
||||
@(static) frequency : u64 = 0
|
||||
if frequency > 0 {
|
||||
return frequency
|
||||
}
|
||||
|
||||
tmp_freq : u64 = 0
|
||||
tmp_size : i64 = size_of(tmp_freq)
|
||||
ret := darwin.syscall_sysctlbyname("machdep.tsc.frequency", &tmp_freq, &tmp_size, nil, 0)
|
||||
if ret < 0 {
|
||||
frequency = 1
|
||||
return 0
|
||||
}
|
||||
|
||||
frequency = tmp_freq
|
||||
return frequency
|
||||
}
|
||||
Reference in New Issue
Block a user