Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Assembly x86 > Re: Problem wit...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 7 of 8 Topic 4583 of 4729
Post > Topic >>

Re: Problem with fasm

by suchi_01 <spamtrap@[EMAIL PROTECTED] > Mar 24, 2008 at 04:19 AM

oops! worked fine. Sorry i forgot another fasm file where i had to
insert the same. Sorry for the confusion. What you say is right

On Mar 24, 10:52 am, suchi_01  <spamt...@[EMAIL PROTECTED]
> wrote:
> Hi Frank,
>             I am sorry i was not clear about the environment. The code
> (assembly language function) is called during boot time by a
> bootsector code (after enabling protected mode). I am successful in
> calling the function but it does not return back to the C code back
> (ie., next line after the call in C Code). At boot time there is no
> elf loader and it is difficult to point it to where it has to return.
> Mysteriously, using global in nasm does the stuff!
>
> Suchindra Chandrahas
>
> On Mar 22, 3:24 pm, Frank Kotler  <spamt...@[EMAIL PROTECTED]
> wrote:
>
> > suchi_01 wrote:
> > > Hi All,
> > >                   There is a complicated issue here. I have
downloaded
> > >fasmsource of a driver and want to integrate it to my kernel.
> > > However, there is a problem:
>
> > > 1. If i call aFASMfunction from within C code (kernel), it is not
> > > able to return back to the next line in C Code
>
> > What *does* it do?
>
> > > 2. If i call aNASMfunction from within C Code, it works properly (it
> > > returns back to next line in C Code)
>
> > > Here are the code snippets:
>
> > >NASM:
>
> > >global<func name>
>
> > > <func name>:
> > >              ret
>
> > >FASM:
>
> > >public<func name>
>
> > > <func name>:
> > >           ret
>
> > > Is there aglobalkeyword or similar stuff inFASM?
>
> > "public", AFAIK. We need to tellFasma "format", too (in the source,
> > not on the command line likeNasm). As a test, I just "converted" aNasm
> > demo I had toFasm(just added "format elf", changed "global" to
> > "public" and fixed up the section declaration). Worked fine. The only
> > issue I can see is that I don't thinkFasmsup****ts OMF. What format are
> > you using?
>
> > Best,
> > Frank
>
> > ;---------------
> > format elf
>
> > publicgetvendor
>
> > section ".text" executable
> > getvendor:
> >      pusha
> >      xor eax, eax
> >      cpuid
> >      mov eax, [esp + 36]
> >      mov [eax], ebx
> >      mov [eax + 4], edx
> >      mov [eax + 8], ecx
> >      mov byte [eax + 12], 0
> >      popa
> >      xor eax, eax
> >      ret
> > ;-----------------
>
> > And the C caller...
>
> > #include <stdio.h>
>
> > void getvendor(char *vendorbuf);
>
> > int main(void)
> >   {char vendorbuf[13];
> >    getvendor(vendorbuf);
>
> >    puts(vendorbuf);
> >    return 0;
> >   }
 




 8 Posts in Topic:
Problem with fasm
suchi_01 <spamtrap@[E  2008-03-22 01:18:36 
Re: Problem with fasm
Frank Kotler <spamtra  2008-03-22 10:24:31 
Re: Problem with fasm
suchi_01 <spamtrap@[E  2008-03-23 22:00:36 
Re: Problem with fasm
Frank Kotler <spamtra  2008-03-24 07:10:39 
Re: Problem with fasm
suchi_01 <spamtrap@[E  2008-03-23 22:52:50 
Re: Problem with fasm
Frank Kotler <spamtra  2008-03-24 11:41:15 
Re: Problem with fasm
suchi_01 <spamtrap@[E  2008-03-24 04:19:06 
Re: Problem with fasm
suchi_01 <spamtrap@[E  2008-03-24 00:54:37 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Jul 25 21:02:20 CDT 2008.