LinuxQuestions.org
Visit Jeremy's Blog.
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 08-06-2004, 11:05 AM   #1
tjt
LQ Newbie
 
Registered: Jun 2004
Posts: 9

Rep: Reputation: 0
Inline Assembly Question


Here is what I have written:

static DWORD lvalue;

asm volatile (
"inl %%dx, %%eax\n\t"
: "=a" (lvalue)
: "d" (port)
: "memory"
);

But when I step through with gdb I always see that eax and lvalue equal 0xffff instead of 0xffffffff. Why aren't they showing up as DWORDs instead of WORDs?
 
Old 08-07-2004, 11:18 PM   #2
tuxfood
Member
 
Registered: Aug 2003
Location: kerala , India
Distribution: RH9 , FC1 ,
Posts: 141

Rep: Reputation: 15
hi...

with the knowlegde that i have abt assembly..isn't eax supposed to be a 32 bit reg.. (0xffff -----> takes 32 bits)

so maybe that's the reason

isn't it????

tuxfood
 
Old 08-07-2004, 11:50 PM   #3
frob23
Senior Member
 
Registered: Jan 2004
Location: Roughly 29.467N / 81.206W
Distribution: OpenBSD, Debian, FreeBSD
Posts: 1,450

Rep: Reputation: 48
0xffff takes 16 bits (0b1111111111111111) not 32. And eax should be 32 bits long.

Just a thought but dx is only 16 bits. Ugh, too bad most of my assembly knowledge comes from when I was still using DOS.
 
Old 08-08-2004, 04:38 AM   #4
jinksys
Member
 
Registered: Aug 2003
Location: 63123
Distribution: OpenSuSE/Ubuntu
Posts: 419

Rep: Reputation: 35
Only thing I could think would be wrong is the static DWORD lvalue; code.
Are you sure DWORD is actually a double word? Can you post the code
that typedef's it?
 
  


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
inline assembly in gcc gursev Programming 2 03-04-2005 02:17 AM
problems with gcc inline assembly using xmm registers Y0jiMb0 Programming 3 12-05-2004 02:59 PM
puzzle about g++ compile options for inline assembly program markbeth Programming 2 09-20-2004 04:30 AM
undefined reference to ... when using inline assembly in C Annie0716 Programming 3 08-01-2004 12:50 AM
subrouine_call in gcc inline assembly sakeeb Programming 4 08-15-2002 10:22 PM

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

All times are GMT -5. The time now is 08:55 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