mirror of
https://github.com/Zeal-Operating-System/ZealOS.git
synced 2025-04-18 05:38:36 +01:00
InvlPg -> InvalidatePage
remove old real-mode code Clean up some debug functions
This commit is contained in:
parent
fcd1560d88
commit
a8c0bc9903
11 changed files with 216 additions and 277 deletions
src
Binary file not shown.
Binary file not shown.
|
@ -33,4 +33,4 @@ U0 StartUpTasks()
|
|||
|
||||
StartUpTasks;
|
||||
|
||||
"\nZenithOS V %5.3f\t%D %T\n\n",sys_os_version,sys_compile_time,sys_compile_time;
|
||||
"\nZenithOS V %5.2f\t%D %T\n\n",sys_os_version,sys_compile_time,sys_compile_time;
|
||||
|
|
BIN
src/Kernel.BIN.C
BIN
src/Kernel.BIN.C
Binary file not shown.
|
@ -1,44 +1,30 @@
|
|||
Bool CheckPtr(U8 *ptr)
|
||||
{//Check if addr is valid ptr.
|
||||
if (mem_heap_base<=ptr<=mem_mapped_space) {
|
||||
if (*MemPageTable(ptr)&1)
|
||||
return TRUE;
|
||||
else
|
||||
return FALSE;
|
||||
} else if (ptr<mem_boot_base)
|
||||
return FALSE;
|
||||
else if (ptr<VGAM_GRAPHICS)
|
||||
return TRUE;
|
||||
if (mem_heap_base <= ptr <= mem_mapped_space)
|
||||
return *MemPageTable(ptr) & 1;
|
||||
else
|
||||
return FALSE;
|
||||
return mem_boot_base < ptr < VGAM_GRAPHICS;
|
||||
}
|
||||
|
||||
Bool CheckCodePtr(U8 *ptr)
|
||||
{//Check if addr is valid code addr.
|
||||
if (mem_heap_base<=ptr<=mem_heap_limit) {
|
||||
if (*MemPageTable(ptr)&1)
|
||||
return TRUE;
|
||||
else
|
||||
return FALSE;
|
||||
} else if (ptr<mem_boot_base)
|
||||
return FALSE;
|
||||
else if (ptr<VGAM_GRAPHICS)
|
||||
return TRUE;
|
||||
if (mem_heap_base <= ptr <= mem_heap_limit)
|
||||
return *MemPageTable(ptr) & 1;
|
||||
else
|
||||
return FALSE;
|
||||
return mem_boot_base < ptr < VGAM_GRAPHICS;
|
||||
}
|
||||
|
||||
Bool CheckOnStack(U8 *ptr,CTask *task=NULL)
|
||||
{//Check if addr is valid stack addr.
|
||||
Bool res=FALSE;
|
||||
Bool res = FALSE;
|
||||
PUSHFD
|
||||
CLI
|
||||
if (task) {
|
||||
if (&task->stack->stack_base<=ptr<=
|
||||
(&task->stack->stack_base)(U8 *)+task->stack->stack_size)
|
||||
if(task) {
|
||||
if (&task->stack->stack_base <= ptr <= (&task->stack->stack_base)(U8 *) + task->stack->stack_size)
|
||||
res=TRUE;
|
||||
} else if (mem_heap_base<=ptr<=mem_heap_limit)
|
||||
res=TRUE;
|
||||
}
|
||||
else if (mem_heap_base <= ptr <= mem_heap_limit)
|
||||
res = TRUE;
|
||||
POPFD
|
||||
return res;
|
||||
}
|
||||
|
@ -46,13 +32,14 @@ Bool CheckOnStack(U8 *ptr,CTask *task=NULL)
|
|||
I64 UnusedStack(CTask *task=NULL)
|
||||
{//Count of usused bytes in task's stack.
|
||||
I64 res;
|
||||
if (!task) task=Fs;
|
||||
if (!task)
|
||||
task=Fs;
|
||||
PUSHFD
|
||||
CLI
|
||||
if (task==Fs)
|
||||
res=GetRSP()(U8 *)-(&task->stack->stack_base)(U8 *);
|
||||
if (task == Fs)
|
||||
res = GetRSP()(U8 *) - (&task->stack->stack_base)(U8 *);
|
||||
else
|
||||
res=task->rsp(U8 *)-(&task->stack->stack_base)(U8 *);
|
||||
res = task->rsp(U8 *) - (&task->stack->stack_base)(U8 *);
|
||||
POPFD
|
||||
return res;
|
||||
}
|
||||
|
@ -286,7 +273,7 @@ I64 *TaskRegAddr(CTask *task,I64 reg_num)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
#define RAWDR_COL (text.cols-40)
|
||||
#define RAWDR_COL (text.cols-40)
|
||||
|
||||
U0 RawDr(CTask *task=NULL)
|
||||
{
|
||||
|
|
|
@ -211,15 +211,7 @@ GET_IP: POP BX
|
|||
INT 0x10
|
||||
CMP AX, 0x004F
|
||||
JNE @@10
|
||||
|
||||
// MOV AX,0x4F02
|
||||
// MOV BX,0x12 //640x480 16 color
|
||||
//#exe {
|
||||
// if (!kernel_config->opts[CONFIG_TEXT_MODE])
|
||||
// StreamPrint("INT 0x10"); //Enable VGA
|
||||
//};
|
||||
// CMP AX,0x004F
|
||||
// JNE @@10 //Jmp if fail
|
||||
|
||||
BTS U32 [SYS_RUN_LEVEL],RLf_VESA
|
||||
@@10:
|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -393,7 +393,7 @@ class CSysLimitBase
|
|||
#define MEM_E820t_BAD_MEM 5
|
||||
#define MEM_E820t_PERM_MEM 7
|
||||
|
||||
class CMemE820
|
||||
class CMemE820
|
||||
{
|
||||
U8 *base;
|
||||
I64 len;
|
||||
|
@ -3845,25 +3845,6 @@ public class CDC
|
|||
#help_index "Devices"
|
||||
//VGA Memory
|
||||
#define VGAM_GRAPHICS 0xA0000
|
||||
#define VGAM_TEXT 0xB8000
|
||||
|
||||
//VGA I/O ports
|
||||
#define VGAP_ATTR_INDEX 0x03C0
|
||||
#define VGAP_ATTR_DATA_WRITE 0x03C0 //alias
|
||||
#define VGAP_ATTR_DATA_READ 0x03C1
|
||||
#define VGAP_MISC_OUTPUT 0x03C2
|
||||
#define VGAP_IDX 0x03C4
|
||||
#define VGAP_DATA 0x03C5
|
||||
#define VGAP_PALETTE_MASK 0x03C6
|
||||
#define VGAP_REG_READ 0x03C7
|
||||
#define VGAP_REG_WRITE 0x03C8
|
||||
#define VGAP_PALETTE_DATA 0x03C9
|
||||
#define VGAP_CRTC_INDEX 0x03D4
|
||||
#define VGAP_CRTC_DATA 0x03D5
|
||||
#define VGAP_INPUT_STAT 0x03DA
|
||||
|
||||
//VGA Registers
|
||||
#define VGAR_MAP_MASK 0x02
|
||||
|
||||
#help_index "Compression/Piece by Piece"
|
||||
#define ARC_BITS_MAX 12
|
||||
|
|
|
@ -264,7 +264,7 @@ public _extern SYS_CACHE_LINE_WIDTH
|
|||
|
||||
#help_index "Processor/Page Tables;Memory/Page Tables"
|
||||
public _intern IC_INVLPG
|
||||
U0 InvlPg(U8 *a); //Invalidate page at addr inst.
|
||||
U0 InvalidatePage(U8 *a); //Invalidate page at addr inst.
|
||||
public _extern MEM_PAGE_SIZE U64 mem_page_size;
|
||||
|
||||
#help_index "Task;Processor"
|
||||
|
@ -275,7 +275,7 @@ public _intern IC_FS CTask *Fs(); //FS seg reg points to the current $LK,"CTask"
|
|||
public _intern IC_RDTSC I64 GetTSC(); //Get time stamp counter.
|
||||
|
||||
#help_index "Graphics/VBE"
|
||||
public _extern SYS_VBE_INFO CVBEInfo sys_vbe_info;
|
||||
public _extern SYS_VBE_INFO CVBEInfo sys_vbe_info;
|
||||
public _extern SYS_VBE_FINAL_MODE CVBEMode sys_vbe_mode;
|
||||
_extern SYS_VBE_FINAL U16 sys_vbe_mode_num;
|
||||
_extern SYS_VBE_MODES CVBEModeShort sys_vbe_modes[VBE_MODES_NUM];
|
||||
|
|
|
@ -116,7 +116,7 @@ U8 *Mem64DevAlloc(I64 *_pages1Gig)
|
|||
do {
|
||||
pte=MemPageTable(a);
|
||||
*pte=*pte&~0x18 |0x11; //Uncached and present
|
||||
InvlPg(dev.mem64_ptr);
|
||||
InvalidatePage(dev.mem64_ptr);
|
||||
a+=mem_page_size;
|
||||
} while (a-dev.mem64_ptr<1<<30);
|
||||
}
|
||||
|
@ -143,7 +143,7 @@ U0 UncachedAliasAlloc() //Make uncached alias for 4 lowest Gig.
|
|||
do {
|
||||
pte=MemPageTable(a);
|
||||
*pte=0x197+a-dev.uncached_alias;
|
||||
InvlPg(a);
|
||||
InvalidatePage(a);
|
||||
a+=mem_page_size;
|
||||
} while (a-dev.uncached_alias<1<<32);
|
||||
}
|
||||
|
|
Binary file not shown.
Loading…
Reference in a new issue