Understanding disassembly x86 + understanding function call + parameter pass and stack frame

Tobias Boege tobias at gambas-buch.de
Sun Sep 15 14:13:43 EDT 2013


On Tue, 03 Sep 2013, nidhi mittal hada wrote:
> Hi,
> 
> while in the pursuit of learning to understand assembly ..
> This is my doubt ..Please help to understand
> 
> *I want to catch where in this disassembly call is made to get_sb function.*
> 
> Somehow in this disassembly, i m not finding, a direct *call* instruction,
> with function name, written in english.
>
> [...]
> 
> *Thats the definition of function*
> 
> vfs_kern_mount(struct file_system_type *type, int flags, const char *name,
> void *data)
> {
>         struct vfsmount *mnt;
>         char *secdata = NULL;
>         int error;
> 
>         if (!type)
>                 return ERR_PTR(-ENODEV);
> 
>         error = -ENOMEM;
> 
>     *  mnt = alloc_vfsmnt(name);*
>         if (!mnt)
>                 goto out;
> 
> *<<<<<<<<<<<<<<THIS PORTION, IS   NOT  VISIBLE  TO ME, **IN  ASSEMBLY
> >>>>>>>>>>>>>>>*
>         if (data && !(type->fs_flags & FS_BINARY_MOUNTDATA)) {
>                 secdata = alloc_secdata();
>                 if (!secdata)
>                         goto out_mnt;
> 
>                 error = security_sb_copy_data(data, secdata);
>                 if (error)
>                         goto out_free_secdata;
>         }
> 
> *   error = type->get_sb(type, flags, name, data,
> mnt);>>>>>>>>>>>>>>>>thats the line i want to catch, in assembly above.
> Where is this call  made in assembly ???*
>         if (error < 0)
>                 goto out_free_secdata;
>         BUG_ON(!mnt->mnt_sb);
>         mnt->mnt_sb->s_flags |= MS_BORN;
> 
>     *    error = security_sb_kern_mount(mnt->mnt_sb, flags, secdata);*
>         if (error)
>                 goto out_sb;
> .
> .
> .
> .
> .
> *out_sb:*
>         dput(mnt->mnt_root);
>         deactivate_locked_super(mnt->mnt_sb);
> *out_free_secdata*:
>         free_secdata(secdata);
> *out_mnt:*
>         free_vfsmnt(mnt);
> *out:*   >>>368
>         return ERR_PTR(error);
> }

You won't find a "direct *call* instruction, with function name, written in
english" because 'get_sb' is not a function[*] but a function pointer. And
moreover it is a member of a structure.

You will have to find out where a pointer to this structure is stored and
where a member relative to this structure it is referenced in a call
instruction. (Hint: It is the only function pointer inside 'type' which is
used in this function. Moreover, it is the only function pointer used in
this function at all.)

Regards,
Tobi

[*] To my shame, I have no clue about the subtleties of definitions of
    entities in the C language. Please forgive me if my words don't accord
    with these definitions.




More information about the Kernelnewbies mailing list