Subversion Repositories HelenOS-historic

Rev

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

Rev 1293 Rev 1386
Line 220... Line 220...
220
	sra $k0, $k0, 0x2     # cp0_exc_cause() part 1
220
	sra $k0, $k0, 0x2     # cp0_exc_cause() part 1
221
	andi $k0, $k0, 0x1f   # cp0_exc_cause() part 2
221
	andi $k0, $k0, 0x1f   # cp0_exc_cause() part 2
222
	sub $k0, 8            # 8=SYSCALL
222
	sub $k0, 8            # 8=SYSCALL
223
	
223
	
224
	beqz $k0, syscall_shortcut
224
	beqz $k0, syscall_shortcut
225
	add $k0, 8            # Revert $k1 back to correct exc number
225
	add $k0, 8            # Revert $k0 back to correct exc number
226
	
226
	
227
	REGISTERS_STORE_AND_EXC_RESET $sp
227
	REGISTERS_STORE_AND_EXC_RESET $sp
228
	
228
	
229
	move $a1, $sp
229
	move $a1, $sp
230
	jal exc_dispatch      # exc_dispatch(excno, register_space)
230
	jal exc_dispatch      # exc_dispatch(excno, register_space)
Line 237... Line 237...
237
# it seems that mips reserves some space on stack for varfuncs???
237
# it seems that mips reserves some space on stack for varfuncs???
238
#define SS_ARG4   16
238
#define SS_ARG4   16
239
#define SS_SP     EOFFSET_SP
239
#define SS_SP     EOFFSET_SP
240
#define SS_STATUS EOFFSET_STATUS
240
#define SS_STATUS EOFFSET_STATUS
241
#define SS_EPC    EOFFSET_EPC
241
#define SS_EPC    EOFFSET_EPC
-
 
242
#define SS_K1     EOFFSET_K1
242
syscall_shortcut:
243
syscall_shortcut:
243
	# We have a lot of space on the stack, with free use
244
	# We have a lot of space on the stack, with free use
244
	mfc0 $t1, $epc
245
	mfc0 $t1, $epc
245
	mfc0 $t0, $status
246
	mfc0 $t0, $status
246
	sw $t1,SS_EPC($sp)  # Save EPC
247
	sw $t1,SS_EPC($sp)  # Save EPC
-
 
248
	sw $k1,SS_K1($sp)   # Save k1, which is not saved during context switch
247
	
249
	
248
	and $t2, $t0, REG_SAVE_MASK # Save only KSU,EXL,ERL,IE
250
	and $t2, $t0, REG_SAVE_MASK # Save only KSU,EXL,ERL,IE
249
	li $t3, ~(0x1f)
251
	li $t3, ~(0x1f)
250
	and $t0, $t0, $t3           # Clear KSU,EXL,ERL
252
	and $t0, $t0, $t3           # Clear KSU,EXL,ERL
251
	ori $t0, $t0, 0x1           # Set IE
253
	ori $t0, $t0, 0x1           # Set IE
Line 268... Line 270...
268
	or $t0, $t0, $t1            # Copy UM,EXL,ERL,IE from saved status
270
	or $t0, $t0, $t1            # Copy UM,EXL,ERL,IE from saved status
269
	mtc0 $t0, $status
271
	mtc0 $t0, $status
270
			
272
			
271
	# restore epc+4
273
	# restore epc+4
272
	lw $t0,SS_EPC($sp)
274
	lw $t0,SS_EPC($sp)
-
 
275
	lw $k1,SS_K1($sp)
273
	addi $t0, $t0, 4
276
	addi $t0, $t0, 4
274
	mtc0 $t0, $epc
277
	mtc0 $t0, $epc
275
	
278
	
276
	lw $sp,SS_SP($sp) # restore sp
279
	lw $sp,SS_SP($sp) # restore sp
277
	
280