Page 1 of 1

Strange behavior of functions be called after task switching

Posted: Wed Sep 23, 2020 2:40 am
by mrjbom
Hi.
I rewrite the code of my task switcher for the hundredth time and now it seems to work correctly.
However, I get a strange error related to calling a function rather than switching tasks.

So, in order for threads running at the kernel level to safely use "return", the first time I call them with the help of "call".
Immediately after calling the thread function, I make a call to the function that completes execution as soon as the thread terminates.
However, here I have problems. This function prints nonsense(data about the first thread is correct, data about the second thread is incorrect, and there should not be a third thread)
For the test I tried calling this function 3 times here and everything prints fine.

It turns out that if I call a function that prints data from another function, I run into problems.
Why is she acting like this?