LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 03-15-2011, 05:27 AM   #1
roMoon
LQ Newbie
 
Registered: Mar 2011
Posts: 4

Rep: Reputation: 0
error: unknown register name '%eax' in 'asm'


An error occur when I compile my inline assemble code with a alpha/linux cross compiler.

code:
Code:
#define CPU_ID(cpu_iid)                   \
       __asm__ __volatile__ (             \
       "mov $0, %%eax\n\t"                \
       "mov %%eax, %0\n\t"                \
       :"=m"(cpu_iid)                     \
       :                                  \
       :"%eax"                            \
       );
error:
Quote:
error: unknown register name '%eax' in 'asm'
does anyone know how to solve this problem? thanks for help.
 
Old 03-15-2011, 10:21 AM   #2
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,292

Rep: Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322
the %.

eax is a register, I think. (Did very little x86 asm). %eax is not a register.
 
Old 03-15-2011, 12:18 PM   #3
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
Quote:
%eax is not a register
More specifically, "%eax" is not an ALPHA register - it's an x86 register.

In "as" assembler syntax (vs. "masm" assembler syntax).

This link might help:
http://www.alphalinux.org/wiki/index.php/Alpha_Assembly

PS:
The snippet in question is a macro that reads the CPU ID from an Intel/AMD x86 processor. As a workaround, perhaps you might just hard-code some dummy CPU ID for your Alpha port?

Last edited by paulsm4; 03-15-2011 at 12:20 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
error: asm/bitops.h: No such file or directory chronickut Linux - Newbie 3 10-04-2010 04:19 PM
[SOLVED] Why the expected =, ,, ;, asm or __attribute__ before typedef error? shawley Programming 8 02-02-2010 11:06 AM
unable to resolve compilation error;./List.c:5: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ amolgupta Programming 3 01-09-2009 10:09 AM
ASM x32 vs ASM x64 Tegramon Programming 3 02-27-2008 02:26 PM
SDL_mixer_MMX.c:16: error: PIC register `ebx' clobbered in `asm' BGuy891653 Linux - Software 0 12-12-2004 06:31 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:42 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration