Changeset cfa70add in mainline
- 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
- Files:
-
- 1 added
- 28 edited
Legend:
- Unmodified
- Added
- Removed
-
boot/arch/sparc64/loader/Makefile
r002e613 rcfa70add 58 58 59 59 COMPONENTS = \ 60 $(KERNELDIR)/kernel.bin 60 $(KERNELDIR)/kernel.bin \ 61 $(USPACEDIR)/ns/ns \ 62 $(USPACEDIR)/init/init \ 63 $(USPACEDIR)/fb/fb \ 64 $(USPACEDIR)/kbd/kbd \ 65 $(USPACEDIR)/console/console \ 66 $(USPACEDIR)/tetris/tetris \ 67 $(USPACEDIR)/ipcc/ipcc \ 68 $(USPACEDIR)/klog/klog 61 69 62 70 OBJECTS := $(addsuffix .o,$(basename $(SOURCES))) -
kernel/arch/sparc64/include/asm.h
r002e613 rcfa70add 331 331 extern void write_to_ig_g6(uint64_t val); 332 332 333 extern void switch_to_userspace(uint64_t pc, uint64_t sp );333 extern void switch_to_userspace(uint64_t pc, uint64_t sp, uint64_t uarg); 334 334 335 335 #endif -
kernel/arch/sparc64/include/mm/as.h
r002e613 rcfa70add 43 43 #define USER_ADDRESS_SPACE_END_ARCH (unsigned long) 0xffffffffffffffff 44 44 45 #define USTACK_ADDRESS_ARCH (0x 7fffffffffffffff-(PAGE_SIZE-1))45 #define USTACK_ADDRESS_ARCH (0xffffffffffffffffULL-(PAGE_SIZE-1)) 46 46 47 47 extern void as_arch_init(void); -
kernel/arch/sparc64/include/mm/tlb.h
r002e613 rcfa70add 180 180 static inline void mmu_secondary_context_write(uint64_t v) 181 181 { 182 asi_u64_write(ASI_DMMU, VA_ PRIMARY_CONTEXT_REG, v);182 asi_u64_write(ASI_DMMU, VA_SECONDARY_CONTEXT_REG, v); 183 183 flush(); 184 184 } -
kernel/arch/sparc64/include/trap/mmu.h
r002e613 rcfa70add 128 128 .macro HANDLE_MMU_TRAPS_FROM_SPILL_OR_FILL 129 129 rdpr %tl, %g1 130 dec %g1131 brz %g 1, 0f ! if TL was 1, skip130 sub %g1, 1, %g2 131 brz %g2, 0f ! if TL was 1, skip 132 132 nop 133 wrpr %g1, 0, %tl ! TL-- 134 rdpr %tt, %g2 135 cmp %g2, TT_SPILL_1_NORMAL 136 be 0f ! trap from spill_1_normal 137 cmp %g2, TT_FILL_1_NORMAL 138 be 0f ! trap from fill_1_normal 139 inc %g1 140 wrpr %g1, 0, %tl ! another trap, TL++ 133 wrpr %g2, 0, %tl ! TL-- 134 rdpr %tt, %g3 135 cmp %g3, TT_SPILL_1_NORMAL 136 be 0f ! trap from spill_1_normal? 137 cmp %g3, TT_FILL_1_NORMAL 138 bne,a 0f ! trap from fill_1_normal? (negated condition) 139 wrpr %g1, 0, %tl ! TL++ 141 140 0: 142 141 .endm -
kernel/arch/sparc64/src/asm.S
r002e613 rcfa70add 151 151 * %o0 Userspace entry address. 152 152 * %o1 Userspace stack pointer address. 153 * %o2 Userspace address of uarg structure. 153 154 */ 154 155 .global switch_to_userspace … … 157 158 wrpr %g0, 0, %cleanwin ! avoid information leak 158 159 save %o1, -STACK_WINDOW_SAVE_AREA_SIZE, %sp 160 161 mov %i3, %o0 ! uarg 159 162 160 163 clr %i2 … … 179 182 stxa %g1, [VA_PRIMARY_CONTEXT_REG] %asi 180 183 flush %i7 184 185 /* 186 * Spills and fills will be handled by the userspace handlers. 187 */ 188 wrpr %g0, WSTATE_OTHER(0) | WSTATE_NORMAL(1), %wstate 181 189 182 190 done ! jump to userspace -
kernel/arch/sparc64/src/context.S
r002e613 rcfa70add 28 28 29 29 #include <arch/context_offset.h> 30 #include <arch/stack.h>31 30 32 31 /** -
kernel/arch/sparc64/src/mm/tlb.c
r002e613 rcfa70add 137 137 data.cp = t->c; 138 138 data.cv = t->c; 139 data.p = t-> p;139 data.p = t->k; /* p like privileged */ 140 140 data.w = ro ? false : t->w; 141 141 data.g = t->g; … … 167 167 data.cp = t->c; 168 168 data.cv = t->c; 169 data.p = t-> p;169 data.p = t->k; /* p like privileged */ 170 170 data.w = false; 171 171 data.g = t->g; -
kernel/arch/sparc64/src/proc/scheduler.c
r002e613 rcfa70add 127 127 ASSERT(THREAD->arch.uspace_window_buffer); 128 128 129 flushw(); /* force all userspace windows into memory */130 131 129 uintptr_t uw_buf = ALIGN_DOWN((uintptr_t) THREAD->arch.uspace_window_buffer, PAGE_SIZE); 132 130 if (!overlaps(uw_buf, PAGE_SIZE, base, 1<<KERNEL_PAGE_WIDTH)) { -
kernel/arch/sparc64/src/sparc64.c
r002e613 rcfa70add 48 48 49 49 bootinfo_t bootinfo; 50 51 void arch_pre_main(void) 52 { 53 /* Setup usermode */ 54 init.cnt = bootinfo.taskmap.count; 55 56 uint32_t i; 57 58 for (i = 0; i < bootinfo.taskmap.count; i++) { 59 init.tasks[i].addr = PA2KA(bootinfo.taskmap.tasks[i].addr); 60 init.tasks[i].size = bootinfo.taskmap.tasks[i].size; 61 } 62 } 50 63 51 64 void arch_pre_mm_init(void) … … 99 112 switch_to_userspace((uintptr_t) kernel_uarg->uspace_entry, 100 113 ((uintptr_t) kernel_uarg->uspace_stack) + STACK_SIZE 101 - (ALIGN_UP(STACK_ITEM_SIZE, STACK_ALIGNMENT) + STACK_BIAS)); 114 - (ALIGN_UP(STACK_ITEM_SIZE, STACK_ALIGNMENT) + STACK_BIAS), 115 (uintptr_t) kernel_uarg->uspace_uarg); 102 116 103 117 for (;;) -
kernel/arch/sparc64/src/start.S
r002e613 rcfa70add 209 209 ! set TL back to 0 210 210 wrpr %g0, 0, %tl 211 212 call arch_pre_main 213 nop 211 214 212 215 call main_bsp -
kernel/arch/sparc64/src/trap/trap_table.S
r002e613 rcfa70add 219 219 SPILL_TO_USPACE_WINDOW_BUFFER 220 220 221 /* TT = 0xa0, TL = 0, spill_0_other handler */ 222 .org trap_table + TT_SPILL_0_OTHER*ENTRY_SIZE 223 .global spill_0_other 224 spill_0_other: 225 SPILL_TO_USPACE_WINDOW_BUFFER 226 221 227 /* TT = 0xc0, TL = 0, fill_0_normal handler */ 222 228 .org trap_table + TT_FILL_0_NORMAL*ENTRY_SIZE … … 548 554 549 555 /* 550 * Mark the CAN SAVE windows as OTHER windows.556 * Mark the CANRESTORE windows as OTHER windows. 551 557 * Set CLEANWIN to NWINDOW-1 so that clean_window traps do not occur. 552 558 */ 553 rdpr %can save, %l0559 rdpr %canrestore, %l0 554 560 wrpr %l0, %otherwin 555 wrpr %g0, %can save561 wrpr %g0, %canrestore 556 562 wrpr %g0, NWINDOW - 1, %cleanwin 557 563 … … 642 648 /* 643 649 * If OTHERWIN is zero, then all the userspace windows have been 644 * spilled to kernel memory (i.e. register window buffer). If 645 * OTHERWIN is non-zero, then some userspace windows are still 650 * spilled to kernel memory (i.e. register window buffer). Moreover, 651 * if the scheduler was called in the meantime, all valid windows 652 * belonging to other threads were spilled by context_restore(). 653 * If OTHERWIN is non-zero, then some userspace windows are still 646 654 * valid. Others might have been spilled. However, the CWP pointer 647 655 * needs no fixing because the scheduler had not been called. … … 660 668 and %g1, TSTATE_CWP_MASK, %l0 661 669 inc %l0 662 and %l0, TSTATE_CWP_MASK, %l0 ! %l0 mod NWINDOW670 and %l0, NWINDOW - 1, %l0 ! %l0 mod NWINDOW 663 671 rdpr %cwp, %l1 664 672 cmp %l0, %l1 … … 668 676 /* 669 677 * Fix CWP. 670 * Just for reminder, the input registers in the current window671 * are the output registers of the window to which we want to672 * restore. Because the fill trap fills only input and local678 * In order to recapitulate, the input registers in the current 679 * window are the output registers of the window to which we want 680 * to restore. Because the fill trap fills only input and local 673 681 * registers of a window, we need to preserve those output 674 682 * registers manually. 675 683 */ 676 flushw677 684 mov %sp, %g2 678 685 stx %i0, [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_I0] … … 739 746 */ 740 747 clr %g4 741 0: andcc %g7, PAGE_WIDTH - 1, %g0 ! PAGE_SIZE alignment check 748 set PAGE_SIZE - 1, %g5 749 0: andcc %g7, %g5, %g0 ! PAGE_SIZE alignment check 742 750 bz 0f ! %g7 is page-aligned, no more windows to refill 743 751 nop -
kernel/generic/src/proc/task.c
r002e613 rcfa70add 221 221 * Create the main thread. 222 222 */ 223 t1 = thread_create(uinit, kernel_uarg, task, 0, "uinit");223 t1 = thread_create(uinit, kernel_uarg, task, THREAD_FLAG_USPACE, "uinit"); 224 224 ASSERT(t1); 225 225 -
uspace/libc/arch/sparc64/_link.ld.in
r002e613 rcfa70add 8 8 9 9 SECTIONS { 10 . = 0x 1000;10 . = 0x2000; 11 11 12 .init ALIGN(0x 1000) : SUBALIGN(0x1000) {12 .init ALIGN(0x2000) : SUBALIGN(0x2000) { 13 13 *(.init); 14 14 } :text … … 18 18 } :text 19 19 20 .data ALIGN(0x1000) : SUBALIGN(0x1000) { 20 .got ALIGN(0x2000) : SUBALIGN(0x2000) { 21 _gp = .; 22 *(.got*); 23 } :data 24 .data ALIGN(0x2000) : SUBALIGN(0x2000) { 21 25 *(.data); 22 26 *(.sdata); … … 38 42 } :data 39 43 40 . = ALIGN(0x 1000);44 . = ALIGN(0x2000); 41 45 _heap = .; 42 46 -
uspace/libc/arch/sparc64/include/atomic.h
r002e613 rcfa70add 1 1 /* 2 * Copyright (C) 2005 Martin Decky2 * Copyright (C) 2005 Jakub Jermar 3 3 * All rights reserved. 4 4 * … … 27 27 */ 28 28 29 /** @addtogroup libcsparc64 29 /** @addtogroup libcsparc64 30 30 * @{ 31 31 */ … … 33 33 */ 34 34 35 #ifndef __sparc64_ATOMIC_H__ 36 #define __sparc64_ATOMIC_H__ 35 #ifndef LIBC_sparc64_ATOMIC_H_ 36 #define LIBC_sparc64_ATOMIC_H_ 37 38 #include <types.h> 39 40 /** Atomic add operation. 41 * 42 * Use atomic compare and swap operation to atomically add signed value. 43 * 44 * @param val Atomic variable. 45 * @param i Signed value to be added. 46 * 47 * @return Value of the atomic variable as it existed before addition. 48 */ 49 static inline long atomic_add(atomic_t *val, int i) 50 { 51 uint64_t a, b; 52 volatile uint64_t x = (uint64_t) &val->count; 53 54 __asm__ volatile ( 55 "0:\n" 56 "ldx %0, %1\n" 57 "add %1, %3, %2\n" 58 "casx %0, %1, %2\n" 59 "cmp %1, %2\n" 60 "bne 0b\n" /* The operation failed and must be attempted again if a != b. */ 61 "nop\n" 62 : "=m" (*((uint64_t *)x)), "=r" (a), "=r" (b) 63 : "r" (i) 64 ); 65 66 return a; 67 } 68 69 static inline long atomic_preinc(atomic_t *val) 70 { 71 return atomic_add(val, 1) + 1; 72 } 73 74 static inline long atomic_postinc(atomic_t *val) 75 { 76 return atomic_add(val, 1); 77 } 78 79 static inline long atomic_predec(atomic_t *val) 80 { 81 return atomic_add(val, -1) - 1; 82 } 83 84 static inline long atomic_postdec(atomic_t *val) 85 { 86 return atomic_add(val, -1); 87 } 37 88 38 89 static inline void atomic_inc(atomic_t *val) 39 90 { 91 (void) atomic_add(val, 1); 40 92 } 41 93 42 94 static inline void atomic_dec(atomic_t *val) 43 95 { 44 } 45 46 static inline long atomic_postinc(atomic_t *val) 47 { 48 atomic_inc(val); 49 return val->count - 1; 50 } 51 52 static inline long atomic_postdec(atomic_t *val) 53 { 54 atomic_dec(val); 55 return val->count + 1; 56 } 57 58 static inline long atomic_preinc(atomic_t *val) 59 { 60 atomic_inc(val); 61 return val->count; 62 } 63 64 static inline long atomic_predec(atomic_t *val) 65 { 66 atomic_dec(val); 67 return val->count; 96 (void) atomic_add(val, -1); 68 97 } 69 98 -
uspace/libc/arch/sparc64/include/config.h
r002e613 rcfa70add 27 27 */ 28 28 29 /** @addtogroup lib sparc6429 /** @addtogroup libcsparc64 30 30 * @{ 31 31 */ … … 36 36 #define LIBC_sparc64_CONFIG_H_ 37 37 38 #define PAGE_WIDTH 1 238 #define PAGE_WIDTH 13 39 39 #define PAGE_SIZE (1<<PAGE_WIDTH) 40 40 -
uspace/libc/arch/sparc64/include/context_offset.h
r002e613 rcfa70add 1 /* This file is automatically generated by gencontext.c. */ 1 2 /* struct context */ 3 #define OFFSET_SP 0x0 4 #define OFFSET_PC 0x8 5 #define OFFSET_I0 0x10 6 #define OFFSET_I1 0x18 7 #define OFFSET_I2 0x20 8 #define OFFSET_I3 0x28 9 #define OFFSET_I4 0x30 10 #define OFFSET_I5 0x38 11 #define OFFSET_FP 0x40 12 #define OFFSET_I7 0x48 13 #define OFFSET_L0 0x50 14 #define OFFSET_L1 0x58 15 #define OFFSET_L2 0x60 16 #define OFFSET_L3 0x68 17 #define OFFSET_L4 0x70 18 #define OFFSET_L5 0x78 19 #define OFFSET_L6 0x80 20 #define OFFSET_L7 0x88 21 #define OFFSET_TP 0x90 2 22 3 /** @}4 */ -
uspace/libc/arch/sparc64/include/endian.h
r002e613 rcfa70add 27 27 */ 28 28 29 29 /** @addtogroup libcsparc64 30 30 * @{ 31 31 */ … … 33 33 */ 34 34 35 #ifndef __sparc64_ENDIAN_H__36 #define __sparc64_ENDIAN_H__35 #ifndef LIBC_sparc64_ENDIAN_H_ 36 #define LIBC_sparc64_ENDIAN_H_ 37 37 38 38 #ifndef __LIBC__ENDIAN_H__ … … 44 44 #endif 45 45 46 46 /** @} 47 47 */ 48 -
uspace/libc/arch/sparc64/include/limits.h
r002e613 rcfa70add 33 33 */ 34 34 35 #ifndef __sparc64__LIMITS_H__36 #define __sparc64__LIMITS_H__35 #ifndef LIBC_sparc64__LIMITS_H_ 36 #define LIBC_sparc64__LIMITS_H_ 37 37 38 38 #define LONG_MIN MIN_INT64 -
uspace/libc/arch/sparc64/include/psthread.h
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 /** @addtogroup libcsparc64 29 /** @addtogroup libcsparc64 30 30 * @{ 31 31 */ … … 33 33 */ 34 34 35 #ifndef __LIBC__sparc64__PSTHREAD_H__36 #define __LIBC__sparc64__PSTHREAD_H__35 #ifndef LIBC_sparc64_PSTHREAD_H_ 36 #define LIBC_sparc64_PSTHREAD_H_ 37 37 38 #include <libarch/stack.h> 38 39 #include <types.h> 40 #include <align.h> 39 41 40 /* We define our own context_set, because we need to set 41 * the TLS pointer to the tcb+0x7000 42 * 43 * See tls_set in thread.h 42 #define SP_DELTA STACK_WINDOW_SAVE_AREA_SIZE 43 44 #ifdef context_set 45 #undef context_set 46 #endif 47 48 #define context_set(c, _pc, stack, size, ptls) \ 49 (c)->pc = ((uintptr_t) _pc) - 8; \ 50 (c)->sp = ((uintptr_t) stack) + ALIGN_UP((size), STACK_ALIGNMENT) - (STACK_BIAS + SP_DELTA); \ 51 (c)->fp = -STACK_BIAS; \ 52 (c)->tp = ptls 53 54 /* 55 * Only save registers that must be preserved across 56 * function calls. 44 57 */ 45 #define context_set(c, _pc, stack, size, ptls) \46 (c)->pc = (sysarg_t) (_pc); \47 (c)->sp = ((sysarg_t) (stack)) + (size) - SP_DELTA; \48 (c)->tls = ((sysarg_t) (ptls)) + 0x7000 + sizeof(tcb_t);49 50 #define SP_DELTA 1651 52 58 typedef struct { 53 uint64_t sp; 54 uint64_t pc; 55 56 uint64_t tls; 57 } __attribute__ ((packed)) context_t; 59 uintptr_t sp; /* %o6 */ 60 uintptr_t pc; /* %o7 */ 61 uint64_t i0; 62 uint64_t i1; 63 uint64_t i2; 64 uint64_t i3; 65 uint64_t i4; 66 uint64_t i5; 67 uintptr_t fp; /* %i6 */ 68 uintptr_t i7; 69 uint64_t l0; 70 uint64_t l1; 71 uint64_t l2; 72 uint64_t l3; 73 uint64_t l4; 74 uint64_t l5; 75 uint64_t l6; 76 uint64_t l7; 77 uint64_t tp; /* %g7 */ 78 } context_t; 58 79 59 80 #endif -
uspace/libc/arch/sparc64/include/stackarg.h
r002e613 rcfa70add 33 33 */ 34 34 35 #ifndef __LIBC__STACKARG_H__36 #define __LIBC__STACKARG_H__35 #ifndef LIBC_sparc64_STACKARG_H_ 36 #define LIBC_sparc64_STACKARG_H_ 37 37 38 38 #endif 39 39 40 41 40 /** @} 42 41 */ -
uspace/libc/arch/sparc64/include/syscall.h
r002e613 rcfa70add 27 27 */ 28 28 29 /** @addtogroup libc 29 /** @addtogroup libcsparc64 30 30 * @{ 31 31 */ -
uspace/libc/arch/sparc64/include/thread.h
r002e613 rcfa70add 1 1 /* 2 * Copyright (C) 2006 Martin Decky 2 * Copyright (C) 2006 Ondrej Palkovsky 3 * Copyright (C) 2006 Jakub Jermar 3 4 * All rights reserved. 4 5 * … … 27 28 */ 28 29 29 /** @addtogroup libcsparc64 30 /** @addtogroup libcsparc64 30 31 * @{ 31 32 */ 32 /** @file 33 /** 34 * @file 35 * @brief sparc64 TLS functions. 36 * 37 * The implementation is based on the IA-32 implementation which was also 38 * designed by Sun and is virtually the same, except the TCB is stored in 39 * %g7 (of the normal set). 33 40 */ 34 41 35 #ifndef __LIBC__sparc64__THREAD_H__ 36 #define __LIBC__sparc64__THREAD_H__ 37 38 #define PPC_TP_OFFSET 0x7000 42 #ifndef LIBC_sparc64_THREAD_H_ 43 #define LIBC_sparc64_THREAD_H_ 39 44 40 45 typedef struct { 46 void *self; 41 47 void *pst_data; 42 48 } tcb_t; … … 44 50 static inline void __tcb_set(tcb_t *tcb) 45 51 { 46 void *tp = tcb; 47 tp += PPC_TP_OFFSET + sizeof(tcb_t); 52 __asm__ volatile ("mov %0, %%g7\n" : : "r" (tcb) : "g7"); 48 53 } 49 54 50 static inline tcb_t * __tcb_get(void)55 static inline tcb_t * __tcb_get(void) 51 56 { 52 return (tcb_t *)(PPC_TP_OFFSET - sizeof(tcb_t)); 57 void *retval; 58 59 __asm__ volatile ("mov %%g7, %0\n" : "=r" (retval)); 60 61 return retval; 53 62 } 54 63 -
uspace/libc/arch/sparc64/include/types.h
r002e613 rcfa70add 36 36 #define LIBC_sparc64_TYPES_H_ 37 37 38 typedef unsigned intsysarg_t;39 typedef unsigned intsize_t;40 typedef signed intssize_t;38 typedef unsigned long sysarg_t; 39 typedef unsigned long size_t; 40 typedef signed long ssize_t; 41 41 typedef ssize_t off_t; 42 42 43 typedef char int8_t;43 typedef signed char int8_t; 44 44 typedef short int int16_t; 45 45 typedef int int32_t; -
uspace/libc/arch/sparc64/src/entry.s
r002e613 rcfa70add 38 38 # 39 39 __entry: 40 sethi %hi(_gp), %l7 41 call __main 42 or %l7, %lo(_gp), %l7 43 call __io_init 44 nop 45 call main 46 nop 47 call __exit 48 nop 40 49 41 50 __entry_driver: 51 sethi %hi(_gp), %l7 52 call __main 53 or %l7, %lo(_gp), %l7 54 call main 55 nop 56 call __exit 57 nop -
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 -
uspace/libc/arch/sparc64/src/thread.c
r002e613 rcfa70add 27 27 */ 28 28 29 /** @addtogroup libcsparc64 29 /** @addtogroup libcsparc64 sparc64 30 * @ingroup lc 30 31 * @{ 31 32 */ 32 33 /** @file 34 * 33 35 */ 34 36 … … 40 42 * @param data Start of data section 41 43 * @return pointer to tcb_t structure 42 *43 44 */ 44 45 tcb_t * __alloc_tls(void **data, size_t size) 45 46 { 46 tcb_t *result; 47 tcb_t *tcb; 48 49 *data = malloc(sizeof(tcb_t) + size); 47 50 48 result = malloc(sizeof(tcb_t) + size); 49 *data = ((void *)result) + sizeof(tcb_t); 50 return result; 51 tcb = (tcb_t *) (*data + size); 52 tcb->self = tcb; 53 54 return tcb; 51 55 } 52 56 53 57 void __free_tls_arch(tcb_t *tcb, size_t size) 54 58 { 55 free(tcb); 59 void *start = ((void *)tcb) - size; 60 free(start); 56 61 } 57 62 -
uspace/libc/arch/sparc64/src/thread_entry.s
r002e613 rcfa70add 1 1 # 2 # Copyright (C) 2006 Martin Decky2 # Copyright (C) 2006 Jakub Jermar 3 3 # All rights reserved. 4 4 # … … 35 35 # 36 36 __thread_entry: 37 37 sethi %hi(_gp), %l7 38 call __thread_main ! %o0 contains address of uarg 39 or %l7, %lo(_gp), %l7 40 41 ! not reached 42 38 43 .end __thread_entry
Note:
See TracChangeset
for help on using the changeset viewer.