Exceptions crash the system

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
User avatar
iansjack
Member
Member
Posts: 4703
Joined: Sat Mar 31, 2012 3:07 am
Location: Chichester, UK

Re: Exceptions crash the system

Post by iansjack »

The value of eax was 0x258. It's possible that that's a valid selector, but unlikely.
User avatar
mrjbom
Member
Member
Posts: 317
Joined: Sun Jul 21, 2019 7:34 am

Re: Exceptions crash the system

Post by mrjbom »

iansjack wrote:The value of eax was 0x258. It's possible that that's a valid selector, but unlikely.
I don't know exactly what you're talking about.
But in the previous message I wrote that lgdt writes the wrong address in gdt.
Octocontrabass
Member
Member
Posts: 5572
Joined: Mon Mar 25, 2013 7:01 pm

Re: Exceptions crash the system

Post by Octocontrabass »

EAX contains the correct value, but does the memory at that address contain the correct values?

You may also want to read the section titled "Aggregates and Unions" in the System V ABI Intel386 Architecture Processor Supplement.
User avatar
mrjbom
Member
Member
Posts: 317
Joined: Sun Jul 21, 2019 7:34 am

Re: Exceptions crash the system

Post by mrjbom »

Octocontrabass wrote:EAX contains the correct value, but does the memory at that address contain the correct values?

You may also want to read the section titled "Aggregates and Unions" in the System V ABI Intel386 Architecture Processor Supplement.
Your message made me think that the data is not in the right order, so I added __attribute__((packed)) to the gdt_ptr structure and everything worked as it should.

Thank you all for your help!
Post Reply