[rtems commit] rtems: make error codes uintptr_t

Gedare Bloom gedare at gwu.edu
Mon Mar 16 19:57:28 UTC 2015


On Mon, Mar 16, 2015 at 3:53 PM, Gedare Bloom <gedare at gwu.edu> wrote:
> On Mon, Mar 16, 2015 at 3:36 PM, Sebastian Huber
> <sebastian.huber at embedded-brains.de> wrote:
>>
>> ----- Gedare Bloom <gedare at gwu.edu> schrieb:
>>> On Mon, Mar 16, 2015 at 2:23 PM, Sebastian Huber
>>> <sebastian.huber at embedded-brains.de> wrote:
>>> >
>>> > ----- Gedare Bloom <gedare at rtems.org> schrieb:
>>> >> Module:    rtems
>>> >> Branch:    master
>>> >> Commit:    1ff449cfc473f6b88e1495492aebd665ad42b236
>>> >> Changeset: http://git.rtems.org/rtems/commit/?id=1ff449cfc473f6b88e1495492aebd665ad42b236
>>> >>
>>> >> Author:    Gedare Bloom <gedare at rtems.org>
>>> >> Date:      Mon Mar 16 12:15:27 2015 -0400
>>> >>
>>> >> rtems: make error codes uintptr_t
>>> >>
>>> >> ---
>>> >>
>>> >>  cpukit/score/include/rtems/score/interr.h | 2 +-
>>> >>  1 file changed, 1 insertion(+), 1 deletion(-)
>>> >>
>>> >> diff --git a/cpukit/score/include/rtems/score/interr.h b/cpukit/score/include/rtems/score/interr.h
>>> >> index e0cedaf..7c2a604 100644
>>> >> --- a/cpukit/score/include/rtems/score/interr.h
>>> >> +++ b/cpukit/score/include/rtems/score/interr.h
>>> >> @@ -164,7 +164,7 @@ typedef enum {
>>> >>    INTERNAL_ERROR_RESOURCE_IN_USE
>>> >>  } Internal_errors_Core_list;
>>> >>
>>> >> -typedef uint32_t Internal_errors_t;
>>> >> +typedef uintptr_t Internal_errors_t;
>>> >
>>> > This is a problem on 16-bit targets.  I suggest to use unsigned long here.
>>> I guess this is fine as long as all 64-bit targets are LP64.
>>
>> The rtems_task_argument has a similar problem.  Maybe we need a new CPU type, e.g. CPU_Uintptr_and_at_least_32_bits.
>
> OK, we could do something like
> typedef unsigned long CPU_Uint32ptr;
> in the 16-bit targets, and
> typedef uintptr_t CPU_Uint32ptr;
> in the rest, in their score/cpu.h files.
>
Actually, we can do something else by checking if size of pointer less
than size of long, use unsigned long, otherwise use uintptr_t.

> The only obvious alternative I see would be to limit strictly the
> error code and task args to be int or ptr.
>
> Gedare
>
>> _______________________________________________
>> devel mailing list
>> devel at rtems.org
>> http://lists.rtems.org/mailman/listinfo/devel


More information about the devel mailing list