Subversion Repositories HelenOS-historic

Compare Revisions

Ignore whitespace Rev 525 → Rev 526

/kernel/trunk/tools/sparc64/gencontext.c
7,6 → 7,7
#define __sparc64_TYPES_H__
#define __ALIGN_H__
 
#include "../../arch/sparc64/include/stack.h"
#include "../../arch/sparc64/include/context.h"
 
#define FILENAME "../../arch/sparc64/include/context_offset.h"
28,15 → 29,8
fprintf(f,"/* struct context */\n");
 
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_L0 0x%x\n",((int)&pctx->l0) - (int )pctx);
fprintf(f,"#define OFFSET_L1 0x%x\n",((int)&pctx->l1) - (int )pctx);
fprintf(f,"#define OFFSET_L2 0x%x\n",((int)&pctx->l2) - (int )pctx);
fprintf(f,"#define OFFSET_L3 0x%x\n",((int)&pctx->l3) - (int )pctx);
fprintf(f,"#define OFFSET_L4 0x%x\n",((int)&pctx->l4) - (int )pctx);
fprintf(f,"#define OFFSET_L5 0x%x\n",((int)&pctx->l5) - (int )pctx);
fprintf(f,"#define OFFSET_L6 0x%x\n",((int)&pctx->l6) - (int )pctx);
fprintf(f,"#define OFFSET_L7 0x%x\n",((int)&pctx->l7) - (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);
/kernel/trunk/arch/sparc64/include/context_offset.h
1,17 → 1,10
/* This file is automatically generated by gencontext.c. */
/* struct context */
#define OFFSET_SP 0x68
#define OFFSET_PC 0x70
#define OFFSET_L0 0x0
#define OFFSET_L1 0x8
#define OFFSET_L2 0x10
#define OFFSET_L3 0x18
#define OFFSET_L4 0x20
#define OFFSET_L5 0x28
#define OFFSET_L6 0x30
#define OFFSET_L7 0x38
#define OFFSET_I1 0x40
#define OFFSET_I2 0x48
#define OFFSET_I3 0x50
#define OFFSET_I4 0x58
#define OFFSET_I5 0x60
#define OFFSET_SP 0x38
#define OFFSET_FP 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
29,7 → 29,9
#ifndef __sparc64_CONTEXT_H__
#define __sparc64_CONTEXT_H__
 
#ifndef __sparc64_STACK_H__
#include <arch/stack.h>
#endif
 
#ifndef __sparc64_TYPES_H__
# include <arch/types.h>
47,28 → 49,23
 
#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)
 
/*
* Only save registers that must be preserved across
* function calls.
* function calls and that are not saved in caller's
* register window.
*/
struct context {
__u64 l0;
__u64 l1;
__u64 l2;
__u64 l3;
__u64 l4;
__u64 l5;
__u64 l6;
__u64 l7;
__u64 i1;
__u64 i2;
__u64 i3;
__u64 i4;
__u64 i5;
__address sp; /* %i6 */
__address fp; /* %i6 */
__address pc; /* %i7 */
__address sp;
ipl_t ipl;
};
 
/kernel/trunk/arch/sparc64/src/context.S
35,38 → 35,23
.global context_restore_arch
 
.macro CONTEXT_STORE r
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 %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 %i6, [\r + OFFSET_SP]
stx %fp, [\r + OFFSET_FP]
stx %i7, [\r + OFFSET_PC]
stx %sp, [\r + OFFSET_SP]
.endm
 
.macro CONTEXT_LOAD r
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_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_SP], %i6
ldx [\r + OFFSET_FP], %fp
ldx [\r + OFFSET_PC], %i7
ldx [\r + OFFSET_SP], %sp
.endm
77,15 → 62,15
CONTEXT_STORE %i0
 
# context_save returns 1
mov 1, %i0
mov 1, %i0
ret
restore %sp, 128, %sp
restore %sp, STACK_WINDOW_SAVE_AREA_SIZE, %sp
 
context_restore_arch:
save %sp, -STACK_WINDOW_SAVE_AREA_SIZE, %sp
CONTEXT_LOAD %i0
 
# context_restore returns 0
xor %i0, %i0, %i0
xor %i0, %i0, %i0
ret
restore %sp, STACK_WINDOW_SAVE_AREA_SIZE, %sp
restore %sp, STACK_WINDOW_SAVE_AREA_SIZE, %sp