Work on HD
This commit is contained in:
parent
4ff65f57d0
commit
d0e7d197c1
|
@ -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 <https://www.gnu.org/licenses/>. //
|
||||
//----------------------------------------------------------------------------//
|
||||
|
||||
#ifndef _KERNEL_H
|
||||
#include <kernel.h>
|
||||
#endif
|
||||
|
||||
#ifndef _IO_ATA_H
|
||||
#define _IO_ATA_H
|
||||
|
||||
#include <ke/idt.h>
|
||||
|
||||
//----------------------------------------------------------------------------//
|
||||
|
||||
void IoReadATA(void *sectorBuffer, char n, char first);
|
||||
void IoDumpSector(void);
|
||||
|
||||
//----------------------------------------------------------------------------//
|
||||
|
||||
#endif
|
|
@ -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 <https://www.gnu.org/licenses/>. //
|
||||
//----------------------------------------------------------------------------//
|
||||
|
||||
#include <io/ata.h>
|
||||
#include <io/vga.h>
|
||||
|
||||
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");
|
||||
}
|
|
@ -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
|
||||
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");
|
||||
|
|
Loading…
Reference in New Issue