1/* 2 * Copyright (c) 2015 Travis Geiselbrecht 3 * 4 * Use of this source code is governed by a MIT-style 5 * license that can be found in the LICENSE file or at 6 * https://opensource.org/licenses/MIT 7 */ 8#include <lk/asm.h> 9 10/* void mips_context_switch( 11 struct mips_context_switch_frame *oldcs, 12 struct mips_context_switch_frame *newcs); */ 13FUNCTION(mips_context_switch) 14 # a0 = oldcs 15 # a1 = newcs 16 17 # save old state 18 sw $s0, 0($a0) 19 sw $s1, 4($a0) 20 sw $s2, 8($a0) 21 sw $s3, 12($a0) 22 sw $s4, 16($a0) 23 sw $s5, 20($a0) 24 sw $s6, 24($a0) 25 sw $s7, 28($a0) 26 sw $s8, 32($a0) 27 sw $ra, 36($a0) 28 sw $sp, 40($a0) 29 30 # load new state 31 lw $s0, 0($a1) 32 lw $s1, 4($a1) 33 lw $s2, 8($a1) 34 lw $s3, 12($a1) 35 lw $s4, 16($a1) 36 lw $s5, 20($a1) 37 lw $s6, 24($a1) 38 lw $s7, 28($a1) 39 lw $s8, 32($a1) 40 lw $ra, 36($a1) 41 lw $sp, 40($a1) 42 43 jr $ra 44 nop 45 46