_idle_task:
! This task is called when the system has nothing else to do. The HLT
! instruction puts the processor in a state where it draws minimum power.
- push halt
+ push _halt
call _level0 ! level0(halt)
pop eax
jmp _idle_task
-halt:
+_halt:
sti
hlt
cli
!
_level0:
mov eax, 4(esp)
- mov (_level0_func), eax
+ cmpb (_k_reenter), -1
+ jne direct
int LEVEL0_VECTOR
ret
+direct:
+ call eax
+ ret
+
!*===========================================================================*
!* read_flags *
#define HASPT(procptr) ((procptr)->p_seg.p_cr3 != 0)
FORWARD _PROTOTYPE( u32_t phys_get32, (vir_bytes v) );
-FORWARD _PROTOTYPE( void set_cr3, (void) );
FORWARD _PROTOTYPE( void vm_enable_paging, (void) );
PRIVATE u32_t vm_cr3; /* temp arg to level0() func */
+PRIVATE void set_cr3()
+{
+ write_cr3(vm_cr3);
+}
+
PUBLIC void vm_set_cr3(struct proc *newptproc)
{
int u = 0;
if(!intr_disabled()) { lock; u = 1; }
vm_cr3= newptproc->p_seg.p_cr3;
if(vm_cr3) {
- vmassert(intr_disabled());
level0(set_cr3);
- vmassert(intr_disabled());
ptproc = newptproc;
- vmassert(intr_disabled());
}
if(u) { unlock; }
}
-PRIVATE void set_cr3()
-{
- write_cr3(vm_cr3);
-}
-
char *cr0_str(u32_t e)
{
static char str[80];
!* level0_call *
!*===========================================================================*
_level0_call:
+! which level0 function to call was passed here by putting it in eax, so
+! we get that from the saved state.
call save
- jmp (_level0_func)
+ mov eax, (_proc_ptr)
+ mov eax, AXREG(eax)
+ jmp eax
!*===========================================================================*
!* data *
_PROTOTYPE( void phys_insw, (U16_t port, phys_bytes buf, size_t count) );
_PROTOTYPE( void phys_outsb, (U16_t port, phys_bytes buf, size_t count) );
_PROTOTYPE( void phys_outsw, (U16_t port, phys_bytes buf, size_t count) );
-_PROTOTYPE( void i386_invlpg_level0, (void) );
_PROTOTYPE( int _memcpy_k, (void *dst, void *src, size_t n) );
_PROTOTYPE( int _memcpy_k_fault, (void) );
_PROTOTYPE( u32_t read_cr3, (void) );
extern char *t_stack[]; /* task stack space */
extern struct segdesc_s gdt[]; /* global descriptor table */
-EXTERN _PROTOTYPE( void (*level0_func), (void) );
-
#endif /* GLO_H */