TempleOSCDV3.11.ISO
This commit is contained in:
1 parent
f8c05f98f4
commit
ed64d7e3b8
549 files changed
+10643
-12855
No files matched your search
@@ -6,7 +6,6 @@ U0 TimeIns()
|
||||
{
|
||||
I64 start1,end1,start2,end2,overhead_time,test_time;
|
||||
I64 reg i,reg temp;
|
||||
Bool old_preempt=Preempt;
|
||||
|
||||
CPURep;
|
||||
|
||||
@@ -34,8 +33,6 @@ U0 TimeIns()
|
||||
test_time=end2-start2;
|
||||
"Remainder Version #2 Cycles\t: %10.5f\n",
|
||||
ToF64(test_time-overhead_time)/SAMPLE_SIZE;
|
||||
|
||||
Preempt(old_preempt);
|
||||
}
|
||||
|
||||
TimeIns;
|
||||
|
||||
@@ -78,7 +78,6 @@ U0 Main()
|
||||
I64 start,end,overhead_time,test_time;
|
||||
F64 d1,fsum;
|
||||
I64 reg i,temp,reg d2,reg sum;
|
||||
Bool old_preempt=Preempt;
|
||||
|
||||
CPURep;
|
||||
|
||||
@@ -141,7 +140,6 @@ U0 Main()
|
||||
"$$RED$$Asm Float Cycles :%10.5f$$FG$$\n",
|
||||
ToF64(test_time)/SAMPLE_SIZE;
|
||||
|
||||
Preempt(old_preempt);
|
||||
}
|
||||
|
||||
Main;
|
||||
|
||||
@@ -18,7 +18,6 @@ U0 GrDemo()
|
||||
{
|
||||
I64 i;
|
||||
F64 t;
|
||||
Bool old_preempt=Preempt;
|
||||
CPURep;
|
||||
for (i=0;i<16;i++) {
|
||||
t=VGAPattern(0x5555555555555555);
|
||||
@@ -28,7 +27,6 @@ U0 GrDemo()
|
||||
"$$GREEN$$Rate:$$RED$$%5.1f FPS$$FG$$"
|
||||
" $$GREEN$$Load@30Hz:$$RED$$%5.1f%%$$FG$$\n",1/t,100*t*30.0;
|
||||
}
|
||||
Preempt(old_preempt);
|
||||
//<CTRL-ALT-f> will flush screen VGA cache.
|
||||
VGAFlush;
|
||||
}
|
||||
|
||||
@@ -55,7 +55,6 @@ U0 TimeIns()
|
||||
{
|
||||
I64 start,end;
|
||||
I64 i,old_irq;
|
||||
Bool old_preempt=Preempt;
|
||||
|
||||
CPURep;
|
||||
old_irq=IntEntrySet(I_F_UNARY_MINUS,F_UNARY_MINUS_INT,IDTET_TRAP);
|
||||
@@ -74,7 +73,6 @@ U0 TimeIns()
|
||||
end=GetTSC;
|
||||
"Call Cycles: %10.5f\n",ToF64(end-start)/SAMPLE_SIZE;
|
||||
|
||||
Preempt(old_preempt);
|
||||
IntEntrySet(I_F_UNARY_MINUS,old_irq,IDTET_IRQ);
|
||||
}
|
||||
|
||||
|
||||
@@ -4,9 +4,9 @@ $ID,2$The mini compiler is like the main compiler, except the main compiler's le
|
||||
|
||||
The main compiler generates $LK,"Intermediate Code",A="FF:::/Compiler/CompilerA.HPP,IC_END"$ at the parser stage. See $LK,"PrsExpression",A="MN:PrsExpression"$(), $LK,"PrsStatement",A="MN:PrsStatement"$().
|
||||
|
||||
The main compiler optimizes See $LK,"Intermediate Code Attributes",A="MN:intermediate_code_table"$, $LK,"Combining Consts",A="FF:::/Compiler/OptPass012.CPP,case IC_MUL"$, $LK,"Choosing Reg Vars",A="FF:::/Compiler/OptPass3.CPP,cmp.num_reg_vars"$. Set $LK,"OTrace",A="MN:OTrace"$(ON) to see the optimization stages.
|
||||
The main compiler optimizes See $LK,"Intermediate Code Attributes",A="MN:intermediate_code_table"$, $LK,"Combining Consts",A="FF:::/Compiler/OptPass012.CPP,case IC_MUL"$, $LK,"Choosing Reg Vars",A="FF:::/Compiler/OptPass3.CPP,cmp.num_reg_vars"$. Use $LK,"PassTrace",A="MN:PassTrace"$() to see the optimization stages.
|
||||
|
||||
The main compiler makes machine code in the back end. See $LK,"IC Struct",A="MN:CIntermediateCode"$, $LK,"COCCompile",A="MN:COCCompile"$ and $LK,"OptPass789A",A="FF:::/Compiler/OptPass789A.CPP,IC_MUL"$(), $LK,"BackEnd",A="FF:::/Compiler/BackA.CPP,ICMul"$. Set $LK,"CTrace",A="MN:CTrace"$(ON) to see the output of the backend.
|
||||
The main compiler makes machine code in the back end. See $LK,"IC Struct",A="MN:CIntermediateCode"$, $LK,"COCCompile",A="MN:COCCompile"$ and $LK,"OptPass789A",A="FF:::/Compiler/OptPass789A.CPP,IC_MUL"$(), $LK,"BackEnd",A="FF:::/Compiler/BackA.CPP,ICMul"$. Set $LK,"Trace",A="MN:Trace"$(ON) to see the output of the backend.
|
||||
$ID,-2$
|
||||
$TR,"Mini Compiler"$
|
||||
$ID,2$For this mini compiler, some things you should know about 64-bit asm:
|
||||
|
||||
@@ -105,10 +105,8 @@ U0 MGCircle(I64 x,I64 y,F64 r)
|
||||
U0 MiniGrLibDemo()
|
||||
{
|
||||
I64 i;
|
||||
Bool old_preempt;
|
||||
MGInit;
|
||||
|
||||
old_preempt=Preempt;
|
||||
for (i=0;i<100;i++)
|
||||
MGHLine(200+i,400+i,300+i);
|
||||
for (i=0;i<500;i+=10)
|
||||
@@ -117,7 +115,6 @@ U0 MiniGrLibDemo()
|
||||
MGCircle(200,100+i,i);
|
||||
MGUpdate;
|
||||
BusyWait(1500000);
|
||||
Preempt(old_preempt);
|
||||
/*
|
||||
We are returning graphics to normal operations under TempleOS.
|
||||
It is not normal to by-pass the TempleOS graphcis routines.
|
||||
|
||||
@@ -8,31 +8,31 @@
|
||||
|
||||
#assert I_USER==0x40
|
||||
|
||||
interrupt U0 MyVect40()
|
||||
interrupt U0 IntMy40()
|
||||
{
|
||||
lock {progress1++;}
|
||||
*LAPIC_EOI(U32 *)=0;
|
||||
}
|
||||
|
||||
interrupt U0 MyVect41()
|
||||
interrupt U0 IntMy41()
|
||||
{
|
||||
lock {progress2++;}
|
||||
*LAPIC_EOI(U32 *)=0;
|
||||
}
|
||||
|
||||
interrupt U0 MyVect42()
|
||||
interrupt U0 IntMy42()
|
||||
{
|
||||
lock {progress3++;}
|
||||
*LAPIC_EOI(U32 *)=0;
|
||||
}
|
||||
|
||||
interrupt U0 MyVect43()
|
||||
interrupt U0 IntMy43()
|
||||
{
|
||||
lock {progress4++;}
|
||||
*LAPIC_EOI(U32 *)=0;
|
||||
}
|
||||
|
||||
I64 vect[4]={&MyVect40,&MyVect41,&MyVect42,&MyVect43};
|
||||
I64 vect[4]={&IntMy40,&IntMy41,&IntMy42,&IntMy43};
|
||||
|
||||
U0 Main()
|
||||
{
|
||||
|
||||
@@ -12,7 +12,7 @@ I64 *addr=VGAM_GRAPHICS,
|
||||
48[RBP]=STK_SELECTOR
|
||||
*/
|
||||
|
||||
interrupt haserrcode U0 PageFault()
|
||||
interrupt haserrcode U0 IntPageFault()
|
||||
{
|
||||
I64 reg *rbp=GetRBP;
|
||||
*pte_addr|=1;
|
||||
@@ -24,7 +24,7 @@ interrupt haserrcode U0 PageFault()
|
||||
|
||||
U0 PageTableDemo2()
|
||||
{
|
||||
U8 *old_idte=IntEntrySet(I_PAGE_FAULT,&PageFault,IDTET_IRQ);
|
||||
U8 *old_idte=IntEntrySet(I_PAGE_FAULT,&IntPageFault,IDTET_IRQ);
|
||||
err_code=0;
|
||||
*pte_addr &=~1; //Not present
|
||||
InvlPg(addr);
|
||||
|
||||
@@ -12,7 +12,7 @@ a fault to switch back.
|
||||
U8 *old_stk,*new_rip;
|
||||
|
||||
asm {
|
||||
TO_RING0:: //Set to handle general protection 0xD fault temporarily.
|
||||
INT_TO_RING0:: //Set to handle general protection 0xD fault temporarily.
|
||||
INC U64 [SYS_PROGRESS1]
|
||||
PUSH U32 CGDT.ds //STKSEG
|
||||
MOV RAX,U64 [&old_stk]
|
||||
@@ -29,7 +29,7 @@ U0 Ring3Demo()
|
||||
U8 *old_vect;
|
||||
"Progress1 Before:%X\n",progress1;
|
||||
CLI
|
||||
old_vect=IntEntrySet(0x0D,TO_RING0,IDTET_TRAP,0);
|
||||
old_vect=IntEntrySet(0x0D,INT_TO_RING0,IDTET_TRAP,0);
|
||||
|
||||
TSSBusy(Gs->tss->tr_ring3,OFF);
|
||||
SetRAX(Gs->tss->tr_ring3+3);
|
||||
|
||||
@@ -10,8 +10,6 @@ U0 PlotXY(I64 x,I64 y)
|
||||
U0 Main()
|
||||
{
|
||||
I64 i;
|
||||
Bool old_preempt=Preempt;
|
||||
|
||||
//This makes all 4 color planes active.
|
||||
OutU8(VGAP_INDEX,VGAR_MAP_MASK);
|
||||
OutU8(VGAP_DATA,WHITE);
|
||||
@@ -39,8 +37,6 @@ That means no read-modify-writes, too.
|
||||
*/
|
||||
BusyWait(4000000);
|
||||
|
||||
Preempt(old_preempt);
|
||||
|
||||
//TempleOS has a 4 plane memory duplicate of the screen, $LK,"gr.screen_image",A="MN:CGrGlbls"$,
|
||||
//and only writes actual changes. See $LK,"GrUpdateVGAGraphics",A="MN:GrUpdateVGAGraphics"$().
|
||||
//<CTRL-ALT-f> will flush screen VGA cache.
|
||||
|
||||
@@ -1,107 +0,0 @@
|
||||
//This task lets you hear how busy the CPU is.
|
||||
U0 LoadTask(I64)
|
||||
{
|
||||
I64 i,j=100;
|
||||
//Preemption is ctrlled on a per task basis.
|
||||
//Preemption is OFF by default on new tasks.
|
||||
//It is turned on for user terminal tasks.
|
||||
Preempt(ON);
|
||||
while (TRUE) {
|
||||
for (i=0;i<10000;i++)
|
||||
InU8(0x21); //Roughly 1 microsecond on all PC's
|
||||
Snd(j);
|
||||
j+=20;
|
||||
if (j>1000) j=100;
|
||||
}
|
||||
}
|
||||
|
||||
U0 SpinningPreempt()
|
||||
{
|
||||
I64 i;
|
||||
"Spinning with preemption....\n";
|
||||
for (i=0;i<3000000;i++)
|
||||
InU8(0x21); //This is a sample hardware stat read
|
||||
}
|
||||
|
||||
U0 SpinningNoPreempt()
|
||||
{
|
||||
I64 i;
|
||||
Bool old_preempt;
|
||||
"Spinning with no preemption...\n";
|
||||
|
||||
//Put on screen before it starts. Text lags by one refresh
|
||||
//and we might catch it in the middle of an update.
|
||||
WinMgrSync;
|
||||
WinMgrSync;
|
||||
WinMgrSync;
|
||||
|
||||
old_preempt=Preempt;
|
||||
for (i=0;i<3000000;i++)
|
||||
InU8(0x21);
|
||||
Preempt(old_preempt);
|
||||
}
|
||||
|
||||
U0 SpinningNoInterrupts()
|
||||
{
|
||||
I64 i;
|
||||
//Interrupts are ctrlled on a per task basis.
|
||||
"Spinning with no interrupts...\n";
|
||||
WinMgrSync;
|
||||
WinMgrSync;
|
||||
WinMgrSync;
|
||||
CLI
|
||||
for (i=0;i<3000000;i++)
|
||||
InU8(0x21);
|
||||
STI
|
||||
}
|
||||
|
||||
U0 CooperativeMultitaskingPreempt()
|
||||
{
|
||||
F64 timeout=tS+3.0;
|
||||
|
||||
"Cooperative multitasking with preemption...\n";
|
||||
while (tS<timeout) {
|
||||
InU8(0x21);
|
||||
Yield;
|
||||
}
|
||||
}
|
||||
|
||||
U0 CooperativeMultitaskingNoPreempt()
|
||||
{
|
||||
F64 timeout=tS+3.0;
|
||||
Bool old_preempt=Preempt;
|
||||
"Cooperative multitasking with no preemption...\n";
|
||||
while (tS<timeout) {
|
||||
InU8(0x21);
|
||||
Yield;
|
||||
}
|
||||
Preempt(old_preempt);
|
||||
}
|
||||
|
||||
U0 CooperativeMultitaskingNoInterrupts()
|
||||
{
|
||||
F64 timeout=tS+3.0;
|
||||
|
||||
CLI
|
||||
"Cooperative multitasking with no interrupts...\n";
|
||||
while (tS<timeout) {
|
||||
InU8(0x21);
|
||||
Yield;
|
||||
}
|
||||
STI
|
||||
}
|
||||
|
||||
U0 SpinningDemo()
|
||||
{
|
||||
CTask *task=Spawn(&LoadTask);
|
||||
SpinningPreempt;
|
||||
SpinningNoPreempt;
|
||||
SpinningNoInterrupts;
|
||||
CooperativeMultitaskingPreempt;
|
||||
CooperativeMultitaskingNoPreempt;
|
||||
CooperativeMultitaskingNoInterrupts;
|
||||
Kill(task);
|
||||
Snd(0);
|
||||
}
|
||||
|
||||
SpinningDemo;
|
||||
@@ -7,7 +7,6 @@ U0 TimeIns()
|
||||
shared_blks,*uncached_I64;
|
||||
CBlkPool *bp;
|
||||
CHeapCtrl *hc;
|
||||
Bool old_preempt;
|
||||
|
||||
"$$RED$$Now, this demo seems broken, perhaps,\n"
|
||||
"because I run in a virtual machine.$$FG$$\n\n";
|
||||
@@ -18,8 +17,6 @@ U0 TimeIns()
|
||||
hc=HeapCtrlBPInit(bp,shared_blks<<12);
|
||||
uncached_I64=MAlloc(sizeof(I64),hc);
|
||||
|
||||
old_preempt=Preempt;
|
||||
|
||||
//Measure cached time
|
||||
start=GetTSC;
|
||||
for (i=0;i<SAMPLE_SIZE;i++)
|
||||
@@ -40,7 +37,6 @@ U0 TimeIns()
|
||||
Free(cached_I64);
|
||||
Free(uncached_I64);
|
||||
Mem2MegFree(bp,shared_blks);
|
||||
Preempt(old_preempt);
|
||||
}
|
||||
|
||||
TimeIns;
|
||||
|
||||
Reference in new issue
Block a user