Changeset 96598b8 in mainline
- Timestamp:
- 2012-03-16T20:32:13Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- b191acae
- Parents:
- 53d5278 (diff), 145d16f8 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - Files:
-
- 3 added
- 29 edited
- 6 moved
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/amd64/include/context.h
r53d5278 r96598b8 38 38 #include <typedefs.h> 39 39 40 /* According to ABI the stack MUST be aligned on 40 /* 41 * According to ABI the stack MUST be aligned on 41 42 * 16-byte boundary. If it is not, the va_arg calling will 42 43 * panic sooner or later -
kernel/arch/arm32/include/context.h
r53d5278 r96598b8 27 27 */ 28 28 29 /** @addtogroup arm32 29 /** @addtogroup arm32 30 30 * @{ 31 31 */ -
kernel/arch/ia64/include/context.h
r53d5278 r96598b8 27 27 */ 28 28 29 /** @addtogroup ia64 29 /** @addtogroup ia64 30 30 * @{ 31 31 */ … … 47 47 * One item is put onto the stack to support get_stack_base(). 48 48 */ 49 #define SP_DELTA 49 #define SP_DELTA (0 + ALIGN_UP(STACK_ITEM_SIZE, STACK_ALIGNMENT)) 50 50 51 51 /* RSE stack starts at the bottom of memory stack, hence the division by 2. */ 52 #define context_set(c, _pc, stack, size) 53 do { 54 (c)->pc = (uintptr_t) _pc; 55 (c)->bsp = ((uintptr_t) stack) + ALIGN_UP((size / 2), REGISTER_STACK_ALIGNMENT); 56 (c)->ar_pfs &= PFM_MASK; 57 (c)->sp = ((uintptr_t) stack) + ALIGN_UP((size / 2), STACK_ALIGNMENT) - SP_DELTA; 58 } while (0) ;52 #define context_set(c, _pc, stack, size) \ 53 do { \ 54 (c)->pc = (uintptr_t) _pc; \ 55 (c)->bsp = ((uintptr_t) stack) + ALIGN_UP((size / 2), REGISTER_STACK_ALIGNMENT); \ 56 (c)->ar_pfs &= PFM_MASK; \ 57 (c)->sp = ((uintptr_t) stack) + ALIGN_UP((size / 2), STACK_ALIGNMENT) - SP_DELTA; \ 58 } while (0) 59 59 60 60 /* -
kernel/arch/mips32/include/context.h
r53d5278 r96598b8 42 42 * Put one item onto the stack to support get_stack_base() and align it up. 43 43 */ 44 #define SP_DELTA ( 0+ ALIGN_UP(STACK_ITEM_SIZE, STACK_ALIGNMENT))44 #define SP_DELTA (ABI_STACK_FRAME + ALIGN_UP(STACK_ITEM_SIZE, STACK_ALIGNMENT)) 45 45 46 46 #ifndef __ASM__ -
kernel/arch/mips32/include/stack.h
r53d5278 r96598b8 27 27 */ 28 28 29 /** @addtogroup mips32 29 /** @addtogroup mips32 30 30 * @{ 31 31 */ … … 36 36 #define KERN_mips32_STACK_H_ 37 37 38 #define STACK_ITEM_SIZE 4 39 #define STACK_ALIGNMENT 8 38 #define STACK_ITEM_SIZE 4 39 #define STACK_ALIGNMENT 8 40 #define ABI_STACK_FRAME 32 40 41 41 42 #endif -
kernel/arch/mips32/src/start.S
r53d5278 r96598b8 241 241 /* $a1 contains physical address of bootinfo_t */ 242 242 jal arch_pre_main 243 nop243 addiu $sp, -ABI_STACK_FRAME 244 244 245 245 j main_bsp … … 281 281 282 282 move $a1, $sp 283 move $a0, $k0 283 284 jal exc_dispatch /* exc_dispatch(excno, register_space) */ 284 move $a0, $k0 285 addiu $sp, -ABI_STACK_FRAME 286 addiu $sp, ABI_STACK_FRAME 285 287 286 288 REGISTERS_LOAD $sp … … 323 325 sw $t0, ISTATE_OFFSET_T0($sp) /* save the 5th argument on the stack */ 324 326 sw $t1, ISTATE_OFFSET_T1($sp) /* save the 6th argument on the stack */ 327 325 328 jal syscall_handler 326 329 sw $v0, ISTATE_OFFSET_V0($sp) /* save the syscall number on the stack */ … … 357 360 move $sp, $k0 358 361 362 move $a0, $sp 359 363 jal tlb_refill 360 move $a0, $sp 364 addiu $sp, -ABI_STACK_FRAME 365 addiu $sp, ABI_STACK_FRAME 361 366 362 367 REGISTERS_LOAD $sp … … 366 371 cache_error_handler: 367 372 KERNEL_STACK_TO_K0 368 sub $k0, ISTATE_SOFT_SIZE 373 sub $k0, ISTATE_SOFT_SIZE 369 374 REGISTERS_STORE_AND_EXC_RESET $k0 370 375 sw $sp, ISTATE_OFFSET_SP($k0) 371 376 move $sp, $k0 372 377 378 move $a0, $sp 373 379 jal cache_error 374 move $a0, $sp 380 addiu $sp, -ABI_STACK_FRAME 381 addiu $sp, ABI_STACK_FRAME 375 382 376 383 REGISTERS_LOAD $sp -
kernel/arch/mips64/include/context.h
r53d5278 r96598b8 42 42 * Put one item onto the stack to support get_stack_base() and align it up. 43 43 */ 44 #define SP_DELTA ( 0+ ALIGN_UP(STACK_ITEM_SIZE, STACK_ALIGNMENT))44 #define SP_DELTA (ABI_STACK_FRAME + ALIGN_UP(STACK_ITEM_SIZE, STACK_ALIGNMENT)) 45 45 46 46 #ifndef __ASM__ -
kernel/arch/mips64/include/stack.h
r53d5278 r96598b8 38 38 #define STACK_ITEM_SIZE 8 39 39 #define STACK_ALIGNMENT 8 40 #define ABI_STACK_FRAME 64 40 41 41 42 #endif -
kernel/arch/mips64/src/start.S
r53d5278 r96598b8 241 241 /* $a1 contains physical address of bootinfo_t */ 242 242 jal arch_pre_main 243 nop243 addiu $sp, -ABI_STACK_FRAME 244 244 245 245 j main_bsp … … 281 281 282 282 move $a1, $sp 283 move $a0, $k0 283 284 jal exc_dispatch /* exc_dispatch(excno, register_space) */ 284 move $a0, $k0 285 addiu $sp, -ABI_STACK_FRAME 286 addiu $sp, ABI_STACK_FRAME 285 287 286 288 REGISTERS_LOAD $sp … … 323 325 sw $t0, ISTATE_OFFSET_T0($sp) /* save the 5th argument on the stack */ 324 326 sw $t1, ISTATE_OFFSET_T1($sp) /* save the 6th argument on the stack */ 327 325 328 jal syscall_handler 326 329 sw $v0, ISTATE_OFFSET_V0($sp) /* save the syscall number on the stack */ … … 357 360 move $sp, $k0 358 361 362 move $a0, $sp 359 363 jal tlb_refill 360 move $a0, $sp 364 addiu $sp, -ABI_STACK_FRAME 365 addiu $sp, ABI_STACK_FRAME 361 366 362 367 REGISTERS_LOAD $sp … … 366 371 cache_error_handler: 367 372 KERNEL_STACK_TO_K0 368 sub $k0, ISTATE_SOFT_SIZE 373 sub $k0, ISTATE_SOFT_SIZE 369 374 REGISTERS_STORE_AND_EXC_RESET $k0 370 375 sw $sp, ISTATE_OFFSET_SP($k0) 371 376 move $sp, $k0 372 377 378 move $a0, $sp 373 379 jal cache_error 374 move $a0, $sp 380 addiu $sp, -ABI_STACK_FRAME 381 addiu $sp, ABI_STACK_FRAME 375 382 376 383 REGISTERS_LOAD $sp -
kernel/arch/sparc64/include/context.h
r53d5278 r96598b8 27 27 */ 28 28 29 /** @addtogroup sparc64 29 /** @addtogroup sparc64 30 30 * @{ 31 31 */ … … 40 40 #include <align.h> 41 41 42 #define SP_DELTA 42 #define SP_DELTA (STACK_WINDOW_SAVE_AREA_SIZE + STACK_ARG_SAVE_AREA_SIZE) 43 43 44 #define context_set(c, _pc, stack, size) \ 45 (c)->pc = ((uintptr_t) _pc) - 8; \ 46 (c)->sp = ((uintptr_t) stack) + ALIGN_UP((size), \ 47 STACK_ALIGNMENT) - (STACK_BIAS + SP_DELTA); \ 48 (c)->fp = -STACK_BIAS 49 44 #define context_set(c, _pc, stack, size) \ 45 do { \ 46 (c)->pc = ((uintptr_t) _pc) - 8; \ 47 (c)->sp = ((uintptr_t) stack) + ALIGN_UP((size), \ 48 STACK_ALIGNMENT) - (STACK_BIAS + SP_DELTA); \ 49 (c)->fp = -STACK_BIAS; \ 50 } while (0) 50 51 51 52 /* -
kernel/generic/include/context.h
r53d5278 r96598b8 41 41 42 42 #define context_set_generic(ctx, _pc, stack, size) \ 43 (ctx)->pc = (uintptr_t) (_pc); \ 44 (ctx)->sp = ((uintptr_t) (stack)) + (size) - SP_DELTA; 43 do { \ 44 (ctx)->pc = (uintptr_t) (_pc); \ 45 (ctx)->sp = ((uintptr_t) (stack)) + (size) - SP_DELTA; \ 46 } while (0) 45 47 46 48 extern int context_save_arch(context_t *ctx) __attribute__((returns_twice)); -
tools/toolchain.sh
r53d5278 r96598b8 53 53 EOF 54 54 55 BINUTILS_VERSION="2.2 1.1"56 BINUTILS_RELEASE=" a"57 GCC_VERSION="4.6. 2"58 GDB_VERSION="7. 3.1"55 BINUTILS_VERSION="2.22" 56 BINUTILS_RELEASE="" 57 GCC_VERSION="4.6.3" 58 GDB_VERSION="7.4" 59 59 60 60 BASEDIR="`pwd`" … … 274 274 GDB_SOURCE="ftp://ftp.gnu.org/gnu/gdb/" 275 275 276 download_fetch "${BINUTILS_SOURCE}" "${BINUTILS}" " bde820eac53fa3a8d8696667418557ad"277 download_fetch "${GCC_SOURCE}" "${GCC_CORE}" "7 80f614ab18c7a9066dec6387d7490b2"278 download_fetch "${GCC_SOURCE}" "${GCC_OBJC}" " 94043cc0d08394eddebed73f30ecad89"279 download_fetch "${GCC_SOURCE}" "${GCC_CPP}" " 87ecd60431e41096419dd8a10f76e46b"280 download_fetch "${GDB_SOURCE}" "${GDB}" " b89a5fac359c618dda97b88645ceab47"276 download_fetch "${BINUTILS_SOURCE}" "${BINUTILS}" "ee0f10756c84979622b992a4a61ea3f5" 277 download_fetch "${GCC_SOURCE}" "${GCC_CORE}" "766091220c6a14fcaa2c06dd573e3758" 278 download_fetch "${GCC_SOURCE}" "${GCC_OBJC}" "48ba23770c34b1cb468f72618b4452c5" 279 download_fetch "${GCC_SOURCE}" "${GCC_CPP}" "37515158a0fb3d0800ec41a08c05e69e" 280 download_fetch "${GDB_SOURCE}" "${GDB}" "95a9a8305fed4d30a30a6dc28ff9d060" 281 281 } 282 282 -
uspace/lib/c/arch/amd64/include/fibril.h
r53d5278 r96598b8 38 38 #include <sys/types.h> 39 39 40 /* According to ABI the stack MUST be aligned on 40 /* 41 * According to ABI the stack MUST be aligned on 41 42 * 16-byte boundary. If it is not, the va_arg calling will 42 43 * panic sooner or later 43 44 */ 44 #define SP_DELTA 45 #define SP_DELTA 16 45 46 46 47 #define context_set(c, _pc, stack, size, ptls) \ -
uspace/lib/c/arch/arm32/include/fibril.h
r53d5278 r96598b8 27 27 */ 28 28 29 /** @addtogroup libcarm32 29 /** @addtogroup libcarm32 30 30 * @{ 31 31 */ … … 42 42 43 43 /** Size of a stack item */ 44 #define STACK_ITEM_SIZE 44 #define STACK_ITEM_SIZE 4 45 45 46 46 /** Stack alignment - see <a href="http://www.arm.com/support/faqdev/14269.html">ABI</a> for details */ 47 #define STACK_ALIGNMENT 47 #define STACK_ALIGNMENT 8 48 48 49 #define SP_DELTA 49 #define SP_DELTA (0 + ALIGN_UP(STACK_ITEM_SIZE, STACK_ALIGNMENT)) 50 50 51 51 52 /** Sets data to the context. 53 * 52 /** Sets data to the context. 53 * 54 54 * @param c Context (#context_t). 55 55 * @param _pc Program counter. … … 62 62 (c)->pc = (sysarg_t) (_pc); \ 63 63 (c)->sp = ((sysarg_t) (stack)) + (size) - SP_DELTA; \ 64 64 (c)->tls = ((sysarg_t)(ptls)) + sizeof(tcb_t) + ARM_TP_OFFSET; \ 65 65 (c)->fp = 0; \ 66 66 } while (0) 67 67 68 /** Fibril context. 68 /** Fibril context. 69 69 * 70 70 * Only registers preserved accross function calls are included. r9 is used … … 91 91 } 92 92 93 94 93 #endif 95 94 -
uspace/lib/c/arch/ia32/include/fibril.h
r53d5278 r96598b8 38 38 #include <sys/types.h> 39 39 40 /* According to ABI the stack MUST be aligned on 40 /* 41 * According to ABI the stack MUST be aligned on 41 42 * 16-byte boundary. If it is not, the va_arg calling will 42 43 * panic sooner or later -
uspace/lib/c/arch/ia64/include/fibril.h
r53d5278 r96598b8 27 27 */ 28 28 29 /** @addtogroup libcia64 29 /** @addtogroup libcia64 30 30 * @{ 31 31 */ … … 45 45 * No need to allocate scratch area. 46 46 */ 47 #define SP_DELTA 47 #define SP_DELTA (0 + ALIGN_UP(STACK_ITEM_SIZE, STACK_ALIGNMENT)) 48 48 49 #define PFM_MASK 49 #define PFM_MASK (~0x3fffffffff) 50 50 51 #define PSTHREAD_INITIAL_STACK_PAGES_NO 2 51 #define PSTHREAD_INITIAL_STACK_PAGES_NO 2 52 52 53 /* Stack is divided into two equal parts (for memory stack and register stack). */ 53 #define PSTHREAD_INITIAL_STACK_DIVISION 254 #define PSTHREAD_INITIAL_STACK_DIVISION 2 54 55 55 #define context_set(c, _pc, stack, size, tls) \ 56 do { \ 57 (c)->pc = (uint64_t) _pc; \ 58 (c)->bsp = ((uint64_t) stack) + size / PSTHREAD_INITIAL_STACK_DIVISION; \ 59 (c)->ar_pfs &= PFM_MASK; \ 60 (c)->sp = ((uint64_t) stack) + ALIGN_UP((size / PSTHREAD_INITIAL_STACK_DIVISION), STACK_ALIGNMENT) - SP_DELTA; \ 61 (c)->tp = (uint64_t) tls; \ 62 } while (0); 63 56 #define context_set(c, _pc, stack, size, tls) \ 57 do { \ 58 (c)->pc = (uint64_t) _pc; \ 59 (c)->bsp = ((uint64_t) stack) + \ 60 size / PSTHREAD_INITIAL_STACK_DIVISION; \ 61 (c)->ar_pfs &= PFM_MASK; \ 62 (c)->sp = ((uint64_t) stack) + \ 63 ALIGN_UP((size / PSTHREAD_INITIAL_STACK_DIVISION), STACK_ALIGNMENT) - \ 64 SP_DELTA; \ 65 (c)->tp = (uint64_t) tls; \ 66 } while (0) 64 67 65 68 /* -
uspace/lib/c/arch/mips32/Makefile.inc
r53d5278 r96598b8 28 28 29 29 ARCH_SOURCES = \ 30 arch/$(UARCH)/src/entry. s\31 arch/$(UARCH)/src/entryjmp. s\32 arch/$(UARCH)/src/thread_entry. s\30 arch/$(UARCH)/src/entry.S \ 31 arch/$(UARCH)/src/entryjmp.S \ 32 arch/$(UARCH)/src/thread_entry.S \ 33 33 arch/$(UARCH)/src/syscall.c \ 34 34 arch/$(UARCH)/src/fibril.S \ -
uspace/lib/c/arch/mips32/include/atomic.h
r53d5278 r96598b8 67 67 " ll %0, %1\n" 68 68 " addu %0, %0, %3\n" /* same as add, but never traps on overflow */ 69 " 69 " move %2, %0\n" 70 70 " sc %0, %1\n" 71 71 " beq %0, %4, 1b\n" /* if the atomic operation failed, try again */ -
uspace/lib/c/arch/mips32/include/config.h
r53d5278 r96598b8 36 36 #define LIBC_mips32_CONFIG_H_ 37 37 38 #define PAGE_WIDTH 39 #define PAGE_SIZE 38 #define PAGE_WIDTH 14 39 #define PAGE_SIZE (1 << PAGE_WIDTH) 40 40 41 41 #endif -
uspace/lib/c/arch/mips32/include/faddr.h
r53d5278 r96598b8 38 38 #include <libarch/types.h> 39 39 40 #define FADDR(fptr) 40 #define FADDR(fptr) ((uintptr_t) (fptr)) 41 41 42 42 #endif -
uspace/lib/c/arch/mips32/include/fibril.h
r53d5278 r96598b8 38 38 39 39 #include <sys/types.h> 40 #include <libarch/stack.h> 41 #include <align.h> 40 42 41 /* We define our own context_set, because we need to set 42 * the TLS pointer to the tcb+0x7000 43 #define SP_DELTA (ABI_STACK_FRAME + ALIGN_UP(STACK_ITEM_SIZE, STACK_ALIGNMENT)) 44 45 /* 46 * We define our own context_set, because we need to set 47 * the TLS pointer to the tcb + 0x7000 43 48 * 44 49 * See tls_set in thread.h 45 50 */ 46 #define context_set(c, _pc, stack, size, ptls) \ 47 (c)->pc = (sysarg_t) (_pc); \ 48 (c)->sp = ((sysarg_t) (stack)) + (size) - SP_DELTA; \ 49 (c)->tls = ((sysarg_t)(ptls)) + 0x7000 + sizeof(tcb_t); 50 51 52 /* +16 is just for sure that the called function 53 * have space to store it's arguments 54 */ 55 #define SP_DELTA (8+16) 51 #define context_set(c, _pc, stack, size, ptls) \ 52 do { \ 53 (c)->pc = (sysarg_t) (_pc); \ 54 (c)->sp = ((sysarg_t) (stack)) + (size) - SP_DELTA; \ 55 (c)->tls = ((sysarg_t)(ptls)) + 0x7000 + sizeof(tcb_t); \ 56 } while (0) 56 57 57 58 typedef struct { -
uspace/lib/c/arch/mips32/src/entry.S
r53d5278 r96598b8 27 27 # 28 28 29 #include <libarch/stack.h> 30 29 31 .text 30 32 .section .init, "ax" … … 41 43 .ent __entry 42 44 __entry: 43 .frame $sp, 32, $3144 .cpload $ 2545 .frame $sp, ABI_STACK_FRAME, $ra 46 .cpload $t9 45 47 46 # FIXME: Reflect exactly ABI specs here 48 # Allocate the stack frame. 49 addiu $sp, -ABI_STACK_FRAME 47 50 48 addiu $sp, -3249 .cprestore 16 # Allow PIC code51 # Allow PIC code 52 .cprestore 16 50 53 51 # Pass pcb_ptr to __main() as the first argument. pcb_ptris already54 # Pass pcb_ptr to __main() as the first argument. It is already 52 55 # in $a0. As the first argument is passed in $a0, no operation 53 56 # is needed. … … 55 58 jal __main 56 59 nop 57 .end 60 61 # 62 # Not reached. 63 # 64 addiu $sp, ABI_STACK_FRAME 65 .end __entry -
uspace/lib/c/arch/mips32/src/entryjmp.S
r53d5278 r96598b8 27 27 # 28 28 29 #include <libarch/stack.h> 30 29 31 .text 30 32 .section .text … … 41 43 entry_point_jmp: 42 44 # tmp := entry_point 43 move $ 25, $a045 move $t9, $a0 44 46 45 47 # Pass pcb to the entry point in $a0 46 48 move $a0, $a1 47 jr $25 48 nop 49 .end 49 50 jr $t9 51 addiu $sp, -ABI_STACK_FRAME 52 addiu $sp, ABI_STACK_FRAME 53 .end entry_point_jmp -
uspace/lib/c/arch/mips32/src/fibril.S
r53d5278 r96598b8 33 33 34 34 #include <libarch/context_offset.h> 35 35 36 36 .global context_save 37 37 .global context_restore 38 38 39 39 context_save: 40 40 CONTEXT_SAVE_ARCH_CORE $a0 41 41 42 42 # context_save returns 1 43 43 j $ra 44 li $v0, 1 45 44 li $v0, 1 45 46 46 context_restore: 47 47 CONTEXT_RESTORE_ARCH_CORE $a0 48 49 # Just for the jump into first function, but one instruction 50 # should not bother us 51 move $t9, $ra 48 49 # Just for the jump into first function, 50 # but one instruction should not bother us 51 move $t9, $ra 52 52 53 # context_restore returns 0 53 54 j $ra 54 xor $v0, $v0 55 55 xor $v0, $v0 -
uspace/lib/c/arch/mips32/src/syscall.c
r53d5278 r96598b8 57 57 "r" (__mips_reg_t1), 58 58 "r" (__mips_reg_v0) 59 : "%ra" /* We are a function call, although C does not 60 * know it */ 59 /* 60 * We are a function call, although C 61 * does not know it. 62 */ 63 : "%ra" 61 64 ); 62 65 -
uspace/lib/c/arch/mips32/src/thread_entry.S
r53d5278 r96598b8 27 27 # 28 28 29 #include <libarch/stack.h> 30 29 31 .text 30 32 … … 40 42 .ent __thread_entry 41 43 __thread_entry: 42 .frame $sp, 32, $3143 .cpload $ 2544 .frame $sp, ABI_STACK_FRAME, $ra 45 .cpload $t9 44 46 45 47 # 46 48 # v0 contains address of uarg. 47 49 # 48 add $ 4, $2, 050 add $a0, $v0, 0 49 51 50 addiu $sp, -32 52 # Allocate the stack frame. 53 addiu $sp, -ABI_STACK_FRAME 54 55 # Allow PIC code 51 56 .cprestore 16 52 57 … … 57 62 # Not reached. 58 63 # 64 addiu $sp, ABI_STACK_FRAME 59 65 .end __thread_entry -
uspace/lib/c/arch/mips32eb/Makefile.inc
r53d5278 r96598b8 28 28 29 29 ARCH_SOURCES = \ 30 arch/$(UARCH)/src/entry. s\31 arch/$(UARCH)/src/entryjmp. s\32 arch/$(UARCH)/src/thread_entry. s\30 arch/$(UARCH)/src/entry.S \ 31 arch/$(UARCH)/src/entryjmp.S \ 32 arch/$(UARCH)/src/thread_entry.S \ 33 33 arch/$(UARCH)/src/syscall.c \ 34 34 arch/$(UARCH)/src/fibril.S \ -
uspace/lib/c/arch/mips64/Makefile.inc
r53d5278 r96598b8 28 28 29 29 ARCH_SOURCES = \ 30 arch/$(UARCH)/src/entry. s\31 arch/$(UARCH)/src/entryjmp. s\32 arch/$(UARCH)/src/thread_entry. s\30 arch/$(UARCH)/src/entry.S \ 31 arch/$(UARCH)/src/entryjmp.S \ 32 arch/$(UARCH)/src/thread_entry.S \ 33 33 arch/$(UARCH)/src/syscall.c \ 34 34 arch/$(UARCH)/src/fibril.S \ -
uspace/lib/c/arch/mips64/include/fibril.h
r53d5278 r96598b8 38 38 39 39 #include <sys/types.h> 40 #include <libarch/stack.h> 41 #include <align.h> 40 42 41 /* We define our own context_set, because we need to set 42 * the TLS pointer to the tcb+0x7000 43 #define SP_DELTA (ABI_STACK_FRAME + ALIGN_UP(STACK_ITEM_SIZE, STACK_ALIGNMENT)) 44 45 /* 46 * We define our own context_set, because we need to set 47 * the TLS pointer to the tcb + 0x7000 43 48 * 44 49 * See tls_set in thread.h 45 50 */ 46 51 #define context_set(c, _pc, stack, size, ptls) \ 47 (c)->pc = (sysarg_t) (_pc); \ 48 (c)->sp = ((sysarg_t) (stack)) + (size) - SP_DELTA; \ 49 (c)->tls = ((sysarg_t)(ptls)) + 0x7000 + sizeof(tcb_t); 50 51 /* +16 is just for sure that the called function 52 * have space to store it's arguments 53 */ 54 #define SP_DELTA (8 + 16) 52 do { \ 53 (c)->pc = (sysarg_t) (_pc); \ 54 (c)->sp = ((sysarg_t) (stack)) + (size) - SP_DELTA; \ 55 (c)->tls = ((sysarg_t)(ptls)) + 0x7000 + sizeof(tcb_t); \ 56 } while (0) 55 57 56 58 typedef struct { -
uspace/lib/c/arch/mips64/src/entry.S
r53d5278 r96598b8 27 27 # 28 28 29 #include <libarch/stack.h> 30 29 31 .text 30 32 .section .init, "ax" … … 41 43 .ent __entry 42 44 __entry: 43 .frame $sp, 32, $31 44 .cpload $25 45 46 # Mips o32 may store its arguments on stack, make space (16 bytes), 47 # so that it could work with -O0 48 # Make space additional 16 bytes for the stack frame 49 50 addiu $sp, -32 51 .cprestore 16 # Allow PIC code 52 53 # Pass pcb_ptr to __main() as the first argument. pcb_ptr is already 45 .frame $sp, ABI_STACK_FRAME, $ra 46 .cpload $t9 47 48 # Allocate the stack frame. 49 addiu $sp, -ABI_STACK_FRAME 50 51 # Allow PIC code 52 .cprestore 16 53 54 # Pass pcb_ptr to __main() as the first argument. It is already 54 55 # in $a0. As the first argument is passed in $a0, no operation 55 56 # is needed. 56 57 57 58 jal __main 58 59 nop 59 .end 60 61 # 62 # Not reached. 63 # 64 addiu $sp, ABI_STACK_FRAME 65 .end __entry -
uspace/lib/c/arch/mips64/src/entryjmp.S
r53d5278 r96598b8 27 27 # 28 28 29 #include <libarch/stack.h> 30 29 31 .text 30 32 .section .text … … 34 36 ## void entry_point_jmp(void *entry_point, void *pcb); 35 37 # 36 # $a0 (=$4) 37 # $a1 (=$5) 38 # $a0 (=$4) contains entry_point 39 # $a1 (=$5) contains pcb 38 40 # 39 41 # Jump to program entry point … … 41 43 entry_point_jmp: 42 44 # tmp := entry_point 43 move $ 25, $a044 45 move $t9, $a0 46 45 47 # Pass pcb to the entry point in $a0 46 48 move $a0, $a1 47 jr $25 48 nop 49 .end 49 50 jr $t9 51 addiu $sp, -ABI_STACK_FRAME 52 addiu $sp, ABI_STACK_FRAME 53 .end entry_point_jmp -
uspace/lib/c/arch/mips64/src/thread_entry.S
r53d5278 r96598b8 27 27 # 28 28 29 #include <libarch/stack.h> 30 29 31 .text 30 32 31 33 .set noat 32 34 .set noreorder 33 35 .option pic2 34 36 35 37 .globl __thread_entry 36 38 … … 40 42 .ent __thread_entry 41 43 __thread_entry: 42 .frame $sp, 32, $3143 .cpload $ 2544 44 .frame $sp, ABI_STACK_FRAME, $ra 45 .cpload $t9 46 45 47 # 46 48 # v0 contains address of uarg. 47 49 # 48 add $4, $2, 0 49 # Mips o32 may store its arguments on stack, make space 50 addiu $sp, -32 50 add $a0, $v0, 0 51 52 # Allocate the stack frame. 53 addiu $sp, -ABI_STACK_FRAME 54 55 # Allow PIC code 51 56 .cprestore 16 52 57 53 58 jal __thread_main 54 59 nop 55 60 56 61 # 57 62 # Not reached. 58 63 # 64 addiu $sp, ABI_STACK_FRAME 59 65 .end __thread_entry -
uspace/lib/c/arch/ppc32/include/fibril.h
r53d5278 r96598b8 27 27 */ 28 28 29 /** @addtogroup libcppc32 29 /** @addtogroup libcppc32 30 30 * @{ 31 31 */ … … 38 38 #include <sys/types.h> 39 39 40 /* We define our own context_set, because we need to set 41 * the TLS pointer to the tcb+0x7000 40 #define SP_DELTA 16 41 42 /* 43 * We define our own context_set, because we need to set 44 * the TLS pointer to the tcb + 0x7000 42 45 * 43 46 * See tls_set in thread.h 44 47 */ 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 16 48 #define context_set(c, _pc, stack, size, ptls) \ 49 do { \ 50 (c)->pc = (sysarg_t) (_pc); \ 51 (c)->sp = ((sysarg_t) (stack)) + (size) - SP_DELTA; \ 52 (c)->tls = ((sysarg_t) (ptls)) + 0x7000 + sizeof(tcb_t); \ 53 } while (0) 51 54 52 55 typedef struct { -
uspace/lib/c/arch/sparc64/include/fibril.h
r53d5278 r96598b8 40 40 #include <align.h> 41 41 42 #define SP_DELTA 42 #define SP_DELTA (STACK_WINDOW_SAVE_AREA_SIZE + STACK_ARG_SAVE_AREA_SIZE) 43 43 44 44 #define context_set(c, _pc, stack, size, ptls) \ … … 50 50 (c)->tp = (uint64_t) ptls; \ 51 51 } while (0) 52 52 53 53 /* 54 54 * Save only registers that must be preserved across -
uspace/lib/c/include/fibril.h
r53d5278 r96598b8 41 41 42 42 #define context_set_generic(c, _pc, stack, size, ptls) \ 43 (c)->pc = (sysarg_t) (_pc); \ 44 (c)->sp = ((sysarg_t) (stack)) + (size) - SP_DELTA; \ 45 (c)->tls = (sysarg_t) (ptls); 43 do { \ 44 (c)->pc = (sysarg_t) (_pc); \ 45 (c)->sp = ((sysarg_t) (stack)) + (size) - SP_DELTA; \ 46 (c)->tls = (sysarg_t) (ptls); \ 47 } while (0) 46 48 47 49 #define FIBRIL_SERIALIZED 1
Note:
See TracChangeset
for help on using the changeset viewer.