mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-05 07:08:48 +00:00
More contextless fixes
This commit is contained in:
@@ -13,7 +13,7 @@ import "core:time"
|
|||||||
foreign import lib "system:System"
|
foreign import lib "system:System"
|
||||||
|
|
||||||
foreign lib {
|
foreign lib {
|
||||||
sysctl :: proc(
|
sysctl :: proc "c" (
|
||||||
name: [^]i32, namelen: u32,
|
name: [^]i32, namelen: u32,
|
||||||
oldp: rawptr, oldlenp: ^uint,
|
oldp: rawptr, oldlenp: ^uint,
|
||||||
newp: rawptr, newlen: uint,
|
newp: rawptr, newlen: uint,
|
||||||
|
|||||||
@@ -30,11 +30,11 @@ args := _alloc_command_line_arguments()
|
|||||||
@(private, require_results)
|
@(private, require_results)
|
||||||
_alloc_command_line_arguments :: proc "contextless" () -> []string {
|
_alloc_command_line_arguments :: proc "contextless" () -> []string {
|
||||||
context = runtime.default_context()
|
context = runtime.default_context()
|
||||||
args := make([]string, len(runtime.args__))
|
cmd_args := make([]string, len(runtime.args__))
|
||||||
for &arg, i in args {
|
for &arg, i in cmd_args {
|
||||||
arg = string(runtime.args__[i])
|
arg = string(runtime.args__[i])
|
||||||
}
|
}
|
||||||
return args
|
return cmd_args
|
||||||
}
|
}
|
||||||
|
|
||||||
@(private, fini)
|
@(private, fini)
|
||||||
@@ -59,9 +59,8 @@ Preopen :: struct {
|
|||||||
preopens: []Preopen
|
preopens: []Preopen
|
||||||
|
|
||||||
@(init, private)
|
@(init, private)
|
||||||
init_preopens :: proc() {
|
init_preopens :: proc "contextless" () {
|
||||||
|
strip_prefixes :: proc "contextless"(path: string) -> string {
|
||||||
strip_prefixes :: proc(path: string) -> string {
|
|
||||||
path := path
|
path := path
|
||||||
loop: for len(path) > 0 {
|
loop: for len(path) > 0 {
|
||||||
switch {
|
switch {
|
||||||
@@ -78,6 +77,8 @@ init_preopens :: proc() {
|
|||||||
return path
|
return path
|
||||||
}
|
}
|
||||||
|
|
||||||
|
context = runtime.default_context()
|
||||||
|
|
||||||
dyn_preopens: [dynamic]Preopen
|
dyn_preopens: [dynamic]Preopen
|
||||||
loop: for fd := wasi.fd_t(3); ; fd += 1 {
|
loop: for fd := wasi.fd_t(3); ; fd += 1 {
|
||||||
desc, err := wasi.fd_prestat_get(fd)
|
desc, err := wasi.fd_prestat_get(fd)
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import "base:intrinsics"
|
|||||||
import "core:sys/linux"
|
import "core:sys/linux"
|
||||||
|
|
||||||
@(init, private)
|
@(init, private)
|
||||||
init_cpu_features :: proc() {
|
init_cpu_features :: proc "contextless" () {
|
||||||
_features: CPU_Features
|
_features: CPU_Features
|
||||||
defer cpu.features = _features
|
defer cpu.features = _features
|
||||||
|
|
||||||
@@ -85,7 +85,7 @@ init_cpu_features :: proc() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(pairs[0].key == .IMA_EXT_0)
|
assert_contextless(pairs[0].key == .IMA_EXT_0)
|
||||||
exts := pairs[0].value.ima_ext_0
|
exts := pairs[0].value.ima_ext_0
|
||||||
exts -= { .FD, .C, .V }
|
exts -= { .FD, .C, .V }
|
||||||
_features += transmute(CPU_Features)exts
|
_features += transmute(CPU_Features)exts
|
||||||
@@ -97,7 +97,7 @@ init_cpu_features :: proc() {
|
|||||||
_features += { .Misaligned_Supported }
|
_features += { .Misaligned_Supported }
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
assert(pairs[1].key == .CPUPERF_0)
|
assert_contextless(pairs[1].key == .CPUPERF_0)
|
||||||
if .FAST in pairs[1].value.cpu_perf_0 {
|
if .FAST in pairs[1].value.cpu_perf_0 {
|
||||||
_features += { .Misaligned_Supported, .Misaligned_Fast }
|
_features += { .Misaligned_Supported, .Misaligned_Fast }
|
||||||
} else if .UNSUPPORTED not_in pairs[1].value.cpu_perf_0 {
|
} else if .UNSUPPORTED not_in pairs[1].value.cpu_perf_0 {
|
||||||
@@ -108,6 +108,6 @@ init_cpu_features :: proc() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@(init, private)
|
@(init, private)
|
||||||
init_cpu_name :: proc() {
|
init_cpu_name :: proc "contextless" () {
|
||||||
cpu.name = "RISCV64"
|
cpu.name = "RISCV64"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package unix
|
|||||||
|
|
||||||
import "base:intrinsics"
|
import "base:intrinsics"
|
||||||
|
|
||||||
sysctl :: proc(mib: []i32, val: ^$T) -> (ok: bool) {
|
sysctl :: proc "contextless" (mib: []i32, val: ^$T) -> (ok: bool) {
|
||||||
mib := mib
|
mib := mib
|
||||||
result_size := u64(size_of(T))
|
result_size := u64(size_of(T))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user