[Prev][Next][Index][Thread]
How to write a Kernel Q3:
thanks :-)
source:
#include <oskit/machine/base_cpu.h>
#include <oskit/x86/base_gdt.h>
#include <oskit/x86/seg.h>
#include <oskit/x86/base_tss.h>
#include <oskit/x86/base_idt.h>
#include <oskit/x86/trap.h>
#include <oskit/x86/base_trap.h>
extern struct x86_desc base_gdt [GDTSZ];
extern struct x86_tss base_tss ;
extern struct x86_desc base_idt [IDTSZ]; /*IDTSZ = 256*/
extern struct cpu_info base_cpuid ; /* cpu info filled by base_cpu_init*/
extern struct gate_init_entry base_trap_inittab [];
main()
{
/*base_cpu_setup(void);*/ /* Can I have this rather than all init below?
*/
base_gdt_init(); /* init the default oskit GDTs*/
base_gdt_load(); /* load proper values of gdt*/
base_idt_load(); /* point all traps, hard & soft to our
table*/
base_trap_init();
base_tss_init();
base_tss_load();
printf("Hello World\n");
}
In the above code I just simple like to initialize all the oskit base structure. Are
there anyhting that I missed? Please modify the code for me.
Thanks
Jammi
Voon-Li Chung wrote:
> > 2. Is the IDT already initialize? How can I put my own traps like for example
> > Id like to create my own customized traps for divide overflow, memory
> > protection. etc.
> No it isnt. To do that, you need to execute the following functions:
> base_idt_load();
> base_trap_init();
> If you look at the flux documentation, the IDT structures flux provides is
> just an array of functions. After this call, they are all the default
> handlers, which tells you the state of the machine and the name of the
> trap, but if you make the appropriate entry point to your handler, in
> conjunction with flux's trap information structure, you can write your
> own.
>
> > 3. Can anyone show me how to initialize a call gate? Just one simple function
> > will do. :-)
> That isn't as easy as it sounds. It requires manipulation of the GDT (look
> at the flux documentation) and bitwise arithmetic. It would be better if
> you looked at the intel documentation relating to call gates. I have a
> copy at http://www.cs.uwa.edu.au/docs/intel/386-guide
> don't let the fact that its a 386 guide fool you. The major differences
> between pentiums and the 386 is the presence of an fpu and speed, that's
> all.
Ya I know that there are bits that I have to tweaks but what I means and my purpose
why I join the oskit mailing list is that I assume that oskit will do some work for
me about that bitwise manipulation. I'm not concern on how slow my system be later.
Its up to the oskit developer I guess to optimized their code but I trust them
anyway. Well I just want to handle my programming all in C or C++ which oskit offers.
:-). If there is a default that oskit provides me, I guess, Id be more happy to use
rather than use oskit and tweaks something inside it. I want also my kernel to be
totally upgradable so that next release of this kit will not do me much work but
instead just compile my kernel sweetly like a cake. :-)
Questions:
1.
=================================
To subscribe or unsubscribe, send mail with "subscribe" or "unsubscribe"
to oskit-users-request@flux.cs.utah.edu. The oskit-announce list is low
volume - if you want to subscribe, mail oskit-announce-request@flux.cs.utah.edu
Follow-Ups: