summaryrefslogtreecommitdiff
path: root/Source/Kernel/Shell
diff options
context:
space:
mode:
Diffstat (limited to 'Source/Kernel/Shell')
-rw-r--r--Source/Kernel/Shell/KernelShell-sys.class.cpp19
-rw-r--r--Source/Kernel/Shell/KernelShell.class.cpp1
-rw-r--r--Source/Kernel/Shell/KernelShell.class.h1
3 files changed, 21 insertions, 0 deletions
diff --git a/Source/Kernel/Shell/KernelShell-sys.class.cpp b/Source/Kernel/Shell/KernelShell-sys.class.cpp
index 6243b0f..b039c4d 100644
--- a/Source/Kernel/Shell/KernelShell-sys.class.cpp
+++ b/Source/Kernel/Shell/KernelShell-sys.class.cpp
@@ -58,3 +58,22 @@ void KernelShell::part(Vector<String>& args) {
}
}
}
+
+void KernelShell::readblock(Vector<String>& args) {
+ if (args.size() == 3) {
+ Vector<Device*> devcs = Dev::findDevices("block");
+ u32int id = args[1].toInt(), block = args[2].toInt();
+ if (id < devcs.size()) {
+ BlockDevice* bdev = (BlockDevice*)devcs[id];
+ *m_vt << "Block " << block << " from device " << bdev->getName() << " (" << bdev->getClass() << ")\n";
+ u8int* buff = (u8int*)Mem::alloc(bdev->blockSize());
+ bdev->readBlocks(block, 1, buff);
+ m_vt->hexDump(buff, 32);
+ Mem::free(buff);
+ } else {
+ *m_vt << "Block device #" << id << " does not exist.\n";
+ }
+ } else {
+ *m_vt << "Usage: readblock <dev id> <block id>\n";
+ }
+}
diff --git a/Source/Kernel/Shell/KernelShell.class.cpp b/Source/Kernel/Shell/KernelShell.class.cpp
index 7f57f8b..9f9858b 100644
--- a/Source/Kernel/Shell/KernelShell.class.cpp
+++ b/Source/Kernel/Shell/KernelShell.class.cpp
@@ -61,6 +61,7 @@ u32int KernelShell::run() {
{"free", &KernelShell::free},
{"uptime", &KernelShell::uptime},
{"part", &KernelShell::part},
+ {"readblock", &KernelShell::readblock},
{0, 0}
};
diff --git a/Source/Kernel/Shell/KernelShell.class.h b/Source/Kernel/Shell/KernelShell.class.h
index e7549c2..4fa9c66 100644
--- a/Source/Kernel/Shell/KernelShell.class.h
+++ b/Source/Kernel/Shell/KernelShell.class.h
@@ -34,6 +34,7 @@ class KernelShell {
void free(Vector<String>& args);
void uptime(Vector<String>& args);
void part(Vector<String>& args);
+ void readblock(Vector<String>& args);
void setup(DirectoryNode* cwd, VirtualTerminal *vt);