Page 2 of 2

Re: How do i appropiately load the IDT?

Posted: Wed Dec 21, 2016 11:02 am
by JAAman
if the LIDT instruction was your only problem, why did you post about it instead of just looking it up in the manuals? volume 2 is the proper answer to any question about an instruction

Re: How do i appropiately load the IDT?

Posted: Thu Dec 22, 2016 1:45 am
by NunoLava1998
crunch wrote:Is your plan to just post about every single step in os development? Obviously you are not picking up on the fact that you MUST be able to read documentation and then be able to translate that into code.

There is no problem with asking questions. This stuff can be difficult to grasp. If you're getting stuck here, you're not going to make it much farther (without significant handholding) until you learn how to rtfm
So? I do rtfm sometimes.

And my IRQ1 handler? Made all by me. I just read documentation and... well, translated it into code.

Re: How do i appropiately load the IDT?

Posted: Thu Dec 22, 2016 1:49 am
by NunoLava1998
"IDTR(Limit) ← SRC[0:15];
IDTR(Base) ← SRC[16:47]; "

The thing is, how do i implement this?
I know i can implement the first with something like "char limit[16];", but i'm not sure how to do the second.

Re: How do i appropiately load the IDT?

Posted: Thu Dec 22, 2016 2:38 am
by Velko
NunoLava1998 wrote:"IDTR(Limit) ← SRC[0:15];
IDTR(Base) ← SRC[16:47]; "

The thing is, how do i implement this?
You have already implemented this. Function lidt() in your mainf.c, starting at line 104 does exactly that. (Assuming your Github DixiumOS repo is up to date).

Or did you copy the code from somewhere, without knowing what it is for? You have to quit that habit.

It is normal to look at other peoples code to see how things are done. Or even copy some, but you must always understand what it does.
Get inspired from it, play around, break it, fix it, break it again, but never copy blindly.

That being said, are you familiar with JamesM or Bran's kernel development tutorials?

Re: How do i appropiately load the IDT?

Posted: Thu Dec 22, 2016 3:17 am
by NunoLava1998
Velko wrote:
NunoLava1998 wrote:"IDTR(Limit) ← SRC[0:15];
IDTR(Base) ← SRC[16:47]; "

The thing is, how do i implement this?
You have already implemented this. Function lidt() in your mainf.c, starting at line 104 does exactly that. (Assuming your Github DixiumOS repo is up to date).

Or did you copy the code from somewhere, without knowing what it is for? You have to quit that habit.

It is normal to look at other peoples code to see how things are done. Or even copy some, but you must always understand what it does.
Get inspired from it, play around, break it, fix it, break it again, but never copy blindly.

That being said, are you familiar with JamesM or Bran's kernel development tutorials?
I meant how to make something like:

"char limit[16];
char base[16..47];"

Re: How do i appropiately load the IDT?

Posted: Thu Dec 22, 2016 3:30 am
by alexfru
NunoLava1998 wrote: I meant how to make something like:

"char limit[16];
char base[16..47];"
Learn C.

Re: How do i appropiately load the IDT?

Posted: Thu Dec 22, 2016 3:40 am
by Velko
NunoLava1998 wrote:I meant how to make something like:

"char limit[16];
char base[16..47];"
You did understand it wrong. (32-bit) LIDT loads a structure that is 48 bits long, not bytes. 16 bits for IDT's length, and then 32 - its address.

C structure:

Code: Select all

struct {
        uint16_t length;
        void*    base;
} __attribute__((packed))
is a way how to describe that.

Re: How do i appropiately load the IDT?

Posted: Thu Dec 22, 2016 5:31 am
by iansjack
NunoLava1998 wrote: I meant how to make something like:

"char limit[16];
char base[16..47];"
Why would you want to do that?