×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

linux assembly

linux assembly

linux assembly

(OP)
Hi,

I am just learning assembly and I am trying to write in Linux.
Linux seems to use eax,ebx etc register while dos uses ax,bx etc. Whats the deal?

I don't get it. Linux-Assembly-HOWTO doesn't have much to say.
Do you have any idea where linux assembly tutorials are given ?

Is asm OS specific?

RE: linux assembly

The use of EAX, EBX, etc. is only possible on 32 bit processors (in the 80x86 family: starting with the 80386). Now each of the registers EAX, EBX, ECX and EDX can now be accessed in four ways (example for EAX):
1.  AL, the low 8 bits of register AX D0-D7 (data bits 0-7)
2.  AH, the high 8 bits of register AX D8-D15
3.  AX, the low 16 bits of register EAX D0-D15
4.  EAX, the full 32 bits D0-D32
Also the registers SP, BP, SI, DI, IP and Flags are expanded to, respectively, ESP, EBP, ESI, EDI, EIP and EFlags (newly added flags: VM, RF, NT, IOPL).
Also added: 2 (data) segment registers: FS and GS; 3 control registers: CR0, CR2 (Page fault linear address) and CR3 (Page directory base); 4 system address registers: GDTR, IDTR, TR and LDTR; 6 debug registers: DR0, DR1, DR2, DR3, DR6 and DR7; and 2 test registers: TR6 and TR7.
All these added registers are still available on 80486, Pentium and Pentium Pro (probably on PII and PIII too).

Regards,
Bert Vingerhoets
vingerhoetsbert@hotmail.com
http://www.geocities.com/thevhbcompany/
Don't worry what people think about you. They're too busy wondering what you think about them.

RE: linux assembly

I'm sorry, I missed the "learning" part, only the first half is relevant to you. Also ASM is hardware specific, but depending on the OS you use, you will be able or not to run some ASM compiler programs.

Regards,
Bert Vingerhoets
vingerhoetsbert@hotmail.com
http://www.geocities.com/thevhbcompany/
Don't worry what people think about you. They're too busy wondering what you think about them.

RE: linux assembly

(OP)
Ok, I am downloading the intel's 3 manuals. Will it contain all these things? Will that be helpful.

Starting assembly in linux - is it advisable ?

RE: linux assembly

I wouldn't know, I've used "The 80x86 Family: Design, Programming and Interfacing" by John Uffenbeck.
To your second question: I have no experience with Linux.

Regards,
Bert Vingerhoets
vingerhoetsbert@hotmail.com
http://www.geocities.com/thevhbcompany/
Don't worry what people think about you. They're too busy wondering what you think about them.

RE: linux assembly

The main thing that the manuals are good for is to use the architecture of the chip and look at the instruction set.  One thing, though, is that some of the instructions, espically on Intel chips, have undocumented side effects.  As for good docs, I haven't found any for GAS yet (the Gnu ASsembler), so please post it if you do.  One thing you can do to see some examples is to write a small c program, say it's called test.c, and then run:

gcc -S test.c

This will produce the assembler code for your source file.  It is in a file called test.s (or filename.s, depending on filename.c)  This can be used to see some examples, but will be tough to learn from.

Good Luck!

MWB

As always, I hope that helped!

Disclaimer:
Beware: Studies have shown that research causes cancer in lab rats.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close