linux-newbie.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: 吴周辉 <wuzhouhui250@gmail.com>
To: linux-newbie@vger.kernel.org
Subject: [HELP] asm language explanation about callq
Date: Wed, 19 Oct 2016 10:20:32 +0800	[thread overview]
Message-ID: <CA+AdbF9O8xvmE+5JpS5p-T1kSjCDQ_Xug18jV7Vr_Cf0F4OwxA@mail.gmail.com> (raw)

I wrote following C program:

#include <linux/module.h>
#include <linux/init.h>

static int param = 4096;
static unsigned long int addr = 0xffff88080984b000;
module_param(param, int, S_IRUGO);
module_param(addr, ulong, S_IRUGO);

static int test_init(void)
{
    memset((void *)addr, 0, param);

    return(-1);
}

static void test_exit(void)
{
}

module_init(test_init);
module_exit(test_exit);

MODULE_LICENSE("GPL");

Then, I compile it, and objdump -d test.o:

test.o:     file format elf64-x86-64


Disassembly of section .text:

0000000000000000 <cleanup_module>:
   0:    55                       push   %rbp
   1:    48 89 e5                 mov    %rsp,%rbp
   4:    e8 00 00 00 00           callq  9 <cleanup_module+0x9>
   9:    c9                       leaveq
   a:    c3                       retq
   b:    0f 1f 44 00 00           nopl   0x0(%rax,%rax,1)

0000000000000010 <init_module>:
  10:    55                       push   %rbp
  11:    48 89 e5                 mov    %rsp,%rbp
  14:    e8 00 00 00 00           callq  19 <init_module+0x9>
  19:    48 63 15 00 00 00 00     movslq 0x0(%rip),%rdx        # 20
<init_module+0x10>
  20:    48 8b 3d 00 00 00 00     mov    0x0(%rip),%rdi        # 27
<init_module+0x17>
  27:    31 f6                    xor    %esi,%esi
  29:    e8 00 00 00 00           callq  2e <init_module+0x1e>
  2e:    b8 ff ff ff ff           mov    $0xffffffff,%eax
  33:    c9                       leaveq
  34:    c3                       retq
  35:    90                       nop
  36:    90                       nop
  37:    90                       nop

Can someone explain what the meaning of three "callq" instruction in objdump's
output, especially the arguments of "callq".

Thanks.
--
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs

                 reply	other threads:[~2016-10-19  2:20 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CA+AdbF9O8xvmE+5JpS5p-T1kSjCDQ_Xug18jV7Vr_Cf0F4OwxA@mail.gmail.com \
    --to=wuzhouhui250@gmail.com \
    --cc=linux-newbie@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).