mirror of
https://git.planet-casio.com/Vhex-Kernel-Core/fxlibc.git
synced 2024-12-29 13:03:38 +01:00
setjmp: do not disable interrupts (#1) (DONE)
SR.BL=1 could cause problems if setjmp or longjmp is loader over a page boundary and the second page is not loaded when interrupts are masked. SR.IMASK=15 is another option, but it seems unnecessary per #1. Blocking interrupts in longjmp did not make too much sense because the blocked SR was immediately replaced by the restored one.
This commit is contained in:
parent
13c3390b22
commit
73d6b2eb7c
3 changed files with 5 additions and 22 deletions
5
STATUS
5
STATUS
|
@ -68,8 +68,8 @@ DONE: Function/symbol/macro is defined, builds, links, and is tested
|
||||||
7.12 <math.h> => OpenLibm
|
7.12 <math.h> => OpenLibm
|
||||||
|
|
||||||
7.13 <setjmp.h>
|
7.13 <setjmp.h>
|
||||||
! 7.13.1 setjmp: TEST
|
7.13.1 setjmp: DONE
|
||||||
! 7.13.2 longjmp: TEST
|
7.13.2 longjmp: DONE
|
||||||
|
|
||||||
7.14 <signal.h>
|
7.14 <signal.h>
|
||||||
! 7.14.1 Macros and stuff: TODO
|
! 7.14.1 Macros and stuff: TODO
|
||||||
|
@ -95,6 +95,7 @@ DONE: Function/symbol/macro is defined, builds, links, and is tested
|
||||||
! 7.19.10 Error-handling functions: TODO
|
! 7.19.10 Error-handling functions: TODO
|
||||||
|
|
||||||
7.20 <stdlib.h>
|
7.20 <stdlib.h>
|
||||||
|
7.20 RAND_MAX, MB_CUR_MAX: TODO
|
||||||
7.20.1.1 atof: DONE
|
7.20.1.1 atof: DONE
|
||||||
7.20.1.2 atoi, atol, atoll: DONE
|
7.20.1.2 atoi, atol, atoll: DONE
|
||||||
7.20.1.3 strtod, strtof, strtold: DONE
|
7.20.1.3 strtod, strtof, strtold: DONE
|
||||||
|
|
|
@ -18,15 +18,6 @@ _longjmp:
|
||||||
movt r9
|
movt r9
|
||||||
add r5, r9
|
add r5, r9
|
||||||
|
|
||||||
! block interrupt
|
|
||||||
int_block:
|
|
||||||
stc sr, r1
|
|
||||||
mov #0x10, r2
|
|
||||||
shll8 r2
|
|
||||||
shll16 r2
|
|
||||||
or r2, r1
|
|
||||||
ldc r1, sr
|
|
||||||
|
|
||||||
context_switch:
|
context_switch:
|
||||||
! load the old SR register first to force register bank switch
|
! load the old SR register first to force register bank switch
|
||||||
! (if needed) then move the context and the returned value into
|
! (if needed) then move the context and the returned value into
|
||||||
|
|
|
@ -5,18 +5,12 @@
|
||||||
.align 2
|
.align 2
|
||||||
/*
|
/*
|
||||||
** int setjmp(jmp_buf env)
|
** int setjmp(jmp_buf env)
|
||||||
** Store the calling environment in ENV, also saving the signal mask.
|
** Store the calling environment in ENV.
|
||||||
** Return 0.
|
** Return 0.
|
||||||
*/
|
*/
|
||||||
_setjmp:
|
_setjmp:
|
||||||
! block interrupt
|
! block interrupt
|
||||||
stc sr, r1
|
stc sr, r3
|
||||||
mov r1, r3
|
|
||||||
mov #0x10, r2
|
|
||||||
shll8 r2
|
|
||||||
shll16 r2
|
|
||||||
or r2, r1
|
|
||||||
ldc r1, sr
|
|
||||||
|
|
||||||
! save current context
|
! save current context
|
||||||
! @note: r3 is the saved SR regsiter
|
! @note: r3 is the saved SR regsiter
|
||||||
|
@ -35,9 +29,6 @@ _setjmp:
|
||||||
mov.l r8, @-r4
|
mov.l r8, @-r4
|
||||||
mov.l r3, @-r4
|
mov.l r3, @-r4
|
||||||
|
|
||||||
! restore sr
|
|
||||||
ldc r3, sr
|
|
||||||
|
|
||||||
! return
|
! return
|
||||||
rts
|
rts
|
||||||
mov #0, r0
|
mov #0, r0
|
||||||
|
|
Loading…
Reference in a new issue