Hi
I'm following Bran's Kernel Development Tutorials.
I have done with the bare bone start up file in assembly, a linker script and a main.c file for basic functions, a batch file to compile and link.
Problem : When I run the batch file build.bat it shows the following assembler message:
main.c:49:6: warning: return type of 'main' is not 'int' [-Wmain]
/tmp/ccobm6mp.s: Assembler messages:
/tmp/ccobm6mp.s:121: Error: junk `%al' after register
/tmp/ccobm6mp.s:137: Error: junk `%dx' after register
Command that are there in build.bat are as following
$: nasm -f elf -o start.o start.asm
$: i586-elf-gcc -Wall -O -fstrength-reduce -fomit-frame-pointer -finline-functions -nostdinc -fno-builtin -I./include -c -o main.o main.c
$: i586-elf-ld -T link.ld -o kernel.bin start.o
Help with the error. Please.
I'm a trying the kernel development for the first time. And I know that there may be several flaws in the code. Please suggest what kind of improvement can be made on the same.
I'll be thankful for all the suggestions.
Assember error: junk `%dx' after register
Re: Assember error: junk `%dx' after register
Hi,
From the tutorial itself:And:
From your "main.c":
And:
The missing commas are what the assembler is complaining about. It's a bit like doing "foo(first second);" in C when you meant "foo(first, second);".
Cheers,
Brendan
You failed to cut & paste properly.DeepakRaj wrote:Problem : When I run the batch file build.bat it shows the following assembler message:
main.c:49:6: warning: return type of 'main' is not 'int' [-Wmain]
/tmp/ccobm6mp.s: Assembler messages:
/tmp/ccobm6mp.s:121: Error: junk `%al' after register
/tmp/ccobm6mp.s:137: Error: junk `%dx' after register
From the tutorial itself:
Code: Select all
__asm__ __volatile__ ("inb %1, %0" : "=a" (rv) : "dN" (_port));
Code: Select all
__asm__ __volatile__ ("outb %1, %0" : : "dN" (_port), "a" (_data));
Code: Select all
__asm__ __volatile__("inb %1 %0" : "=a" (res) : "Nd" (_port));
Code: Select all
__asm__ __volatile__("outb %1 %0" : : "Nd" (_port), "a" (_data));
Cheers,
Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
Re: Assember error: junk `%dx' after register
Thanks Brendan.Brendan wrote:Hi,
You failed to cut & paste properly.DeepakRaj wrote:Problem : When I run the batch file build.bat it shows the following assembler message:
main.c:49:6: warning: return type of 'main' is not 'int' [-Wmain]
/tmp/ccobm6mp.s: Assembler messages:
/tmp/ccobm6mp.s:121: Error: junk `%al' after register
/tmp/ccobm6mp.s:137: Error: junk `%dx' after register
From the tutorial itself:And:Code: Select all
__asm__ __volatile__ ("inb %1, %0" : "=a" (rv) : "dN" (_port));
From your "main.c":Code: Select all
__asm__ __volatile__ ("outb %1, %0" : : "dN" (_port), "a" (_data));
And:Code: Select all
__asm__ __volatile__("inb %1 %0" : "=a" (res) : "Nd" (_port));
The missing commas are what the assembler is complaining about. It's a bit like doing "foo(first second);" in C when you meant "foo(first, second);".Code: Select all
__asm__ __volatile__("outb %1 %0" : : "Nd" (_port), "a" (_data));
Cheers,
Brendan
I guessed it would be something silly like this. Actually I typed it rather than coping.
Thanks once again for the help.