OSDev.org

The Place to Start for Operating System Developers
It is currently Mon May 06, 2024 2:00 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: Inline ASM troubles... [SOLVED]
PostPosted: Sat Apr 07, 2007 10:40 pm 
Offline
Member
Member

Joined: Sun Jan 14, 2007 9:15 pm
Posts: 2566
Location: Sydney, Australia (I come from a land down under!)
I have finally got my OS working again :D

Now I'm working on the stdlib for developers, and I've already run into a problem.

I'm trying this for my putc function:
Code:
__asm__ __volatile__ ( "movb %0,%edx" : : "d" ( c ) );
__asm__ __volatile__ ( "movd $0x1,%eax" );
__asm__ __volatile__ ( "int $0x15" );


This is the syscall my operating system supports to handle the same thing as 'putc' in kernel-space. EDX is meant to hold the character.

GCC complains with this error message:
Code:
putc_stdlib.c:5: error: invalid 'asm': operand number missing after %-letter


Edit: fixed it:
Code:
__asm__ __volatile__ ( "movb %0,%%dl" : : "d" ( c ) );
__asm__ __volatile__ ( "movb $0x1,%al" );
__asm__ __volatile__ ( "int $0x15" );


EDIT: 4 years later... wow :)
Check out the inline assembly examples for a much better way to do this kind of thing.

Also, the actual problem is in "mov %0, %dl", which should be "mov %0, %%dl" in this context.

_________________
Pedigree | GitHub | Twitter | LinkedIn


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Amazonbot [bot] and 12 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group