question

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.
Post Reply
Grinjander

question

Post by Grinjander »

Hi,

I know it's a stupid question, but i don't know how can i get an address of this struct:

int off1;
int off2;

I have an address ( a pointer ) splited in this two integers. And i'd like to kwon the whole address. Can anyone helpme please.

I'll use it to get my IDT address.
Tim

Re:question

Post by Tim »

If you have a structure like this:

Code: Select all

struct some_structure
{
    int off1;
    int off2;
};

some_structure s;
...then you can get the address of the start of the structure using [tt]&s[/tt].
Grinjander

Re:question

Post by Grinjander »

Hi Tim.

No, my struct is an IDT entry. So the off1 and aff2 are separated by two integers.

That's what i don't know how to do, get the whole address when they are separated.
Tim

Re:question

Post by Tim »

OK, then you can't. You will need to do bit manipulation to separate the 32 bits into the relevant fields.
Grinjander

Re:question

Post by Grinjander »

Ok,

Thanks Tim. But i can't imagine how can i do this. Can you put me an example please? Or any web or code... I've tried to make very things with negetive results.

Thanks
Tim

Re:question

Post by Tim »

This is basic C language stuff. You should go and read up on the relevant parts of the C language, then come back and try this.
GRinjander

Re:question

Post by GRinjander »

I only ask you an example, i try to serach it in google but i don't found anything, before post this here.
Tim

Re:question

Post by Tim »

I believe that you should be able to program well in your chosen language before starting OS development. OS development is difficult enough without having to learn programming at the same time.

If you aren't already a capable programmer, I recommend that you go and learn programming before you start on an OS project.
Post Reply