All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: Ask a question related Assemble and C revert  within vmlinux ?
@ 2009-07-10  4:45 peter meng
  0 siblings, 0 replies; 4+ messages in thread
From: peter meng @ 2009-07-10  4:45 UTC (permalink / raw)
  To: Albert ARIBAUD; +Cc: linux-kernel


Hi,Albert

Thanks .

--- On Thu, 7/9/09, Albert ARIBAUD <albert.aribaud@free.fr> wrote:

> From: Albert ARIBAUD <albert.aribaud@free.fr>
> Subject: Re: Ask a question related Assemble and C revert  within vmlinux ?
> To: "peter meng" <mengsanshui@yahoo.com.cn>
> Cc: linux-kernel@vger.kernel.org
> Date: Thursday, July 9, 2009, 7:35 PM
> peter meng a écrit :
> > Hi
> > 
> > I compile the linux kernel with mips .
> > Is there any tools let the Assemble code correspond to
> C code ?
> > I mean Assemble line correspond to C line .
> 
> Look up you C compiler's command line options. There should
> be several to generate listings, with either assembly or
> mixed assembly and C.
> 
> Or if your tool chain has the objdump utility, objdump also
> has options to disassemble, and possibly intermix source
> code lines.
> 
> Amicalement,
> -- Albert.
> 


      

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Ask a question related Assemble and C revert  within vmlinux ?
  2009-07-09 10:50 peter meng
  2009-07-09 11:35 ` Albert ARIBAUD
@ 2009-07-09 12:49 ` Jiri Olsa
  1 sibling, 0 replies; 4+ messages in thread
From: Jiri Olsa @ 2009-07-09 12:49 UTC (permalink / raw)
  To: peter meng; +Cc: linux-kernel

On Thu, Jul 09, 2009 at 06:50:47PM +0800, peter meng wrote:
> 
> Hi
> 
> I compile the linux kernel with mips .
> Is there any tools let the Assemble code correspond to C code ?
> I mean Assemble line correspond to C line .

not sure about mips, but for x86:
objdump -S ./ex.o

you need to have debug info compiled in..

jirka

