flat assembler
Message board for the users of flat assembler.

Index > OS Construction > ELF, ELF64 and use32?

Author
Thread Post new topic Reply to topic
Artlav



Joined: 23 Dec 2004
Posts: 188
Location: Moscow, Russia
Artlav
I'm trying to get a 64bit kernel to be multiboot-compliant, with a bootstrap code to get it into long mode.

For that there is a crt0.o in fasm and the rest in HLL.
For 32 bit case there were no problems, but 64 bit case don't quite want to play nice.

It starts something like that:
Code:
format ELF64
section '.text' executable
;//###########################################################################//
;magic stuff to enable multi-boot compliance...
mb_magic:            dd 1BADB002h
mb_flags:           dd 3
mb_checksum:        dd 0-3-1BADB002h
;//###########################################################################//
use32
_start:
 cli
 lgdt   [gdt32_limit]
 lidt  [idt32_limit]
 jmp   next
    

But the use32 is apparently ignored, since lgdt gives a size error.

Meanwhile, if i use format ELF then the LD linker won't see it as valid, but it compiles ok, and use64 appears to be used.

So, is there any way to do this nicely?
32-bit & 64-bit-code o + HLL code o into one multiboot file.

Also, would GRUB read ELF64?
Post 08 Aug 2010, 16:29
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17671
Location: In your JS exploiting you and your system
revolution
If you would post some minimal code that can be compiled then you might have more luck with getting help for your problem.
Post 31 Aug 2010, 01:32
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.