[Prev][Next][Index][Thread]
Re: How to write a Kernel Q2
> From: "Joel M. Damaso" <jmdamaso@bhpi.com.ph>
> Subject: Re: How to write a Kernel Q2
>
> > main()
> > {
> > printf("Hello World");
> > }
> >
>
> Questions:
>
> 1. So the program above during its execution is already in protected
> mode?
Remembering that we are talking about the x86 architecture, yes. By
the time you get to the main program, the processor has been properly
initialized, and is running in protected, flat, 32bit mode.
> 2. Is the IDT already initialize?
Yes, the IDT has been initialized. See section 10.7.4 (base_idt) of
the oskit manual.
> 2. How can I put my own traps like for example Id like to create my
> own customized traps for divide overflow, memory protection. etc.
See section 10.8 of the oskit manual. Specifically, section 10.8.4
describes the high-level handler array called base_trap_handlers,
which you can use to define your own trap handlers (written in C).
> 3. Can anyone show me how to initialize a call gate? Just one simple
> function will do. :-)
There are no examples in the oskit that use call gates, but you can
take a look at unsupported/redzone.c, which shows how to install a
task gate. The concepts are similar.
> 4. How can I find the starting free memory if the program above is
> in protected mode and the model is flat. Also with the max
> menory. Does oskit have any function to get those info?
See the discussion in section 10.11, and phys_mem_max in section
10.11.2. The notion of "starting free memory" is a little harder to
address. Free memory is managed and allocated using the LMM module
(Section 16). By the time you get to the main program, there is no
longer a "next free address" concept, but only a way to allocate
memory from the free pool using higher level functions like malloc and
lmm_alloc.
Lbs
---------------------------------------------------------------------------
Leigh B. Stoller Computer Science - Flux Research Group
stoller@cs.utah.edu University of Utah
http://www.cs.utah.edu/~stoller Salt Lake City, Utah 84112
Voice: (813) 899-9296 FAX: (801) 585-3743
---------------------------------------------------------------------------
=================================
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: