Boost logo

Boost :

Subject: Re: [boost] [coroutine] : My Confusion
From: Oliver Kowalke (oliver.kowalke_at_[hidden])
Date: 2012-05-09 02:03:25


Hi Chris,

> In the past, I would always pass a pointer to an abstraction of the
> context to an assembly routine that was responsible for
>
> * context-save
> * task switch
> * context-restore and task re-schedule

> Where are these things in
> Boost.Coroutine?
> Where is the low-level assembly that does the *nuts-and-bolts*
> of the context switching?

boost.context contains struct fcontext_t storing the architecture+ABI specific stuff (registers) and functions make_fcontext() and jump_fcontext(). The first function is used to set up a fcontext_t and the second one is used to jump from one context to another one. Both functions are written in assembler.

Template coroutine aggregates two fcontext's.
One to store the relevant registers form the calling context and the second struct contains the register stuff of the to called context (coroutines context, coroutine's funtion).

> Or am I just totally confused here? Are you doing it in
> a high-level abstraction that I simply don't understand?
> Are you using proprocessor macros to do the context switch?

it's assembler code (no inline assembler).

> Where is the assembler stuff?

libs/context/src/asm/...

so long,
Oliver

-- 
NEU: FreePhone 3-fach-Flat mit kostenlosem Smartphone!                                  
Jetzt informieren: http://mobile.1und1.de/?ac=OM.PW.PW003K20328T7073a

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk