Skip to content

Commit

Permalink
hdd
Browse files Browse the repository at this point in the history
  • Loading branch information
usernameak committed Oct 12, 2017
1 parent 2c8bea9 commit 716b6e1
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
Binary file modified .initrd
Binary file not shown.
2 changes: 2 additions & 0 deletions js/core/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ const pci = require('./pci');
const net = require('./net');
const stdio = require('./stdio');
const speaker = require('../driver/ibmpc/pcspeaker');
const ata = require('../driver/ata');

class Runtime {
constructor() {
Expand All @@ -39,6 +40,7 @@ class Runtime {
net,
stdio,
speaker,
ata,
machine: {
reboot: __SYSCALL.reboot,
shutdown: () => __SYSCALL.acpiEnterSleepState(5),
Expand Down
17 changes: 16 additions & 1 deletion js/service/shell/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ const cmds = {

if (mode === 'play') {
$$.speaker.play(frec, duration);
f.stdio.writeLine(`Playing ${frec} gz at ${duration} ms...`);
f.stdio.writeLine(`Playing ${frec} Hz at ${duration} ms...`);
return res(0);
} else if (mode === 'stop') {
$$.speaker.stop();
Expand All @@ -160,6 +160,21 @@ const cmds = {
f.stdio.writeError('Use "play" or "stop"!');
return res(1);
},
listparts: {
description: 'List HDD partitions',
usage: 'listparts',
run(args, f, res) {
const buf = $$.ata.read(0, 1).slice(0x1BE, 64);
for (let i = 0; i < 4; i++) {
if (buf[i * 16]) {
f.stdio.writeLine(`Partition ${i} exists on drive`);
} else {
f.stdio.writeLine(`Partition ${i} doesn't exist on drive`);
}
}
return res(0);
},
},
},
};

Expand Down

0 comments on commit 716b6e1

Please sign in to comment.