Re: Problem with fasm
- From: suchi_01 <spamtrap@xxxxxxxxxx>
- Date: Sun, 23 Mar 2008 22:00:36 -0700 (PDT)
Hi Frank,
Thanks for the reply. Will try it and let you know. This
is precisely what i want to do, but the problem is that the bootsector
code does not have an elf loader yet, so i don't know whether .text
part will be identified and put in the right place or not during boot
process
Suchindra Chandrahas
On Mar 22, 3:24 pm, Frank Kotler <spamt...@xxxxxxxxxx> wrote:
suchi_01 wrote:
Hi All,
There is a complicated issue here. I have downloaded
fasm source of a driver and want to integrate it to my kernel.
However, there is a problem:
1. If i call a FASM function 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 a NASM function 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 a global keyword or similar stuff in FASM?
"public", AFAIK. We need to tell Fasm a "format", too (in the source,
not on the command line like Nasm). As a test, I just "converted" a Nasm
demo I had to Fasm (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 think Fasm supports OMF. What format are
you using?
Best,
Frank
;---------------
format elf
public getvendor
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;
}
.
- Follow-Ups:
- Re: Problem with fasm
- From: Frank Kotler
- Re: Problem with fasm
- References:
- Problem with fasm
- From: suchi_01
- Re: Problem with fasm
- From: Frank Kotler
- Problem with fasm
- Prev by Date: Re: Is it possible to address more than 1MB in real-mode
- Next by Date: Re: Problem with fasm
- Previous by thread: Re: Problem with fasm
- Next by thread: Re: Problem with fasm
- Index(es):
Relevant Pages
|