home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
dumptool.zip
/
SAMPLRPN.ZIP
/
logxcpt.rpn
next >
Wrap
Text File
|
1997-04-29
|
3KB
|
106 lines
;log any user exception before the excption handlers have a go
;
major=252
hmte=6 ;os2krnl
vars=4
;
minor=0x1000
opcode=0x55 ;push
object=0xf ;GA Merlin 9.023 ALLSTRICT Kernel
offset=0x46daf ; _XCPTBuildR3DispatcherStack segment:offset
;
;
push w,8 ;log 2 dwords
push ss
push esp
push w,4
add ;bump past the return eip
log mrs ;log the exception number and trap number
;
;
; get current TCB address via the SAS
; requires 2 variables to be defined for temporary use.
;
; Actually there is a better way to get the current TCB address.
; Pete Guy pointed this out. The variable CurrTCB is always at the
; same relative offset to selector 30. CurrTCB contains the offset
; (fff0) from sel 30 to the aliased current TCB. I'll change the
; following code when I get time!
;
push w,0x70;SAS selector (used later)
push w,0x70;SAS selector
push w,0x0e;offset to tasking section offset
push wis
move v,0 ;save tasking section offset
push w,0xa ;offset to slot no address
add ;TOS=sel:off-> @tasknumber
push sis ;(using first push w,0x70)
cnvrt sxd ;TOS->tasknumber
push fif ;fetch slot number
push w,4 ;scale by 4
mul ;convert to index into tcb ptrs table
move v,1 ;save offset into TCB table
pop n,1
push w,0x70
push v,0 ;offset into tasking section
push w,0x6 ;offset to @TCB ptrs addr
add
push sis
cnvrt sxd ;address of @tcb table on stack
push fif ;addres of tcb table on TOS
push v,1 ;offset into table for current thread
add
push fif ;current tcb address on stack
move v,0 ;save tcb address
; have now arived at current TCB address
; save the stack frame address in v3
push w,0x3c ;tcb offset to stack frame address
add ;tos points to stack frame address
push fif ;tos=stack frame addr
move v,3 ;save stack frame address
;
; save the CRI address in v1. Log the cri
push w,0x58 ;cri size
push v,0 ;tcb address
push w,0x38;tcb offset to cri pointer
add
push fif ;cri ptr on tos
move v,1 ;saved cri address
log mrf ;cri logged
;
; save client stake frame size in v2
push v,1 ;cri addr
push fif ;cri type/size on tos
move v,2 ;cri stack type/size saved in v2
;
; leave cbargs on TOS
push v,1 ;cri addr
push w,0x44 ;cbargs rip offset
add
push fif ;cbargs rip on tos
cnvrt dxs ;beak into two stack entries
push w,0x3
and
jmp zn,cbarg
;
;nocbarg:
push d,0
jmp n,logstack
;
cbarg:
pop n,1 ;leave tos=cbargs offset
push v,3 ;stack frame address
add ;tos=address of cbargs
push fif ;tos=cbargs
;
;
; Log the client stack frame + args + ss:esp
logstack:
push v,2 ;stack size
add
push w,8 ;allow for stack switch (ss:esp)
add ;tos=length of stack to log
push v,3 ;address of stack frame
log mrf