Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix 10-SystemCall trap bug #15

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

fix 10-SystemCall trap bug #15

wants to merge 1 commit into from

Conversation

ccckmit
Copy link
Contributor

@ccckmit ccckmit commented Nov 15, 2021

  1. timer_scratch[][] => trap_scratch[][]
  2. 擴大 scratch 大小為 32+1
  3. 用 csrrw t6, mscratch, t6 , 避免原本 t6 可能改變的風險

Copy link
Collaborator

@ianchen0119 ianchen0119 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

相關 comment 都在 sys.s,再麻煩老師解惑 <(_ _)>


# save mepc to context of current task
csrr a0, mepc
sw a0, 124(t6)
sw a0, 128(t6)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

124(t6) 應該沒有使用到,為何要用 128(t6)


csrrw t6, mscratch, t6
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

感覺這行與 line 162 的 csrrw t6, mscratch, t6 都可以移除掉(?)


# Do actual context switching.
# Notice this will enable global interrupt
csrrw t6, mscratch, t6
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

t 開頭的暫存器都是提供暫存用的,trap_vector 結束時不換回來也沒關係。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants