/trunk/uspace/lib/libc/arch/sparc64/include/context_offset.h |
---|
0,0 → 1,21 |
/* This file is automatically generated by gencontext.c. */ |
/* struct context */ |
#define OFFSET_SP 0x0 |
#define OFFSET_PC 0x8 |
#define OFFSET_I0 0x10 |
#define OFFSET_I1 0x18 |
#define OFFSET_I2 0x20 |
#define OFFSET_I3 0x28 |
#define OFFSET_I4 0x30 |
#define OFFSET_I5 0x38 |
#define OFFSET_FP 0x40 |
#define OFFSET_I7 0x48 |
#define OFFSET_L0 0x50 |
#define OFFSET_L1 0x58 |
#define OFFSET_L2 0x60 |
#define OFFSET_L3 0x68 |
#define OFFSET_L4 0x70 |
#define OFFSET_L5 0x78 |
#define OFFSET_L6 0x80 |
#define OFFSET_L7 0x88 |
#define OFFSET_TP 0x90 |
/trunk/uspace/lib/libc/arch/sparc64/src/fibril.S |
---|
26,7 → 26,7 |
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
# |
#include <kernel/arch/context_offset.h> |
#include <libarch/context_offset.h> |
.text |
33,8 → 33,52 |
.global context_save |
.global context_restore |
.macro CONTEXT_STORE r |
stx %sp, [\r + OFFSET_SP] |
stx %o7, [\r + OFFSET_PC] |
stx %i0, [\r + OFFSET_I0] |
stx %i1, [\r + OFFSET_I1] |
stx %i2, [\r + OFFSET_I2] |
stx %i3, [\r + OFFSET_I3] |
stx %i4, [\r + OFFSET_I4] |
stx %i5, [\r + OFFSET_I5] |
stx %fp, [\r + OFFSET_FP] |
stx %i7, [\r + OFFSET_I7] |
stx %l0, [\r + OFFSET_L0] |
stx %l1, [\r + OFFSET_L1] |
stx %l2, [\r + OFFSET_L2] |
stx %l3, [\r + OFFSET_L3] |
stx %l4, [\r + OFFSET_L4] |
stx %l5, [\r + OFFSET_L5] |
stx %l6, [\r + OFFSET_L6] |
stx %l7, [\r + OFFSET_L7] |
stx %g7, [\r + OFFSET_TP] |
.endm |
.macro CONTEXT_LOAD r |
ldx [\r + OFFSET_SP], %sp |
ldx [\r + OFFSET_PC], %o7 |
ldx [\r + OFFSET_I0], %i0 |
ldx [\r + OFFSET_I1], %i1 |
ldx [\r + OFFSET_I2], %i2 |
ldx [\r + OFFSET_I3], %i3 |
ldx [\r + OFFSET_I4], %i4 |
ldx [\r + OFFSET_I5], %i5 |
ldx [\r + OFFSET_FP], %fp |
ldx [\r + OFFSET_I7], %i7 |
ldx [\r + OFFSET_L0], %l0 |
ldx [\r + OFFSET_L1], %l1 |
ldx [\r + OFFSET_L2], %l2 |
ldx [\r + OFFSET_L3], %l3 |
ldx [\r + OFFSET_L4], %l4 |
ldx [\r + OFFSET_L5], %l5 |
ldx [\r + OFFSET_L6], %l6 |
ldx [\r + OFFSET_L7], %l7 |
ldx [\r + OFFSET_TP], %g7 |
.endm |
context_save: |
CONTEXT_SAVE_ARCH_CORE %o0 |
CONTEXT_STORE %o0 |
retl |
mov 1, %o0 ! context_save_arch returns 1 |
48,6 → 92,6 |
# |
flushw |
CONTEXT_RESTORE_ARCH_CORE %o0 |
CONTEXT_LOAD %o0 |
retl |
xor %o0, %o0, %o0 ! context_restore_arch returns 0 |
/trunk/kernel/arch/sparc64/include/context_offset.h |
---|
48,60 → 48,4 |
#define OFFSET_L6 0x80 |
#define OFFSET_L7 0x88 |
#ifndef KERNEL |
# define OFFSET_TP 0x90 |
#endif |
#ifdef __ASM__ |
.macro CONTEXT_SAVE_ARCH_CORE ctx:req |
stx %sp, [\ctx + OFFSET_SP] |
stx %o7, [\ctx + OFFSET_PC] |
stx %i0, [\ctx + OFFSET_I0] |
stx %i1, [\ctx + OFFSET_I1] |
stx %i2, [\ctx + OFFSET_I2] |
stx %i3, [\ctx + OFFSET_I3] |
stx %i4, [\ctx + OFFSET_I4] |
stx %i5, [\ctx + OFFSET_I5] |
stx %fp, [\ctx + OFFSET_FP] |
stx %i7, [\ctx + OFFSET_I7] |
stx %l0, [\ctx + OFFSET_L0] |
stx %l1, [\ctx + OFFSET_L1] |
stx %l2, [\ctx + OFFSET_L2] |
stx %l3, [\ctx + OFFSET_L3] |
stx %l4, [\ctx + OFFSET_L4] |
stx %l5, [\ctx + OFFSET_L5] |
stx %l6, [\ctx + OFFSET_L6] |
stx %l7, [\ctx + OFFSET_L7] |
#ifndef KERNEL |
stx %g7, [\ctx + OFFSET_TP] |
#endif |
.endm |
.macro CONTEXT_RESTORE_ARCH_CORE ctx:req |
ldx [\ctx + OFFSET_SP], %sp |
ldx [\ctx + OFFSET_PC], %o7 |
ldx [\ctx + OFFSET_I0], %i0 |
ldx [\ctx + OFFSET_I1], %i1 |
ldx [\ctx + OFFSET_I2], %i2 |
ldx [\ctx + OFFSET_I3], %i3 |
ldx [\ctx + OFFSET_I4], %i4 |
ldx [\ctx + OFFSET_I5], %i5 |
ldx [\ctx + OFFSET_FP], %fp |
ldx [\ctx + OFFSET_I7], %i7 |
ldx [\ctx + OFFSET_L0], %l0 |
ldx [\ctx + OFFSET_L1], %l1 |
ldx [\ctx + OFFSET_L2], %l2 |
ldx [\ctx + OFFSET_L3], %l3 |
ldx [\ctx + OFFSET_L4], %l4 |
ldx [\ctx + OFFSET_L5], %l5 |
ldx [\ctx + OFFSET_L6], %l6 |
ldx [\ctx + OFFSET_L7], %l7 |
#ifndef KERNEL |
ldx [\ctx + OFFSET_TP], %g7 |
#endif |
.endm |
#endif /* __ASM__ */ |
#endif |
/trunk/kernel/arch/sparc64/src/context.S |
---|
36,15 → 36,55 |
* functions. |
*/ |
#include <arch/context_offset.h> |
.text |
.global context_save_arch |
.global context_restore_arch |
.macro CONTEXT_STORE r |
stx %sp, [\r + OFFSET_SP] |
stx %o7, [\r + OFFSET_PC] |
stx %i0, [\r + OFFSET_I0] |
stx %i1, [\r + OFFSET_I1] |
stx %i2, [\r + OFFSET_I2] |
stx %i3, [\r + OFFSET_I3] |
stx %i4, [\r + OFFSET_I4] |
stx %i5, [\r + OFFSET_I5] |
stx %fp, [\r + OFFSET_FP] |
stx %i7, [\r + OFFSET_I7] |
stx %l0, [\r + OFFSET_L0] |
stx %l1, [\r + OFFSET_L1] |
stx %l2, [\r + OFFSET_L2] |
stx %l3, [\r + OFFSET_L3] |
stx %l4, [\r + OFFSET_L4] |
stx %l5, [\r + OFFSET_L5] |
stx %l6, [\r + OFFSET_L6] |
stx %l7, [\r + OFFSET_L7] |
.endm |
.macro CONTEXT_LOAD r |
ldx [\r + OFFSET_SP], %sp |
ldx [\r + OFFSET_PC], %o7 |
ldx [\r + OFFSET_I0], %i0 |
ldx [\r + OFFSET_I1], %i1 |
ldx [\r + OFFSET_I2], %i2 |
ldx [\r + OFFSET_I3], %i3 |
ldx [\r + OFFSET_I4], %i4 |
ldx [\r + OFFSET_I5], %i5 |
ldx [\r + OFFSET_FP], %fp |
ldx [\r + OFFSET_I7], %i7 |
ldx [\r + OFFSET_L0], %l0 |
ldx [\r + OFFSET_L1], %l1 |
ldx [\r + OFFSET_L2], %l2 |
ldx [\r + OFFSET_L3], %l3 |
ldx [\r + OFFSET_L4], %l4 |
ldx [\r + OFFSET_L5], %l5 |
ldx [\r + OFFSET_L6], %l6 |
ldx [\r + OFFSET_L7], %l7 |
.endm |
context_save_arch: |
CONTEXT_SAVE_ARCH_CORE %o0 |
CONTEXT_STORE %o0 |
retl |
mov 1, %o0 ! context_save_arch returns 1 |
58,6 → 98,6 |
# |
flushw |
CONTEXT_RESTORE_ARCH_CORE %o0 |
CONTEXT_LOAD %o0 |
retl |
xor %o0, %o0, %o0 ! context_restore_arch returns 0 |