> 
> 
> 
> ----------------cut from objdump -S vmlinux ----------------------
> 801b5b40 <ip_rcv>:
> 801b5b40:       27bdffc0        addiu   sp,sp,-64
> 801b5b44:       afb00028        sw      s0,40(sp)
> 801b5b48:       afbf0038        sw      ra,56(sp)
> 801b5b4c:       afb30034        sw      s3,52(sp)
> 801b5b50:       afb20030        sw      s2,48(sp)
> 801b5b54:       afb1002c        sw      s1,44(sp)
> 801b5b58:       8c82006c        lw      v0,108(a0)
> 801b5b5c:       3c0300e0        lui     v1,0xe0
> 801b5b60:       3c050060        lui     a1,0x60
> 801b5b64:       00431024        and     v0,v0,v1
> 801b5b68:       10450022        beq     v0,a1,801b5bf4 <ip_rcv+0xb4>
> 801b5b6c:       00808021        move    s0,a0
> 801b5b70:       3c128029        lui     s2,0x8029
> 801b5b74:       8e42ef90        lw      v0,-4208(s2)
> 801b5b78:       00808821        move    s1,a0
> 801b5b7c:       8c430004        lw      v1,4(v0)
> 801b5b80:       24630001        addiu   v1,v1,1
> 801b5b84:       ac430004        sw      v1,4(v0)
> 801b5b88:       8c850078        lw      a1,120(a0)
> 801b5b8c:       38a50001        xori    a1,a1,0x1
> 801b5b90:       14a00027        bnez    a1,801b5c30 <ip_rcv+0xf0>
> 801b5b94:       00000000        nop
> 801b5b98:       122000d6        beqz    s1,801b5ef4 <ip_rcv+0x3b4>
> 801b5b9c:       02208021        move    s0,s1
> 801b5ba0:       8e250058        lw      a1,88(s1)
> ........
> ----------------------ip_rcv source code ---------------
> 
> int ip_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt, struct net_device *orig_dev)
> {
> 	struct iphdr *iph;
> 	u32 len;
> 
> 	/* When the interface is in promisc. mode, drop all the crap
> 	 * that it receives, do not try to analyse it.
> 	 */
> 	if (skb->pkt_type == PACKET_OTHERHOST)
> 		goto drop;
> 
> 	IP_INC_STATS_BH(IPSTATS_MIB_INRECEIVES);
> 
> 	if ((skb = skb_share_check(skb, GFP_ATOMIC)) == NULL) {
> 		IP_INC_STATS_BH(IPSTATS_MIB_INDISCARDS);
> 		goto out;
> 	}
> 
> 	if (!pskb_may_pull(skb, sizeof(struct iphdr)))
> 		goto inhdr_error;
> 
> 	iph = skb->nh.iph;
> 
> 
> 	if (iph->ihl < 5 || iph->version != 4)
> 		goto inhdr_error;
> 
> 	if (!pskb_may_pull(skb, iph->ihl*4))
> 		goto inhdr_error;
> 
> 	iph = skb->nh.iph;
> .............
> 
> 
> Thanks a lot .
> Best Regards.
> Peter Meng
> 
> 
> 
>       
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" 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.tux.org/lkml/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Ask a question related Assemble and C revert  within vmlinux ?
  2009-07-09 10:50 peter meng
@ 2009-07-09 11:35 ` Albert ARIBAUD
  2009-07-09 12:49 ` Jiri Olsa
  1 sibling, 0 replies; 4+ messages in thread
From: Albert ARIBAUD @ 2009-07-09 11:35 UTC (permalink / raw)
  To: peter meng; +Cc: linux-kernel

peter meng a écrit :
> Hi
> 
> I compile the linux kernel with mips .
> Is there any tools let the Assemble code correspond to C code ?
> I mean Assemble line correspond to C line .

Look up you C compiler's command line options. There should be several to 
generate listings, with either assembly or mixed assembly and C.

Or if your tool chain has the objdump utility, objdump also has options to 
disassemble, and possibly intermix source code lines.

Amicalement,
-- 
Albert.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Ask a question related Assemble and C revert  within vmlinux ?
@ 2009-07-09 10:50 peter meng
  2009-07-09 11:35 ` Albert ARIBAUD
  2009-07-09 12:49 ` Jiri Olsa
  0 siblings, 2 replies; 4+ messages in thread
From: peter meng @ 2009-07-09 10:50 UTC (permalink / raw)
  To: linux-kernel


Hi

I compile the linux kernel with mips .
Is there any tools let the Assemble code correspond to C code ?
I mean Assemble line correspond to C line .



----------------cut from objdump -S vmlinux ----------------------
801b5b40 <ip_rcv>:
801b5b40:       27bdffc0        addiu   sp,sp,-64
801b5b44:       afb00028        sw      s0,40(sp)
801b5b48:       afbf0038        sw      ra,56(sp)
801b5b4c:       afb30034        sw      s3,52(sp)
801b5b50:       afb20030        sw      s2,48(sp)
801b5b54:       afb1002c        sw      s1,44(sp)
801b5b58:       8c82006c        lw      v0,108(a0)
801b5b5c:       3c0300e0        lui     v1,0xe0
801b5b60:       3c050060        lui     a1,0x60
801b5b64:       00431024        and     v0,v0,v1
801b5b68:       10450022        beq     v0,a1,801b5bf4 <ip_rcv+0xb4>
801b5b6c:       00808021        move    s0,a0
801b5b70:       3c128029        lui     s2,0x8029
801b5b74:       8e42ef90        lw      v0,-4208(s2)
801b5b78:       00808821        move    s1,a0
801b5b7c:       8c430004        lw      v1,4(v0)
801b5b80:       24630001        addiu   v1,v1,1
801b5b84:       ac430004        sw      v1,4(v0)
801b5b88:       8c850078        lw      a1,120(a0)
801b5b8c:       38a50001        xori    a1,a1,0x1
801b5b90:       14a00027        bnez    a1,801b5c30 <ip_rcv+0xf0>
801b5b94:       00000000        nop
801b5b98:       122000d6        beqz    s1,801b5ef4 <ip_rcv+0x3b4>
801b5b9c:       02208021        move    s0,s1
801b5ba0:       8e250058        lw      a1,88(s1)
........
----------------------ip_rcv source code ---------------

int ip_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt, struct net_device *orig_dev)
{
	struct iphdr *iph;
	u32 len;

	/* When the interface is in promisc. mode, drop all the crap
	 * that it receives, do not try to analyse it.
	 */
	if (skb->pkt_type == PACKET_OTHERHOST)
		goto drop;

	IP_INC_STATS_BH(IPSTATS_MIB_INRECEIVES);

	if ((skb = skb_share_check(skb, GFP_ATOMIC)) == NULL) {
		IP_INC_STATS_BH(IPSTATS_MIB_INDISCARDS);
		goto out;
	}

	if (!pskb_may_pull(skb, sizeof(struct iphdr)))
		goto inhdr_error;

	iph = skb->nh.iph;


	if (iph->ihl < 5 || iph->version != 4)
		goto inhdr_error;

	if (!pskb_may_pull(skb, iph->ihl*4))
		goto inhdr_error;

	iph = skb->nh.iph;
.............


Thanks a lot .
Best Regards.
Peter Meng



      

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-07-10  4:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-07-10  4:45 Ask a question related Assemble and C revert within vmlinux ? peter meng
  -- strict thread matches above, loose matches on Subject: below --
2009-07-09 10:50 peter meng
2009-07-09 11:35 ` Albert ARIBAUD
2009-07-09 12:49 ` Jiri Olsa

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.