Write to 0xB8000 does't work
Re: Write to 0xB8000 does't work
Oup sorry i would said 4kb. Ok if i understand, ALIGN 4096 it a good think only if i use the paging system in pMode. If i dontuse it i can use a différent number and more that number is smal better is the memory speed. When I said ELF is the same as PE I would say if ELF is a executable as PE and not if ELF is 100% like PE. And if I was under Window, canI use ELF to build my kernel ?
- gzaloprgm
- Member
- Posts: 141
- Joined: Sun Sep 23, 2007 4:53 pm
- Location: Buenos Aires, Argentina
- Contact:
Re: Write to 0xB8000 does't work
You can just eliminate the align line if you don't plan using paging / mapping kernel sections as RO, etc. If you delete it it wont be faster, the kernel will be smaller (in size).spiner900 wrote:If i dontuse it i can use a différent number and more that number is smal better is the memory speed.
ELF in a kernel is only useful if you are using a bootloader which supports it (ie: GRUB) or when you want your OS to load applications, in which you can compile them as ELF and load them.When I said ELF is the same as PE I would say if ELF is a executable as PE and not if ELF is 100% like PE. And if I was under Window, canI use ELF to build my kernel ?
If you want to use ELF to build your kernel, you will probably need to make a cross-compiler (Check the wiki for more info).
Cheers,
gzaloprgm
Visit https://gzalo.com : my web site with electronic circuits, articles, schematics, pcb, calculators, and other things related to electronics.
Re: Write to 0xB8000 does't work
Ok but now I want my kernel in a plain binary file, but i have to use ELF object to get it in 32 bit. Is there a other way ?
- gzaloprgm
- Member
- Posts: 141
- Joined: Sun Sep 23, 2007 4:53 pm
- Location: Buenos Aires, Argentina
- Contact:
Re: Write to 0xB8000 does't work
Yes, you can try compiling as a 32 bit COFF and then using a tool such as objdump to convert it to a plain binary file.
Visit https://gzalo.com : my web site with electronic circuits, articles, schematics, pcb, calculators, and other things related to electronics.
Re: Write to 0xB8000 does't work
ok thanks !
-
- Member
- Posts: 524
- Joined: Sun Nov 09, 2008 2:55 am
- Location: Pennsylvania, USA
Re: Write to 0xB8000 does't work
Or you could take the normal elf32 and use objcopy. And if I remember correctly, COFF is a relocatable object format and not a finished excecutable format.gzaloprgm wrote:Yes, you can try compiling as a 32 bit COFF and then using a tool such as objdump to convert it to a plain binary file.
Smaller isn't better, more aligned is better. Accessing a multibyte variable is faster on boundaries evenly divisible by the size of the value. So 32-bit variables should be aligned to 4 bytes, 64-bit to 8 bytes, 128-bit to 16, etc. I said 16 because thats typically the biggest data size you will see.If i dontuse it i can use a différent number and more that number is smal better is the memory speed.
Re: Write to 0xB8000 does't work
I really don't see what's wrong with letting LD do the conversion to a flat binary for you. Something like the following should work fine, and I find it just as easy (if not easier, since it requires less steps) than using objcopy.JohnnyTheDon wrote:Or you could take the normal elf32 and use objcopy. And if I remember correctly, COFF is a relocatable object format and not a finished excecutable format.gzaloprgm wrote:Yes, you can try compiling as a 32 bit COFF and then using a tool such as objdump to convert it to a plain binary file.
Code: Select all
ld --oformat binary -Ttext 0x0 -o kernel.bin kernel.o startup.o ...
Re: Write to 0xB8000 does't work
Only question I have is why one would want a plain binary kernel anyways. I do not see any benefit of it.
OS Development Series | Wiki | os | ncc
char c[2]={"\x90\xC3"};int main(){void(*f)()=(void(__cdecl*)(void))(void*)&c;f();}
char c[2]={"\x90\xC3"};int main(){void(*f)()=(void(__cdecl*)(void))(void*)&c;f();}
- Combuster
- Member
- Posts: 9301
- Joined: Wed Oct 18, 2006 3:45 am
- Libera.chat IRC: [com]buster
- Location: On the balcony, where I can actually keep 1½m distance
- Contact:
Re: Write to 0xB8000 does't work
Much easier to load by a custom bootloaderneon wrote:Only question I have is why one would want a plain binary kernel anyways. I do not see any benefit of it.
Re: Write to 0xB8000 does't work
True. Easier is not always better though.Much easier to load by a custom bootloader
OS Development Series | Wiki | os | ncc
char c[2]={"\x90\xC3"};int main(){void(*f)()=(void(__cdecl*)(void))(void*)&c;f();}
char c[2]={"\x90\xC3"};int main(){void(*f)()=(void(__cdecl*)(void))(void*)&c;f();}