Commit bf917a1
committed
[libcpu-riscv]: [surpport SMP]: Fix the overflow issue of the spinlock's owner field
The owner field is of type unsigned short. When 0xffff is incremented by 1,
it will wrap around to 0 and carry over, causing errors in the ticket field.
Solution: When the owner field is 0xffff, simply set it to 0 manually.
Signed-off-by: Mengchen Teng <teng_mengchen@163.com>1 parent 9cdbc36 commit bf917a1
1 file changed
Lines changed: 14 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
158 | 158 | | |
159 | 159 | | |
160 | 160 | | |
161 | | - | |
162 | | - | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
163 | 175 | | |
164 | 176 | | |
165 | 177 | | |
| |||
0 commit comments