Browse Source

Bluescreens!

pull/4/head
Łukasz Magiera 7 years ago
parent
commit
ace9e5d15a
  1. 21
      src/lua/core/boot.lua
  2. 4
      src/lua/core/sandbox.lua

21
src/lua/core/boot.lua

@ -3,29 +3,38 @@ local boot = {}
function boot.boot()
local gpu = modules.component.api.proxy(modules.component.api.list("gpu", true)())
local w, h = gpu.getResolution()
local function bsod(err)
gpu.setBackground(0x0000FF)
gpu.setForeground(0xFFFFFF)
gpu.fill(0, 0, w, h, " ")
gpu.set(2, 2, "CRITICAL ERROR OCCURED")
gpu.set(2, 3, "Lua BIOS Has failed:")
gpu.set(2, 5, tostring(err))
io.flush()
native.sleep(2000000)
gpu.setForeground(0xFFFFFF)
gpu.setBackground(0x000000)
end
print("r= " .. tostring(w) .. " " .. tostring(h))
gpu.fill(0, 0, w, h, " ")
gpu.set(10, 5, "HHHHHHHHHHHHH")
gpu.set(11, 11, "VVVVVVVVVVVVVVVVV", true)
print("LuPI L2 INIT")
print("FIXME: boot stub")
native.sleep(1000000)
local code = modules.component.api.invoke(modules.component.api.list("eeprom", true)(), "get")
if not code then
print("No bootcode")
error("No bootcode")
end
---PASS SANDBOX!!!!!!
local f, reason = load(code, "=BIOS", nil, modules.sandbox)
if not f then
print(reason)
else
local e, reason = pcall(f)
if not e then
print("ERROR")
print(reason)
--TODO: Make fancy bsod here
bsod(reason)
end
print("System quit, Panic")
end

4
src/lua/core/sandbox.lua

@ -125,6 +125,10 @@ sandbox = {
return os.time(table)
end,
tmpname = nil,
sleep = function(time)
checkArg(1, time, "number")
native.sleep(time * 1000000)
end
},
debug = { --TODO: Consider expanding
getinfo = function(...)

Loading…
Cancel
Save