diff --git a/include/io/ata.h b/include/io/ata.h new file mode 100644 index 0000000..73ff34b --- /dev/null +++ b/include/io/ata.h @@ -0,0 +1,41 @@ +//----------------------------------------------------------------------------// +// GNU GPL OS/K // +// // +// Desc: Basic Read Only ATA Long mode Driver // +// // +// // +// Copyright © 2018-2019 The OS/K Team // +// // +// This file is part of OS/K. // +// // +// OS/K is free software: you can redistribute it and/or modify // +// it under the terms of the GNU General Public License as published by // +// the Free Software Foundation, either version 3 of the License, or // +// any later version. // +// // +// OS/K is distributed in the hope that it will be useful, // +// but WITHOUT ANY WARRANTY//without even the implied warranty of // +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // +// GNU General Public License for more details. // +// // +// You should have received a copy of the GNU General Public License // +// along with OS/K. If not, see . // +//----------------------------------------------------------------------------// + +#ifndef _KERNEL_H +#include +#endif + +#ifndef _IO_ATA_H +#define _IO_ATA_H + +#include + +//----------------------------------------------------------------------------// + +void IoReadATA(void *sectorBuffer, char n, char first); +void IoDumpSector(void); + +//----------------------------------------------------------------------------// + +#endif diff --git a/kaleid/kernel/io/ata.c b/kaleid/kernel/io/ata.c new file mode 100644 index 0000000..e92e4fa --- /dev/null +++ b/kaleid/kernel/io/ata.c @@ -0,0 +1,43 @@ +//----------------------------------------------------------------------------// +// GNU GPL OS/K // +// // +// Desc: Basic Read Only ATA Long mode Driver // +// // +// // +// Copyright © 2018-2019 The OS/K Team // +// // +// This file is part of OS/K. // +// // +// OS/K is free software: you can redistribute it and/or modify // +// it under the terms of the GNU General Public License as published by // +// the Free Software Foundation, either version 3 of the License, or // +// any later version. // +// // +// OS/K is distributed in the hope that it will be useful, // +// but WITHOUT ANY WARRANTY//without even the implied warranty of // +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // +// GNU General Public License for more details. // +// // +// You should have received a copy of the GNU General Public License // +// along with OS/K. If not, see . // +//----------------------------------------------------------------------------// + +#include +#include + +void IoDumpFirstSector(void) +{ + char sector[513] = {0}; + KernLog("Sector addr : %p\n", §or[0]); + + IoReadATA(sector, 1, 1); + + for (int i = 0; i < 513; i++) { + if (isascii(sector[i])) + KernLog("%c", sector[i]); + else + KernLog(" "); + } + + KernLog("\n\n"); +} diff --git a/kaleid/kernel/sh/shcmds.c b/kaleid/kernel/sh/shcmds.c index ab3214a..a96e8ea 100644 --- a/kaleid/kernel/sh/shcmds.c +++ b/kaleid/kernel/sh/shcmds.c @@ -127,8 +127,10 @@ error_t CmdDie(int argc, char **argv, char *cmdline) error_t CmdDumpATASect(int argc, char **argv, char *cmdline) { - char sector[513] = {0}; + char sector[600] = {0}; int sectNumber = ShAtoi(argv[1]); + int x = 0; + size_t ret; if (!sectNumber) { KernLog("Bad argument\n\n"); @@ -139,11 +141,22 @@ error_t CmdDumpATASect(int argc, char **argv, char *cmdline) IoReadATA(sector, 1, sectNumber); - for (int i = 0; i < 513; i++) { - if (isprint(sector[i])) - KernLog("%c", sector[i]); - else - KernLog(" "); + while(x < 513) { + for (int i = 0; i < 13; i++) { + KernLog("%02x ", (uchar)sector[i+x]); + } + KernLog(" "); + for (int i = 0; i < 13; i++) { + if (isprint(sector[i+x])) + KernLog("%C%c%C", + VGA_COLOR_LIGHT_BLUE, + sector[i+x], + shcol); + else + KernLog("%c", 0); + } + KernLog("\n"); + x += 20; } KernLog("\n\n");