Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.arch.embedded > #27956

Re: "Boost context" for task switching on embedded Linux on ARM

From Niklas Holsti <niklas.holsti@tidorum.invalid>
Newsgroups comp.arch.embedded
Subject Re: "Boost context" for task switching on embedded Linux on ARM
Date 2018-08-07 22:41 +0300
Organization Tidorum Ltd
Message-ID <fsuauuF4h4vU1@mid.individual.net> (permalink)
References (6 earlier) <d8c82ce1-b784-4cd7-bef2-d8c713a752d9@googlegroups.com> <52566ade-3dcc-43b0-ae3a-707cfc93d8f3@googlegroups.com> <j80gmd5mmlrvh8o99uh2va8kjolkh8bv39@4ax.com> <87pnyvgxuk.fsf@nightsong.com> <c1njmd1rue1r9ot26igdd05nnfffp9ngns@4ax.com>

Show all headers | View raw


On 18-08-07 22:10 , George Neuner wrote:
> On Mon, 06 Aug 2018 11:21:23 -0700, Paul Rubin
> <no.email@nospam.invalid> wrote:
>
>> George Neuner <gneuner2@comcast.net> writes:
>>> Multi-tasking with [setjmp/jmp_buf] is another issue
    ...
>>
>> This sounds pretty horrendous and compiler and hardware dependent.  You
>> are basically writing a miniature OS in your scheduler.
   ...
>> It helps if the compiler docs explicitly say it's supposed to work.
>
> Actually, the C standard says it works - at least if you read between
> the lines.

C11 says it is undefined -- see below.

> [Section] 7.13 guarantees that CPU state[*] sufficient to restore
> the calling environment of setjmp will be preserved in the jmp_buf
> structure, and that that state [modulo setjmp's return value] will be
> restored by calling longjmp.
>
> Although the standard does not address it's use in multitasking, the
> description of the operation of setjmp/longjmp matches quite well the
> description of a register state task switcher.

I don't remember which version of C the OP intends to use, but the C11 
draft (n1570.pdf) contains this text in section 7.13.2.1, for longjmp:

"The longjmp function restores the environment saved by the most recent 
invocation of the setjmp macro in the same invocation of the program 
with the corresponding jmp_buf argument. If ... the invocation was from
another thread of execution ... the behavior is undefined."

-- 
Niklas Holsti
Tidorum Ltd
niklas holsti tidorum fi
       .      @       .

Back to comp.arch.embedded | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

"Boost context" for task switching on embedded Linux on ARM gp.kiwi@gmail.com - 2018-08-03 05:52 -0700
  Re: "Boost context" for task switching on embedded Linux on ARM George Neuner <gneuner2@comcast.net> - 2018-08-04 03:28 -0400
    Re: "Boost context" for task switching on embedded Linux on ARM Niklas Holsti <niklas.holsti@tidorum.invalid> - 2018-08-04 11:13 +0300
      Re: "Boost context" for task switching on embedded Linux on ARM George Neuner <gneuner2@comcast.net> - 2018-08-04 07:08 -0400
        Re: "Boost context" for task switching on embedded Linux on ARM George Neuner <gneuner2@comcast.net> - 2018-08-04 07:22 -0400
          Re: "Boost context" for task switching on embedded Linux on ARM graeme.prentice@gmail.com - 2018-08-04 04:49 -0700
            Re: "Boost context" for task switching on embedded Linux on ARM "gp...@gmail.com" <graeme.prentice@gmail.com> - 2018-08-04 05:25 -0700
              Re: "Boost context" for task switching on embedded Linux on ARM graeme.prentice@gmail.com - 2018-08-04 06:01 -0700
                Re: "Boost context" for task switching on embedded Linux on ARM George Neuner <gneuner2@comcast.net> - 2018-08-06 04:17 -0400
                Re: "Boost context" for task switching on embedded Linux on ARM Paul Rubin <no.email@nospam.invalid> - 2018-08-06 11:21 -0700
                Re: "Boost context" for task switching on embedded Linux on ARM Niklas Holsti <niklas.holsti@tidorum.invalid> - 2018-08-06 22:48 +0300
                Re: "Boost context" for task switching on embedded Linux on ARM gp.kiwi@gmail.com - 2018-08-07 04:43 -0700
                Re: "Boost context" for task switching on embedded Linux on ARM George Neuner <gneuner2@comcast.net> - 2018-08-07 15:10 -0400
                Re: "Boost context" for task switching on embedded Linux on ARM Niklas Holsti <niklas.holsti@tidorum.invalid> - 2018-08-07 22:41 +0300
                Re: "Boost context" for task switching on embedded Linux on ARM George Neuner <gneuner2@comcast.net> - 2018-08-08 00:42 -0400
                Re: "Boost context" for task switching on embedded Linux on ARM Niklas Holsti <niklas.holsti@tidorum.invalid> - 2018-08-08 08:21 +0300
                Re: "Boost context" for task switching on embedded Linux on ARM George Neuner <gneuner2@comcast.net> - 2018-08-09 10:55 -0400
                Re: "Boost context" for task switching on embedded Linux on ARM Niklas Holsti <niklas.holsti@tidorum.invalid> - 2018-08-09 22:14 +0300
            Re: "Boost context" for task switching on embedded Linux on ARM George Neuner <gneuner2@comcast.net> - 2018-08-06 04:04 -0400
              Re: "Boost context" for task switching on embedded Linux on ARM gp.kiwi@gmail.com - 2018-08-06 04:09 -0700
                Re: "Boost context" for task switching on embedded Linux on ARM George Neuner <gneuner2@comcast.net> - 2018-08-06 12:29 -0400

csiph-web