Im trying to write a kernel in c..im not using grub and i want my code to start at 0050:0000 in real mode. when i link should i use ld -Ttext 0x500 to specify 0050:0000?
thanks anyone....
OS kernel in C
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:OS kernel in C
LD is a 32 bits only linker, afaik. It will not let you assemble such programs.
What you need is rather something like exe2bin ...
What you need is rather something like exe2bin ...
Re:OS kernel in C
ld is a 32-bit linker, gcc is a 32-bit compiler, as is a 32-bit assembler. To write 16-bit C code you will need a completely different set of tools.
Re:OS kernel in C
hello,
i suggest you use nasm. it is a great assembler. If u ever need any help with loading or jumping to your kernel, come to #osdev @ irc.wyldryde.net. My name is xsism
Regards,
Mr. xsism
i suggest you use nasm. it is a great assembler. If u ever need any help with loading or jumping to your kernel, come to #osdev @ irc.wyldryde.net. My name is xsism
Regards,
Mr. xsism
Re:OS kernel in C
hello.
gcc compiler can generate 16 bit code.
you only add
asm(".code16gcc");
to your source file.
gcc compiler can generate 16 bit code.
you only add
asm(".code16gcc");
to your source file.
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:OS kernel in C
indeed, (and i'm surprised to learn it
but it will still generate 32 bits ELF/COFF object files that completely ignore the segmentation (thus only the TINY model is available for you) and it simply add "db 66 db 67" before instructions so that its 32bits code runs correctly. This definitely suxx and will produce *very* inefficient code.
do not use it ... really.
but it will still generate 32 bits ELF/COFF object files that completely ignore the segmentation (thus only the TINY model is available for you) and it simply add "db 66 db 67" before instructions so that its 32bits code runs correctly. This definitely suxx and will produce *very* inefficient code.
do not use it ... really.