From 60c532a504d9905994b5fd720c29d7d85538c97e Mon Sep 17 00:00:00 2001 From: ablechen <17895010372@163.com> Date: Mon, 8 Aug 2022 22:33:59 +0800 Subject: [PATCH 1/4] fixed the comment of 'reg_save t6' --- code/os/03-contextswitch/entry.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/os/03-contextswitch/entry.S b/code/os/03-contextswitch/entry.S index e952564..5896878 100644 --- a/code/os/03-contextswitch/entry.S +++ b/code/os/03-contextswitch/entry.S @@ -90,7 +90,7 @@ switch_to: csrrw t6, mscratch, t6 # swap t6 and mscratch beqz t6, 1f # Notice: previous task may be NULL - reg_save t6 # save context of prev task + reg_save t6 # save context of current task # Save the actual t6 register, which we swapped into # mscratch -- Gitee From 250487afc128c544555c85da9a942fc179098e68 Mon Sep 17 00:00:00 2001 From: ablechen <17895010372@163.com> Date: Mon, 8 Aug 2022 22:58:01 +0800 Subject: [PATCH 2/4] fixed the comment of 'reg_save t6' --- code/os/03-contextswitch/entry.S | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/code/os/03-contextswitch/entry.S b/code/os/03-contextswitch/entry.S index 5896878..d4b5818 100644 --- a/code/os/03-contextswitch/entry.S +++ b/code/os/03-contextswitch/entry.S @@ -89,7 +89,8 @@ .align 4 switch_to: csrrw t6, mscratch, t6 # swap t6 and mscratch - beqz t6, 1f # Notice: previous task may be NULL + beqz t6, 1f # Notice: if this is the first time to run, t6 will be NULL, + # because after sched_init, mscratch is NULL reg_save t6 # save context of current task # Save the actual t6 register, which we swapped into -- Gitee From 9e9298dbebab9d996aa883c9678ac0d451d93448 Mon Sep 17 00:00:00 2001 From: ablechen <17895010372@163.com> Date: Tue, 9 Aug 2022 20:19:28 +0800 Subject: [PATCH 3/4] fixed a word in the comment --- code/os/04-multitask/sched.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/os/04-multitask/sched.c b/code/os/04-multitask/sched.c index 85259df..1bb3bfd 100644 --- a/code/os/04-multitask/sched.c +++ b/code/os/04-multitask/sched.c @@ -43,7 +43,7 @@ void schedule() /* * DESCRIPTION * Create a task. - * - start_routin: task routune entry + * - start_routin: task routine entry * RETURN VALUE * 0: success * -1: if error occured -- Gitee From c2842a5df6053bcb8afd7456fcd2ffe8814f316c Mon Sep 17 00:00:00 2001 From: ablechen <17895010372@163.com> Date: Tue, 1 Nov 2022 21:29:14 +0800 Subject: [PATCH 4/4] fix some useless statements --- code/os/02-memanagement/page.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/os/02-memanagement/page.c b/code/os/02-memanagement/page.c index b0f1924..fddddd4 100644 --- a/code/os/02-memanagement/page.c +++ b/code/os/02-memanagement/page.c @@ -117,8 +117,8 @@ void *page_alloc(int npages) * meet a free page, continue to check if following * (npages - 1) pages are also unallocated. */ - struct Page *page_j = page_i; - for (int j = i; j < (i + npages); j++) { + struct Page *page_j = page_i+1; + for (int j = i+1; j < (i + npages); j++) { if (!_is_free(page_j)) { found = 0; break; -- Gitee