- Timestamp:
- 2012-03-13T15:23:11Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 145d16f8
- Parents:
- df366b5e
- Location:
- uspace/lib/c/arch
- Files:
-
- 3 added
- 5 edited
- 6 moved
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/arch/mips32/Makefile.inc
rdf366b5e r6d123b3 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/fibril.h
rdf366b5e r6d123b3 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
rdf366b5e r6d123b3 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
rdf366b5e r6d123b3 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/thread_entry.S
rdf366b5e r6d123b3 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
rdf366b5e r6d123b3 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
rdf366b5e r6d123b3 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
rdf366b5e r6d123b3 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
rdf366b5e r6d123b3 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
rdf366b5e r6d123b3 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
rdf366b5e r6d123b3 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
Note:
See TracChangeset
for help on using the changeset viewer.