mirror of
https://github.com/curioustorvald/tsvm.git
synced 2026-06-11 23:34:04 +09:00
RESET and SYSRQ is now trapped by a hypervisor
This commit is contained in:
@@ -37,7 +37,7 @@ function print_prompt_text() {
|
||||
con.addch(16);con.curs_right()
|
||||
con.color_pair(0,253)
|
||||
print(" \\"+shell_pwd.join("\\").substring(1)+" ")
|
||||
if (errorlevel != 0) {
|
||||
if (errorlevel != 0 && errorlevel != "undefined" && errorlevel != undefined) {
|
||||
con.color_pair(166,253)
|
||||
print("["+errorlevel+"] ")
|
||||
}
|
||||
@@ -48,7 +48,7 @@ function print_prompt_text() {
|
||||
}
|
||||
else {
|
||||
// con.color_pair(253,255)
|
||||
if (errorlevel != 0)
|
||||
if (errorlevel != 0 && errorlevel != "undefined" && errorlevel != undefined)
|
||||
print(CURRENT_DRIVE + ":\\" + shell_pwd.join("\\") + " [" + errorlevel + "]" + PROMPT_TEXT)
|
||||
else
|
||||
print(CURRENT_DRIVE + ":\\" + shell_pwd.join("\\") + PROMPT_TEXT)
|
||||
|
||||
@@ -9,8 +9,7 @@ hyve is a hypervisor for tsvm.
|
||||
3. hands the control over to the TVDOS until SysRq sequence is struck
|
||||
*/
|
||||
|
||||
let context = parallel.spawnNewContext()
|
||||
let bios = `
|
||||
const bios = `
|
||||
// probe bootable device
|
||||
|
||||
var _BIOS = {};
|
||||
@@ -24,8 +23,6 @@ _BIOS.FIRST_BOOTABLE_PORT = [0,1]; // ah screw it
|
||||
|
||||
Object.freeze(_BIOS);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// load a bootsector using 'LOADBOOT'
|
||||
let portNumber = 0;
|
||||
let driveStatus = 0;
|
||||
@@ -54,17 +51,46 @@ else {
|
||||
printerrln("No bootable medium found.");
|
||||
}
|
||||
`
|
||||
let runner = parallel.attachProgram("TVDOS", context, bios)
|
||||
parallel.launch(runner)
|
||||
|
||||
sys.sleep(1000);
|
||||
let runner = undefined
|
||||
|
||||
function startNewInstance() {
|
||||
runner = parallel.attachProgram("TVDOS", parallel.spawnNewContext(), bios)
|
||||
serial.println("Starting new instance "+runner)
|
||||
parallel.launch(runner)
|
||||
sys.sleep(1000)
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
// initial kickstart
|
||||
startNewInstance()
|
||||
|
||||
while (parallel.isRunning(runner)) {
|
||||
graphics.plotPixel( // test fill the framebuffer to prove VM is shared
|
||||
(Math.random() * 560) | 0,
|
||||
(Math.random() * 448) | 0,
|
||||
(Math.random() * 256) | 0
|
||||
)
|
||||
if (sys.peek(-49) >>> 7 == 1) {
|
||||
sys.poke(-49, 0)
|
||||
|
||||
parallel.kill(runner)
|
||||
|
||||
graphics.clearText()
|
||||
graphics.clearPixels(255)
|
||||
|
||||
startNewInstance()
|
||||
}
|
||||
else if (sys.peek(-49) >>> 6 == 1) {
|
||||
sys.poke(-49, 0)
|
||||
|
||||
let threads = parallel.getThreadPool()
|
||||
|
||||
serial.println("======================")
|
||||
for (let i = 0; i < threads.size; i++) {
|
||||
serial.println(`Thread #${i+1}: ${threads[i]}`)
|
||||
}
|
||||
serial.println("======================")
|
||||
|
||||
sys.sleep(300)
|
||||
}
|
||||
sys.sleep(0)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user