TempleOSCDV5.00.ISO
This commit is contained in:
1 parent
122df6338e
commit
f6eacf7744
374 files changed
+11078
-11204
No files matched your search
@@ -19,10 +19,10 @@ BDVD_START::
|
||||
MOV SP,BOOT_STK_SIZE+DVD_BOOT_LOADER_SIZE
|
||||
STI
|
||||
|
||||
CALL BDVD_GET_IP
|
||||
BDVD_GET_IP:
|
||||
CALL BDVD_GET_RIP
|
||||
BDVD_GET_RIP:
|
||||
POP BX
|
||||
SUB BX,BDVD_GET_IP-BDVD_START
|
||||
SUB BX,BDVD_GET_RIP-BDVD_START
|
||||
SHR BX,4
|
||||
//This copies this bootloader's code to 0x$TX,"00096600",D="DD_BOOT_HIGH_LOC_DVD"$
|
||||
MOV AX,CS
|
||||
|
||||
@@ -21,10 +21,10 @@ BHD_CODE::
|
||||
MOV SP,BOOT_STK_SIZE+MODULE_SIZE
|
||||
STI
|
||||
|
||||
CALL BHD_GET_IP
|
||||
BHD_GET_IP:
|
||||
CALL BHD_GET_RIP
|
||||
BHD_GET_RIP:
|
||||
POP BX
|
||||
SUB BX,BHD_GET_IP-BHD_START
|
||||
SUB BX,BHD_GET_RIP-BHD_START
|
||||
SHR BX,4
|
||||
//This copies this bootloader's code to 0x$TX,"00096C00",D="DD_BOOT_HIGH_LOC_HD"$
|
||||
MOV AX,CS
|
||||
|
||||
@@ -30,10 +30,10 @@ BMHD_CODE::
|
||||
|
||||
MOV ES,AX
|
||||
|
||||
CALL BMHD_GET_IP
|
||||
BMHD_GET_IP:
|
||||
CALL BMHD_GET_RIP
|
||||
BMHD_GET_RIP:
|
||||
POP BX
|
||||
SUB BX,BMHD_GET_IP-BMHD_START
|
||||
SUB BX,BMHD_GET_RIP-BMHD_START
|
||||
MOV CX,BX
|
||||
SHR BX,4
|
||||
//This copies this bootloader's code to 0x$TX,"00096C00",D="DD_BOOT_HIGH_LOC_MHD"$
|
||||
@@ -41,8 +41,8 @@ BMHD_GET_IP:
|
||||
PUSH AX
|
||||
ADD AX,BX
|
||||
MOV DS,AX
|
||||
MOV U16 [BMHD_OLD_CS_IP-BMHD_START],CX
|
||||
POP U16 [BMHD_OLD_CS_IP+2-BMHD_START]
|
||||
MOV U16 [BMHD_OLD_CS_RIP-BMHD_START],CX
|
||||
POP U16 [BMHD_OLD_CS_RIP+2-BMHD_START]
|
||||
|
||||
MOV CX,MODULE_SIZE
|
||||
XOR SI,SI
|
||||
@@ -57,7 +57,7 @@ BMHD_GET_IP:
|
||||
DU16 BMHD_HISTART-BMHD_START,BOOT_HIGH_LOC_MHD;
|
||||
|
||||
BMHD_BIOS_DRV_NUM: DU8 0;
|
||||
BMHD_OLD_CS_IP: DU16 0,0;
|
||||
BMHD_OLD_CS_RIP: DU16 0,0;
|
||||
//Gets patched by $LK,"BootHDIns",A="MN:BootHDIns"$().
|
||||
BMHD_BLK_CNT:: DU16 0;
|
||||
|
||||
@@ -97,7 +97,7 @@ BMHD_HISTART:
|
||||
LOOP @@05
|
||||
|
||||
MOV DL,U8 [BMHD_BIOS_DRV_NUM-BMHD_START]
|
||||
MOV EBX,U32 [BMHD_OLD_CS_IP-BMHD_START]
|
||||
MOV EBX,U32 [BMHD_OLD_CS_RIP-BMHD_START]
|
||||
//My assembler doesn't support 16-bit very well.
|
||||
DU8 0xEA; //JMP BOOT_RAM_BASE:0000
|
||||
DU16 0,BOOT_RAM_BASE/16;
|
||||
|
||||
@@ -15,7 +15,7 @@ BMHD2_START::
|
||||
//This copies this bootloader's code to 0x$TX,"00096A00",D="DD_BOOT_HIGH_LOC_MHD2"$
|
||||
MOV AX,CS
|
||||
MOV DS,AX
|
||||
MOV U32 [BMHD2_OLD_CS_IP-BMHD2_START],EBX
|
||||
MOV U32 [BMHD2_OLD_CS_RIP-BMHD2_START],EBX
|
||||
MOV U8 [BMHD2_BIOS_DRV_NUM-BMHD2_START],DL
|
||||
|
||||
MOV CX,MODULE_SIZE
|
||||
@@ -93,9 +93,9 @@ BMHD2_HISTART:
|
||||
@@10: MOV U32 [BMHD2_DAP_BLK_LO-BMHD2_START],EBX
|
||||
MOV U32 [BMHD2_DAP_BLK_HI-BMHD2_START],EAX
|
||||
|
||||
MOV AX,U16 [BMHD2_OLD_CS_IP-BMHD2_START]
|
||||
MOV AX,U16 [BMHD2_OLD_CS_RIP-BMHD2_START]
|
||||
SHR AX,4
|
||||
ADD AX,U16 [BMHD2_OLD_CS_IP+2-BMHD2_START]
|
||||
ADD AX,U16 [BMHD2_OLD_CS_RIP+2-BMHD2_START]
|
||||
MOV U16 [BMHD2_DAP_BUF+2-BMHD2_START],AX //ES:0000
|
||||
MOV SI,BMHD2_DAP-BMHD2_START //DS:SI=DAP
|
||||
MOV DL,U8 [BMHD2_BIOS_DRV_NUM-BMHD2_START]
|
||||
@@ -115,7 +115,7 @@ BMHD2_HISTART:
|
||||
|
||||
//My assembler doesn't support 16-bit very well.
|
||||
DU8 0xEA; //JMP xxxx:yyyy
|
||||
BMHD2_OLD_CS_IP:
|
||||
BMHD2_OLD_CS_RIP:
|
||||
DU16 0,0;
|
||||
BMHD2_END::
|
||||
//Continues here $LK,"::/Adam/Opt/Boot/BootHD.HC",A="FF:::/Adam/Opt/Boot/BootHD.HC,START"$
|
||||
|
||||
@@ -30,12 +30,13 @@ _extern _HI_CALL I64 HiCall(U8 *machine_code);
|
||||
_extern _HI_MEMCPY U8 *HiMemCpy(U8 *dst,U8 *src,I64 cnt);
|
||||
|
||||
#help_index "Boot"
|
||||
public U0 BootRAM(U8 *filename)
|
||||
{//Softboot Kernel Bin file. No hardware reset.
|
||||
public U0 BootRAM(U8 *filename=NULL)
|
||||
{//Softboot Kernel.BIN file. No hardware reset.
|
||||
I64 size;
|
||||
CKernel *hi_image,*lo_image=sys_boot_base-sizeof(CBinFile),
|
||||
CKernel *hi_image,*lo_image=mem_boot_base-sizeof(CBinFile),
|
||||
reg *sys_ram_reboot;
|
||||
|
||||
if (!filename)
|
||||
filename="::/Kernel/" KERNEL_BIN_C;
|
||||
do if (!(hi_image=FileRead(filename,&size))) return;
|
||||
while (hi_image<0x100000); //If alloc from low 640K, just get another copy.
|
||||
|
||||
|
||||
@@ -25,7 +25,27 @@ class CElTorito
|
||||
U8 zero2[20];
|
||||
};
|
||||
|
||||
U0 RedSeaISO9660(U8 *iso_filename,U8 drv_let,I64 stage2_blk=0,I64 stage2_size=0)
|
||||
U0 RedSeaISO9660Stage1(U8 *iso_filename,U8 *stage2_filename)
|
||||
{
|
||||
CDirEntry de;
|
||||
CFile *out_file=NULL;
|
||||
U8 *stage1_buf=CAlloc(DVD_BOOT_LOADER_SIZE);
|
||||
if (FileFind(stage2_filename,&de) && (out_file=FOpen(iso_filename,"wc+"))) {
|
||||
MemCpy(stage1_buf,BDVD_START,BDVD_END-BDVD_START);
|
||||
*(BDVD_BLK_LO -BDVD_START+stage1_buf)(U32 *)=de.cluster>>2;
|
||||
*(BDVD_BLK_CNT -BDVD_START+stage1_buf)(U16 *)=
|
||||
(de.size+DVD_BLK_SIZE-1)>>(BLK_SIZE_BITS+2);
|
||||
*(BDVD_SHIFT_BLKS -BDVD_START+stage1_buf)(U16 *)=de.cluster&3;
|
||||
if (de.cluster&3)
|
||||
*(BDVD_BLK_CNT -BDVD_START+stage1_buf)(U16 *)+=1;
|
||||
FWBlks(out_file,stage1_buf,
|
||||
20<<2+1<<2,DVD_BOOT_LOADER_SIZE/BLK_SIZE);
|
||||
FClose(out_file);
|
||||
}
|
||||
Free(stage1_buf);
|
||||
}
|
||||
|
||||
U0 RedSeaISO9660(U8 *iso_filename,U8 drv_let)
|
||||
{
|
||||
CDrv *dv=Let2Drv(drv_let);
|
||||
CISO1PriDesc *iso_pri=CAlloc(DVD_BLK_SIZE),
|
||||
@@ -35,8 +55,7 @@ U0 RedSeaISO9660(U8 *iso_filename,U8 drv_let,I64 stage2_blk=0,I64 stage2_size=0)
|
||||
I64 iso_size=0,i,j;
|
||||
U32 *d;
|
||||
CElTorito *et=CAlloc(DVD_BLK_SIZE);
|
||||
U8 *stage1_buf=CAlloc(DVD_BOOT_LOADER_SIZE),
|
||||
*zero_buf=CAlloc(DVD_BLK_SIZE);
|
||||
U8 *zero_buf=CAlloc(DVD_BLK_SIZE);
|
||||
CFile *out_file=NULL;
|
||||
|
||||
if (out_file=FOpen(iso_filename,"wc+")) {
|
||||
@@ -87,20 +106,9 @@ U0 RedSeaISO9660(U8 *iso_filename,U8 drv_let,I64 stage2_blk=0,I64 stage2_size=0)
|
||||
et->sect_cnt=4; //5 seems like the limit, 4 is safer
|
||||
et->load_rba=20<<2>>2+1;
|
||||
FWBlks(out_file,et,20<<2,4);
|
||||
|
||||
MemCpy(stage1_buf,BDVD_START,BDVD_END-BDVD_START);
|
||||
*(BDVD_BLK_LO -BDVD_START+stage1_buf)(U32 *)=stage2_blk>>2;
|
||||
*(BDVD_BLK_CNT -BDVD_START+stage1_buf)(U16 *)=
|
||||
(stage2_size+DVD_BLK_SIZE-1)>>(BLK_SIZE_BITS+2);
|
||||
*(BDVD_SHIFT_BLKS -BDVD_START+stage1_buf)(U16 *)=stage2_blk&3;
|
||||
if (stage2_blk&3)
|
||||
*(BDVD_BLK_CNT -BDVD_START+stage1_buf)(U16 *)+=1;
|
||||
FWBlks(out_file,stage1_buf,
|
||||
20<<2+1<<2,DVD_BOOT_LOADER_SIZE/BLK_SIZE);
|
||||
FClose(out_file);
|
||||
}
|
||||
Free(zero_buf);
|
||||
Free(stage1_buf);
|
||||
Free(et);
|
||||
Free(iso_pri);
|
||||
Free(iso_boot);
|
||||
@@ -129,7 +137,7 @@ public I64 RedSeaISO(U8 *_iso_filename=NULL,U8 *_src_dir,
|
||||
U8 *_stage2_filename=NULL)
|
||||
{//See $LK,"::/Misc/DoDistro.HC"$. Must be ISO.C
|
||||
I64 i,res,root_cnt,root_dir_blks,bitmap_blks,bitmap_blks1;
|
||||
CDirEntry *tmpde,de;
|
||||
CDirEntry *tmpde;
|
||||
U8 buf[STR_LEN],*iso_filename,*src_dir,*stage2_filename;
|
||||
CDrv *dv=DrvMakeFreeSlot(DrvNextFreeLet('Q')); //First $LK,"BDT_ISO_FILE_WRITE",A="MN:BDT_ISO_FILE_WRITE"$
|
||||
CBlkDev *bd=BlkDevNextFreeSlot(dv->drv_let,BDT_ISO_FILE_WRITE);
|
||||
@@ -162,13 +170,10 @@ public I64 RedSeaISO(U8 *_iso_filename=NULL,U8 *_src_dir,
|
||||
bd->max_blk--; //Inclusive.
|
||||
bd->file_dsk_name=AStrNew(iso_filename);
|
||||
bd->init_root_dir_blks=root_dir_blks;
|
||||
BlkDevAdd(bd,TRUE,TRUE);
|
||||
BlkDevAdd(bd,,TRUE,TRUE);
|
||||
StrPrint(buf,"%C:/",dv->drv_let);
|
||||
CopyTree(src_dir,buf,TRUE);
|
||||
if (FileFind(stage2_filename,&de))
|
||||
RedSeaISO9660(iso_filename,dv->drv_let,de.cluster,de.size);
|
||||
else
|
||||
RedSeaISO9660(iso_filename,dv->drv_let);
|
||||
RedSeaISO9660Stage1(iso_filename,stage2_filename);
|
||||
DrvDel(dv);
|
||||
BlkDevDel(bd);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,156 @@
|
||||
#help_index "DolDoc/Cmd Line (Typically)"
|
||||
|
||||
U0 CursorRemFile(U8 *filename)
|
||||
{//Rem ASCII 5 cursor from one file.
|
||||
CDoc *doc=DocRead(filename,DOCF_PLAIN_TEXT|DOCF_NO_CURSOR);
|
||||
DocWrite(doc);
|
||||
DocDel(doc);
|
||||
}
|
||||
public U0 CursorRem(U8 *files_find_mask="*")
|
||||
{//Rem ASCII 5 cursor.
|
||||
I64 fuf_flags=0;
|
||||
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+r+T+f+F+O");
|
||||
CDirEntry *tmpde=FilesFind(files_find_mask,fuf_flags),*tmpde1=tmpde;
|
||||
while (tmpde) {
|
||||
CursorRemFile(tmpde->full_name);
|
||||
Touch(tmpde->full_name,"",,tmpde->datetime);
|
||||
tmpde=tmpde->next;
|
||||
}
|
||||
DirTreeDel(tmpde1);
|
||||
}
|
||||
|
||||
U0 CollapseFile(U8 *filename,Bool collapse=TRUE)
|
||||
{//Collapse $LK,"DolDoc",A="FI:::/Doc/DolDocOverview.DD"$ trees in one file.
|
||||
CDoc *doc=DocRead(filename,DOCF_NO_CURSOR);
|
||||
DocCollapse(collapse,doc);
|
||||
DocWrite(doc);
|
||||
DocDel(doc);
|
||||
}
|
||||
public U0 Collapse(U8 *files_find_mask="*",
|
||||
Bool collapse=TRUE,U8 *fu_flags=NULL)
|
||||
{//Collapse $LK,"DolDoc",A="FI:::/Doc/DolDocOverview.DD"$ trees.
|
||||
I64 fuf_flags=0;
|
||||
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+r+f+F+$$+O");
|
||||
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),fu_flags);
|
||||
CDirEntry *tmpde=FilesFind(files_find_mask,fuf_flags),*tmpde1=tmpde;
|
||||
while (tmpde && !Bt(&fuf_flags,FUf_CANCEL)) {
|
||||
CollapseFile(tmpde->full_name,collapse);
|
||||
Touch(tmpde->full_name,"",,tmpde->datetime);
|
||||
tmpde=tmpde->next;
|
||||
}
|
||||
DirTreeDel(tmpde1);
|
||||
}
|
||||
|
||||
I64 DocOptEntry(CDoc *,CDocEntry *doc_e,I64 fuf_flags)
|
||||
{
|
||||
U8 *st,*st2,**_dst;
|
||||
I64 i,res=0;
|
||||
|
||||
if (doc_e->de_flags&DOCEF_LINK && doc_e->de_flags&(DOCEF_AUX_STR|DOCEF_TAG)) {
|
||||
if (doc_e->de_flags & DOCEF_AUX_STR && doc_e->de_flags & DOCEF_TAG &&
|
||||
!MemCmp(doc_e->aux_str,"FI:",3) &&
|
||||
!StrCmp(doc_e->aux_str+3,doc_e->tag)) {
|
||||
Free(doc_e->aux_str);
|
||||
doc_e->aux_str=NULL;
|
||||
doc_e->de_flags&=~DOCEF_AUX_STR;
|
||||
res++;
|
||||
}
|
||||
if (doc_e->de_flags & DOCEF_AUX_STR)
|
||||
_dst=&doc_e->aux_str;
|
||||
else
|
||||
_dst=&doc_e->tag;
|
||||
if (StrMatch(".Z",*_dst)) {
|
||||
st=DocLinkFile(*_dst);
|
||||
if (FileFind(st)) {
|
||||
if (IsDotZ(st))
|
||||
st[StrLen(st)-2]=0;
|
||||
i=StrLen(st);
|
||||
if ((st2=StrMatch(st,*_dst)) && st2[i]=='.' && st2[i+1]=='Z') {
|
||||
StrCpy(st2+i,st2+i+2);
|
||||
res++;
|
||||
}
|
||||
}
|
||||
Free(st);
|
||||
}
|
||||
if (fuf_flags&FUF_RISKY) {
|
||||
if (doc_e->de_flags & DOCEF_AUX_STR) {
|
||||
if (st=StrMatch(".Z",doc_e->aux_str)) {
|
||||
StrCpy(st,st+2);
|
||||
res++;
|
||||
}
|
||||
}
|
||||
if (doc_e->de_flags&DOCEF_TAG) {
|
||||
if (st=StrMatch(".Z",doc_e->tag)) {
|
||||
StrCpy(st,st+2);
|
||||
res++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
I64 DocOptDoc(CDoc *doc,I64 fuf_flags)
|
||||
{//Optimize Doc.
|
||||
Bool unlock=DocLock(doc);
|
||||
I64 res=0;
|
||||
CDocEntry *doc_e,*doc_e1,*doc_e_last;
|
||||
DocRecalc(doc);
|
||||
doc_e_last=NULL;
|
||||
doc_e=doc->head.next;
|
||||
while (doc_e!=doc) {
|
||||
doc_e1=doc_e->next;
|
||||
if (res+=DocOptEntry(doc,doc_e,fuf_flags))
|
||||
res+=DocOptEntry(doc,doc_e,fuf_flags);
|
||||
if (doc_e_last && doc_e_last->type&~0xFF00==doc_e->type&~0xFF00 &&
|
||||
doc_e_last->de_flags==doc_e->de_flags &&
|
||||
Bt(doldoc.type_flags_chk_dup,doc_e->type_u8) &&
|
||||
doc_e_last->attr==doc_e->attr) {
|
||||
DocEntryDel(doc,doc_e);
|
||||
res++;
|
||||
} else
|
||||
doc_e_last=doc_e;
|
||||
doc_e=doc_e1;
|
||||
}
|
||||
DocRecalc(doc);
|
||||
if (unlock)
|
||||
DocUnlock(doc);
|
||||
return res;
|
||||
}
|
||||
I64 DocOptFile(U8 *filename,I64 fuf_flags)
|
||||
{//Optimize file.
|
||||
I64 res;
|
||||
CDoc *doc=DocRead(filename);
|
||||
if (res=DocOptDoc(doc,fuf_flags)) {
|
||||
"-%d:%s\n",res,doc->filename.name;
|
||||
DocWrite(doc);
|
||||
}
|
||||
DocDel(doc);
|
||||
return res;
|
||||
}
|
||||
I64 DocOptLst(CDirEntry *tmpde,I64 fuf_flags)
|
||||
{
|
||||
I64 res=0;
|
||||
CDirEntry *tmpde1;
|
||||
while (tmpde) {
|
||||
tmpde1=tmpde->next;
|
||||
if (tmpde->attr & RS_ATTR_DIR) {
|
||||
if (tmpde->sub) {
|
||||
"Scanning Directory: %s\n",tmpde->full_name;
|
||||
res+=DocOptLst(tmpde->sub,fuf_flags);
|
||||
}
|
||||
} else
|
||||
res+=DocOptFile(tmpde->full_name,fuf_flags);
|
||||
DirEntryDel(tmpde);
|
||||
tmpde=tmpde1;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
public I64 DocOpt(U8 *files_find_mask="*",U8 *fu_flags=NULL)
|
||||
{//Optimize $LK,"DolDoc",A="FI:::/Doc/DolDocOverview.DD"$ files, eliminating aux_str's and .Z's.
|
||||
//+R flag for aggressively risky.
|
||||
I64 fuf_flags=0;
|
||||
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+r+$$");
|
||||
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),fu_flags);
|
||||
return DocOptLst(FilesFind(files_find_mask,fuf_flags&FUG_FILES_FIND),
|
||||
fuf_flags&~FUG_FILES_FIND);
|
||||
}
|
||||
+18
-18
@@ -35,10 +35,10 @@ U0 HeapLogMAlloc(U8 *addr)
|
||||
i=addr>>3 &(HL_HASH_SIZE-1);
|
||||
PUSHFD
|
||||
CLI
|
||||
while (LBts(&sys_semas[SYS_SEMA_HEAPLOG_LOCK],0))
|
||||
while (LBts(&sys_semas[SEMA_HEAPLOG_LOCK],0))
|
||||
PAUSE
|
||||
QueIns(tmphl,heaplog_head[i].last);
|
||||
LBtr(&sys_semas[SYS_SEMA_HEAPLOG_LOCK],0);
|
||||
LBtr(&sys_semas[SEMA_HEAPLOG_LOCK],0);
|
||||
POPFD
|
||||
}
|
||||
}
|
||||
@@ -52,20 +52,20 @@ U0 HeapLogFree(U8 *addr)
|
||||
i=addr>>3 &(HL_HASH_SIZE-1);
|
||||
PUSHFD
|
||||
CLI
|
||||
while (LBts(&sys_semas[SYS_SEMA_HEAPLOG_LOCK],0))
|
||||
while (LBts(&sys_semas[SEMA_HEAPLOG_LOCK],0))
|
||||
PAUSE
|
||||
tmphl=heaplog_head[i].next;
|
||||
while (tmphl!=&heaplog_head[i]) {
|
||||
if (addr==tmphl->addr) {
|
||||
QueRem(tmphl);
|
||||
LBtr(&sys_semas[SYS_SEMA_HEAPLOG_LOCK],0);
|
||||
LBtr(&sys_semas[SEMA_HEAPLOG_LOCK],0);
|
||||
POPFD
|
||||
Free(tmphl);
|
||||
return;
|
||||
}
|
||||
tmphl=tmphl->next;
|
||||
}
|
||||
LBtr(&sys_semas[SYS_SEMA_HEAPLOG_LOCK],0);
|
||||
LBtr(&sys_semas[SEMA_HEAPLOG_LOCK],0);
|
||||
POPFD
|
||||
}
|
||||
}
|
||||
@@ -74,7 +74,7 @@ public Bool HeapLog(Bool val=ON,CTask *task=NULL)
|
||||
{//Turn on. Collect data. Call $LK,"HeapLogAddrRep",A="MN:HeapLogAddrRep"$() or $LK,"HeapLogSizeRep",A="MN:HeapLogSizeRep"$().
|
||||
I64 i;
|
||||
if (val) {
|
||||
if (Bt(&sys_semas[SYS_SEMA_HEAPLOG_ACTIVE],0)) {
|
||||
if (Bt(&sys_semas[SEMA_HEAPLOG_ACTIVE],0)) {
|
||||
"HeapLog Already Active\n";
|
||||
return TRUE;
|
||||
} else {
|
||||
@@ -85,7 +85,7 @@ public Bool HeapLog(Bool val=ON,CTask *task=NULL)
|
||||
heaplog_hc_watched=task;//Actually, not a task, must be a HeapCtrl.
|
||||
PUSHFD
|
||||
CLI
|
||||
while (LBts(&sys_semas[SYS_SEMA_HEAPLOG_LOCK],0))
|
||||
while (LBts(&sys_semas[SEMA_HEAPLOG_LOCK],0))
|
||||
PAUSE
|
||||
heaplog_hc=HeapCtrlInit(,,sys_data_bp);
|
||||
ext[EXT_HEAPLOG_MALLOC]=&HeapLogMAlloc;
|
||||
@@ -93,13 +93,13 @@ public Bool HeapLog(Bool val=ON,CTask *task=NULL)
|
||||
heaplog_head=MAlloc(sizeof(CHeapLogHash)*HL_HASH_SIZE,heaplog_hc);
|
||||
for (i=0;i<HL_HASH_SIZE;i++)
|
||||
QueInit(&heaplog_head[i]);
|
||||
LBtr(&sys_semas[SYS_SEMA_HEAPLOG_LOCK],0);
|
||||
LBtr(&sys_semas[SEMA_HEAPLOG_LOCK],0);
|
||||
POPFD
|
||||
LBts(&sys_semas[SYS_SEMA_HEAPLOG_ACTIVE],0);
|
||||
LBts(&sys_semas[SEMA_HEAPLOG_ACTIVE],0);
|
||||
return FALSE;
|
||||
}
|
||||
} else {
|
||||
if (!LBtr(&sys_semas[SYS_SEMA_HEAPLOG_ACTIVE],0)) {
|
||||
if (!LBtr(&sys_semas[SEMA_HEAPLOG_ACTIVE],0)) {
|
||||
"HeapLog Not Active\n";
|
||||
return FALSE;
|
||||
} else {
|
||||
@@ -116,12 +116,12 @@ public U0 HeapLogAddrRep(Bool leave_it=OFF)
|
||||
{//Call $LK,"HeapLog",A="MN:HeapLog"$() first and collect data.
|
||||
I64 i,j,total=0;
|
||||
CHeapLog *tmphl,hl;
|
||||
if (!LBtr(&sys_semas[SYS_SEMA_HEAPLOG_ACTIVE],0)) {
|
||||
if (!LBtr(&sys_semas[SEMA_HEAPLOG_ACTIVE],0)) {
|
||||
"HeapLog Not Active\n";
|
||||
return;
|
||||
}
|
||||
"$$WW,0$$";
|
||||
while (LBts(&sys_semas[SYS_SEMA_HEAPLOG_LOCK],0))
|
||||
while (LBts(&sys_semas[SEMA_HEAPLOG_LOCK],0))
|
||||
PAUSE
|
||||
for (i=0;i<HL_HASH_SIZE;i++) {
|
||||
tmphl=heaplog_head[i].next;
|
||||
@@ -136,9 +136,9 @@ public U0 HeapLogAddrRep(Bool leave_it=OFF)
|
||||
tmphl=hl.next;
|
||||
}
|
||||
}
|
||||
LBtr(&sys_semas[SYS_SEMA_HEAPLOG_LOCK],0);
|
||||
LBtr(&sys_semas[SEMA_HEAPLOG_LOCK],0);
|
||||
"\n$$LTRED$$Total:%08X$$FG$$\n",total;
|
||||
LBts(&sys_semas[SYS_SEMA_HEAPLOG_ACTIVE],0);
|
||||
LBts(&sys_semas[SEMA_HEAPLOG_ACTIVE],0);
|
||||
if (!leave_it)
|
||||
HeapLog(OFF);
|
||||
}
|
||||
@@ -148,7 +148,7 @@ public U0 HeapLogSizeRep(Bool leave_it=OFF)
|
||||
I64 i,j,k,total=0;
|
||||
CHeapLog *tmphla,hla,*tmphls,*tmphls1;
|
||||
CHeapLogHash *size_head;
|
||||
if (!LBtr(&sys_semas[SYS_SEMA_HEAPLOG_ACTIVE],0)) {
|
||||
if (!LBtr(&sys_semas[SEMA_HEAPLOG_ACTIVE],0)) {
|
||||
"HeapLog Not Active\n";
|
||||
return;
|
||||
}
|
||||
@@ -158,7 +158,7 @@ public U0 HeapLogSizeRep(Bool leave_it=OFF)
|
||||
QueInit(&size_head[i]);
|
||||
|
||||
"$$WW,0$$";
|
||||
while (LBts(&sys_semas[SYS_SEMA_HEAPLOG_LOCK],0))
|
||||
while (LBts(&sys_semas[SEMA_HEAPLOG_LOCK],0))
|
||||
PAUSE
|
||||
for (i=0;i<HL_HASH_SIZE;i++) {
|
||||
tmphla=heaplog_head[i].next;
|
||||
@@ -187,7 +187,7 @@ hl_found:
|
||||
tmphla=hla.next;
|
||||
}
|
||||
}
|
||||
LBtr(&sys_semas[SYS_SEMA_HEAPLOG_LOCK],0);
|
||||
LBtr(&sys_semas[SEMA_HEAPLOG_LOCK],0);
|
||||
|
||||
for (i=0;i<HL_HASH_SIZE;i++) {
|
||||
tmphls=size_head[i].next;
|
||||
@@ -205,7 +205,7 @@ hl_found:
|
||||
Free(size_head);
|
||||
|
||||
"\n$$LTRED$$Total:%08X$$FG$$\n",total;
|
||||
LBts(&sys_semas[SYS_SEMA_HEAPLOG_ACTIVE],0);
|
||||
LBts(&sys_semas[SEMA_HEAPLOG_ACTIVE],0);
|
||||
if (!leave_it)
|
||||
HeapLog(OFF);
|
||||
}
|
||||
@@ -9,6 +9,8 @@ Cd(__DIR__);;
|
||||
#include "Merge"
|
||||
#include "Profiler"
|
||||
#include "StrUtils"
|
||||
#include "DocUtils"
|
||||
#include "ToDolDoc"
|
||||
#include "ToTXT"
|
||||
#include "TOS"
|
||||
Cd("..");;
|
||||
+12
-11
@@ -35,11 +35,11 @@ I64 TaskStkSize(CTask *task)
|
||||
|
||||
I64 TaskQueSize(CTask *task)
|
||||
{
|
||||
CSrvCmd *tmpc,*tmpc1;
|
||||
CJob *tmpc,*tmpc1;
|
||||
I64 res=0;
|
||||
PUSHFD
|
||||
CLI
|
||||
while (LBts(&task->srv_ctrl.flags,SVCRf_LOCKED))
|
||||
while (LBts(&task->srv_ctrl.flags,JOBCf_LOCKED))
|
||||
PAUSE
|
||||
|
||||
tmpc1=&task->srv_ctrl.next_waiting;
|
||||
@@ -56,7 +56,7 @@ I64 TaskQueSize(CTask *task)
|
||||
tmpc=tmpc->next;
|
||||
}
|
||||
|
||||
LBtr(&task->srv_ctrl.flags,SVCRf_LOCKED);
|
||||
LBtr(&task->srv_ctrl.flags,JOBCf_LOCKED);
|
||||
POPFD
|
||||
return res;
|
||||
}
|
||||
@@ -101,7 +101,7 @@ Bool MemRepTask(CTask *task,Bool override_validate=FALSE)
|
||||
if (task==Fs)
|
||||
task->rsp=GetRSP;
|
||||
st=MStrUtil(task->task_title,SUF_REM_CTRL_CHARS|SUF_SAFE_DOLLAR);
|
||||
"$$BLACK$$%-25ts %010X$$FG$$\n$$ID,2$$",st,task;
|
||||
"$$BLACK$$%-27ts#%08X$$FG$$\n$$ID,2$$",st,task;
|
||||
Free(st);
|
||||
"Heap\t:%010X/%010X\n",TaskMemUsed(task,override_validate),
|
||||
TaskMemAlloced(task,override_validate);
|
||||
@@ -114,6 +114,8 @@ Bool MemRepTask(CTask *task,Bool override_validate=FALSE)
|
||||
"Stk\t\t:$$RED$$$$BK,1$$Overflow$$BK,0$$$$FG$$/%010X\n",j;
|
||||
|
||||
"HashTable\t:%010X\n",HashTableSize2(task->hash_table);
|
||||
"FPU\t\t:%010X\n",MSize2(task->fpu_mmx);
|
||||
"CurDir\t:%010X\n",MSize2(task->cur_dir);
|
||||
|
||||
if (pdoc=DocPut(task))
|
||||
"PutDoc\t:%010X\n",DocSize(pdoc);
|
||||
@@ -124,7 +126,7 @@ Bool MemRepTask(CTask *task,Bool override_validate=FALSE)
|
||||
|
||||
cc=task->next_cc;
|
||||
while (cc!=&task->next_cc) {
|
||||
"Lex\t\t:%010X\n",CmpCtrlSize(cc);
|
||||
"CmpCtrl\t:%010X\n",CmpCtrlSize(cc);
|
||||
cc=cc->next;
|
||||
}
|
||||
|
||||
@@ -136,7 +138,7 @@ Bool MemRepTask(CTask *task,Bool override_validate=FALSE)
|
||||
|
||||
if (task==sys_winmgr_task) {
|
||||
"gr.pen_brushes\t:%010X\n",PenBrushesSize;
|
||||
"gr_scrn_zoom_tbles:%010X\n",ScrnZoomTablesSize;
|
||||
"gr.scrn_zoom_tbles\t:%010X\n",ScrnZoomTablesSize;
|
||||
} else if (task==adam_task) {
|
||||
j=0;k=0;m=0;n=0;
|
||||
for (i=0;i<mp_cnt;i++) {
|
||||
@@ -194,18 +196,17 @@ public U0 MemRep()
|
||||
I64 i;
|
||||
CTask *task;
|
||||
CCPU *c;
|
||||
CBinFile *bfh=sys_boot_base-sizeof(CBinFile);
|
||||
CBinFile *bfh=mem_boot_base-sizeof(CBinFile);
|
||||
bfh(I64)+=bfh->file_size-1;
|
||||
|
||||
"$$BLACK$$Low Memory\t:0000100000$$FG$$\n$$ID,2$$";
|
||||
"Kernel\t:%010X-%010X\n",sys_boot_base-sizeof(CBinFile),bfh;
|
||||
"Kernel\t:%010X-%010X\n",mem_boot_base-sizeof(CBinFile),bfh;
|
||||
|
||||
"VGA\t\t:00000A0000-00000BFFFF\n";
|
||||
"$$ID,-2$$$$BLACK$$High Memory\t:0000100000-%010X$$FG$$\n",
|
||||
sys_heap_limit;
|
||||
"$$ID,2$$Fixed Area for page tables and misc\n\t\t:%010X-%010X\n",
|
||||
mem_heap_limit;
|
||||
"$LK,"SYS_FIXED_AREA",A="MN:CSysFixedArea"$\t:%010X-%010X\n",
|
||||
SYS_FIXED_AREA,SYS_FIXED_AREA+sizeof(CSysFixedArea)-1;
|
||||
"$$ID,-2$$";
|
||||
|
||||
if (sys_data_bp) {
|
||||
"$$BLACK$$Code Heap\t:%010X/%010X$$FG$$\n",
|
||||
|
||||
@@ -56,7 +56,7 @@ I64 ProfCompare(U8 *i1,U8 *i2)
|
||||
|
||||
public U0 ProfRep(I64 filter_cnt=1,Bool leave_it=OFF)
|
||||
{//Profiler report. Call $LK,"Prof",A="MN:Prof"$() first and collect data.
|
||||
I64 i,hits,ip,last_ip=0,routine_total=0;
|
||||
I64 i,hits,rip,last_rip=0,routine_total=0;
|
||||
F64 total_time;
|
||||
U8 buf[256],buf2[256],last_buf[256];
|
||||
if (!LBtr(&pf_prof_active,0))
|
||||
@@ -69,12 +69,12 @@ public U0 ProfRep(I64 filter_cnt=1,Bool leave_it=OFF)
|
||||
QSortI64(pf_array,pf_buf_in_ptr,&ProfCompare);
|
||||
*last_buf=0;
|
||||
for (i=0;i<pf_buf_in_ptr;i+=hits) {
|
||||
ip=pf_array[i];
|
||||
rip=pf_array[i];
|
||||
hits=0;
|
||||
do hits++;
|
||||
while (i+hits<pf_buf_in_ptr && pf_array[i+hits]==ip);
|
||||
while (i+hits<pf_buf_in_ptr && pf_array[i+hits]==rip);
|
||||
|
||||
StrPrint(buf,"%p",ip);
|
||||
StrPrint(buf,"%p",rip);
|
||||
StrFirstRem(buf,"+",buf2);
|
||||
if (StrCmp(buf2,last_buf)) {
|
||||
if (*last_buf && routine_total>=filter_cnt)
|
||||
@@ -85,8 +85,8 @@ public U0 ProfRep(I64 filter_cnt=1,Bool leave_it=OFF)
|
||||
}
|
||||
routine_total+=hits;
|
||||
if (hits>=filter_cnt) {
|
||||
"%6.2f %08X:%P\n",100*hits/total_time,hits,ip;
|
||||
last_ip=ip;
|
||||
"%6.2f %08X:%P\n",100*hits/total_time,hits,rip;
|
||||
last_rip=rip;
|
||||
}
|
||||
}
|
||||
if (*last_buf && routine_total>=filter_cnt)
|
||||
|
||||
@@ -69,7 +69,7 @@ public I64 Sort(U8 *_in_name,U8 *_out_name=NULL,
|
||||
return res; //Num Entries
|
||||
}
|
||||
|
||||
I64 DocWordsFile(CDoc *doc_out=NULL,U8 *filename,U32 *chars_bmp)
|
||||
I64 DocWordsFile(CDoc *doc_out=NULL,U8 *filename,U32 *char_bmp)
|
||||
{
|
||||
U8 *ptr,*ptr2;
|
||||
I64 res=0,ch;
|
||||
@@ -79,11 +79,11 @@ I64 DocWordsFile(CDoc *doc_out=NULL,U8 *filename,U32 *chars_bmp)
|
||||
if (doc_e->de_flags & DOCEF_TAG) {
|
||||
ptr=doc_e->tag;
|
||||
while (*ptr) {
|
||||
while (*ptr && !Bt(chars_bmp,*ptr))
|
||||
while (*ptr && !Bt(char_bmp,*ptr))
|
||||
ptr++;
|
||||
|
||||
ptr2=ptr;
|
||||
while (*ptr && Bt(chars_bmp,*ptr))
|
||||
while (*ptr && Bt(char_bmp,*ptr))
|
||||
ptr++;
|
||||
|
||||
ch=*ptr;
|
||||
@@ -100,7 +100,7 @@ I64 DocWordsFile(CDoc *doc_out=NULL,U8 *filename,U32 *chars_bmp)
|
||||
DocDel(doc_in);
|
||||
return res;
|
||||
}
|
||||
public I64 Words(U8 *files_find_mask="*",U32 *chars_bmp=chars_bmp_alpha,
|
||||
public I64 Words(U8 *files_find_mask="*",U32 *char_bmp=char_bmp_alpha,
|
||||
U8 *fu_flags=NULL)
|
||||
{//Break file into list of not-unique words.
|
||||
I64 fuf_flags=0,res=0;
|
||||
@@ -110,7 +110,7 @@ public I64 Words(U8 *files_find_mask="*",U32 *chars_bmp=chars_bmp_alpha,
|
||||
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),fu_flags);
|
||||
tmpde=tmpde1=FilesFind(files_find_mask,fuf_flags);
|
||||
while (tmpde) {
|
||||
res+=DocWordsFile(doc_out,tmpde->full_name,chars_bmp);
|
||||
res+=DocWordsFile(doc_out,tmpde->full_name,char_bmp);
|
||||
tmpde=tmpde->next;
|
||||
}
|
||||
DirTreeDel(tmpde1);
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
#help_index "Misc/TOS"
|
||||
|
||||
public U0 TOSStaffIns()
|
||||
{//Completes TOS install from TempleOSStaff.ISO
|
||||
SettingsPush; //See $LK,"SettingsPush",A="MN:SettingsPush"$
|
||||
AutoComplete;
|
||||
WinBorder;
|
||||
WinMax;
|
||||
DocClear;
|
||||
"$$PURPLE$$$$TX+CX,\"Complete TOS install from TempleOSStaff.ISO\"$$$$FG$$\n\n\n\n";
|
||||
InsRereg;
|
||||
if (HostChgDsk("/home/tad/TAD/Site1/Wb/TempleOSSup1.ISO.C"))
|
||||
CopyTree("T:/","~/Sup1");
|
||||
if (HostChgDsk("/home/tad/TAD/Site1Stale/files/TempleOSBooks1.ISO.C"))
|
||||
CopyTree("T:/","~/Books1");
|
||||
if (HostChgDsk("/home/tad/TAD/Site1Stale/files/TempleOSBooks2.ISO.C"))
|
||||
CopyTree("T:/","~/Books2");
|
||||
SettingsPop;
|
||||
Once("TOSBootHDIns;\"\n\nRun TOSRegen;\n\n\n\";");
|
||||
if (PressAKey!=CH_SHIFT_ESC)
|
||||
Reboot;
|
||||
}
|
||||
|
||||
public U0 TOSStdIns()
|
||||
{//Completes TOS install from TempleOSCD.ISO
|
||||
SettingsPush; //See $LK,"SettingsPush",A="MN:SettingsPush"$
|
||||
AutoComplete;
|
||||
WinBorder;
|
||||
WinMax;
|
||||
DocClear;
|
||||
"$$PURPLE$$$$TX+CX,\"Complete TOS install from TempleOSCD.ISO\"$$$$FG$$\n\n\n\n";
|
||||
InsRereg;
|
||||
if (FileFind("/Demo/AcctExample"))
|
||||
Copy("::/Demo/AcctExample/*","~");
|
||||
if (HostChgDsk("/home/tad/Downloads/TempleOSSup1.ISO.C"))
|
||||
CopyTree("T:/","~/Sup1");
|
||||
if (HostChgDsk("/home/tad/Downloads/TempleOSWeb.ISO.C"))
|
||||
CopyTree("T:/","~/Web");
|
||||
if (HostChgDsk("/home/tad/Downloads/TempleOSBooks1.ISO.C"))
|
||||
CopyTree("T:/","~/Books1");
|
||||
if (HostChgDsk("/home/tad/Downloads/TempleOSBooks2.ISO.C"))
|
||||
CopyTree("T:/","~/Books2");
|
||||
SettingsPop;
|
||||
Once("TOSBootHDIns;\"\n\nRun TOSRegen;\n\n\n\";");
|
||||
if (PressAKey!=CH_SHIFT_ESC)
|
||||
Reboot;
|
||||
}
|
||||
Reference in new issue
Block a user