Page 2 of 2

Re: Exceptions crash the system

Posted: Mon Aug 17, 2020 10:58 am
by iansjack
The value of eax was 0x258. It's possible that that's a valid selector, but unlikely.

Re: Exceptions crash the system

Posted: Mon Aug 17, 2020 11:04 am
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.

Re: Exceptions crash the system

Posted: Mon Aug 17, 2020 11:14 pm
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.

Re: Exceptions crash the system

Posted: Tue Aug 18, 2020 10:10 am
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!