Changeset d2fa31f7 in mainline
- Timestamp:
- 2008-03-15T08:48:18Z (17 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 7397c73
- Parents:
- cbd6545f
- Location:
- uspace/lib/libc
- Files:
-
- 2 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/libc/arch/ia32/src/setjmp.S
rcbd6545f rd2fa31f7 27 27 # 28 28 29 #include <kernel/arch/context_offset.h> 30 29 31 .text 30 32 .global setjmp … … 33 35 .type setjmp,@function 34 36 setjmp: 35 movl 0(%esp), %ecx # save current pc 36 leal 4(%esp), %edx # save stack pointer 37 movl (%edx), %eax # get jmp_buf pointer 37 movl 0(%esp),%eax # save pc value into eax 38 movl 4(%esp),%edx # address of the context variable to save context to 38 39 39 # Save registers 40 movl %ebx, 0(%eax) 41 movl %esi, 4(%eax) 42 movl %edi, 8(%eax) 43 movl %ebp, 12(%eax) 44 movl %edx, 16(%eax) 40 # save registers to given structure 41 CONTEXT_SAVE_ARCH_CORE %edx %eax 45 42 46 movl %ecx, 20(%eax) # save pc43 xorl %eax,%eax # set_jmp returns 0 47 44 ret 48 45 … … 53 50 movl 8(%esp), %eax # put return value into eax 54 51 55 # restore all registers 56 movl 0(%ecx), %ebx 57 movl 4(%ecx), %esi 58 movl 8(%ecx), %edi 59 movl 12(%ecx), %ebp 60 movl 16(%ecx), %esp 61 62 movl 20(%ecx), %edx # saved return address 63 jmp *%edx 52 # restore registers from jmp_buf 53 CONTEXT_RESTORE_ARCH_CORE %ecx %edx 54 55 movl %edx,0(%esp) # put saved pc on stack 56 ret 57 -
uspace/lib/libc/include/setjmp.h
rcbd6545f rd2fa31f7 27 27 */ 28 28 29 /** @addtogroup libc ia3229 /** @addtogroup libc 30 30 * @{ 31 31 */ … … 33 33 */ 34 34 35 #ifndef LIBC_ ia32_SETJMP_H_36 #define LIBC_ ia32_SETJMP_H_35 #ifndef LIBC_SETJMP_H_ 36 #define LIBC_SETJMP_H_ 37 37 38 #include <libarch/ types.h>38 #include <libarch/fibril.h> 39 39 40 typedef struct { 41 uint32_t ebx; 42 uint32_t esi; 43 uint32_t edi; 44 uint32_t ebp; 45 uint32_t esp; 46 uint32_t pc; 47 } jmp_buf; 40 typedef context_t jmp_buf; 48 41 49 int setjmp(jmp_buf env);50 void longjmp(jmp_buf env,int val) __attribute__((__noreturn__));42 extern int setjmp(jmp_buf env); 43 extern void longjmp(jmp_buf env,int val) __attribute__((__noreturn__)); 51 44 52 45 #endif -
uspace/lib/libc/include/unistd.h
rcbd6545f rd2fa31f7 39 39 #include <libarch/config.h> 40 40 41 #ifndef NULL 41 42 #define NULL 0 43 #endif 44 42 45 #define getpagesize() (PAGE_SIZE) 43 46
Note:
See TracChangeset
for help on using the changeset viewer.