]> Zhao Yanbai Git Server - kernel.git/commitdiff
修复disk_request_t.bb字段未初始化的问题
authoracevest <zhaoyanbai@126.com>
Sat, 11 May 2024 11:07:24 +0000 (19:07 +0800)
committeracevest <zhaoyanbai@126.com>
Sat, 11 May 2024 11:07:24 +0000 (19:07 +0800)
drivers/ata.c
kernel/semaphore.c
kernel/task_root.c

index 8feb1820944385eed003fc542ed43e0c3586f15e..a751cd9fd63d1f1ddc6de52487cb37440eb21a56 100644 (file)
@@ -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
index 6000451cb8db5ff3c3c11c8c67981974143de922..19b08b554b90c5233a0272bb1e169a9652414844 100644 (file)
@@ -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;
 
index 528f3a9ac2732a0f6b62e67a6754766a1df12b97..c7eeeadce9f02ddde7fbd1a207506d0c4eaa0019 100644 (file)
@@ -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;");