context::regs
Adam Lackorzynski
adam at os.inf.tu-dresden.de
Sun May 3 23:29:43 CEST 2015
On Wed Apr 29, 2015 at 14:20:11 +0800, watermirror wrote:
> hi,the implemention of Context::regs() is like this:
>
> return reinterpret_cast<Entry_frame*>(Cpu::stack_align(reinterpret_cast<Mword>(this + Size)) -1;
>
> how this algorithm came out?i think the memory of the object is allocated by c++ compiler, but why '(this + Size)' could get Entry_frame of a thread?
The stacks of the threads have a 2^n size and are size-aligned which
makes such calculations possible. Threads also have their own new
operator which handles this.
Adam
--
Adam adam at os.inf.tu-dresden.de
Lackorzynski http://os.inf.tu-dresden.de/~adam/
More information about the l4-hackers
mailing list