All of lore.kernel.org
 help / color / mirror / Atom feed
* [HELP] asm language explanation about callq
@ 2016-10-19  2:20 吴周辉
  0 siblings, 0 replies; only message in thread
From: 吴周辉 @ 2016-10-19  2:20 UTC (permalink / raw)
  To: linux-newbie

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2016-10-19  2:20 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-19  2:20 [HELP] asm language explanation about callq 吴周辉

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.