summaryrefslogtreecommitdiff
path: root/stage3/ata.c
diff options
context:
space:
mode:
authorLizzy Fleckenstein <lizzy@vlhl.dev>2024-01-09 21:22:14 +0100
committerLizzy Fleckenstein <lizzy@vlhl.dev>2024-01-09 21:26:23 +0100
commitc6e1454fbb872aed5d445d458958943556271529 (patch)
tree4951f6a95e4ddead170a355940822f8c86b6ed63 /stage3/ata.c
parent59f22bc7ce5bbadf62722f3db5c93b45e86e4cca (diff)
downloadcuddles-c6e1454fbb872aed5d445d458958943556271529.tar.xz
rename some functions to not use standard names
this avoids confusion when some of those functions differ subtly from their standard versions. free -> kfree realloc -> krealloc malloc -> kmalloc rationale: kmalloc() behaves different from malloc() in that it will never return NULL. it will panic on OOM. try_kmalloc behaves like the usual malloc. memcpy -> lmemcpy memcpy_r -> rmemcpy rationale: by design, lmemcpy() and rmemcpy() allow memory areas to overlap. the 'l' and 'r' indicate the direction of the copy operation.
Diffstat (limited to 'stage3/ata.c')
-rw-r--r--stage3/ata.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/stage3/ata.c b/stage3/ata.c
index 3a862fe..94396be 100644
--- a/stage3/ata.c
+++ b/stage3/ata.c
@@ -107,7 +107,7 @@ void ata_init()
if (inb(IO_ATA0_DATA + ATA_IO_LBA_MID) != 0 || inb(IO_ATA0_DATA + ATA_IO_LBA_HIGH) != 0)
panic(S("ata0-witch is not ATA\n"));
- u16 *idvec = malloc(256 * sizeof *idvec);
+ u16 *idvec = kmalloc(256 * sizeof *idvec);
ata_recv(idvec);
if (!(idvec[83] & (1 << 10)))
@@ -116,7 +116,7 @@ void ata_init()
// u64 lba48_sectors = *(u64 *) &idvec[100];
// print_num(lba48_sectors, 10, 0); print("\n");
- free(idvec);
+ kfree(idvec);
print(S("ata0-witch initialized\n"));
}
@@ -147,7 +147,7 @@ void ata_read(u64 lba, u16 sectors, void *buffer)
void *ata_read_full(u64 lba, u64 sectors)
{
- void *buffer = malloc(512 * sectors);
+ void *buffer = kmalloc(512 * sectors);
for (u64 off = 0; off < sectors; off += 0x10000) {
u64 sects = sectors - off;