1/* 2 * Copyright (c) 2021 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 m68k_context_switch(struct m68k_context_switch_frame *oldcs, struct m68k_context_switch_frame *newcs); 11FUNCTION(m68k_context_switch) 12 movel %sp@+,%d0 // pop PC off the stack 13 movel %sp@,%a0 // oldcs 14 movel %sp@(4),%a1 // newcs 15 16 // save old state 17 movel %sp, %a0@(0) // oldcs.sp 18 movel %d0, %a0@(4) // oldcs.pc 19 moveml %d2-%d7/%a2-%a6, %a0@(8) // oldcs.<base of callee saved list> 20 21 // load new state 22 movel %a1@(0), %sp // newcs.sp 23 movel %a1@(4), %sp@- // newcs.pc -> stack 24 moveml %a1@(8), %d2-%d7/%a2-%a6 // newcs.<base of callee saved list> 25 26 // return to new PC 27 rts 28END_FUNCTION(m68k_context_switch) 29 30