jserv / mini-arm-os

Build a minimal multi-tasking OS kernel for ARM from scratch
Other
1.06k stars 243 forks source link

Fix unexpected intial content in user thread stack #16

Closed iankuan closed 7 years ago

iankuan commented 7 years ago

When program initialize the second thread, we don't need to predefine apsr. It should be zero.

jserv commented 7 years ago

Improve Git commit messages first. It was meant "predefine apsr" but a matter of Thumb bit manipulate.

iankuan commented 7 years ago

I think it is more appropriate to change the commit message to "In this implementation, the second thread would be trigged by exception return. The unexpected behavior would happen on loading xpsr. It shouldn't enable carry flag in apsr at first time."

jserv commented 7 years ago

Change from

In this implementation, the second thread would be trigged by exception return. The unexpected behavior would happen on loading xpsr. It shouldn't enable carry flag in apsr at first time.

to

After creation of first user-level thread, the next thread is likely triggered by exception return. However, unexpected behavior occurs while the load of xPSR due to incorrect configuration on enabling carry flags in APSR at the initial stage.

jserv commented 7 years ago

The subject "Fix unexpected thread initialization" is not precise though.