OSDev.org

The Place to Start for Operating System Developers
It is currently Sat Jan 19, 2019 4:26 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Triple Fault when try to get Low Memory Map [SOLVED]
PostPosted: Fri Dec 28, 2018 1:06 pm 
Offline

Joined: Thu Dec 27, 2018 1:45 pm
Posts: 4
Hi,

I'm getting Triple Fault when trying to get Low Memory Map described in this wiki post on OSDev.
The section describe the code in assembler, but I wrote it in GCC asm inline, like this:

Code:
// Top of the file
__asm__(".code16gcc\n");
[...]
uint16_t __noinline SMAP_DetectLowMemory(void)
{
        uint16_t mem = 0;

        asm volatile
        (
                "clc\n\t"
                "int $0x12"
                : "=a"(mem)
        );

        return mem;
}

P.D: "__noinline" is a macro to "__attribute__((noinline))"

When I compile it, linked to my kernel and called it on kernel_main(), my system enter in triple fault. I dump the cpu_reset on qemu, but I'm begginer and I'm not realy sure how to read the dump and get on the root of the problem.
Here is the dump generated by qemu with the "-d cpu_reset" option.
P.D: I boot my system with -kernel option in qemu

How can I handle this? And how can I better read the dump?

ENV:
i686-elf-gcc 8.2.0
i686-elf-as 2.31.1
i686-elf-ld 2.31.1
qemu-system-i386 3.1.0


Last edited by moige on Fri Dec 28, 2018 4:38 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: Triple Fault when try to get Low Memory Map
PostPosted: Fri Dec 28, 2018 2:28 pm 
Offline
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 1412
The -kernel option in QEMU is multiboot-compatible. Your kernel is already running in protected mode, so you can't call BIOS interrupts. The multiboot structures provide all of the information you need, so you shouldn't be trying to call BIOS interrupts anyway.

You can find links to the multiboot specification here, including header files you can use to help parse the structures.


Top
 Profile  
 
 Post subject: Re: Triple Fault when try to get Low Memory Map
PostPosted: Fri Dec 28, 2018 4:29 pm 
Offline

Joined: Thu Dec 27, 2018 1:45 pm
Posts: 4
Octocontrabass wrote:
The -kernel option in QEMU is multiboot-compatible. Your kernel is already running in protected mode, so you can't call BIOS interrupts. The multiboot structures provide all of the information you need, so you shouldn't be trying to call BIOS interrupts anyway.

You can find links to the multiboot specification here, including header files you can use to help parse the structures.

Thanks! I didn't know that -kernel pass to protected mode. Or maybe I had to supposed it...


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: alberinfo, Bing [Bot], Google [Bot] and 12 guests


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 post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group