Active Topics

 


Reply
Thread Tools
Posts: 7 | Thanked: 0 times | Joined on Jun 2010
#1
Hello, I bought this bookand went without reading it for a while. But recently, I started reading it again and wished to use it to practice on my N810 Wimax. Then, I realized that the book strictly covers the x86 architecture i.e. the assembly instructions outputted from objdump and gdb are assembly from the x86 architecture and therefore the arm architecture assembly shown on my n810 doesnt make sense to me since im used to x86.

So my question is: is there some way that the assembly can be outputted as x86 instructions? I do realize that what I'm asking is probably impossible, so a follow-up question would be: What would be a good way to "migrate" from x86 to arm assembly?

Any help is appreciated!
 
Posts: 1,048 | Thanked: 1,127 times | Joined on Jan 2010 @ Amsterdam
#2
As far as I know to output asm code written for one architecture can not be outputted as code for another architecture. Thereīs a reason why we have to declare the target architecture at the beginning of each piece of code written.

That being said, I have bookmarked some sites I found, just last week, with information on asm for arm7. I donīt have access to that machine right now, but tomorrow I should be able to post them. Provided youīre interested and it is what you asked for.

Either way, happy to see someoe with an interest in asm!
 

The Following 3 Users Say Thank You to anthonie For This Useful Post:
Posts: 7 | Thanked: 0 times | Joined on Jun 2010
#3
Thanks for the info and yes im very interested in asm. I really like seeing the lower-level instructions and understanding the logical flow of the program and, although I do love if(){ do this } loops, I, being a math and logic oriented person, love seeing how the branches are performed in assembly and i really love using gdb
 
Posts: 1,101 | Thanked: 1,184 times | Joined on Aug 2008 @ Spain
#4
Google search, second result: http://www.coranac.com/tonc/text/asm.htm
 

The Following User Says Thank You to maacruz For This Useful Post:
Posts: 7 | Thanked: 0 times | Joined on Jun 2010
#5
Originally Posted by maacruz View Post
Google search, second result: http://www.coranac.com/tonc/text/asm.htm
Thanks for the link. Definitely a great start!
 
Posts: 1,048 | Thanked: 1,127 times | Joined on Jan 2010 @ Amsterdam
#6
Originally Posted by maacruz View Post
Google search, second result: http://www.coranac.com/tonc/text/asm.htm
Thatīs one! Cheers. The links to the other ones I bookmarked are mentioned here as well.


I seem to get different results when I google from my n900...
 
Posts: 1,048 | Thanked: 1,127 times | Joined on Jan 2010 @ Amsterdam
#7
 
Posts: 7 | Thanked: 0 times | Joined on Jun 2010
#8
Thank you for all the resources

After reading through some of these documents, I realize it will take some time to learn arm assembly, so could someone possibly give me a "leg up" so to speak? I've attached the source code for a C program and the output of gdb and I would like if someone could help me understand the logical flow of the program. Like if you could step me through the program and explain each step?
 
Posts: 7 | Thanked: 0 times | Joined on Jun 2010
#9
Thank you for all the resources

After reading through some of these documents, I realize it will take some time to learn arm assembly, so could someone possibly give me a "leg up" so to speak? Here is the source code for a C program and the output of gdb and I would like if someone could help me understand the logical flow of the program. Like if you could step me through the programs disassembly and explain each step?

Main.c:
Code:
#include <stdio.h>
int main()

{
  
   printf("Hello, world!\n");

   return 0;

}
GDB output:
Code:
(gdb) break main
Breakpoint 1 at 0x838c: file main.c, line 5.
(gdb) run
Starting program: /home/user/a.out 

Breakpoint 1, main () at main.c:5
5	  printf("Hello, world!\n");
(gdb) disassemble main
Dump of assembler code for function main:
0x00008380 <main+0>:	mov	r12, sp
0x00008384 <main+4>:	push	{r11, r12, lr, pc}
0x00008388 <main+8>:	sub	r11, r12, #4	; 0x4
0x0000838c <main+12>:	ldr	r0, [pc, #8]	; 0x839c <main+28>
0x00008390 <main+16>:	bl	0x82cc <printf>
0x00008394 <main+20>:	mov	r0, #0	; 0x0
0x00008398 <main+24>:	ldm	sp, {r11, sp, pc}
0x0000839c <main+28>:	andeq	r8, r0, r8, lsr #8
End of assembler dump.
(gdb) x/s 0x8428
0x8428:	 "Hello, world!\n"
My main problem with understanding the disassembly is that my last command reveals the "Hello, world!\n" string at the address 0x00008428, yet I see nowhere in the programs disassembly where it points to this address to printf() it?

Again, any help is appreciated!
 
Posts: 1,101 | Thanked: 1,184 times | Joined on Aug 2008 @ Spain
#10
Just read carefully again the section about inmediate values in the link I provided. I won't spare you the pleasure of discovering how it is right under your nose.
 

The Following User Says Thank You to maacruz For This Useful Post:
Reply


 
Forum Jump


All times are GMT. The time now is 21:40.