Re: Find the calling function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Elad...

On Fri, Jul 25, 2008 at 4:03 AM, Elad Lahav
<elad_lahav@xxxxxxxxxxxxxxxxxxxxx> wrote:
> I am trying to determine, in run-time, the where a function was called from.
> I believe that the standard way of doing this on an x86 is by looking at the
> top of the stack pointed to by the EBP register. I.e., the following code
> should yield the return address in 'addr':
>
> asm volatile("movl 0x4(%%ebp), %0\n" : "=r"(addr));

I think that's correct... parameters are pushed first, then ret addr.
So the closest with %ebp should be ret addr AFAIK.

> However, looking at the assembly code of the function I'm interested in
> (update_process_times), the calling convention looks odd: EBP is not pushed,
> and RET is not invoked at the end. I assume this has something to do with
> the function being called in interrupt context?
Are you sure? Looking at
http://lxr.linux.no/linux/kernel/time/tick-common.c#L70, you can see
that update_process_times() seems being called normally. So I guess
you should see "call" and "ret" when checking the assembly codes

regards,

Mulyadi.

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux