From d9caf655fb9c0e9b1e2331f7e45743afbb2564fd Mon Sep 17 00:00:00 2001 From: Astronand Date: Fri, 30 Jan 2026 11:16:20 -0500 Subject: [PATCH] did mutiple changes --- Src/Hyperion-bash/bin/bashex | 19 +- Src/Hyperion-bash/bin/neofetch | 14 +- Src/Hyperion-bash/bin/startup/runShell.lua | 2 +- Src/Hyperion-core/lib/sys/fs | 6 +- Src/Hyperion-core/sbin/init.lua | 13 +- .../lib/modules/Hyperion/10_vfs.kmod | 28 +- .../lib/modules/Hyperion/40_pam.kmod | 473 +++++++++--------- .../lib/modules/Hyperion/45_hypervisor.kmod | 40 +- .../lib/modules/Hyperion/90_init.kmod | 12 +- 9 files changed, 318 insertions(+), 289 deletions(-) diff --git a/Src/Hyperion-bash/bin/bashex b/Src/Hyperion-bash/bin/bashex index 67f380a..300a85f 100644 --- a/Src/Hyperion-bash/bin/bashex +++ b/Src/Hyperion-bash/bin/bashex @@ -6,9 +6,10 @@ syscall.TTY_print("HyperionOS Bash Shell") local str="" local stopInput=false local inputIO=syscall.IO_getBoundQueue() -local pid=syscall.HPV_getPid() +local pid=syscall.getpid() local proc=0 local fs=require("sys.fs") +local timeout=1 printInline("> ") while true do local event = {syscall.IO_pullEvent()} @@ -45,7 +46,7 @@ while true do printInline("> ") end syscall.IO_bind("bash:"..tostring(pid)) - proc = syscall.HPV_spawn(program, path) + proc = syscall.spawn(program, path) syscall.IO_bind(inputIO) end str="" @@ -58,7 +59,7 @@ while true do end end if stopInput then - local exited, code = syscall.HPV_collect(proc) + local exited, code = syscall.collect(proc) if exited then print("\nTask exited with code:\n"..tostring(code)) printInline("> ") @@ -66,16 +67,22 @@ while true do else if event[1] then if event[1]=="keyTyped" and event[3]=="^c" then - syscall.HPV_kill(proc) + syscall.kill(proc) print("Terminated") printInline("> ") stopInput=false elseif event[1]=="keyTyped" and event[3]=="^d" then - syscall.HPV_kill(proc) - syscall.HPV_exit(0) + syscall.kill(proc) + syscall.exit(0) else syscall.IO_pushEvent("bash:"..tostring(pid), table.unpack(event)) end + timeout=10 + else + timeout=timeout-1 + end + if timeout<0 then + sleep(.05) end end end diff --git a/Src/Hyperion-bash/bin/neofetch b/Src/Hyperion-bash/bin/neofetch index dacbd11..0cd73a7 100644 --- a/Src/Hyperion-bash/bin/neofetch +++ b/Src/Hyperion-bash/bin/neofetch @@ -1,12 +1,12 @@ -local userhost = (syscall.OS_getUser() or "Unknown").."@"..(syscall.OS_getHostname() or "Unknown") +local userhost = (syscall.getUser() or "Unknown").."@"..(syscall.getHostname() or "Unknown") print(".. *. .. | "..userhost) -print(" *= +@* +* | "../rep("-",#userhost)) -print(" .@#. -@@@= :#@. | OS: "..(syscall.OS_version() or "Unknown")) -print(" =@@+ *@@@# +@@= | Host: "..(syscall.OS_getHost() or "Unknown")) -print(" %@@%: *@@@# -%@@% | Uptime: "..(syscall.OS_getUptime() or "Unknown")) -print(" :@@@@+ *@@@# .*@@@@: | Tasks: "..tostring((#syscall.HPV_list() or "Unknown"))) +print(" *= +@* +* | "..string.rep("-",#userhost)) +print(" .@#. -@@@= :#@. | OS: "..(syscall.version() or "Unknown")) +print(" =@@+ *@@@# +@@= | Host: "..(syscall.getHost() or "Unknown")) +print(" %@@%: *@@@# -%@@% | Uptime: "..(syscall.getUptime() or "Unknown")) +print(" :@@@@+ *@@@# .*@@@@: | Tasks: "..tostring((#syscall.getTasks() or "Unknown"))) print(" :*@@@%- *@@@# -@@@@*: | Packages: ".."Unknown") -print(" =%@@#. *@@@# .#@@%= | Shell: "..(syscall.HPV_getEnviron("SHELL") or "Unknown")) +print(" =%@@#. *@@@# .#@@%= | Shell: "..(syscall.getEnviron("SHELL") or "Unknown")) print(" :=. :*@@= *@@@# =@@+: .=: | ") print(" %@#=..*# +@@@# #*..=#@# | ") print(" .@@@@+=# .%@%: #=+@@@@. | ") diff --git a/Src/Hyperion-bash/bin/startup/runShell.lua b/Src/Hyperion-bash/bin/startup/runShell.lua index 247461d..67ea5f4 100644 --- a/Src/Hyperion-bash/bin/startup/runShell.lua +++ b/Src/Hyperion-bash/bin/startup/runShell.lua @@ -1,4 +1,4 @@ local fs = require("sys.fs") local bashStr = fs.readAllText("/bin/bash") local bashFun = load(bashStr) -syscall.HPV_spawn(bashFun, "bash") \ No newline at end of file +syscall.spawn(bashFun, "bash") \ No newline at end of file diff --git a/Src/Hyperion-core/lib/sys/fs b/Src/Hyperion-core/lib/sys/fs index 1523014..d9c9828 100644 --- a/Src/Hyperion-core/lib/sys/fs +++ b/Src/Hyperion-core/lib/sys/fs @@ -114,15 +114,15 @@ function fs.remove(path) end function fs.list(path) - return syscall.list(path) + return syscall.listdir(path) end function fs.type(path) return syscall.type(path) end -function fs.attributes(path) - return syscall.attributes(path) +function fs.stat(path) + return syscall.stat(path) end function fs.exists(path) diff --git a/Src/Hyperion-core/sbin/init.lua b/Src/Hyperion-core/sbin/init.lua index 38e47b8..b274d7c 100644 --- a/Src/Hyperion-core/sbin/init.lua +++ b/Src/Hyperion-core/sbin/init.lua @@ -27,7 +27,7 @@ for i,v in ipairs(files) do if not startupFunc then kernel.log("Error loading startup script '" .. filepath .. "': " .. err, "ERROR") else - syscall.HPV_spawn(function() + syscall.spawn(function() syscall.IO_bind("eventQueue:"..tostring(i)) local spot = #eventQueues+1 eventQueues[spot]="eventQueue:"..tostring(i) @@ -38,20 +38,27 @@ for i,v in ipairs(files) do kernel.log("Successfully executed startup script: " .. filepath, "INFO") end local event={true} - while event[1] do - syscall.IO_pullEvent() + while #event~=0 do + event={syscall.IO_pullEvent()} end end, "startup:" .. v) end end end +local timeout=1 while true do local event = {syscall.IO_pullEvent()} if event[1] then for i,v in ipairs(eventQueues) do syscall.IO_pushEvent(v, table.unpack(event)) end + timeout=10 + else + timeout=timeout-1 + end + if timeout<0 then + sleep(.05) end kernel.saveLog() end \ No newline at end of file diff --git a/Src/Hyperion-kernel/lib/modules/Hyperion/10_vfs.kmod b/Src/Hyperion-kernel/lib/modules/Hyperion/10_vfs.kmod index 421bc72..d4d05ea 100644 --- a/Src/Hyperion-kernel/lib/modules/Hyperion/10_vfs.kmod +++ b/Src/Hyperion-kernel/lib/modules/Hyperion/10_vfs.kmod @@ -1,3 +1,4 @@ +--:Minify:-- local kernel = ... local vfs = {} kernel.vfs=vfs @@ -115,17 +116,13 @@ end local function getMeta(path) local disk, newPath = resolvePath(path) - kernel.log(newPath) while newPath ~= "/" and newPath~="" do local target = newPath:match("([^/]+)/?$") - kernel.log(target) if target == ".meta" then error("Cannot open metafile") end if disk:fileExists(newPath .. ".meta") then return newPath .. ".meta", target end newPath = newPath:gsub("/[^/]+/?$", "") - kernel.log(newPath) - kernel.saveLog() end return nil @@ -430,7 +427,22 @@ function vfs.exists(path) local disk, diskPath = resolvePath(path) local meta = getFileMeta(path) checkperms(meta, "r") - disk:fileExists(diskPath) + return disk:fileExists(diskPath) +end + +function vfs.type(path) + local disk, diskPath = resolvePath(path) + local meta = getFileMeta(path) + checkperms(meta, "r") + return disk:type(diskPath) +end + +function vfs.getcwd() + return kernel.currentTask.cwd +end + +function vfs.chdir(path) + kernel.currentTask.cwd=path end -- Export syscalls @@ -453,9 +465,9 @@ sys["chmod"] = vfs.chmod sys["fchmod"] = vfs.fchmod sys["chown"] = vfs.chown sys["fchown"] = vfs.fchown -sys["exists"]=vfs.exists +sys["exists"] = vfs.exists +sys["type"] = vfs.type sys["mount"] = vfs.mount sys["umount"] = vfs.umount -kernel.log("VFS module loaded") -return vfs \ No newline at end of file +kernel.log("VFS module loaded") \ No newline at end of file diff --git a/Src/Hyperion-kernel/lib/modules/Hyperion/40_pam.kmod b/Src/Hyperion-kernel/lib/modules/Hyperion/40_pam.kmod index 5cdd7e2..8a4c0e5 100644 --- a/Src/Hyperion-kernel/lib/modules/Hyperion/40_pam.kmod +++ b/Src/Hyperion-kernel/lib/modules/Hyperion/40_pam.kmod @@ -1,238 +1,237 @@ --:Minify:-- ---local kernel = ... ---local pam = {} ---kernel.pam = pam ---local loggedIn = {} --- ---local function getFile(path) --- local file = kernel.vfs.open(path, "r") --- if not file then error("Failed to open file: "..path) end --- local content = kernel.vfs.read(file, 1024000) --- kernel.vfs.close(file) --- return content ---end --- ---local blake2s --- ---do --- local MOD32 = 2^32 --- local function norm(x) --- return x % MOD32 --- end --- --- local function tobits(x) --- x = norm(x) --- local t = {} --- for i = 0, 31 do --- local b = x % 2 --- t[i] = b --- x = (x - b) / 2 --- end --- return t --- end --- --- local function frombits(t) --- local x = 0 --- local p = 1 --- for i = 0, 31 do --- if t[i] == 1 then --- x = x + p --- end --- p = p * 2 --- end --- return norm(x) --- end --- --- local function bor(...) --- local args = {...} --- if #args == 0 then return 0 end --- local bits = tobits(args[1]) --- for i = 2, #args do --- local b = tobits(args[i]) --- for j = 0, 31 do --- bits[j] = (bits[j] == 1 or b[j] == 1) and 1 or 0 --- end --- end --- return frombits(bits) --- end --- --- local function bxor(...) --- local args = {...} --- if #args == 0 then return 0 end --- local bits = tobits(args[1]) --- for i = 2, #args do --- local b = tobits(args[i]) --- for j = 0, 31 do --- bits[j] = (bits[j] ~= b[j]) and 1 or 0 --- end --- end --- return frombits(bits) --- end --- --- local function lshift(x, n) --- return norm(norm(x) * 2^n) --- end --- --- local function rshift(x, n) --- return math.floor(norm(x) / 2^n) --- end --- --- local function rotr(x, n) --- return bor(rshift(x, n), lshift(x, 32 - n)) --- end --- --- local IV = { --- 0x6A09E667, 0xBB67AE85, 0x3C6EF372, 0xA54FF53A, --- 0x510E527F, 0x9B05688C, 0x1F83D9AB, 0x5BE0CD19 --- } --- --- local SIGMA = { --- {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}, --- {14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3}, --- {11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4}, --- {7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8}, --- {9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13}, --- {2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9}, --- {12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11}, --- {13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10}, --- {6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5}, --- {10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0} --- } --- --- local function G(v, a, b, c, d, x, y) --- v[a] = (v[a] + v[b] + x) % MOD32 --- v[d] = rotr(bxor(v[d], v[a]), 16) --- v[c] = (v[c] + v[d]) % MOD32 --- v[b] = rotr(bxor(v[b], v[c]), 12) --- v[a] = (v[a] + v[b] + y) % MOD32 --- v[d] = rotr(bxor(v[d], v[a]), 8) --- v[c] = (v[c] + v[d]) % MOD32 --- v[b] = rotr(bxor(v[b], v[c]), 7) --- end --- --- local function compress(h, block, t, last) --- local v = {} --- for i = 1, 8 do v[i] = h[i] end --- for i = 1, 8 do v[i + 8] = IV[i] end --- --- v[13] = bxor(v[13], t) --- if last then --- v[15] = bxor(v[15], 0xFFFFFFFF) --- end --- --- local m = {} --- for i = 0, 15 do --- local p = i * 4 + 1 --- m[i] = --- (block:byte(p) or 0) + --- ((block:byte(p + 1) or 0) * 0x100) + --- ((block:byte(p + 2) or 0) * 0x10000) + --- ((block:byte(p + 3) or 0) * 0x1000000) --- end --- --- for r = 1, 10 do --- local s = SIGMA[r] --- G(v,1,5,9,13, m[s[1]], m[s[2]]) --- G(v,2,6,10,14, m[s[3]], m[s[4]]) --- G(v,3,7,11,15, m[s[5]], m[s[6]]) --- G(v,4,8,12,16, m[s[7]], m[s[8]]) --- G(v,1,6,11,16, m[s[9]], m[s[10]]) --- G(v,2,7,12,13, m[s[11]], m[s[12]]) --- G(v,3,8,9,14, m[s[13]], m[s[14]]) --- G(v,4,5,10,15, m[s[15]], m[s[16]]) --- end --- --- for i = 1, 8 do --- h[i] = bxor(h[i], v[i], v[i + 8]) --- end --- end --- --- function blake2s(msg, key) --- key = key or "" --- --- local h = {} --- for i = 1, 8 do h[i] = IV[i] end --- --- local outlen = 32 -- bytes --- h[1] = bxor( --- h[1], --- 0x01010000 + lshift(#key, 8) + outlen --- ) --- --- local t = 0 --- --- if #key > 0 then --- local block = key .. string.rep("\0", 64 - #key) --- t = #key --- compress(h, block, t, false) --- end --- --- for i = 1, #msg, 64 do --- local block = msg:sub(i, i + 63) --- if #block < 64 then --- block = block .. string.rep("\0", 64 - #block) --- end --- t = t + math.min(64, #msg - i + 1) --- compress(h, block, t, i + 64 > #msg) --- end --- --- local out = "" --- for i = 1, 8 do --- out = out .. string.format("%08x", h[i]) --- end --- return out --- end ---end --- ---if not blake2s then error("Failed to load blake2s") end --- ---if not kernel.vfs.exists("/etc/pam.d/secret") then --- local key = "" --- for i=1, 256 do --- key=key..string.char(math.random(1,255)) --- end --- local handle = kernel.vfs.open("/etc/pam.d/secret", "w") --- kernel.vfs.write(handle, key) --- kernel.vfs.close(handle) ---end --- ---local pepper = getFile("/etc/pam.d/secret") --- ---function pam.authenticate(username, password) --- local fpasswd = getFile("/etc/passwd") --- local fshadow = getFile("/etc/shadow") --- --- local passwdLines = string.split(fpasswd, "\n") --- local shadowLines = string.split(fshadow, "\n") --- --- local passwd = {} --- local shadow = {} --- for _, line in ipairs(passwdLines) do --- local fields = string.split(line, ":") --- passwd[fields[1]] = fields --- end --- for _, line in ipairs(shadowLines) do --- local fields = string.split(line, ":") --- shadow[fields[1]] = fields --- end --- --- for user, fields in pairs(passwd) do --- if user == username then --- local shadowPasswd = string.split(shadow[user][2], "$") --- local salt = shadowPasswd[2] --- local hashedPassword = blake2s(password .. salt, pepper) --- if hashedPassword == shadowPasswd[3] then --- loggedIn[username] = kernel.newUUID() --- return loggedIn[username] --- else --- return false --- end --- end --- end ---end --- ---function pam.authToken(username, token) --- return loggedIn[username] == token ---end --- --- \ No newline at end of file +local kernel = ... +local pam = {} +kernel.pam = pam +local loggedIn = {} + +local function getFile(path) + local file = kernel.vfs.open(path, "r") + if not file then error("Failed to open file: "..path) end + local content = kernel.vfs.read(file, 1024000) + kernel.vfs.close(file) + return content +end + +local blake2s + +do + local MOD32 = 2^32 + local function norm(x) + return x % MOD32 + end + + local function tobits(x) + x = norm(x) + local t = {} + for i = 0, 31 do + local b = x % 2 + t[i] = b + x = (x - b) / 2 + end + return t + end + + local function frombits(t) + local x = 0 + local p = 1 + for i = 0, 31 do + if t[i] == 1 then + x = x + p + end + p = p * 2 + end + return norm(x) + end + + local function bor(...) + local args = {...} + if #args == 0 then return 0 end + local bits = tobits(args[1]) + for i = 2, #args do + local b = tobits(args[i]) + for j = 0, 31 do + bits[j] = (bits[j] == 1 or b[j] == 1) and 1 or 0 + end + end + return frombits(bits) + end + + local function bxor(...) + local args = {...} + if #args == 0 then return 0 end + local bits = tobits(args[1]) + for i = 2, #args do + local b = tobits(args[i]) + for j = 0, 31 do + bits[j] = (bits[j] ~= b[j]) and 1 or 0 + end + end + return frombits(bits) + end + + local function lshift(x, n) + return norm(norm(x) * 2^n) + end + + local function rshift(x, n) + return math.floor(norm(x) / 2^n) + end + + local function rotr(x, n) + return bor(rshift(x, n), lshift(x, 32 - n)) + end + + local IV = { + 0x6A09E667, 0xBB67AE85, 0x3C6EF372, 0xA54FF53A, + 0x510E527F, 0x9B05688C, 0x1F83D9AB, 0x5BE0CD19 + } + + local SIGMA = { + {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}, + {14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3}, + {11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4}, + {7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8}, + {9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13}, + {2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9}, + {12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11}, + {13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10}, + {6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5}, + {10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0} + } + + local function G(v, a, b, c, d, x, y) + v[a] = (v[a] + v[b] + x) % MOD32 + v[d] = rotr(bxor(v[d], v[a]), 16) + v[c] = (v[c] + v[d]) % MOD32 + v[b] = rotr(bxor(v[b], v[c]), 12) + v[a] = (v[a] + v[b] + y) % MOD32 + v[d] = rotr(bxor(v[d], v[a]), 8) + v[c] = (v[c] + v[d]) % MOD32 + v[b] = rotr(bxor(v[b], v[c]), 7) + end + + local function compress(h, block, t, last) + local v = {} + for i = 1, 8 do v[i] = h[i] end + for i = 1, 8 do v[i + 8] = IV[i] end + + v[13] = bxor(v[13], t) + if last then + v[15] = bxor(v[15], 0xFFFFFFFF) + end + + local m = {} + for i = 0, 15 do + local p = i * 4 + 1 + m[i] = + (block:byte(p) or 0) + + ((block:byte(p + 1) or 0) * 0x100) + + ((block:byte(p + 2) or 0) * 0x10000) + + ((block:byte(p + 3) or 0) * 0x1000000) + end + + for r = 1, 10 do + local s = SIGMA[r] + G(v,1,5,9,13, m[s[1]], m[s[2]]) + G(v,2,6,10,14, m[s[3]], m[s[4]]) + G(v,3,7,11,15, m[s[5]], m[s[6]]) + G(v,4,8,12,16, m[s[7]], m[s[8]]) + G(v,1,6,11,16, m[s[9]], m[s[10]]) + G(v,2,7,12,13, m[s[11]], m[s[12]]) + G(v,3,8,9,14, m[s[13]], m[s[14]]) + G(v,4,5,10,15, m[s[15]], m[s[16]]) + end + + for i = 1, 8 do + h[i] = bxor(h[i], v[i], v[i + 8]) + end + end + + function blake2s(msg, key) + key = key or "" + + local h = {} + for i = 1, 8 do h[i] = IV[i] end + + local outlen = 32 -- bytes + h[1] = bxor( + h[1], + 0x01010000 + lshift(#key, 8) + outlen + ) + + local t = 0 + + if #key > 0 then + local block = key .. string.rep("\0", 64 - #key) + t = #key + compress(h, block, t, false) + end + + for i = 1, #msg, 64 do + local block = msg:sub(i, i + 63) + if #block < 64 then + block = block .. string.rep("\0", 64 - #block) + end + t = t + math.min(64, #msg - i + 1) + compress(h, block, t, i + 64 > #msg) + end + + local out = "" + for i = 1, 8 do + out = out .. string.format("%08x", h[i]) + end + return out + end +end + +if not blake2s then error("Failed to load blake2s") end + +if not kernel.vfs.exists("/etc/pam.d/secret") then + local key = "" + for i=1, 256 do + key=key..string.char(math.random(1,255)) + end + local handle = kernel.vfs.open("/etc/pam.d/secret", "w") + kernel.vfs.write(handle, key) + kernel.vfs.close(handle) +end + +local pepper = getFile("/etc/pam.d/secret") + +function pam.authenticate(username, password) + local fpasswd = getFile("/etc/passwd") + local fshadow = getFile("/etc/shadow") + + local passwdLines = string.split(fpasswd, "\n") + local shadowLines = string.split(fshadow, "\n") + + local passwd = {} + local shadow = {} + for _, line in ipairs(passwdLines) do + local fields = string.split(line, ":") + passwd[fields[1]] = fields + end + for _, line in ipairs(shadowLines) do + local fields = string.split(line, ":") + shadow[fields[1]] = fields + end + + for user, fields in pairs(passwd) do + if user == username then + local shadowPasswd = string.split(shadow[user][2], "$") + local salt = shadowPasswd[2] + local hashedPassword = blake2s(password .. salt, pepper) + if hashedPassword == shadowPasswd[3] then + loggedIn[username] = kernel.newUUID() + return loggedIn[username] + else + return false + end + end + end +end + +function pam.authToken(username, token) + return loggedIn[username] == token +end + diff --git a/Src/Hyperion-kernel/lib/modules/Hyperion/45_hypervisor.kmod b/Src/Hyperion-kernel/lib/modules/Hyperion/45_hypervisor.kmod index 6979d8a..455ff70 100644 --- a/Src/Hyperion-kernel/lib/modules/Hyperion/45_hypervisor.kmod +++ b/Src/Hyperion-kernel/lib/modules/Hyperion/45_hypervisor.kmod @@ -70,7 +70,7 @@ function sys.sleep(ms) coroutine.yield() end -function sys.getTaskInfo(pid) +function sys.getTask(pid) if tasks[tostring(pid)] then local task = tasks[tostring(pid)] local children = {} @@ -169,14 +169,18 @@ function sys.continue(pid) end end -function sys.getPid() +function sys.getpid() return kernel.currentTask.pid end -function sys.list() +function sys.getppid() + return kernel.currentTask.parent.pid +end + +function sys.getTasks() local ret={} - for i,_ in pairs(tasks) do - ret[i]=sys.getTaskInfo(i) + for i,v in pairs(tasks) do + ret[i]=v.pid end return ret end @@ -203,18 +207,20 @@ function sys.exit(code) end end -kernel.syscalls["spawn"]=sys.spawn -kernel.syscalls["sleep"]=sys.sleep -kernel.syscalls["getTaskInfo"]=sys.getTaskInfo -kernel.syscalls["collect"]=sys.collect -kernel.syscalls["kill"]=sys.kill -kernel.syscalls["stop"]=sys.stop -kernel.syscalls["continue"]=sys.continue -kernel.syscalls["getPid"]=sys.getPid -kernel.syscalls["list"]=sys.list -kernel.syscalls["setEnviron"]=sys.setEnviron -kernel.syscalls["getEnviron"]=sys.getEnviron -kernel.syscalls["exit"]=sys.exit +local sysc=kernel.syscalls +sysc["spawn"]=sys.spawn +sysc["sleep"]=sys.sleep +sysc["getTask"]=sys.getTask +sysc["collect"]=sys.collect +sysc["kill"]=sys.kill +sysc["stop"]=sys.stop +sysc["continue"]=sys.continue +sysc["getpid"]=sys.getpid +sysc["getppid"]=sys.getppid +sysc["getTasks"]=sys.getTasks +sysc["setEnviron"]=sys.setEnviron +sysc["getEnviron"]=sys.getEnviron +sysc["exit"]=sys.exit kernel._G.sleep=function(...)coroutine.yield("syscall","sleep",...)end local function reapDeadTasks() diff --git a/Src/Hyperion-kernel/lib/modules/Hyperion/90_init.kmod b/Src/Hyperion-kernel/lib/modules/Hyperion/90_init.kmod index baf62e6..7273817 100644 --- a/Src/Hyperion-kernel/lib/modules/Hyperion/90_init.kmod +++ b/Src/Hyperion-kernel/lib/modules/Hyperion/90_init.kmod @@ -2,14 +2,12 @@ local kernel = ... kernel.log("Loading init system...") kernel.log("InitPath: "..kernel.config.initPath) -local handle = kernel.vfs.open(kernel.config.initPath, "r") -kernel.log("O") -local data = kernel.vfs.read(handle, 1024 * 1024 * 4) -kernel.log("R") -kernel.vfs.close(handle) -kernel.log("C") -local initFunc, err = load(data, "@sysinit") +local handle = kernel.vfs.open(kernel.config.initPath, "r") +local data = kernel.vfs.read(handle, 1024 * 1024 * 4) +kernel.vfs.close(handle) + +local initFunc, err = load(data, "@sysinit", "t", kernel._U) if not initFunc then error("Failed to load init system: "..err) end