add cynosure loader

This commit is contained in:
i develop things 2021-09-03 16:27:00 -04:00 committed by GitHub
parent d96ffb10da
commit 52c9da6fe3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 35 additions and 0 deletions

View File

@ -0,0 +1,35 @@
-- cynosure loader --
local zy = krequire("zorya")
local utils = krequire("utils")
local thd = krequire("thd")
local vdev = krequire("util_vcomponent")
local function proxytable(t)
return setmetatable({}, {__index=function(self, i)
if (type(t[i]) == "table") then
self[i] = proxytable(t[i])
return rawget(self, i)
else
return t[i]
end
end})
end
local monolith_count = 0
return function(addr)
local fs = component.proxy(addr)
thd.add("cynosure$"..monolith_count, function()
local env = utils.make_env()
function env.computer.getBootAddress()
return addr
end
function env.computer.setBootAddress()end
local old_dl = utils.debug_log
load(utils.readfile(fs.address, fs.open("/boot/cynosure.lua")), "=/boot/cynosure.lua", "t", env)()
computer.pushSignal("cynosure_dead")
end)
while true do
if computer.pullSignal() == "cynosure_dead" then
utils.debug_log("Got signal.")
break
end
end
end