From: acevest Date: Sat, 11 May 2024 11:07:24 +0000 (+0800) Subject: 修复disk_request_t.bb字段未初始化的问题 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/zlib_tech.html?a=commitdiff_plain;h=fceec7b5bbbf745b9e9559d2b8dcc571cbe5db7a;p=kernel.git 修复disk_request_t.bb字段未初始化的问题 --- diff --git a/drivers/ata.c b/drivers/ata.c index 8feb182..a751cd9 100644 --- a/drivers/ata.c +++ b/drivers/ata.c @@ -226,7 +226,7 @@ void tmp_ide_disk_read(dev_t dev, uint32_t sect_nr, uint32_t count, char *buf) { // mbr_ext_offset: 在MBR中的扩展分区记录里的偏移地址 // lba_partition_table: 扩展分区的真实偏移地址 void read_partition_table(ide_drive_t *drv, uint32_t mbr_ext_offset, uint32_t lba_partition_table, int depth) { - disk_request_t r; + // disk_request_t r; char *sect = kmalloc(SECT_SIZE, 0); #if 1 diff --git a/kernel/semaphore.c b/kernel/semaphore.c index 6000451..19b08b5 100644 --- a/kernel/semaphore.c +++ b/kernel/semaphore.c @@ -58,6 +58,7 @@ volatile void up(semaphore_t *s) { s->cnt++; } else { semaphore_waiter_t *waiter = list_first_entry(&s->wait_list, semaphore_waiter_t, list); + assert(waiter != 0); list_del(&waiter->list); task_t *task = waiter->task; diff --git a/kernel/task_root.c b/kernel/task_root.c index 528f3a9..c7eeead 100644 --- a/kernel/task_root.c +++ b/kernel/task_root.c @@ -112,6 +112,8 @@ void taskA_entry() { r.pos = sect_nr; r.count = 1; r.buf = disk_buf1; + r.bb = 0; + send_disk_request(&r); // verify_hd_data(sect_nr, disk_buf1, current->name); @@ -135,8 +137,10 @@ void taskB_entry() { r.pos = sect_nr; r.count = 1; r.buf = disk_buf2; + r.bb = 0; + send_disk_request(&r); - // verify_hd_data(sect_nr, disk_buf2, current->name); + // verify_hd_data(sect_nr, disk_buf2, current->name); for (int i = 0; i < 1; i++) { asm("hlt;");