rjw | 1f88458 | 2022-01-06 17:20:42 +0800 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright (c) 2015 Stefan Kristiansson |
| 3 | * |
| 4 | * Permission is hereby granted, free of charge, to any person obtaining |
| 5 | * a copy of this software and associated documentation files |
| 6 | * (the "Software"), to deal in the Software without restriction, |
| 7 | * including without limitation the rights to use, copy, modify, merge, |
| 8 | * publish, distribute, sublicense, and/or sell copies of the Software, |
| 9 | * and to permit persons to whom the Software is furnished to do so, |
| 10 | * subject to the following conditions: |
| 11 | * |
| 12 | * The above copyright notice and this permission notice shall be |
| 13 | * included in all copies or substantial portions of the Software. |
| 14 | * |
| 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
| 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
| 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
| 18 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY |
| 19 | * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, |
| 20 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE |
| 21 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
| 22 | */ |
| 23 | #include <asm.h> |
| 24 | |
| 25 | /* void or1k_context_switch( |
| 26 | struct or1k_context_switch_frame *oldcs, |
| 27 | struct or1k_context_switch_frame *newcs); */ |
| 28 | FUNCTION(or1k_context_switch) |
| 29 | /* save old context */ |
| 30 | l.sw 0(r3), r1 |
| 31 | l.sw 4(r3), r2 |
| 32 | l.sw 8(r3), r9 |
| 33 | l.sw 12(r3), r10 |
| 34 | l.sw 16(r3), r14 |
| 35 | l.sw 20(r3), r16 |
| 36 | l.sw 24(r3), r18 |
| 37 | l.sw 28(r3), r20 |
| 38 | l.sw 32(r3), r22 |
| 39 | l.sw 36(r3), r24 |
| 40 | l.sw 40(r3), r26 |
| 41 | l.sw 44(r3), r28 |
| 42 | l.sw 48(r3), r30 |
| 43 | |
| 44 | /* restore new context */ |
| 45 | l.lwz r30, 48(r4) |
| 46 | l.lwz r28, 44(r4) |
| 47 | l.lwz r26, 40(r4) |
| 48 | l.lwz r24, 36(r4) |
| 49 | l.lwz r22, 32(r4) |
| 50 | l.lwz r20, 28(r4) |
| 51 | l.lwz r18, 24(r4) |
| 52 | l.lwz r16, 20(r4) |
| 53 | l.lwz r14, 16(r4) |
| 54 | l.lwz r10, 12(r4) |
| 55 | l.lwz r9, 8(r4) |
| 56 | l.lwz r2, 4(r4) |
| 57 | l.jr r9 |
| 58 | l.lwz r1, 0(r4) |