fix: indirect block alloc

This commit is contained in:
d0p1 🏳️‍⚧️ 2024-09-02 11:42:31 +02:00
parent 8165ea664f
commit 8505e8f23e
2 changed files with 7 additions and 2 deletions

View file

@ -38,6 +38,7 @@ bmap(struct fs_inode *ip, uint32_t blocknum)
if (addrs[index] == 0) if (addrs[index] == 0)
{ {
addrs[index] = fs_balloc(ip->super); addrs[index] = fs_balloc(ip->super);
fs_bio_bwrite(buff);
} }
fs_bio_brelse(buff); fs_bio_brelse(buff);
return (addrs[index]); return (addrs[index]);

View file

@ -136,10 +136,12 @@ start:
cmp edx, 7 cmp edx, 7
jb .direct_loop jb .direct_loop
xchg bx, bx
.indirect_read: .indirect_read:
push ebx push ebx
mov ax, DISK_BUFFER/10 mov ax, DISK_BUFFER/0x10
mov es, ax mov es, ax
mov eax, [DISK_BUFFER + 512 + INODE_SIZE * 2 + inode.zones + 28] ;zones[7] == indirect mov eax, [DISK_BUFFER + 512 + INODE_SIZE * 2 + inode.zones + 28] ;zones[7] == indirect
@ -147,7 +149,9 @@ start:
xor bx, bx xor bx, bx
call disk_read_sectors call disk_read_sectors
mov ax, LOADER_BASE/10 xchg bx, bx
mov ax, LOADER_BASE/0x10
mov es, ax mov es, ax
pop ebx pop ebx