Subversion Repositories HelenOS-historic

Rev

Rev 899 | Rev 912 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 899 Rev 911
Line 35... Line 35...
35
 
35
 
36
#if (STACK_FRAME_SIZE % STACK_ALIGNMENT != 0)
36
#if (STACK_FRAME_SIZE % STACK_ALIGNMENT != 0)
37
#error Memory stack must be 16-byte aligned.
37
#error Memory stack must be 16-byte aligned.
38
#endif
38
#endif
39
 
39
 
-
 
40
/** Partitioning of bank 0 registers. */
-
 
41
#define R_OFFS 		r16
-
 
42
#define R_HANDLER	r17
-
 
43
#define R_RET		r18
-
 
44
#define R_KSTACK	r23	/* keep in sync with before_thread_runs_arch() */
-
 
45
 
40
/** Heavyweight interrupt handler
46
/** Heavyweight interrupt handler
41
 *
47
 *
42
 * This macro roughly follows steps from 1 to 19 described in
48
 * This macro roughly follows steps from 1 to 19 described in
43
 * Intel Itanium Architecture Software Developer's Manual, Chapter 3.4.2.
49
 * Intel Itanium Architecture Software Developer's Manual, Chapter 3.4.2.
44
 *
50
 *
Line 52... Line 58...
52
 * @param offs Offset from the beginning of IVT.
58
 * @param offs Offset from the beginning of IVT.
53
 * @param handler Interrupt handler address.
59
 * @param handler Interrupt handler address.
54
 */
60
 */
55
.macro HEAVYWEIGHT_HANDLER offs, handler=universal_handler
61
.macro HEAVYWEIGHT_HANDLER offs, handler=universal_handler
56
    .org ivt + \offs
62
    .org ivt + \offs
57
	mov r24 = \offs
63
	mov R_OFFS = \offs
58
	movl r25 = \handler ;;
64
	movl R_HANDLER = \handler ;;
59
	mov ar.k0 = r24
-
 
60
	mov ar.k1 = r25
-
 
61
	br heavyweight_handler
65
	br heavyweight_handler
62
.endm
66
.endm
63
 
67
 
64
.global heavyweight_handler
68
.global heavyweight_handler
65
heavyweight_handler:
69
heavyweight_handler:
66
    /* 1. copy interrupt registers into bank 0 */
70
    /* 1. copy interrupt registers into bank 0 */
-
 
71
    
-
 
72
	/*
-
 
73
	 * Note that r24-r31 from bank0 can be used only as long as PSR.ic = 0.
-
 
74
	 */
67
	mov r24 = cr.iip
75
	mov r24 = cr.iip
68
	mov r25 = cr.ipsr
76
	mov r25 = cr.ipsr
69
	mov r26 = cr.iipa
77
	mov r26 = cr.iipa
70
	mov r27 = cr.isr
78
	mov r27 = cr.isr
71
	mov r28 = cr.ifa
79
	mov r28 = cr.ifa
Line 115... Line 123...
115
	st8 [r31] = r29, -8	/* save ar.bsp */
123
	st8 [r31] = r29, -8	/* save ar.bsp */
116
	
124
	
117
	mov ar.rsc = r24	/* restore RSE's setting */
125
	mov ar.rsc = r24	/* restore RSE's setting */
118
	
126
	
119
    /* steps 6 - 15 are done by heavyweight_handler_inner() */
127
    /* steps 6 - 15 are done by heavyweight_handler_inner() */
120
	mov r24 = b0 		/* save b0 belonging to interrupted context */
128
	mov R_RET = b0 		/* save b0 belonging to interrupted context */
121
	mov r26 = ar.k0
-
 
122
	mov r25 = ar.k1
-
 
123
	br.call.sptk.many rp = heavyweight_handler_inner
129
	br.call.sptk.many b0 = heavyweight_handler_inner
124
0:	mov b0 = r24		/* restore b0 belonging to the interrupted context */
130
0:	mov b0 = R_RET		/* restore b0 belonging to the interrupted context */
125
 
131
 
126
    /* 16. RSE switch to interrupted context */
132
    /* 16. RSE switch to interrupted context */
127
	cover			/* allocate zerro size frame (step 1 (from Intel Docs)) */
133
	cover			/* allocate zerro size frame (step 1 (from Intel Docs)) */
128
 
134
 
129
	add r31 = STACK_SCRATCH_AREA_SIZE, r12 ;;
135
	add r31 = STACK_SCRATCH_AREA_SIZE, r12 ;;
Line 182... Line 188...
182
	 * will be preserved in stacked registers and backing store.
188
	 * will be preserved in stacked registers and backing store.
183
	 */
189
	 */
184
	alloc loc0 = ar.pfs, 0, 47, 2, 0 ;;
190
	alloc loc0 = ar.pfs, 0, 47, 2, 0 ;;
185
	
191
	
186
	/* bank 0 is going to be shadowed, copy essential data from there */
192
	/* bank 0 is going to be shadowed, copy essential data from there */
187
	mov loc1 = r24	/* b0 belonging to interrupted context */
193
	mov loc1 = R_RET	/* b0 belonging to interrupted context */
188
	mov loc2 = r25
194
	mov loc2 = R_HANDLER
189
	mov out0 = r26
195
	mov out0 = R_OFFS
190
	
196
	
191
	add out1 = STACK_SCRATCH_AREA_SIZE, r12
197
	add out1 = STACK_SCRATCH_AREA_SIZE, r12
192
 
198
 
193
    /* 6. switch to bank 1 and reenable PSR.ic */
199
    /* 6. switch to bank 1 and reenable PSR.ic */
194
	ssm PSR_IC_MASK
200
	ssm PSR_IC_MASK
Line 321... Line 327...
321
    /* 15. disable PSR.ic and switch to bank 0 */
327
    /* 15. disable PSR.ic and switch to bank 0 */
322
	rsm PSR_IC_MASK
328
	rsm PSR_IC_MASK
323
	bsw.0 ;;
329
	bsw.0 ;;
324
	srlz.d
330
	srlz.d
325
 
331
 
326
	mov r24 = loc1
332
	mov R_RET = loc1
327
	mov ar.pfs = loc0
333
	mov ar.pfs = loc0
328
	br.ret.sptk.many b0
334
	br.ret.sptk.many b0
329
 
335
 
330
.global ivt
336
.global ivt
331
.align 32768
337
.align 32768