0

I'm debugging a problem in a driver I'm writing. The kernel core files I have for this show a problem in uart_remove_one_port which is a function in the serial_core.c (i.e. part of the kernel). I ran objdump -d -S on the vmlinux file for the kernel I'm running to look at this better. I have the following:

ffffffff813cce60:   48 8b 83 c8 00 00 00    mov    0xc8(%rbx),%rax
ffffffff813cce67:   48 89 df                mov    %rbx,%rdi
ffffffff813cce6a:   ff 90 98 00 00 00       callq  *0x98(%rax)

I'm a bit confused about what the callq instruction is doing. callq *0x98(%rax), seems to be using some expression as permissible in x86_64 stuff as mentioned here. However, I'm not sure what the '*' character does to it. I haven't found a sufficient answer to this either. Is it indirection as I'd use in C int *p = <something_real>; *p = 5; or is it multiplying something? I believe this instruction, mov 0xc8(%rbx),%rax, means "add 0xc8 to the rbx register and push the result in rax." Drawing on this, is this other instruction saying, "add 0x98 to rax and then dereference that by calling that function?"

Jester
  • 56,577
  • 4
  • 81
  • 125
Andrew Falanga
  • 2,274
  • 4
  • 26
  • 51
  • 2
    If you are confused by at&t syntax switch to intel (`-Mintel`). That's just an indirect call through a pointer in memory `call [rax+0x98]`. The `*` is optional in this case, it's only required when you have `call foo` vs `call *foo` – Jester May 19 '16 at 23:02
  • You are also wrong about the meaning of `mov 0xc8(%rbx),%rax`. This is a load of a 64-bit word from memory at address `%rbx + 0xc8` into register `%rax`. Your interpretation would be correct for `lea 0xc8(%rbx), %rax`. – EOF May 20 '16 at 09:35
  • @EOF Thank you for the clarification. – Andrew Falanga May 20 '16 at 14:43
  • @Jester I was beginning to suspect that this is what was happening. At this location in the assembly, it is calling (dereferencing) a function pointer (from C, I don't know if that's the right terminology for assembly). Thank you for confirming. Would you mind making your comments a real answer so that I may select this as answered? – Andrew Falanga May 20 '16 at 14:47

0 Answers0