TempleOSCDV4.01.ISO
This commit is contained in:
1 parent
0e0592d9a6
commit
fedf66361e
85 files changed
+2463
-2376
No files matched your search
@@ -98,10 +98,10 @@ U0 ATARepEntry(I64 base0,I64 base1,I64 unit,I64 irq,U8 *msg,
|
||||
*num_hints+=1;
|
||||
"\n\n$$PURPLE$$ $$BT+X,\"%d\",LM=\"%d\\n\"$$$$FG$$$$LM,4$$",*num_hints,*num_hints;
|
||||
if (type==BDT_ATA)
|
||||
"$$RED$$ATA ";
|
||||
"$$RED$$Hard Drive $$LTBLUE$$ATA ";
|
||||
else
|
||||
"$$RED$$ATAPI ";
|
||||
"$$LTBLUE$$%s$$FG$$\nBase0:0x%04X Base1:0x%04X\nIrq:0x%02X Unit:%d$$LM,0$$\n",
|
||||
"$$RED$$CD/DVD Drive $$LTBLUE$$ATAPI ";
|
||||
"%s$$FG$$\nBase0:0x%04X Base1:0x%04X\nIrq:0x%02X Unit:%d$$LM,0$$\n",
|
||||
msg,base0,base1,irq,unit;
|
||||
if (_root) {
|
||||
tempha=CAlloc(sizeof(CATARep));
|
||||
@@ -191,6 +191,16 @@ public I64 ATARep(Bool pmt=TRUE,Bool just_ide=FALSE,CATARep **_root=NULL)
|
||||
return num_hints;
|
||||
}
|
||||
|
||||
CATARep *ATARepFind(CATARep *haystack_root,I64 needle_num)
|
||||
{
|
||||
while (haystack_root) {
|
||||
if (haystack_root->num==needle_num)
|
||||
return haystack_root;
|
||||
haystack_root=haystack_root->next;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
CATARep *ATAIDDrvs(CATARep *root,I64 _sys_boot_drv,
|
||||
CATARep **_ata_drv,CATARep **_atapi_drv)
|
||||
{//This is for when trying to sort-out main hard drives and CD/DVD drives.
|
||||
|
||||
@@ -160,112 +160,6 @@ Bool DrvEnable(U8 drv_let,Bool val)
|
||||
return result;
|
||||
}
|
||||
|
||||
CATARep *ATARepFind(CATARep *haystack_root,I64 needle_num)
|
||||
{
|
||||
while (haystack_root) {
|
||||
if (haystack_root->num==needle_num)
|
||||
return haystack_root;
|
||||
haystack_root=haystack_root->next;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
U0 Mount(Bool repartition=FALSE)
|
||||
{//Mount a drive.
|
||||
CBlkDev *bd;
|
||||
I64 first_drv_num,type,unit,num_hints;
|
||||
U8 blks_buf[STR_LEN],addr_buf[STR_LEN],base0_buf[STR_LEN],base1_buf[STR_LEN];
|
||||
Bool add;
|
||||
CATARep *root,*tempha;
|
||||
|
||||
do {
|
||||
DrvRep;
|
||||
"\n****** Mount Drives ******\n"
|
||||
"The first drive letter is the letter\n"
|
||||
"of the first partition. If adding\n"
|
||||
"a hard drive, you should pick 'C'.\n"
|
||||
"If more than one partition is present\n"
|
||||
"they will be lettered in sequence.\n"
|
||||
"\nFirst Drive Letter ($$PURPLE$$<ENTER>$$FG$$ to exit):";
|
||||
first_drv_num=ToUpper(GetChar)-'A';
|
||||
'\n';
|
||||
if (0<=first_drv_num<NUM_DRVS) {
|
||||
"\t$$PURPLE$$1$$FG$$=RAM\n\t$$PURPLE$$2$$FG$$=ATA(Harddisk)\n"
|
||||
"\t$$PURPLE$$3$$FG$$=ATAPI(CD/DVD)\nType:";
|
||||
type=GetChar-'0';
|
||||
'\n';
|
||||
|
||||
unit=0;
|
||||
if (type==BDT_ATA || type==BDT_ATAPI) {
|
||||
num_hints=ATARep(,,&root);
|
||||
do {
|
||||
if (num_hints)
|
||||
"Enter dev number or\nport with $$PURPLE$$0x$$FG$$ prefix.\n"
|
||||
"I/O Port Base0:\n";
|
||||
else
|
||||
"Include $$PURPLE$$0x$$FG$$ prefix.\nI/O Port Base0:\n";
|
||||
GetS(base0_buf,STR_LEN);
|
||||
} while (!Str2I64(base0_buf));
|
||||
if (1<=Str2I64(base0_buf)<=num_hints) {
|
||||
tempha=ATARepFind(root,Str2I64(base0_buf));
|
||||
StrPrint(base0_buf,"0x%X",tempha->base0);
|
||||
StrPrint(base1_buf,"0x%X",tempha->base1);
|
||||
unit=tempha->unit;
|
||||
} else {
|
||||
if (type==BDT_ATAPI)
|
||||
StrCpy(base1_buf,"0");
|
||||
else
|
||||
do {
|
||||
"I/O Port Base1:\n";
|
||||
GetS(base1_buf,STR_LEN);
|
||||
} while (!Str2I64(base1_buf));
|
||||
do {
|
||||
"\t$$PURPLE$$0$$FG$$=Master\n\t$$PURPLE$$1$$FG$$=Slave\nUnit:";
|
||||
unit=GetChar-'0';
|
||||
} while (!(0<=unit<=1));
|
||||
'\n';
|
||||
}
|
||||
LinkedLstDel(root);
|
||||
}
|
||||
if (type==BDT_RAM) {
|
||||
"Addr of RAM disk ($$PURPLE$$<ENTER>$$FG$$ to MAlloc):";
|
||||
GetS(addr_buf,STR_LEN);
|
||||
"Blks of 512 bytes:";
|
||||
GetS(blks_buf,STR_LEN);
|
||||
}
|
||||
|
||||
if (BDT_NULL<type<BDT_NUM_TYPES && 0<=unit<=1) {
|
||||
bd=BlkDevNextFree(first_drv_num+'A',type);
|
||||
bd->unit=unit;
|
||||
if (type==BDT_RAM) {
|
||||
if (!*addr_buf) StrCpy(addr_buf,"0");
|
||||
bd->RAM_dsk=Str2I64(addr_buf);
|
||||
bd->max_blk=Str2I64(blks_buf)-1;
|
||||
}
|
||||
if (type==BDT_ATA ||
|
||||
type==BDT_ATAPI) {
|
||||
bd->base0=Str2I64(base0_buf);
|
||||
bd->base1=Str2I64(base1_buf);
|
||||
}
|
||||
add=TRUE;
|
||||
if (type==BDT_ATA && repartition) {
|
||||
"\nReformat WHOLE drive!";
|
||||
if (YorN) {
|
||||
if (!BlkDevAdd(bd,TRUE,TRUE))
|
||||
"\n\n$$BK,1$$$$RED$$Operation Failed$$BK,0$$$$FG$$\n\n";
|
||||
else
|
||||
CallExtStr("PrtDsk",bd->first_drv_let);
|
||||
add=FALSE;
|
||||
}
|
||||
}
|
||||
if (add && !BlkDevAdd(bd,FALSE,TRUE))
|
||||
"\n\n$$BK,1$$$$RED$$Operation Failed$$BK,0$$$$FG$$\n\n";
|
||||
} else
|
||||
"\n\n$$BK,1$$$$RED$$Operation Failed$$BK,0$$$$FG$$\n\n";
|
||||
}
|
||||
} while (0<=first_drv_num<NUM_DRVS);
|
||||
}
|
||||
|
||||
I64 SysGetI64()
|
||||
{
|
||||
U8 st[STR_LEN];
|
||||
|
||||
+7
-94
@@ -23,17 +23,12 @@ class CKernelCfg
|
||||
Bool opts[CFG_NUM_OPTIONS];
|
||||
U8 mem_init_val,heap_init_val,var_init_val,
|
||||
boot_drv_let,auto_mount_ide_hd_let,auto_mount_ide_cd_let;
|
||||
Bool dvd_ports_pmt;
|
||||
};
|
||||
|
||||
CDoc *KernelCfgAddDev(CKernelCfg *c)
|
||||
{
|
||||
I64 ch,num_hints,first_drv_num,type,unit,cnt=0;
|
||||
U8 blks_buf[STR_LEN],addr_buf[STR_LEN],base0_buf[STR_LEN],base1_buf[STR_LEN];
|
||||
CATARep *root=NULL,*tempha;
|
||||
CDoc *doc=DocNew;
|
||||
Bool make_free;
|
||||
|
||||
I64 ch,cnt=0;
|
||||
CDoc *doc=DocNew,*doc2;
|
||||
"\n\nIn anticipation of the drives you will\n"
|
||||
"define shortly, enter the drive letter\n"
|
||||
"of the drive with the account directory.\n"
|
||||
@@ -43,97 +38,15 @@ CDoc *KernelCfgAddDev(CKernelCfg *c)
|
||||
c->boot_drv_let=ch;
|
||||
else
|
||||
c->boot_drv_let=Drv2Let(Fs->cur_dv);
|
||||
|
||||
"\n\n$$BK,1$$$$PURPLE$$Mount drives so they will be present when "
|
||||
"you boot.$$FG$$$$BK,0$$\n";
|
||||
do {
|
||||
"\n****** Mount Drives ******\n"
|
||||
"The first drive letter is the letter\n"
|
||||
"of the first partition. If adding\n"
|
||||
"a hard drive, you should pick 'C'.\n"
|
||||
"If more than one partition is present\n"
|
||||
"they will be lettered in sequence.\n"
|
||||
"\nFirst Drive Letter ($$PURPLE$$<ENTER>$$FG$$ to exit):";
|
||||
first_drv_num=ToUpper(GetChar)-'A';
|
||||
'\n';
|
||||
if (0<=first_drv_num<NUM_DRVS) {
|
||||
"\t$$PURPLE$$1$$FG$$=RAM\n\t$$PURPLE$$2$$FG$$=ATA(Harddisk)\n"
|
||||
"\t$$PURPLE$$3$$FG$$=ATAPI(CD/DVD)\nType:";
|
||||
type=GetChar-'0';
|
||||
'\n';
|
||||
|
||||
unit=0;
|
||||
if (type==BDT_RAM) {
|
||||
"Addr of RAM disk ($$PURPLE$$<ENTER>$$FG$$ to MAlloc):";
|
||||
GetS(addr_buf,STR_LEN);
|
||||
"Blks of 512 bytes:";
|
||||
GetS(blks_buf,STR_LEN);
|
||||
} else if (type==BDT_ATA ||
|
||||
type==BDT_ATAPI) {
|
||||
num_hints=ATARep(,,&root);
|
||||
if (type==BDT_ATAPI) {
|
||||
"<ENTER> to use booted CD/DVD\n";
|
||||
if (num_hints)
|
||||
"Enter dev number or\nport with $$PURPLE$$0x$$FG$$ prefix.\n"
|
||||
"I/O Port Base0:\n";
|
||||
else
|
||||
"Include $$PURPLE$$0x$$FG$$ prefix.\nI/O Port Base0:\n";
|
||||
GetS(base0_buf,STR_LEN);
|
||||
} else
|
||||
do {
|
||||
if (num_hints)
|
||||
"Enter dev number or\nport with $$PURPLE$$0x$$FG$$ prefix.\n"
|
||||
"I/O Port Base0:\n";
|
||||
else
|
||||
"Include $$PURPLE$$0x$$FG$$ prefix.\nI/O Port Base0:\n";
|
||||
GetS(base0_buf,STR_LEN);
|
||||
} while (!Str2I64(base0_buf));
|
||||
if (1<=Str2I64(base0_buf)<=num_hints) {
|
||||
tempha=ATARepFind(root,Str2I64(base0_buf));
|
||||
StrPrint(base0_buf,"0x%X",tempha->base0);
|
||||
StrPrint(base1_buf,"0x%X",tempha->base1);
|
||||
unit=tempha->unit;
|
||||
} else if (type!=BDT_ATAPI || *base0_buf) {
|
||||
if (type==BDT_ATAPI)
|
||||
StrCpy(base1_buf,"0");
|
||||
else
|
||||
do {
|
||||
"I/O Port Base1:\n";
|
||||
GetS(base1_buf,STR_LEN);
|
||||
} while (!Str2I64(base1_buf));
|
||||
do {
|
||||
"\t$$PURPLE$$0$$FG$$=Master\n\t$$PURPLE$$1$$FG$$=Slave\nUnit:";
|
||||
unit=GetChar-'0';
|
||||
} while (!(0<=unit<=1));
|
||||
'\n';
|
||||
}
|
||||
LinkedLstDel(root);
|
||||
}
|
||||
if (BDT_NULL<type<BDT_NUM_TYPES && 0<=unit<=1) {
|
||||
DocPrint(doc,"bd=BlkDevNextFree(%d,%d);"
|
||||
"bd->unit=%d;",first_drv_num+'A',type,unit);
|
||||
if (type==BDT_RAM) {
|
||||
if (!*addr_buf) StrCpy(addr_buf,"0");
|
||||
DocPrint(doc,"bd->RAM_dsk=%s;",addr_buf);
|
||||
DocPrint(doc,"bd->max_blk=(%s)-1;",blks_buf);
|
||||
}
|
||||
make_free=FALSE;
|
||||
if (type==BDT_ATA || type==BDT_ATAPI) {
|
||||
if (type==BDT_ATAPI && !*base0_buf) {
|
||||
c->dvd_ports_pmt=TRUE;
|
||||
DocPrint(doc,"blkdev.boot_rescue_drv_pmt=GetBaseUnit(bd);");
|
||||
if (first_drv_num+'A'==c->boot_drv_let)
|
||||
make_free=TRUE;
|
||||
} else
|
||||
DocPrint(doc,"bd->base0=%s;bd->base1=%s;",
|
||||
base0_buf,base1_buf);
|
||||
}
|
||||
DocPrint(doc,"BlkDevAdd(bd,FALSE,%d);",make_free);
|
||||
cnt++;
|
||||
} else
|
||||
"\n\n$$BK,1$$$$RED$$Operation Failed$$BK,0$$$$FG$$\n\n";
|
||||
if (doc2=BlkDevPmt(c->boot_drv_let)) {
|
||||
DocInsDoc(doc,doc2);
|
||||
DocDel(doc2);
|
||||
cnt++;
|
||||
}
|
||||
} while (!cnt || 0<=first_drv_num<NUM_DRVS);
|
||||
} while (!cnt || doc2);
|
||||
return doc;
|
||||
}
|
||||
|
||||
|
||||
@@ -173,12 +173,6 @@ U0 KernelMain()
|
||||
BlkDevsInitAll;
|
||||
"After BlkDevsInitAll\n";
|
||||
|
||||
#exe {
|
||||
if (kernel_cfg->dvd_ports_pmt)
|
||||
StreamPrint(
|
||||
"if (blkdev.boot_rescue_drv_pmt) \"%%S\",\"ST_DVD_PORTS_PMT2\";");
|
||||
};
|
||||
|
||||
ChgDsk(':');
|
||||
Gs->idle_task->cur_dv=blkdev.let_to_drv[ToUpper(blkdev.boot_drv_let)-'A'];
|
||||
LBts(&sys_run_level,RLf_BLKDEV);
|
||||
|
||||
+1
-1
@@ -305,7 +305,7 @@ USE64
|
||||
|
||||
BTS U32 [SYS_RUN_LEVEL],RLf_BOOT_HEAP
|
||||
|
||||
PUSH ADAM_STK
|
||||
PUSH MEM_ADAM_STK
|
||||
PUSH U32 SYS_FIXED_AREA+CSysFixedArea.adam
|
||||
CALL &TaskInit
|
||||
CALL SET_FS_BASE
|
||||
|
||||
+4
-3
@@ -177,10 +177,10 @@ I64 TaskInit(CTask *task,I64 stk_size)
|
||||
MemCpy(task->fpu_mmx,
|
||||
SYS_FIXED_AREA+offset(CSysFixedArea.init_fpu_mmx),sizeof(CFPU));
|
||||
|
||||
task->hash_table=HashTableNew(TASK_HASH_SIZE,task);
|
||||
task->hash_table=HashTableNew(TASK_HASH_TABLE_SIZE,task);
|
||||
|
||||
if (!stk_size)
|
||||
stk_size=DFT_STK;
|
||||
stk_size=MEM_DFT_STK;
|
||||
task->stk=temps=TaskStkNew(stk_size,task);
|
||||
task->rsp=(&temps->stk_base)(U8 *)+temps->stk_size;
|
||||
|
||||
@@ -308,6 +308,7 @@ I64 ExeCmdLine(CCmpCtrl *cc)
|
||||
Fs->answer_type=type;
|
||||
Fs->answer_time=tS-t0;
|
||||
Fs->new_answer=TRUE;
|
||||
cc->pmt_line=0;
|
||||
}
|
||||
if (!(cc->flags&CCF_HAS_MISC_DATA))
|
||||
Free(machine_code);
|
||||
@@ -333,7 +334,7 @@ U0 UserTaskCont()
|
||||
CDoc *doc;
|
||||
Bool cont=TRUE;
|
||||
do {
|
||||
cc=CmpCtrlNew(,CCF_PMT);
|
||||
cc=CmpCtrlNew(,CCF_PMT|CCF_QUESTION_HELP);
|
||||
QueIns(cc,Fs->last_lex);
|
||||
try {
|
||||
Lex(cc);
|
||||
|
||||
+1344
-1347
File diff suppressed because it is too large.
Load diff
+42
-39
@@ -1011,10 +1011,9 @@ public class CHashGlblVar:CHashSrcSym
|
||||
#define DOCEF_SKIP 0x10000000000000
|
||||
#define DOCEF_POPUP 0x20000000000000
|
||||
#define DOCEF_SKIP_IN_FORM 0x40000000000000
|
||||
#define DOCEF_HARD_SKIP 0x80000000000000
|
||||
#define DOCEF_FILTER_SKIP 0x100000000000000
|
||||
#define DOCEF_NO_CLICK_ON 0x200000000000000
|
||||
#define DOCEF_DONT_DRAW 0x400000000000000 //only works on sprites
|
||||
#define DOCEF_FILTER_SKIP 0x80000000000000
|
||||
#define DOCEF_NO_CLICK_ON 0x100000000000000
|
||||
#define DOCEF_DONT_DRAW 0x200000000000000 //only works on sprites
|
||||
|
||||
#define DOCEG1_DONT_EDIT (DOCEF_DEFINE|DOCEF_HTML_LINK|\
|
||||
DOCEF_AUX_STR|DOCEF_BIN_PTR_LINK|DOCEF_SCROLLING_X|DOCEF_TAG_CB)
|
||||
@@ -1086,11 +1085,10 @@ public class CHashGlblVar:CHashSrcSym
|
||||
#define DOCEf_SKIP 52
|
||||
#define DOCEf_POPUP 53
|
||||
#define DOCEf_SKIP_IN_FORM 54
|
||||
#define DOCEf_HARD_SKIP 55
|
||||
#define DOCEf_FILTER_SKIP 56
|
||||
#define DOCEf_NO_CLICK_ON 57
|
||||
#define DOCEf_DONT_DRAW 58 //only works on sprites
|
||||
#define DOCEf_NUM_FLAGS 59
|
||||
#define DOCEf_FILTER_SKIP 55
|
||||
#define DOCEf_NO_CLICK_ON 56
|
||||
#define DOCEf_DONT_DRAW 57 //only works on sprites
|
||||
#define DOCEf_NUM_FLAGS 58
|
||||
|
||||
public class CDocBin
|
||||
{
|
||||
@@ -2086,15 +2084,16 @@ class CLexHashTableContext
|
||||
//CmpCtrl flags
|
||||
#define CCF_PMT 1
|
||||
#define CCf_PMT 0
|
||||
#define CCF_DONT_FREE_BUF 2
|
||||
#define CCF_NO_DEFINES 4
|
||||
#define CCF_IN_IF 8
|
||||
#define CCF_JUST_LOAD 16
|
||||
#define CCF_KEEP_NEW_LINES 32
|
||||
#define CCF_KEEP_DOT 64
|
||||
#define CCF_KEEP_NUM_SIGN 128
|
||||
#define CCF_KEEP_AT_SIGN 256
|
||||
#define CCf_PASS_TRACE_PRESENT 9
|
||||
#define CCF_QUESTION_HELP 2
|
||||
#define CCF_DONT_FREE_BUF 4
|
||||
#define CCF_NO_DEFINES 8
|
||||
#define CCF_IN_IF 16
|
||||
#define CCF_JUST_LOAD 32
|
||||
#define CCF_KEEP_NEW_LINES 64
|
||||
#define CCF_KEEP_DOT 128
|
||||
#define CCF_KEEP_NUM_SIGN 256
|
||||
#define CCF_KEEP_AT_SIGN 512
|
||||
#define CCf_PASS_TRACE_PRESENT 10
|
||||
#define CCF_NOT_CONST 0x0000010000
|
||||
#define CCF_NO_REG_OPT 0x0000020000
|
||||
#define CCF_IN_QUOTES 0x0000040000
|
||||
@@ -2165,7 +2164,7 @@ public class CCmpCtrl
|
||||
CCodeCtrl coc;
|
||||
CPrsStk *ps;
|
||||
CAOTCtrl *aotc;
|
||||
I64 aot_depth;
|
||||
I64 aot_depth,pmt_line;
|
||||
U0 pad;#assert !($$&7) //(compiler lags one token)
|
||||
};
|
||||
|
||||
@@ -2532,6 +2531,7 @@ public class CDirEntry
|
||||
#define FUf_ALL 3
|
||||
#define FUf_CANCEL 4
|
||||
#define FUf_REPLACE 5
|
||||
#define FUf_RISKY 5
|
||||
#define FUf_PUBLIC 6
|
||||
#define FUf_MAP 7
|
||||
#define FUf_EXPAND 8
|
||||
@@ -2557,6 +2557,7 @@ public class CDirEntry
|
||||
#define FUF_ALL 0x000008 //a
|
||||
#define FUF_CANCEL 0x000010 //c
|
||||
#define FUF_REPLACE 0x000020 //R
|
||||
#define FUF_RISKY 0x000020 //R
|
||||
#define FUF_PUBLIC 0x000040 //p
|
||||
#define FUF_MAP 0x000080 //m
|
||||
#define FUF_EXPAND 0x000100 //x
|
||||
@@ -2613,7 +2614,7 @@ public class CDirEntry
|
||||
//locked flags
|
||||
#define BDlf_LOCKED 0
|
||||
|
||||
#define NUM_BLKDEVS 32
|
||||
#define NUM_BLKDEVS 26
|
||||
#define BD_SIGNATURE_VAL 'BDSV'
|
||||
public class CBlkDev
|
||||
{
|
||||
@@ -2664,7 +2665,7 @@ class CFreeLst
|
||||
I64 start,size;
|
||||
};
|
||||
|
||||
#define NUM_DRVS 32
|
||||
#define NUM_DRVS 26
|
||||
|
||||
#define DRV_SIGNATURE_VAL 'DVSV'
|
||||
public class CDrv
|
||||
@@ -2715,7 +2716,7 @@ public class CBlkDevGlbls
|
||||
CDrv *drvs,*let_to_drv[32];
|
||||
I64 auto_mount_ide_cnt;
|
||||
U8 boot_drv_let,first_hd_drv_let,first_dvd_drv_let;
|
||||
Bool boot_rescue_drv_pmt,dvd_boot_is_good,pad[3];
|
||||
Bool dvd_boot_is_good,pad[4];
|
||||
};
|
||||
|
||||
#help_index "File/Internal"
|
||||
@@ -2784,8 +2785,8 @@ class CMemUsed
|
||||
#help_index "Memory/BlkPool"
|
||||
/*TempleOS does not mess with page tables after it
|
||||
identity-maps them during boot -- $LK,"SYS_INIT_MEM",A="MN:SYS_INIT_MEM"$.
|
||||
$LK,"PAGE_SIZE",A="MN:PAGE_SIZE"$ is arbitrary, and is not related to CPU hardware.
|
||||
I need some unit for memory allocation so I invented "$LK,"PAGE_SIZE",A="MN:PAGE_SIZE"$".
|
||||
$LK,"MEM_PAGE_SIZE",A="MN:MEM_PAGE_SIZE"$ is arbitrary, and is not related to CPU hardware.
|
||||
I need some unit for memory allocation so I invented "$LK,"MEM_PAGE_SIZE",A="MN:MEM_PAGE_SIZE"$".
|
||||
|
||||
All virtual addresses are identical to physical, always.
|
||||
There is no high kernel memory because RAM's physical
|
||||
@@ -2825,18 +2826,20 @@ class CMemRange
|
||||
I64 size;
|
||||
};
|
||||
|
||||
#define PAGE_BITS 9
|
||||
#define PAGE_SIZE (1<<PAGE_BITS)
|
||||
#define MEM_PAGE_BITS 9
|
||||
#define MEM_PAGE_SIZE (1<<MEM_PAGE_BITS)
|
||||
#define MEM_HEAP_HASH_SIZE 1024
|
||||
#define MEM_FREE_PAGE_HASH_SIZE 0x100
|
||||
//It is common to $LK,"MAlloc",A="MN:MAlloc"$() exact powers of two. There is some overhead.
|
||||
//We add $TX,"2",D="MEM_EXTRA_HASH2_PAGES"$ pages, so a request is not rounded-up to next power of two.
|
||||
#define MEM_EXTRA_HASH2_PAGES 2
|
||||
|
||||
#define HEAP_HASH_SIZE 1024
|
||||
#define FREE_PAGE_HASH_SIZE 0x100
|
||||
#define MEM_ADAM_STK (MEM_PAGE_SIZE*512) //Like 16384*MEM_PAGE_SIZE
|
||||
#define MEM_SETH_STK (MEM_PAGE_SIZE*512)
|
||||
#define MEM_INTERRUPT_STK (MEM_PAGE_SIZE*512)
|
||||
#define MEM_DFT_STK (MEM_PAGE_SIZE*512)
|
||||
|
||||
#define ADAM_STK (PAGE_SIZE*512) //limit of like 16384*PAGE_SIZE
|
||||
#define SETH_STK (PAGE_SIZE*512)
|
||||
#define INTERRUPT_STK (PAGE_SIZE*512)
|
||||
#define DFT_STK (PAGE_SIZE*512)
|
||||
|
||||
#define TASK_HASH_SIZE (1<<10)
|
||||
#define TASK_HASH_TABLE_SIZE (1<<10)
|
||||
|
||||
//locked flags
|
||||
#define BPlf_LOCKED 0
|
||||
@@ -2844,8 +2847,8 @@ public class CBlkPool
|
||||
{
|
||||
I64 locked_flags,alloced_u8s,used_u8s;
|
||||
CMemBlk *mem_free_lst,*mem_free_2meg_lst,
|
||||
*free_page_hash[FREE_PAGE_HASH_SIZE],
|
||||
*free_page_hash2[64-PAGE_BITS];
|
||||
*free_page_hash[MEM_FREE_PAGE_HASH_SIZE],
|
||||
*free_page_hash2[64-MEM_PAGE_BITS];
|
||||
};
|
||||
|
||||
#help_index "Memory/HeapCtrl"
|
||||
@@ -2862,7 +2865,7 @@ public class CHeapCtrl
|
||||
CMemBlk *next_mem_blk,*last_mem_blk;
|
||||
CMemUnused *malloc_free_lst;
|
||||
CMemUsed *next_um,*last_um;
|
||||
CMemUnused *heap_hash[HEAP_HASH_SIZE/sizeof(U8 *)];
|
||||
CMemUnused *heap_hash[MEM_HEAP_HASH_SIZE/sizeof(U8 *)];
|
||||
};
|
||||
|
||||
#help_index "Devices"
|
||||
@@ -3425,7 +3428,7 @@ public class CSysFixedArea
|
||||
CTask adam;
|
||||
CBlkPool adam_bp;
|
||||
CHeapCtrl adam_hc;
|
||||
$$=($$+PAGE_SIZE-1)&-PAGE_SIZE;
|
||||
$$=($$+MEM_PAGE_SIZE-1)&-MEM_PAGE_SIZE;
|
||||
};
|
||||
|
||||
#help_index "Char"
|
||||
@@ -3835,7 +3838,7 @@ public class CDbgGlbls
|
||||
#define BOOT_SRC_DVD 3
|
||||
|
||||
// $LK,"Auto",A="MN:Auto"$("") StdIn for call to $LK,"MakeOSDrvBootInstall",A="MN:MakeOSDrvBootInstall"$().
|
||||
#define STD_DISTRO_DVD_CFG "Tb1\nScale2Mem(2048,0x40000)\nt3 \n\n\n\n"
|
||||
#define STD_DISTRO_DVD_CFG "Tb\nScale2Mem(2048,0x40000)\nt \n\n\n\n"
|
||||
|
||||
#help_index "Misc/Registry"
|
||||
//Registry sys_msg_flags. $LK,"RegOneTimePopUp",A="MN:RegOneTimePopUp"$()
|
||||
|
||||
@@ -5,9 +5,6 @@ public extern CAutoCompleteGlbls ac;
|
||||
#help_index "AutoComplete/Dictionary"
|
||||
public extern CAutoCompleteDictGlbls acd;
|
||||
|
||||
#help_index "AutoFile;StdIn/AutoFile"
|
||||
#help_file "::/Doc/AutoFile"
|
||||
|
||||
#help_index "Bit"
|
||||
public extern I64 BCnt(I64 d);
|
||||
public extern U8 *reverse_bits_table,*set_bits_table;
|
||||
@@ -461,7 +458,6 @@ public extern Bool DrvEnable(U8 drv_let,Bool val);
|
||||
#help_index "Install;File/Cmd Line (Typically);Cmd Line (Typically);"
|
||||
public extern U0 Fmt(U8 drv_let,Bool quick=TRUE,
|
||||
Bool confirm=TRUE,I64 type=DVT_FAT32);
|
||||
public extern U0 Mount(Bool repartition=FALSE);
|
||||
|
||||
#help_index "Install;Memory/BlkPool"
|
||||
public extern I64 Scale2Mem(I64 min,I64 max,I64 limit=2*1024*1024*1024);
|
||||
|
||||
@@ -9,7 +9,7 @@ U0 BlkPoolAdd(CBlkPool *bp,CMemBlk *m,I64 pages512)
|
||||
m->next=bp->mem_free_lst;
|
||||
m->pages=pages512;
|
||||
m->mb_signature=MBS_UNUSED_SIGNATURE_VAL;
|
||||
bp->alloced_u8s+=pages512<<PAGE_BITS;
|
||||
bp->alloced_u8s+=pages512<<MEM_PAGE_BITS;
|
||||
bp->mem_free_lst=m;
|
||||
LBtr(&bp->locked_flags,BPlf_LOCKED);
|
||||
POPFD
|
||||
@@ -20,9 +20,9 @@ U0 BlkPoolInit(CBlkPool *bp,I64 pages512)
|
||||
I64 num;
|
||||
CMemBlk *m;
|
||||
MemSet(bp,0,sizeof(CBlkPool));
|
||||
m=(bp(U8 *)+sizeof(CBlkPool)+PAGE_SIZE-1)&~(PAGE_SIZE-1);
|
||||
num=(bp(U8 *)+pages512<<PAGE_BITS-m(U8 *))>>PAGE_BITS;
|
||||
bp->alloced_u8s=(pages512-num)<<PAGE_BITS; //Compensate before num added.
|
||||
m=(bp(U8 *)+sizeof(CBlkPool)+MEM_PAGE_SIZE-1)&~(MEM_PAGE_SIZE-1);
|
||||
num=(bp(U8 *)+pages512<<MEM_PAGE_BITS-m(U8 *))>>MEM_PAGE_BITS;
|
||||
bp->alloced_u8s=(pages512-num)<<MEM_PAGE_BITS; //Compensate before num added.
|
||||
BlkPoolAdd(bp,m,num);
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ U0 BlkPoolsInit()
|
||||
code_heap_limit=0x80000000;
|
||||
|
||||
i=code_heap_limit-0x1000000;
|
||||
BlkPoolAdd(sys_code_bp,0x1000000,i>>PAGE_BITS);
|
||||
BlkPoolAdd(sys_code_bp,0x1000000,i>>MEM_PAGE_BITS);
|
||||
sys_heap_limit=i+0x1000000-1;
|
||||
|
||||
if (code_heap_limit<total) {
|
||||
@@ -58,12 +58,12 @@ U0 BlkPoolsInit()
|
||||
}
|
||||
if (code_heap_limit<=lo<hi) {
|
||||
if (first) {
|
||||
BlkPoolInit(lo,(hi-lo)>>PAGE_BITS);
|
||||
BlkPoolInit(lo,(hi-lo)>>MEM_PAGE_BITS);
|
||||
sys_data_bp=lo;
|
||||
Fs->data_heap=HeapCtrlInit(,Fs,sys_data_bp);
|
||||
first=FALSE;
|
||||
} else
|
||||
BlkPoolAdd(sys_data_bp,lo,(hi-lo)>>PAGE_BITS);
|
||||
BlkPoolAdd(sys_data_bp,lo,(hi-lo)>>MEM_PAGE_BITS);
|
||||
}
|
||||
}
|
||||
m20++;
|
||||
|
||||
@@ -17,9 +17,10 @@ CHeapCtrl *HeapCtrlBPInit(CBlkPool *bp,I64 pages512)
|
||||
CHeapCtrl *hc;
|
||||
MemSet(bp,0,sizeof(CBlkPool)+sizeof(CHeapCtrl));
|
||||
hc=HeapCtrlInit(bp(U8 *)+sizeof(CBlkPool),,bp);
|
||||
m=(bp(U8 *)+sizeof(CBlkPool)+sizeof(CHeapCtrl)+PAGE_SIZE-1)&~(PAGE_SIZE-1);
|
||||
num=(bp(U8 *)+pages512<<PAGE_BITS-m(U8 *))>>PAGE_BITS;
|
||||
bp->alloced_u8s=(pages512-num)<<PAGE_BITS;
|
||||
m=(bp(U8 *)+sizeof(CBlkPool)+sizeof(CHeapCtrl)+MEM_PAGE_SIZE-1)&
|
||||
~(MEM_PAGE_SIZE-1);
|
||||
num=(bp(U8 *)+pages512<<MEM_PAGE_BITS-m(U8 *))>>MEM_PAGE_BITS;
|
||||
bp->alloced_u8s=(pages512-num)<<MEM_PAGE_BITS;
|
||||
BlkPoolAdd(bp,m,num);
|
||||
return hc;
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ _MALLOC::
|
||||
PAUSE //don't know if this instruction helps
|
||||
JC @@25
|
||||
|
||||
CMP RAX,HEAP_HASH_SIZE
|
||||
CMP RAX,MEM_HEAP_HASH_SIZE
|
||||
JAE @@30
|
||||
MOV RSI,U64 CHeapCtrl.heap_hash[RAX+RDX]
|
||||
TEST RSI,RSI
|
||||
@@ -51,8 +51,8 @@ _MALLOC::
|
||||
JMP I32 MALLOC_ALMOST_DONE
|
||||
|
||||
//Big allocation
|
||||
@@30: ADD RAX,sizeof(CMemBlk)+PAGE_SIZE-1
|
||||
SHR RAX,PAGE_BITS
|
||||
@@30: ADD RAX,sizeof(CMemBlk)+MEM_PAGE_SIZE-1
|
||||
SHR RAX,MEM_PAGE_BITS
|
||||
|
||||
PUSH RDX //preserve HeapCtrl
|
||||
PUSH RAX //num blks (we must pass address of this)
|
||||
@@ -66,7 +66,7 @@ _MALLOC::
|
||||
TEST RSI,RSI
|
||||
JZ @@45 //Out of memory
|
||||
|
||||
SHL RAX,PAGE_BITS
|
||||
SHL RAX,MEM_PAGE_BITS
|
||||
SUB RAX,sizeof(CMemBlk)
|
||||
ADD RSI,sizeof(CMemBlk)
|
||||
JMP I32 MALLOC_ALMOST_DONE
|
||||
@@ -79,8 +79,8 @@ _MALLOC::
|
||||
TEST RSI,RSI
|
||||
JNZ @@55
|
||||
PUSH RAX //-**** save byte size
|
||||
ADD RAX,16*PAGE_SIZE-1
|
||||
SHR RAX,PAGE_BITS
|
||||
ADD RAX,16*MEM_PAGE_SIZE-1
|
||||
SHR RAX,MEM_PAGE_BITS
|
||||
|
||||
PUSH RDX //preserve HeapCtrl
|
||||
PUSH RAX //num blks (we must pass address of this)
|
||||
@@ -105,7 +105,7 @@ _MALLOC::
|
||||
JMP I32 MALLOC_FINAL_EXIT //Never gets here, hopefully.
|
||||
|
||||
@@50: LEA RSI,U64 sizeof(CMemBlk)[RSI]
|
||||
SHL RAX,PAGE_BITS
|
||||
SHL RAX,MEM_PAGE_BITS
|
||||
SUB RAX,sizeof(CMemBlk)
|
||||
LEA RBX,U64 CHeapCtrl.malloc_free_lst-CMemUnused.next[RDX]
|
||||
MOV RDI,U64 CMemUnused.next[RBX]
|
||||
@@ -292,7 +292,7 @@ _FREE::
|
||||
|
||||
MOV RDX,U64 CMemUsed.hc[RSI]
|
||||
#endif
|
||||
CMP RAX,HEAP_HASH_SIZE
|
||||
CMP RAX,MEM_HEAP_HASH_SIZE
|
||||
JAE @@50
|
||||
|
||||
#assert CMemUnused.size==CMemUsed.size
|
||||
|
||||
+11
-11
@@ -14,7 +14,7 @@ Return: NULL if out of memory.
|
||||
CLI
|
||||
while (LBts(&bp->locked_flags,BPlf_LOCKED))
|
||||
PAUSE
|
||||
num<<=21-PAGE_BITS;
|
||||
num<<=21-MEM_PAGE_BITS;
|
||||
|
||||
m=&bp->mem_free_2meg_lst;
|
||||
while (TRUE) {
|
||||
@@ -28,7 +28,7 @@ Return: NULL if out of memory.
|
||||
goto am_done;
|
||||
} else {
|
||||
result->pages-=num;
|
||||
result(U8 *)+=result->pages<<PAGE_BITS;
|
||||
result(U8 *)+=result->pages<<MEM_PAGE_BITS;
|
||||
result->pages=num;
|
||||
goto am_done;
|
||||
}
|
||||
@@ -53,20 +53,20 @@ Return: NULL if out of memory.
|
||||
goto am_done;
|
||||
}
|
||||
} else {
|
||||
if (i=(result(U8 *)&0x1FFFFF)>>PAGE_BITS) {
|
||||
j=1<<(21-PAGE_BITS)-i;
|
||||
if (i=(result(U8 *)&0x1FFFFF)>>MEM_PAGE_BITS) {
|
||||
j=1<<(21-MEM_PAGE_BITS)-i;
|
||||
if (result->pages<num+j)
|
||||
m=result;
|
||||
else if (result->pages==num+j) {
|
||||
result->pages-=num;
|
||||
result(U8 *)+=result->pages<<PAGE_BITS;
|
||||
result(U8 *)+=result->pages<<MEM_PAGE_BITS;
|
||||
result->pages=num;
|
||||
goto am_done;
|
||||
} else {
|
||||
m1=result;
|
||||
result(U8 *)+=j<<PAGE_BITS;
|
||||
result(U8 *)+=j<<MEM_PAGE_BITS;
|
||||
result->pages=num;
|
||||
m=result(U8 *)+num<<PAGE_BITS;
|
||||
m=result(U8 *)+num<<MEM_PAGE_BITS;
|
||||
m->pages=m1->pages-num-j;
|
||||
m1->pages=j;
|
||||
m->next=m1->next;
|
||||
@@ -75,7 +75,7 @@ Return: NULL if out of memory.
|
||||
goto am_done;
|
||||
}
|
||||
} else {
|
||||
m=m->next=result(U8 *)+num<<PAGE_BITS;
|
||||
m=m->next=result(U8 *)+num<<MEM_PAGE_BITS;
|
||||
m->next=result->next;
|
||||
m->pages=result->pages-num;
|
||||
m->mb_signature=MBS_UNUSED_SIGNATURE_VAL;
|
||||
@@ -86,9 +86,9 @@ Return: NULL if out of memory.
|
||||
}
|
||||
}
|
||||
am_done:
|
||||
i=num<<PAGE_BITS;
|
||||
i=num<<MEM_PAGE_BITS;
|
||||
bp->used_u8s+=i;
|
||||
num>>=21-PAGE_BITS;
|
||||
num>>=21-MEM_PAGE_BITS;
|
||||
*_pages2Meg=num;
|
||||
m=result;
|
||||
m1=m(U8 *)+i;
|
||||
@@ -170,7 +170,7 @@ U0 Mem2MegFree(CMemBlk *m,I64 pages2Meg,CBlkPool *bp=NULL)
|
||||
while (LBts(&bp->locked_flags,BPlf_LOCKED))
|
||||
PAUSE
|
||||
m->mb_signature=MBS_UNUSED_SIGNATURE_VAL;
|
||||
m->pages=pages2Meg<<(21-PAGE_BITS);
|
||||
m->pages=pages2Meg<<(21-MEM_PAGE_BITS);
|
||||
bp->used_u8s-=pages2Meg<<21;
|
||||
m->next=bp->mem_free_2meg_lst;
|
||||
bp->mem_free_2meg_lst=m;
|
||||
|
||||
+16
-16
@@ -23,21 +23,21 @@ Return: NULL if out of memory.
|
||||
CLI
|
||||
while (LBts(&bp->locked_flags,BPlf_LOCKED))
|
||||
PAUSE
|
||||
if (num<FREE_PAGE_HASH_SIZE) {
|
||||
if (num<MEM_FREE_PAGE_HASH_SIZE) {
|
||||
if (result=bp->free_page_hash[num]) {
|
||||
bp->free_page_hash[num]=result->next;
|
||||
goto at_done;
|
||||
}
|
||||
i=Bsr(FREE_PAGE_HASH_SIZE)+1;
|
||||
i=Bsr(MEM_FREE_PAGE_HASH_SIZE)+1;
|
||||
} else {
|
||||
//We'll now round-up to a power of two.
|
||||
//There is some overhead on allocations and
|
||||
//we wouldn't want to round to the next
|
||||
//power of two if a power of two was requested.
|
||||
//So we use a little more than a power of two.
|
||||
num-=2;
|
||||
num-=MEM_EXTRA_HASH2_PAGES;
|
||||
i=Bsr(num)+1;
|
||||
num=1<<i+2;
|
||||
num=1<<i+MEM_EXTRA_HASH2_PAGES;
|
||||
if (result=bp->free_page_hash2[i]) {
|
||||
bp->free_page_hash2[i]=result->next;
|
||||
goto at_done;
|
||||
@@ -50,11 +50,11 @@ Return: NULL if out of memory.
|
||||
//freed larger size block... and, screw-it, return the whole thing.
|
||||
do {
|
||||
if (result=bp->free_page_hash2[++i]) {
|
||||
num=1<<i+2;
|
||||
num=1<<i+MEM_EXTRA_HASH2_PAGES;
|
||||
bp->free_page_hash2[i]=result->next;
|
||||
goto at_done;
|
||||
}
|
||||
} while (i<64-PAGE_BITS-1);
|
||||
} while (i<64-MEM_PAGE_BITS-1);
|
||||
num=0;
|
||||
result=NULL; //Out of memory
|
||||
goto at_done;
|
||||
@@ -67,7 +67,7 @@ Return: NULL if out of memory.
|
||||
goto at_done;
|
||||
} else {
|
||||
result->pages-=num;
|
||||
result(U8 *)+=result->pages<<PAGE_BITS;
|
||||
result(U8 *)+=result->pages<<MEM_PAGE_BITS;
|
||||
result->pages=num;
|
||||
goto at_done;
|
||||
}
|
||||
@@ -75,7 +75,7 @@ Return: NULL if out of memory.
|
||||
}
|
||||
at_done:
|
||||
*_pages512=num;
|
||||
bp->used_u8s+=num<<PAGE_BITS;
|
||||
bp->used_u8s+=num<<MEM_PAGE_BITS;
|
||||
LBtr(&bp->locked_flags,BPlf_LOCKED);
|
||||
POPFD
|
||||
return result;
|
||||
@@ -92,8 +92,8 @@ U0 Mem512Free(CMemBlk *m,I64 pages512,CBlkPool *bp=NULL)
|
||||
PAUSE
|
||||
m->mb_signature=MBS_UNUSED_SIGNATURE_VAL;
|
||||
m->pages=pages512;
|
||||
bp->used_u8s-=pages512<<PAGE_BITS;
|
||||
if (pages512<FREE_PAGE_HASH_SIZE) {
|
||||
bp->used_u8s-=pages512<<MEM_PAGE_BITS;
|
||||
if (pages512<MEM_FREE_PAGE_HASH_SIZE) {
|
||||
m->next=bp->free_page_hash[pages512];
|
||||
bp->free_page_hash[pages512]=m;
|
||||
} else {
|
||||
@@ -102,7 +102,7 @@ U0 Mem512Free(CMemBlk *m,I64 pages512,CBlkPool *bp=NULL)
|
||||
//we wouldn't want to round to the next
|
||||
//power of two if a power of two was requested.
|
||||
//So we use a little more than a power of two.
|
||||
pages512-=2;
|
||||
pages512-=MEM_EXTRA_HASH2_PAGES;
|
||||
i=Bsr(pages512);
|
||||
m->next=bp->free_page_hash2[i];
|
||||
bp->free_page_hash2[i]=m;
|
||||
@@ -124,12 +124,12 @@ Return: NULL if out of memory.
|
||||
if (result=Mem512Alloc(_pages512,hc->bp)) {
|
||||
QueIns(result,hc->last_mem_blk);
|
||||
result->mb_signature=MBS_USED_SIGNATURE_VAL;
|
||||
hc->alloced_u8s+=*_pages512<<PAGE_BITS;
|
||||
hc->alloced_u8s+=*_pages512<<MEM_PAGE_BITS;
|
||||
|
||||
//Tidy-up free lst (Move into heap hash)
|
||||
//because if free lst gets long, delay causes crash
|
||||
threshold=HEAP_HASH_SIZE>>4;
|
||||
#assert HEAP_HASH_SIZE>>4>=sizeof(U8 *)
|
||||
threshold=MEM_HEAP_HASH_SIZE>>4;
|
||||
#assert MEM_HEAP_HASH_SIZE>>4>=sizeof(U8 *)
|
||||
do {
|
||||
cnt=0;
|
||||
_uum=&hc->malloc_free_lst;
|
||||
@@ -147,7 +147,7 @@ Return: NULL if out of memory.
|
||||
}
|
||||
}
|
||||
threshold<<=1;
|
||||
} while (cnt>8 && threshold<=HEAP_HASH_SIZE);
|
||||
} while (cnt>8 && threshold<=MEM_HEAP_HASH_SIZE);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -161,7 +161,7 @@ U0 Mem512TaskFree(CMemBlk *m,CHeapCtrl *hc)
|
||||
SysBadFree(m);
|
||||
else {
|
||||
QueRem(m);
|
||||
hc->alloced_u8s-=m->pages<<PAGE_BITS;
|
||||
hc->alloced_u8s-=m->pages<<MEM_PAGE_BITS;
|
||||
Mem512Free(m,m->pages,hc->bp);
|
||||
}
|
||||
POPFD
|
||||
|
||||
@@ -124,7 +124,8 @@ pain without MAlloc up-and-running.
|
||||
#define ESTIMATED_MISC_ALLOCS 0x100000
|
||||
|
||||
#assert CONSERVATIVE_16MEG_SIZE-
|
||||
(SYS_FIXED_AREA+sizeof(CSysFixedArea))>ADAM_STK+ESTIMATED_MISC_ALLOCS
|
||||
(SYS_FIXED_AREA+sizeof(CSysFixedArea))>MEM_ADAM_STK+
|
||||
ESTIMATED_MISC_ALLOCS
|
||||
|
||||
//EBX=BASE EAX=SIZE
|
||||
TEST U8 [SYS_MEM_INIT_FLAG],1
|
||||
@@ -136,7 +137,7 @@ pain without MAlloc up-and-running.
|
||||
REP_STOSB
|
||||
POP EAX
|
||||
|
||||
@@40: SHR EAX,PAGE_BITS
|
||||
@@40: SHR EAX,MEM_PAGE_BITS
|
||||
MOV ESI,SYS_FIXED_AREA+CSysFixedArea.adam_bp
|
||||
MOV EDI,U32 CBlkPool.mem_free_lst[ESI]
|
||||
MOV U32 CMemBlk.next[EBX],EDI
|
||||
@@ -145,7 +146,7 @@ pain without MAlloc up-and-running.
|
||||
MOV U32 CBlkPool.mem_free_lst+4[ESI],0
|
||||
MOV U32 CMemBlk.mb_signature[EBX],MBS_UNUSED_SIGNATURE_VAL
|
||||
MOV U32 CMemBlk.pages[EBX],EAX
|
||||
SHL EAX,PAGE_BITS
|
||||
SHL EAX,MEM_PAGE_BITS
|
||||
ADD U32 CBlkPool.alloced_u8s[ESI],EAX
|
||||
RET
|
||||
}
|
||||
|
||||
@@ -80,11 +80,11 @@ CTSS *TSSNew(I64 cpu_num)
|
||||
tss->io_map_offset=offset(CTSS.io_map);
|
||||
MemSet(tss->io_map,0xFF,0x10000/8);
|
||||
|
||||
tss->st0=MAlloc(INTERRUPT_STK);
|
||||
tss->st0=MAlloc(MEM_INTERRUPT_STK);
|
||||
tss->rsp0=tss->st0(U8 *)+MSize(tss->st0);
|
||||
tss->st1=MAlloc(INTERRUPT_STK);
|
||||
tss->st1=MAlloc(MEM_INTERRUPT_STK);
|
||||
tss->rsp1=tss->st1(U8 *)+MSize(tss->st1);
|
||||
tss->st2=MAlloc(INTERRUPT_STK);
|
||||
tss->st2=MAlloc(MEM_INTERRUPT_STK);
|
||||
tss->rsp2=tss->st2(U8 *)+MSize(tss->st2);
|
||||
|
||||
tss->tr =offset(CGDT.tr)+cpu_num*16;
|
||||
@@ -352,7 +352,7 @@ U0 Core0StartMP()
|
||||
|
||||
for (i=1;i<my_mp_cnt;i++) {
|
||||
StrPrint(buf,"Seth Task CPU#%d",i);
|
||||
task=Spawn(&CoreAPSethInit,NULL,buf,,,SETH_STK,0);
|
||||
task=Spawn(&CoreAPSethInit,NULL,buf,,,MEM_SETH_STK,0);
|
||||
task->rflags=RFLAGG_START;
|
||||
//$LK,"CTask",A="MN:CTask"$ alloced off this core's seth_task's heap (Which is Adam)
|
||||
CPUStructInit(i,&cpu_structs[i],task);
|
||||
@@ -397,7 +397,7 @@ U0 Core0Init()
|
||||
}
|
||||
|
||||
interrupt U0 IntMPCrash()
|
||||
{//Entering the debugger from another core causes an interrupt on core#0
|
||||
{//Entering the debugger from another core causes an interrupt on core0
|
||||
//Which calls this routine.
|
||||
*LAPIC_EOI(U32 *)=0;
|
||||
mp_cnt=1;
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
/*On each core, tasks are linked in a
|
||||
circular doubly-linked list queue with
|
||||
the Seth task as the head. On core#0,
|
||||
the Seth task as the head. On core0,
|
||||
the queue order represents the front-to-back
|
||||
window stack order with the window mgr
|
||||
as the wallpaper.
|
||||
@@ -224,7 +224,7 @@ RESTORE_RSI_TASK2:
|
||||
JC @@20 //Jmp if had chance for IRQ already
|
||||
MOV RAX,U64 GS:CCPU.idle_task[RAX]
|
||||
MOV RSP,U64 CTask.stk[RAX]
|
||||
ADD RSP,DFT_STK+CTaskStk.stk_base //Rst to top
|
||||
ADD RSP,MEM_DFT_STK+CTaskStk.stk_base //Rst to top
|
||||
CALL SET_FS_BASE
|
||||
STI //Restore idle task so we can unmask IRQs.
|
||||
HLT
|
||||
|
||||
Reference in new issue
Block a user