large integer implicitly truncated to unsigned type

Programming, for all ages and all languages.
Post Reply
User avatar
DixiumOS
Member
Member
Posts: 84
Joined: Tue Jan 10, 2017 3:19 pm
Libera.chat IRC: NunoLava1998

large integer implicitly truncated to unsigned type

Post by DixiumOS »

I am trying to follow Bran's IDT tutorial (changing some things, of course).

However, i get a overflow error (trying to fit a value that is larger than possible).
How would i fix this overflow error?

Current code as of now is at DixiumOS-1 repo here.
Problem is located at interrupts/idt.c, function idt_install, at line

Code: Select all

idtp.limit = (sizeof (struct idt_entry) * 256) - 1;
"warning: large integer implicitly truncated to unsigned type [-Woverflow]"
(not so frequently updated) Code is at:

https://github.com/NunoLava1998/DixiumOS-1
Octocontrabass
Member
Member
Posts: 5513
Joined: Mon Mar 25, 2013 7:01 pm

Re: large integer implicitly truncated to unsigned type

Post by Octocontrabass »

What is the value you are trying to assign to idtp.limit?

What is the type of idtp.limit?

What is the range of possible values for that type?
User avatar
dozniak
Member
Member
Posts: 723
Joined: Thu Jul 12, 2012 7:29 am
Location: Tallinn, Estonia

Re: large integer implicitly truncated to unsigned type

Post by dozniak »

How did you manage to copypaste the code with mistakes?

I'm not really amazed, just tired by the SNR.
Learn to read.
User avatar
DixiumOS
Member
Member
Posts: 84
Joined: Tue Jan 10, 2017 3:19 pm
Libera.chat IRC: NunoLava1998

Re: large integer implicitly truncated to unsigned type

Post by DixiumOS »

dozniak wrote:How did you manage to copypaste the code with mistakes?

I'm not really amazed, just tired by the SNR.
Oops. Silly me.
That fixed the problem, thank you. :P

I need to fix my IDT code though. It triple faults the system for whatever reason.
(not so frequently updated) Code is at:

https://github.com/NunoLava1998/DixiumOS-1
User avatar
iansjack
Member
Member
Posts: 4685
Joined: Sat Mar 31, 2012 3:07 am
Location: Chichester, UK

Re: large integer implicitly truncated to unsigned type

Post by iansjack »

DixiumOS wrote: I need to fix my IDT code though. It triple faults the system for whatever reason.
'Twas ever thus.

So, fix it. Don't keep listing all of your mistakes; it just confirms people's opinion.
Octocontrabass
Member
Member
Posts: 5513
Joined: Mon Mar 25, 2013 7:01 pm

Re: large integer implicitly truncated to unsigned type

Post by Octocontrabass »

DixiumOS wrote:It triple faults the system for whatever reason.
Your function to install the ISRs calls the ISRs and places their return value to the IDT instead of placing the function pointer in the IDT.

But it never gets that far, because the first ISR it calls has IRET in inline assembly, which tries to use the stack frame as a return address.
Post Reply