sorry......i think i know who is the caller: i86pc/ml/locore.s:
1553 1554 /* 1555 * XXX - may want a fast path that avoids sys_rtt_common in the 1556 * most common case. 1557 */ 1558 ALTENTRY(_sys_rtt) 1559 CLI(%rax) /* disable interrupts */ 1560 ALTENTRY(_sys_rtt_ints_disabled) 1561 movq %rsp, %rdi /* pass rp to sys_rtt_common */ 1562 call sys_rtt_common /* do common sys_rtt tasks */ 1563 testq %rax, %rax /* returning to userland? */ 1564 jz sr_sup 1565 1566 /* 1567 * Return to user 1568 */ 1569 ASSERT_UPCALL_MASK_IS_SET 1570 cmpw $UCS_SEL, REGOFF_CS(%rsp) /* test for native (64-bit) lwp? */ 1571 je sys_rtt_syscall 1572 1573 /* 1574 * Return to 32-bit userland 1575 */ 1576 ALTENTRY(sys_rtt_syscall32) 1577 USER32_POP 1578 the above is difficult to read, the below is far easier: lwp_rtt+0x55: movq 0x20(%rsp),%rsi lwp_rtt+0x5a: movq 0x40(%rsp),%rdi lwp_rtt+0x5f: call +0x1843b4 <post_syscall> lwp_rtt+0x64: movq %cr0,%rdi lwp_rtt+0x67: orq $0x8,%rdi lwp_rtt+0x6b: movq %rdi,%cr0 _sys_rtt: cli _sys_rtt_ints_disabled: movq %rsp,%rdi _sys_rtt_ints_disabled+3: call +0x2b431 <sys_rtt_common> _sys_rtt_ints_disabled+8: testq %rax,%rax _sys_rtt_ints_disabled+0xb: je +0x91 <sr_sup> _sys_rtt_ints_disabled+0x11: cmpw $0x53,0xd0(%rsp) _sys_rtt_ints_disabled+0x1a: je +0x28 <sys_rtt_syscall> sys_rtt_syscall32: movl 0x10(%rsp),%edi sys_rtt_syscall32+4: movl 0x18(%rsp),%esi sys_rtt_syscall32+8: movl 0x20(%rsp),%edx sys_rtt_syscall32+0xc: movl 0x28(%rsp),%ecx sys_rtt_syscall32+0x10: movl 0x40(%rsp),%eax sys_rtt_syscall32+0x14: movl 0x48(%rsp),%ebx sys_rtt_syscall32+0x18: movl 0x50(%rsp),%ebp so i guessed the processing will flow through from lwp_rtt, to sys_rtt, to sys_rtt_syscall32 etc etc.....and calling sys_rtt_common() from in between. but the intent is still vague for me? On Thu, Nov 19, 2009 at 4:38 PM, Peter Teoh <htmldevelo...@gmail.com> wrote: > Writing the "most generic" dtrace script possible (please correct me > if wrong :-)): > > pid$target:::entry, > pid$target:::return > / execname == "YYYYY" / > { > printf("u:"); > } > > fbt::*:entry, > fbt::*:return > / execname == "YYYYY" / > { > printf("k:"); > } > > I managed to trace the transition from user to kernel and vice versa: > > 1 6847 sys_rtt_common:return k: > 1 67621 mutex_lock:return u: > 1 6846 sys_rtt_common:entry k: > 1 6847 sys_rtt_common:return k: > 1 62685 _malloc_unlocked:entry u: > 1 6846 sys_rtt_common:entry k: > 1 6847 sys_rtt_common:return k: > 1 62693 cleanfree:entry u: > 1 6846 sys_rtt_common:entry k: > 1 5746 trap:entry k: > 1 6940 do_interrupt:entry k: > 1 6842 cpu_idle_exit:entry k: > 1 6843 cpu_idle_exit:return k: > 1 26906 apic_intr_enter:entry k: > 1 6190 psm_get_cpu_id:entry k: > 1 6191 psm_get_cpu_id:return k: > 1 26907 apic_intr_enter:return k: > 1 3700 hilevel_intr_prolog:entry k: > > the thing is that i keep seeing this sys_rtt_common() everywhere. > what is the purpose of this function? the code is not understood by > me either: > > http://cvs.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/uts/i86pc/os/intr.c > > 994 /* > 995 * Common tasks always done by _sys_rtt, called with > interrupts disabled. > 996 * Returns 1 if returning to userland, 0 if returning to system mode. > 997 */ > 998 int > 999 sys_rtt_common(struct regs *rp) > 1000 { > > I cannot answer - who call sys_rtt_common()? from any userspace API > (cleanfree() for example), how is the transition to kernel's > sys_rtt_common() done? > > SYSENTER? (what code)? > > and inside the function - why is it sometime returning back to > userspace, and sometime continuing processing in kernelspace? > > -- > Regards, > Peter Teoh > -- Regards, Peter Teoh _______________________________________________ opensolaris-code mailing list opensolaris-code@opensolaris.org http://mail.opensolaris.org/mailman/listinfo/opensolaris-code