Subversion Repositories shark

Compare Revisions

Ignore whitespace Rev 3 → Rev 40

/shark/trunk/oslib/xlib/xsystab.c
23,9 → 23,8
 
#include <ll/i386/cons.h>
#include <ll/i386/mem.h>
#include <ll/math.h>
 
FILE(X - SysTab);
FILE(X-SysTab);
 
extern GATE IDT[256];
 
33,9 → 32,9
/* to fill a GATE structure & copy it into the Interrupt Descriptor */
/* Table or IDT; its phisical address is given by IDT_base */
 
void IDT_place(BYTE num, void (*handler) (void))
void IDT_place(BYTE num,void (*handler)(void))
{
DWORD offset = (DWORD) (handler);
DWORD offset = (DWORD)(handler);
IDT[num].sel = X_FLATCODE_SEL;
/* Set DPL = 3, to allow execution of the gate from any ring */
IDT[num].access = INT_GATE386 | 0x60;
49,7 → 48,7
/* When a descriptor is cleared using it will cause a SEGMENT FAULT */
/* to refer such descriptor */
 
void GDT_place(WORD sel, DWORD base, DWORD lim, BYTE acc, BYTE gran)
void GDT_place(WORD sel,DWORD base,DWORD lim,BYTE acc,BYTE gran)
{
union gdt_entry x;
/* This is declared in [wc32/gnu]\x0.[asm/s] */
60,8 → 59,8
x.d.base_hi = ((base & 0xFF000000) >> 24);
x.d.access = acc;
x.d.lim_lo = (lim & 0xFFFF);
x.d.gran = (gran | ((lim >> 16) & 0x0F) | 0x40);
memcpy(GDT_base + (sel & ~3), &x, sizeof(union gdt_entry));
x.d.gran = (gran | ((lim >> 16) & 0x0F) | 0x40);
memcpy(GDT_base+(sel & ~3),&x,sizeof(union gdt_entry));
}
 
/* This function is used to read & format the descriptor data */
69,14 → 68,14
/* a descriptor rather than reading,modifying & updating with */
/* this high level functions! */
 
DWORD GDT_read(WORD sel, DWORD * lim, BYTE * acc, BYTE * gran)
DWORD GDT_read(WORD sel,DWORD *lim,BYTE *acc,BYTE *gran)
{
union gdt_entry x;
/* This is declared in [wc32/gnu]\x0.[asm/s] */
extern LIN_ADDR GDT_base;
/*DWORD offset = appl2linear(&x); */
/*DWORD offset = appl2linear(&x);*/
DWORD base;
memcpy(&x, GDT_base + sel, sizeof(union gdt_entry));
memcpy(&x,GDT_base+sel,sizeof(union gdt_entry));
base = x.d.base_hi;
base <<= 8;
base |= x.d.base_med;
87,9 → 86,7
*lim <<= 16;
*lim |= x.d.lim_lo;
}
if (acc != NULL)
*acc = x.d.access;
if (gran != NULL)
*gran = x.d.gran & 0xF0;
return (base);
if (acc != NULL) *acc = x.d.access;
if (gran != NULL) *gran = x.d.gran & 0xF0;
return(base);
}