[L4alpha-cvscommit] CVS: L4Alpha/pal ipc.mar,1.15,1.16 thread.mar,1.9,1.10
Status: Beta
Brought to you by:
dpotts
|
From: Daniel P. <dp...@us...> - 2002-01-02 05:47:53
|
Update of /cvsroot/l4alpha/L4Alpha/pal
In directory usw-pr-cvs1:/tmp/cvs-serv20720/pal
Modified Files:
ipc.mar thread.mar
Log Message:
Added ipc_ret_cancel_polling support
If thread being aborted or ex-reg'ed is aborted it should unwind it's stack corr
ectly (and not trash register contents)
This commit does it right for aborting threads that are currently trying to send to another thread.
Will clean up commented out code later.
Index: ipc.mar
===================================================================
RCS file: /cvsroot/l4alpha/L4Alpha/pal/ipc.mar,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** ipc.mar 2002/01/02 04:08:46 1.15
--- ipc.mar 2002/01/02 05:47:48 1.16
***************
*** 1024,1038 ****
lda AT, TCB_SEND_QUEUE (p0) ; delete this entry from send queue
delete_ll AT, p2, p3, ISLIST
GET_16CONS v0, IPC_S_TIMEOUT
; now we unwind the stack
- .if df do_fast_asm_unfriendly_unstack
- lda sp, <17 * 8>(sp) ; was 16 was 14
- .iff
- ;; This should be the same as ipc_send_eq unstacking...
- pop p_t0!p_t1!p_t2!p_t3!p_t4!p_t5!p_t6!p_t8!p_a4!p_a5!p_fp!p_v0
- pop p_a0!p_a1!p_a2!p_a3
- pop p_pp1
- .endc
ENDIF
--- 1024,1035 ----
lda AT, TCB_SEND_QUEUE (p0) ; delete this entry from send queue
delete_ll AT, p2, p3, ISLIST
+
+ ;; Update list state.
+ ldl t0, TCB_LIST_STATE(t12)
+ bic t0, #LLS_POLLING_QUEUE, t0
+ stl t0, TCB_LIST_STATE(t12)
GET_16CONS v0, IPC_S_TIMEOUT
; now we unwind the stack
ENDIF
***************
*** 1057,1068 ****
full_close_frame
- ;;; Generic fail from IPC (reason is on stack).
ALIGN_FETCH_BLOCK
ipc_ret_fail:
.if df ev4
create_PPR_context
.endc
enable_int pp0
- pop p_v0 ; get failure result off stack
full_close_frame
--- 1054,1079 ----
full_close_frame
ALIGN_FETCH_BLOCK
+ ipc_polling_unstack:
+ .if df do_fast_asm_unfriendly_unstack ; you probably never want to enable this
+ lda sp, <17 * 8>(sp)
+ .iff
+ ;; This should be the same as ipc_send_eq unstacking...
+ pop p_t0!p_t1!p_t2!p_t3!p_t4!p_t5!p_t6!p_t8!p_a4!p_a5!p_fp!p_v0
+ pop p_a0!p_a1!p_a2!p_a3
+ pop p_pp1
+ ret zero, (ra)
+ .endc
+
+
+ ;;; ABORT fail routine from ex_reg/remote_abort (reason is on stack).
+ ALIGN_FETCH_BLOCK
ipc_ret_fail:
.if df ev4
create_PPR_context
.endc
+ ; pop p_pp0 ; get failure off stack..
+
enable_int pp0
full_close_frame
***************
*** 1073,1077 ****
.if df ev4
create_PPR_context
! .endc
GET_16CONS v0, IPC_S_CANCELLED
enable_int t0
--- 1084,1092 ----
.if df ev4
create_PPR_context
! .endc
!
! ; pop p_pp0
! bsr ra, ipc_polling_unstack
!
GET_16CONS v0, IPC_S_CANCELLED
enable_int t0
Index: thread.mar
===================================================================
RCS file: /cvsroot/l4alpha/L4Alpha/pal/thread.mar,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** thread.mar 2002/01/02 04:11:50 1.9
--- thread.mar 2002/01/02 05:47:48 1.10
***************
*** 519,525 ****
;; Restart thread and mark it as runnable
! ; GET_16CONS t0, TFS_RUNNING
! ; stq t0, TCB_THREAD_STATE(t12)
! ; enqueue_busy t12, t0, t1, t2
--- 519,525 ----
;; Restart thread and mark it as runnable
! GET_16CONS t0, TFS_RUNNING
! stq t0, TCB_THREAD_STATE(t12)
! enqueue_busy t12, t0, t1, t2
***************
*** 896,900 ****
bic t0, #TFS_POLLING, t1
IFZ t1
! kmsg <"Removing polling thread"<CR><LF>>
;; Thread is polling, so remove it from the other threads send root
--- 896,900 ----
bic t0, #TFS_POLLING, t1
IFZ t1
! ; kmsg <"Removing polling thread"<CR><LF>>
;; Thread is polling, so remove it from the other threads send root
***************
*** 906,914 ****
bic t0, #LLS_POLLING_QUEUE, t0
stl t0, TCB_LIST_STATE(t12)
!
! GET_16CONS t1, IPC_S_CANCELLED
br zero, remote_abort_out
XENDIF
!
cmpeq t0, #TFS_ABORTED, t1
IF t1
--- 906,919 ----
bic t0, #LLS_POLLING_QUEUE, t0
stl t0, TCB_LIST_STATE(t12)
!
! ; GET_16CONS t1, IPC_S_CANCELLED
! pal_addr t2, <ipc_ret_cancel_polling + 1>
br zero, remote_abort_out
XENDIF
!
! ;; FIXME - these cases below need a new entry point (not ipc_ret_fail)
! ;; like the POLLING case above has.
!
! .if ne 0 ; stupid case?
cmpeq t0, #TFS_ABORTED, t1
IF t1
***************
*** 916,927 ****
debug ; FIXME --- what to do here?
! GET_16CONS t1, IPC_S_CANCELLED
br zero, remote_abort_out
XENDIF
!
cmpeq t0, #TFS_LOCKED_RUNNING, t1
IF t1
;; FIXME --- I probably need to clean up more state than I currently do.
! GET_16CONS t1, IPC_S_ABORTED
br zero, remote_abort_out
XENDIF
--- 921,935 ----
debug ; FIXME --- what to do here?
! ; GET_16CONS t1, IPC_S_CANCELLED
! pal_addr t2, <ipc_ret_fail + 1>
br zero, remote_abort_out
XENDIF
! .endc
!
cmpeq t0, #TFS_LOCKED_RUNNING, t1
IF t1
;; FIXME --- I probably need to clean up more state than I currently do.
! ; GET_16CONS t1, IPC_S_ABORTED
! pal_addr t2, <ipc_ret_fail + 1>
br zero, remote_abort_out
XENDIF
***************
*** 930,934 ****
IF t1
;; FIXME --- I probably need to clean up more state than I currently do.
! GET_16CONS t1, IPC_R_ABORTED
br zero, remote_abort_out
XENDIF
--- 938,943 ----
IF t1
;; FIXME --- I probably need to clean up more state than I currently do.
! ; GET_16CONS t1, IPC_R_ABORTED
! pal_addr t2, <ipc_ret_fail + 1>
br zero, remote_abort_out
XENDIF
***************
*** 936,955 ****
;; Otherwise we were doing a receive
GET_16CONS t1, IPC_R_CANCELLED
ALIGN_FETCH_BLOCK <^x47FF041F> ; align with nops
remote_abort_out:
;; Store reason for cancel/abort on stack and reset KSP.
! lda t0, <TCB_STACKTOP - <4*8>>(t12)
! stq t1, 0(t0)
! stq t0, TCB_KSP(t12)
subq zero, #1, t0
stq t0, TCB_STACK_MODE(t12)
-
- pal_addr t1, <ipc_ret_fail + 1>
- stq t1, TCB_RESTART(t12)
! GET_16CONS t1, TFS_ABORTED; FIXME --- Correct? (should I do this later?)
! stq t1, TCB_THREAD_STATE(t12)
;; Return
--- 945,966 ----
;; Otherwise we were doing a receive
GET_16CONS t1, IPC_R_CANCELLED
+ pal_addr t2, <ipc_ret_cancel_wait + 1>
+ ; more work to be done?
ALIGN_FETCH_BLOCK <^x47FF041F> ; align with nops
remote_abort_out:
+ ;;; t2 is return entry point
;; Store reason for cancel/abort on stack and reset KSP.
!
! ; ldq t0, TCB_KSP(t12) ; get stack pointer
! ; subq t0, #8, t0 ; space for error result
!
! ; stq t1, 0(t0)
! ; stq t0, TCB_KSP(t12)
subq zero, #1, t0
stq t0, TCB_STACK_MODE(t12)
! stq t2, TCB_RESTART(t12)
;; Return
***************
*** 1078,1091 ****
and t0, #TCS_DEAD, t0
IFZ t0 ; not dying
! .if ne 0
kmsg <"Aborting thread ">
khex t1
kmsg <<CR><LF>>
.endc
! ; I'm not sure about this
pal_addr t0, <ipc_ret_cancel_polling+1> ; state was polling
! lda AT, <TCB_STACKTOP-<3*8>>(t1)
! stq AT, TCB_KSP(t1)
stq t0, TCB_RESTART(t1)
GET_16CONS t0, TFS_RUNNING
--- 1089,1106 ----
and t0, #TCS_DEAD, t0
IFZ t0 ; not dying
! .if ne 1
kmsg <"Aborting thread ">
khex t1
kmsg <<CR><LF>>
.endc
! ; I'm not sure about this
! ;; THIS NEEDS FIXING...
pal_addr t0, <ipc_ret_cancel_polling+1> ; state was polling
! ; lda AT, <TCB_STACKTOP-<3*8>>(t1) - changed to:
! ; ldq AT, TCB_KSP(t1)
! ; subq AT, #8, AT
!
! ; stq AT, TCB_KSP(t1)
stq t0, TCB_RESTART(t1)
GET_16CONS t0, TFS_RUNNING
***************
*** 1348,1354 ****
; I'm not sure about this
pal_addr t6, <ipc_ret_cancel_polling+1> ; state was polling
! lda AT, <TCB_STACKTOP-<3*8>>(t5)
! stq AT, TCB_KSP(t5)
stq t6, TCB_RESTART(t5)
GET_16CONS t6, TFS_RUNNING
--- 1363,1369 ----
; I'm not sure about this
pal_addr t6, <ipc_ret_cancel_polling+1> ; state was polling
! ; lda AT, <TCB_STACKTOP-<3*8>>(t5)
! ; stq AT, TCB_KSP(t5)
stq t6, TCB_RESTART(t5)
GET_16CONS t6, TFS_RUNNING
|