Re: Help required in understanding assembly code

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

 



Hi,

Le Tue, 22 Jan 2008 16:15:49 +0530,
Shreyansh <shreyansh.jain@xxxxxxxxx> a écrit :

> (This is a x86_64 machine I am working on, running SLES10 SP1)

I don't have the source code for that exact kernel version, and several
things have changed since then.

> 1) What does the instruction "mov   0xffffffff803d54e0(,%rax,8),
> %rdx" imply?

Your code is:

0xffffffff8012128e <page_to_pfn>:       mov    (%rdi),%rax
0xffffffff80121291 <page_to_pfn+3>:     shr    $0x38,%rax
0xffffffff80121295 <page_to_pfn+7>:     mov    0xffffffff803d54e0(,%rax,8),%rdx
0xffffffff8012129d <page_to_pfn+15>:    mov    $0x6db6db6db6db6db7,%rax
0xffffffff801212a7 <page_to_pfn+25>:    sub    0x620(%rdx),%rdi

I suspect that the argument "struct page *" is passed in %rdi. It first
dereferences it to get the page->flags value (which is at the beginning
of the page structure). Once this value is in %rax, it shifts it right
by 38 bits, which I suspect is the >> ZONETABLE_PGSHIFT in your source
code. Then, it accesses to the zone_table[] array : it access to the
%rax-th entry, in an array of elements with an 8 byte size (and
zone_table[] is an array of "struct zone *", so it's an array of 8
bytes elements). In %rdx, we now have a pointer to a "struct zone *"...
which in fact happens to be NULL.

So, I would say that either your page->flags are broken, either your
zone_table[] array is incorrect.

> 2) for "RIP: 0010:[<ffffffff801212a7>] " what does
> "0010" mean?

It's the segment selector. It selects through which segment we are
accessing the code. It is an offset in the Global Descriptor Table
(GDT). These are x86/x86_64 specific bits, I don't think you care about
this for your particular issue.

> 3) Does "EFLAGS: 00010217" signify any error value, and
> if it does, how to interpret it?

Take the Intel Developer manual, volume 1 (available at
http://www.intel.com/products/processor/manuals/), page 78. It
describes the contents of the EFLAGS register.

Sincerly,

Thomas
-- 
Thomas Petazzoni, Free Electrons
Free Embedded Linux Training Materials
on http://free-electrons.com/training
(More than 1500 pages!)

Attachment: signature.asc
Description: PGP signature


[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