1,5 → 1,5 |
/* |
* Copyright (C) 2006 Martin Decky |
* Copyright (C) 2005 Jakub Jermar |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
26,35 → 26,56 |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
|
/** @addtogroup libcsparc64 |
/** @addtogroup libcsparc64 |
* @{ |
*/ |
/** @file |
*/ |
|
#ifndef __LIBC__sparc64__PSTHREAD_H__ |
#define __LIBC__sparc64__PSTHREAD_H__ |
#ifndef LIBC_sparc64_PSTHREAD_H_ |
#define LIBC_sparc64_PSTHREAD_H_ |
|
#include <libarch/stack.h> |
#include <types.h> |
#include <align.h> |
|
/* We define our own context_set, because we need to set |
* the TLS pointer to the tcb+0x7000 |
* |
* See tls_set in thread.h |
*/ |
#define context_set(c, _pc, stack, size, ptls) \ |
(c)->pc = (sysarg_t) (_pc); \ |
(c)->sp = ((sysarg_t) (stack)) + (size) - SP_DELTA; \ |
(c)->tls = ((sysarg_t) (ptls)) + 0x7000 + sizeof(tcb_t); |
#define SP_DELTA STACK_WINDOW_SAVE_AREA_SIZE |
|
#define SP_DELTA 16 |
#ifdef context_set |
#undef context_set |
#endif |
|
#define context_set(c, _pc, stack, size, ptls) \ |
(c)->pc = ((uintptr_t) _pc) - 8; \ |
(c)->sp = ((uintptr_t) stack) + ALIGN_UP((size), STACK_ALIGNMENT) - (STACK_BIAS + SP_DELTA); \ |
(c)->fp = -STACK_BIAS; \ |
(c)->tp = ptls |
|
/* |
* Only save registers that must be preserved across |
* function calls. |
*/ |
typedef struct { |
uint64_t sp; |
uint64_t pc; |
|
uint64_t tls; |
} __attribute__ ((packed)) context_t; |
uintptr_t sp; /* %o6 */ |
uintptr_t pc; /* %o7 */ |
uint64_t i0; |
uint64_t i1; |
uint64_t i2; |
uint64_t i3; |
uint64_t i4; |
uint64_t i5; |
uintptr_t fp; /* %i6 */ |
uintptr_t i7; |
uint64_t l0; |
uint64_t l1; |
uint64_t l2; |
uint64_t l3; |
uint64_t l4; |
uint64_t l5; |
uint64_t l6; |
uint64_t l7; |
uint64_t tp; /* %g7 */ |
} context_t; |
|
#endif |
|