1/* 2 * Copyright (c) 2015 Stefan Kristiansson 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 or1k_context_switch( 11 struct or1k_context_switch_frame *oldcs, 12 struct or1k_context_switch_frame *newcs); */ 13FUNCTION(or1k_context_switch) 14 /* save old context */ 15 l.sw 0(r3), r1 16 l.sw 4(r3), r2 17 l.sw 8(r3), r9 18 l.sw 12(r3), r10 19 l.sw 16(r3), r14 20 l.sw 20(r3), r16 21 l.sw 24(r3), r18 22 l.sw 28(r3), r20 23 l.sw 32(r3), r22 24 l.sw 36(r3), r24 25 l.sw 40(r3), r26 26 l.sw 44(r3), r28 27 l.sw 48(r3), r30 28 29 /* restore new context */ 30 l.lwz r30, 48(r4) 31 l.lwz r28, 44(r4) 32 l.lwz r26, 40(r4) 33 l.lwz r24, 36(r4) 34 l.lwz r22, 32(r4) 35 l.lwz r20, 28(r4) 36 l.lwz r18, 24(r4) 37 l.lwz r16, 20(r4) 38 l.lwz r14, 16(r4) 39 l.lwz r10, 12(r4) 40 l.lwz r9, 8(r4) 41 l.lwz r2, 4(r4) 42 l.jr r9 43 l.lwz r1, 0(r4) 44