Changeset cfa70add in mainline for uspace/libc/arch/sparc64/src/psthread.S
- Timestamp:
- 2006-09-03T23:37:14Z (18 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- fd85ae5
- Parents:
- 002e613
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/libc/arch/sparc64/src/psthread.S
r002e613 rcfa70add 1 1 # 2 # Copyright (C) 200 6 Martin Decky2 # Copyright (C) 2005 Jakub Jermar 3 3 # All rights reserved. 4 4 # … … 27 27 # 28 28 29 .text 29 #include <libarch/context_offset.h> 30 31 /** 32 * Both context_save_arch() and context_restore_arch() are 33 * leaf-optimized procedures. This kind of optimization 34 * is very important and prevents any implicit window 35 * spill/fill/clean traps in these very core kernel 36 * functions. 37 */ 38 39 .text 30 40 31 41 .global context_save 32 42 .global context_restore 33 43 34 #include <libarch/context_offset.h> 44 .macro CONTEXT_STORE r 45 stx %sp, [\r + OFFSET_SP] 46 stx %o7, [\r + OFFSET_PC] 47 stx %i0, [\r + OFFSET_I0] 48 stx %i1, [\r + OFFSET_I1] 49 stx %i2, [\r + OFFSET_I2] 50 stx %i3, [\r + OFFSET_I3] 51 stx %i4, [\r + OFFSET_I4] 52 stx %i5, [\r + OFFSET_I5] 53 stx %fp, [\r + OFFSET_FP] 54 stx %i7, [\r + OFFSET_I7] 55 stx %l0, [\r + OFFSET_L0] 56 stx %l1, [\r + OFFSET_L1] 57 stx %l2, [\r + OFFSET_L2] 58 stx %l3, [\r + OFFSET_L3] 59 stx %l4, [\r + OFFSET_L4] 60 stx %l5, [\r + OFFSET_L5] 61 stx %l6, [\r + OFFSET_L6] 62 stx %l7, [\r + OFFSET_L7] 63 stx %g7, [\r + OFFSET_TP] 64 .endm 65 66 .macro CONTEXT_LOAD r 67 ldx [\r + OFFSET_SP], %sp 68 ldx [\r + OFFSET_PC], %o7 69 ldx [\r + OFFSET_I0], %i0 70 ldx [\r + OFFSET_I1], %i1 71 ldx [\r + OFFSET_I2], %i2 72 ldx [\r + OFFSET_I3], %i3 73 ldx [\r + OFFSET_I4], %i4 74 ldx [\r + OFFSET_I5], %i5 75 ldx [\r + OFFSET_FP], %fp 76 ldx [\r + OFFSET_I7], %i7 77 ldx [\r + OFFSET_L0], %l0 78 ldx [\r + OFFSET_L1], %l1 79 ldx [\r + OFFSET_L2], %l2 80 ldx [\r + OFFSET_L3], %l3 81 ldx [\r + OFFSET_L4], %l4 82 ldx [\r + OFFSET_L5], %l5 83 ldx [\r + OFFSET_L6], %l6 84 ldx [\r + OFFSET_L7], %l7 85 ldx [\r + OFFSET_TP], %g7 86 .endm 35 87 36 88 context_save: 37 89 CONTEXT_STORE %o0 90 retl 91 mov 1, %o0 ! context_save_arch returns 1 38 92 39 93 context_restore: 94 # 95 # Flush all active windows. 96 # This is essential, because CONTEXT_LOAD overwrites 97 # %sp of CWP - 1 with the value written to %fp of CWP. 98 # Flushing all active windows mitigates this problem 99 # as CWP - 1 becomes the overlap window. 100 # 101 flushw 102 103 CONTEXT_LOAD %o0 104 retl 105 xor %o0, %o0, %o0 ! context_restore_arch returns 0
Note:
See TracChangeset
for help on using the changeset viewer.