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:
40abf56
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/mips32/include/libarch/tls.h

    r9b1baac r0b05082  
    6161 * - No assumption about DTV etc., but it will not have a fixed address
    6262 */
    63 #define MIPS_TP_OFFSET 0x7000
     63#define ARCH_TP_OFFSET (0x7000 + sizeof(tcb_t))
    6464
    6565typedef struct {
     
    6767} tcb_t;
    6868
    69 static inline void __tcb_set(tcb_t *tcb)
     69static inline void __tcb_raw_set(void *tls)
    7070{
    71         uint8_t *tp = (uint8_t *) tcb;
    72         tp += MIPS_TP_OFFSET + sizeof(tcb_t);
    73 
    74         asm volatile ("add $27, %0, $0" : : "r" (tp)); /* Move tls to K1 */
     71        /* Move tls to K1 */
     72        asm volatile ("add $27, %0, $0" :: "r" (tls));
    7573}
    7674
    77 static inline tcb_t *__tcb_get(void)
     75static inline void *__tcb_raw_get(void)
    7876{
    79         uint8_t *retval;
    80 
     77        void *retval;
    8178        asm volatile ("add %0, $27, $0" : "=r" (retval));
    82 
    83         return (tcb_t *)(retval - MIPS_TP_OFFSET - sizeof(tcb_t));
     79        return retval;
    8480}
    8581
Note: See TracChangeset for help on using the changeset viewer.