From 29e5ba8116d8ed5c4984b13d1563ad629f2ff825 Mon Sep 17 00:00:00 2001 From: d0p1 Date: Mon, 22 Jul 2024 17:32:12 +0200 Subject: [PATCH] fix: ata disk enumeration --- kernel/Makefile | 2 +- kernel/bio.inc | 11 ++++++++++- kernel/dev/at/ata.inc | 6 +++--- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/kernel/Makefile b/kernel/Makefile index 51d909e..0f4ad01 100644 --- a/kernel/Makefile +++ b/kernel/Makefile @@ -43,7 +43,7 @@ SRCS = kernel.asm \ .PHONY: all all: $(KERNEL) -PHONY: const.inc +.PHONY: const.inc const.inc: const.inc.in sh $(TOOLSDIR)/version.sh $< $@ diff --git a/kernel/bio.inc b/kernel/bio.inc index d9c56e2..32036e8 100644 --- a/kernel/bio.inc +++ b/kernel/bio.inc @@ -19,7 +19,9 @@ bio_init: rep stosb ret -bio_get: + ;; Function: bio_read + ;; +bio_bread: mov eax, uBIOLock call lock_acquire @@ -27,7 +29,14 @@ bio_get: call lock_release ret + ;; Function: bio_brelse + ;; Unbusy a buffer and release it to the free lists. bio_brelse: + mov eax, uBIOLock + call lock_acquire + + mov eax, uBIOLock + call lock_release ret uBIOLock dd 0 diff --git a/kernel/dev/at/ata.inc b/kernel/dev/at/ata.inc index 266fc47..fe80006 100644 --- a/kernel/dev/at/ata.inc +++ b/kernel/dev/at/ata.inc @@ -156,17 +156,17 @@ ata_probe: jnz .skip push ecx - cmp ecx, ATA_CHAN1_IO + cmp bx, ATA_CHAN1_IO jne @f add ecx, 2 jmp .drive_found @@: - cmp ecx, ATA_CHAN2_IO + cmp bx, ATA_CHAN2_IO jne @f add ecx, 4 jmp .drive_found @@: - cmp ecx, ATA_CHAN3_IO + cmp bx, ATA_CHAN3_IO jne @f add ecx, 8 jmp .drive_found