OSDev.org

The Place to Start for Operating System Developers
It is currently Fri Apr 19, 2024 8:07 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: synchronize NASM and C Code
PostPosted: Fri Mar 01, 2002 6:48 am 
Hi, I'm designing an OS using NASM and C code.
Sometimes I had trouble with "synchronisation" between C structures and NASM offsets.

In order to avoid this problem, I use a header file which is commun between C and ASM files.

Because C is different than NASM, the layout of the header file is specific in order to work for for both compilers.

Here is the structure of the file :

; /* Comment for both C and NASM

PLACE YOUR ASM CODE HERE

%undef __TAG_TO_EXCLUDE_C_CODE_FROM_NASM__
%ifdef __TAG_TO_EXCLUDE_C_CODE_FROM_NASM__
; End of the comment */

PLACE YOUR C CODE HERE

; /*
%endif
; */


I know this file won't avoid problem because NASM Code is not "linked" to C Code, but because everything is in a single file, you can easily check for synchronisation.

Perhaps there is other way to do the same thing, but I think this code could be helpful for other OS designer. It has been tested with NASM and GCC.

Roswell

PS : It is unuseful to tell me that you can include ASM code in C file with GCC because I want to use NASM.


Top
  
 
 Post subject: Re: synchronize NASM and C Code
PostPosted: Mon Mar 04, 2002 1:43 am 
That's pretty cool! :) I'll remember that...


Top
  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Bing [Bot], SemrushBot [Bot] and 208 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