Ignore:
Timestamp:
2018-07-18T18:56:16Z (7 years ago)
Author:
Jiří Zárevúcky <jiri.zarevucky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
40abf56a
Parents:
9b1baac
git-author:
Jiří Zárevúcky <jiri.zarevucky@…> (2018-07-18 14:25:11)
git-committer:
Jiří Zárevúcky <jiri.zarevucky@…> (2018-07-18 18:56:16)
Message:

Adds

  • tcb_raw_get(), which returns the value of the TP register without any offsets applied to it,
  • tcb_raw_set(), which does the opposite,
  • tcb_is_set(), which returns true iff the register is not NULL,
  • tcb_reset(), which sets the register to NULL.

Used for debug assertions.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/arch/ppc32/include/libarch/tls.h

    r9b1baac r0b05082  
    4040#include <libc.h>
    4141
    42 #define PPC_TP_OFFSET 0x7000
     42#define ARCH_TP_OFFSET (0x7000 + sizeof(tcb_t))
    4343
    4444typedef struct {
     
    4646} tcb_t;
    4747
    48 static inline void __tcb_set(tcb_t *tcb)
     48static inline void __tcb_raw_set(void *tls)
    4949{
    50         uint8_t *tp = (uint8_t *) tcb;
    51         tp += PPC_TP_OFFSET + sizeof(tcb_t);
    52 
    53         asm volatile (
    54             "mr %%r2, %0\n"
    55             :
    56             : "r" (tp)
    57         );
     50        asm volatile ("mr %%r2, %0\n" :: "r" (tls));
    5851}
    5952
    60 static inline tcb_t *__tcb_get(void)
     53static inline void *__tcb_raw_get(void)
    6154{
    62         uint8_t *retval;
    63 
    64         asm volatile (
    65             "mr %0, %%r2\n"
    66             : "=r" (retval)
    67         );
    68 
    69         return (tcb_t *) (retval - PPC_TP_OFFSET - sizeof(tcb_t));
     55        void *retval;
     56        asm volatile ("mr %0, %%r2\n" : "=r" (retval));
     57        return retval;
    7058}
    7159
Note: See TracChangeset for help on using the changeset viewer.