/kernel/trunk/tools/sparc64/gencontext.c |
---|
27,15 → 27,13 |
fprintf(f, "/* This file is automatically generated by %s. */\n", __FILE__); |
fprintf(f,"/* struct context */\n"); |
fprintf(f,"#define OFFSET_O1 0x%x\n",((int)&pctx->o1) - (int )pctx); |
fprintf(f,"#define OFFSET_O2 0x%x\n",((int)&pctx->o2) - (int )pctx); |
fprintf(f,"#define OFFSET_O3 0x%x\n",((int)&pctx->o3) - (int )pctx); |
fprintf(f,"#define OFFSET_O4 0x%x\n",((int)&pctx->o4) - (int )pctx); |
fprintf(f,"#define OFFSET_O5 0x%x\n",((int)&pctx->o5) - (int )pctx); |
fprintf(f,"#define OFFSET_SP 0x%x\n",((int)&pctx->sp) - (int )pctx); |
fprintf(f,"#define OFFSET_FP 0x%x\n",((int)&pctx->fp) - (int )pctx); |
fprintf(f,"#define OFFSET_PC 0x%x\n",((int)&pctx->pc) - (int )pctx); |
fprintf(f,"#define OFFSET_I1 0x%x\n",((int)&pctx->i1) - (int )pctx); |
fprintf(f,"#define OFFSET_I2 0x%x\n",((int)&pctx->i2) - (int )pctx); |
fprintf(f,"#define OFFSET_I3 0x%x\n",((int)&pctx->i3) - (int )pctx); |
fprintf(f,"#define OFFSET_I4 0x%x\n",((int)&pctx->i4) - (int )pctx); |
fprintf(f,"#define OFFSET_I5 0x%x\n",((int)&pctx->i5) - (int )pctx); |
fclose(f); |
/kernel/trunk/arch/sparc64/include/context_offset.h |
---|
1,10 → 1,9 |
/* This file is automatically generated by gencontext.c. */ |
/* struct context */ |
#define OFFSET_SP 0x38 |
#define OFFSET_FP 0x28 |
#define OFFSET_O1 0x0 |
#define OFFSET_O2 0x8 |
#define OFFSET_O3 0x10 |
#define OFFSET_O4 0x18 |
#define OFFSET_O5 0x20 |
#define OFFSET_SP 0x28 |
#define OFFSET_PC 0x30 |
#define OFFSET_I1 0x0 |
#define OFFSET_I2 0x8 |
#define OFFSET_I3 0x10 |
#define OFFSET_I4 0x18 |
#define OFFSET_I5 0x20 |
/kernel/trunk/arch/sparc64/include/context.h |
---|
49,7 → 49,6 |
#define context_set(c, _pc, stack, size) \ |
(c)->pc = ((__address) _pc) - 8; \ |
(c)->fp = NULL; \ |
(c)->sp = ((__address) stack) + ALIGN((size), STACK_ALIGNMENT) - (STACK_BIAS + SP_DELTA) |
/* |
58,14 → 57,13 |
* register window. |
*/ |
struct context { |
__u64 i1; |
__u64 i2; |
__u64 i3; |
__u64 i4; |
__u64 i5; |
__address fp; /* %i6 */ |
__address pc; /* %i7 */ |
__address sp; |
__u64 o1; |
__u64 o2; |
__u64 o3; |
__u64 o4; |
__u64 o5; |
__address sp; /* %o6 */ |
__address pc; /* %o7 */ |
ipl_t ipl; |
}; |
/kernel/trunk/arch/sparc64/src/context.S |
---|
35,42 → 35,36 |
.global context_restore_arch |
.macro CONTEXT_STORE r |
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_PC] |
stx %o1, [\r + OFFSET_I1] |
stx %o2, [\r + OFFSET_I2] |
stx %o3, [\r + OFFSET_I3] |
stx %o4, [\r + OFFSET_I4] |
stx %o5, [\r + OFFSET_I5] |
stx %o7, [\r + OFFSET_PC] |
stx %sp, [\r + OFFSET_SP] |
.endm |
.macro CONTEXT_LOAD r |
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_PC], %i7 |
ldx [\r + OFFSET_I1], %o1 |
ldx [\r + OFFSET_I2], %o2 |
ldx [\r + OFFSET_I3], %o3 |
ldx [\r + OFFSET_I4], %o4 |
ldx [\r + OFFSET_I5], %o5 |
ldx [\r + OFFSET_PC], %o7 |
ldx [\r + OFFSET_SP], %sp |
.endm |
context_save_arch: |
save %sp, -STACK_WINDOW_SAVE_AREA_SIZE, %sp |
CONTEXT_STORE %i0 |
CONTEXT_STORE %o0 |
# context_save returns 1 |
mov 1, %i0 |
ret |
restore %sp, STACK_WINDOW_SAVE_AREA_SIZE, %sp |
retl |
mov 1, %o0 |
context_restore_arch: |
save %sp, -STACK_WINDOW_SAVE_AREA_SIZE, %sp |
CONTEXT_LOAD %i0 |
CONTEXT_LOAD %o0 |
# context_restore returns 0 |
xor %i0, %i0, %i0 |
ret |
restore %sp, STACK_WINDOW_SAVE_AREA_SIZE, %sp |
retl |
xor %o0, %o0, %o0 |