mirror of
https://github.com/plctlab/riscv-operating-system-mooc.git
synced 2025-12-26 17:19:04 +00:00
improved comments
Signed-off-by: ablechen <17895010372@163.com> Signed-off-by: Wang Chen <wangchen20@iscas.ac.cn>
This commit is contained in:
@@ -89,12 +89,16 @@
|
||||
.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: the first time switch_to() is
|
||||
# called, mscratch is initialized as zero
|
||||
# (in sched_init()), which makes t6 zero,
|
||||
# and that's the special case we have to
|
||||
# handle with t6
|
||||
reg_save t6 # save context of prev task
|
||||
|
||||
# Save the actual t6 register, which we swapped into
|
||||
# mscratch
|
||||
mv t5, t6 # t5 points to the context of current task
|
||||
mv t5, t6 # t5 points to the context of next task
|
||||
csrr t6, mscratch # read t6 back from mscratch
|
||||
sw t6, 120(t5) # save t6 with t5 as base
|
||||
|
||||
|
||||
@@ -89,12 +89,16 @@
|
||||
.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: the first time switch_to() is
|
||||
# called, mscratch is initialized as zero
|
||||
# (in sched_init()), which makes t6 zero,
|
||||
# and that's the special case we have to
|
||||
# handle with t6
|
||||
reg_save t6 # save context of prev task
|
||||
|
||||
# Save the actual t6 register, which we swapped into
|
||||
# mscratch
|
||||
mv t5, t6 # t5 points to the context of current task
|
||||
mv t5, t6 # t5 points to the context of next task
|
||||
csrr t6, mscratch # read t6 back from mscratch
|
||||
sw t6, 120(t5) # save t6 with t5 as base
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -122,12 +122,16 @@ trap_vector:
|
||||
.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: the first time switch_to() is
|
||||
# called, mscratch is initialized as zero
|
||||
# (in sched_init()), which makes t6 zero,
|
||||
# and that's the special case we have to
|
||||
# handle with t6
|
||||
reg_save t6 # save context of prev task
|
||||
|
||||
# Save the actual t6 register, which we swapped into
|
||||
# mscratch
|
||||
mv t5, t6 # t5 points to the context of current task
|
||||
mv t5, t6 # t5 points to the context of next task
|
||||
csrr t6, mscratch # read t6 back from mscratch
|
||||
sw t6, 120(t5) # save t6 with t5 as base
|
||||
|
||||
|
||||
@@ -38,7 +38,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
|
||||
|
||||
@@ -122,12 +122,16 @@ trap_vector:
|
||||
.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: the first time switch_to() is
|
||||
# called, mscratch is initialized as zero
|
||||
# (in sched_init()), which makes t6 zero,
|
||||
# and that's the special case we have to
|
||||
# handle with t6
|
||||
reg_save t6 # save context of prev task
|
||||
|
||||
# Save the actual t6 register, which we swapped into
|
||||
# mscratch
|
||||
mv t5, t6 # t5 points to the context of current task
|
||||
mv t5, t6 # t5 points to the context of next task
|
||||
csrr t6, mscratch # read t6 back from mscratch
|
||||
sw t6, 120(t5) # save t6 with t5 as base
|
||||
|
||||
|
||||
@@ -38,7 +38,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
|
||||
|
||||
@@ -122,12 +122,16 @@ trap_vector:
|
||||
.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: the first time switch_to() is
|
||||
# called, mscratch is initialized as zero
|
||||
# (in sched_init()), which makes t6 zero,
|
||||
# and that's the special case we have to
|
||||
# handle with t6
|
||||
reg_save t6 # save context of prev task
|
||||
|
||||
# Save the actual t6 register, which we swapped into
|
||||
# mscratch
|
||||
mv t5, t6 # t5 points to the context of current task
|
||||
mv t5, t6 # t5 points to the context of next task
|
||||
csrr t6, mscratch # read t6 back from mscratch
|
||||
sw t6, 120(t5) # save t6 with t5 as base
|
||||
|
||||
|
||||
@@ -38,7 +38,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
|
||||
|
||||
@@ -41,7 +41,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
|
||||
|
||||
@@ -41,7 +41,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
|
||||
|
||||
@@ -41,7 +41,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
|
||||
|
||||
@@ -41,7 +41,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
|
||||
|
||||
Reference in New Issue
Block a user