TempleOSCD_150720.ISO
This commit is contained in:
1 parent
401601816c
commit
f8c05f98f4
554 files changed
+26046
-24853
No files matched your search
+6
-5
@@ -2,12 +2,11 @@
|
||||
#include "BootHD"
|
||||
#include "BootMHD"
|
||||
#include "BootMHD2"
|
||||
#include "DskCDDVD"
|
||||
#include "DskISOFile"
|
||||
#include "BootIns"
|
||||
|
||||
#help_index "Call"
|
||||
asm {
|
||||
USE64
|
||||
_HI_CALL::
|
||||
PUSH RBP
|
||||
MOV RBP,RSP
|
||||
@@ -34,14 +33,15 @@ _HI_MEMCPY::
|
||||
POP RBP
|
||||
RET1 24
|
||||
}
|
||||
_extern _HI_CALL I64 HiCall(U8 *s);
|
||||
_extern _HI_CALL I64 HiCall(U8 *machine_code);
|
||||
_extern _HI_MEMCPY U8 *HiMemCpy(U8 *dst,U8 *src,I64 cnt);
|
||||
|
||||
#help_index "Boot"
|
||||
public U0 RAMReboot(U8 *filename)
|
||||
{//Softboot Kernel Bin file. No hardware reset.
|
||||
I64 size;
|
||||
CKernel *hi_image,*lo_image=sys_boot_base-sizeof(CBinFile),reg *sys_ram_reboot;
|
||||
CKernel *hi_image,*lo_image=sys_boot_base-sizeof(CBinFile),
|
||||
reg *sys_ram_reboot;
|
||||
|
||||
do if (!(hi_image=FileRead(filename,&size))) return;
|
||||
while (hi_image<0x100000);
|
||||
@@ -52,7 +52,8 @@ public U0 RAMReboot(U8 *filename)
|
||||
hi_image->boot_src=BOOT_SRC_RAM;
|
||||
hi_image->boot_patch_table_base=lo_image(U8 *)+hi_image->h.patch_table_offset;
|
||||
hi_image->sys_run_level =lo_image->sys_run_level&(RLF_VGA|RLF_16BIT);
|
||||
MemCpy(&hi_image->start,&lo_image->start,sizeof(CKernel)-offset(CKernel.start));
|
||||
MemCpy(&hi_image->start,&lo_image->start,
|
||||
sizeof(CKernel)-offset(CKernel.start));
|
||||
|
||||
CLI
|
||||
if (mp_cnt>1)
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#define CD_BOOT_LOADER_SIZE CD_BLK_SIZE*1 //Max CD_BLK_SIZE*4, I think
|
||||
#define BOOT_HIGH_LOC_CD ((BOOT_RAM_LIMIT-(BOOT_STK_SIZE+CD_BOOT_LOADER_SIZE))>>4)
|
||||
#define BOOT_HIGH_LOC_CD ((BOOT_RAM_LIMIT-\
|
||||
(BOOT_STK_SIZE+CD_BOOT_LOADER_SIZE))>>4)
|
||||
|
||||
DefinePrint(
|
||||
"DD_BOOT_HIGH_LOC_CD","%08X",BOOT_HIGH_LOC_CD<<4);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#define MODULE_SIZE 1*BLK_SIZE
|
||||
#define BOOT_HIGH_LOC_HD ((BOOT_RAM_LIMIT-(BOOT_STK_SIZE+MODULE_SIZE))>>4)
|
||||
#define BOOT_HIGH_LOC_HD ((BOOT_RAM_LIMIT-\
|
||||
(BOOT_STK_SIZE+MODULE_SIZE))>>4)
|
||||
|
||||
DefinePrint(
|
||||
"DD_BOOT_HIGH_LOC_HD","%08X",BOOT_HIGH_LOC_HD<<4);
|
||||
|
||||
+22
-22
@@ -13,8 +13,8 @@
|
||||
public U0 MakeAll()
|
||||
{//Use $LK,"MakeOSDrvBootInstall",A="MN:MakeOSDrvBootInstall"$. Loader must be patched.
|
||||
//These 2 modules (and bootloaders at top) are the only AOT
|
||||
//compiled code in TempleOS. Everything else is JIT.
|
||||
//You are doing it wrong if you make AOT compiled code.
|
||||
//compiled code in TempleOS. Everything else is JIT.
|
||||
//You are doing it wrong if you make AOT compiled code.
|
||||
if (Cmp("/Compiler/Compiler","Compiler",,':'))
|
||||
throw;
|
||||
if (Cmp("/Kernel/Kernel","Kernel",,':'))
|
||||
@@ -24,15 +24,15 @@ public U0 MakeAll()
|
||||
public Bool MakeOSDrvBootInstall(U8 src_drv=0,U8 dst_drv=0)
|
||||
{// Does $LK,"MakeAll",A="MN:MakeAll"$ and installs new boot-loader.
|
||||
|
||||
//Normally, you just supply a src_drv. It will compile
|
||||
//the code on that drive and update the boot sect.
|
||||
//Normally, you just supply a src_drv. It will compile
|
||||
//the code on that drive and update the boot sect.
|
||||
|
||||
//If you are making a bootable CD-ROM, you supply a dst_drv.
|
||||
//See $LK,"::/Misc/MakeDistro.CPP"$
|
||||
//If you are making a bootable CD-ROM, you supply a dst_drv.
|
||||
//See $LK,"::/Misc/MakeDistro.CPP"$
|
||||
|
||||
//See $LK,"Install Documentation",A="FI:::/Doc/Install.TXT"$
|
||||
//See $LK,"Install Documentation",A="FI:::/Doc/Install.TXT"$
|
||||
|
||||
//Study my account examples my technique: $LK,"Cfg Strs",A="FL:::/Demo/AcctExample/TOSCfg.CPP,1"$, $LK,"Update Funs",A="FL:::/Demo/AcctExample/TOSDistro.CPP,1"$
|
||||
//Study my account examples my technique: $LK,"Cfg Strs",A="FL:::/Demo/AcctExample/TOSCfg.CPP,1"$, $LK,"Update Funs",A="FL:::/Demo/AcctExample/TOSDistro.CPP,1"$
|
||||
|
||||
CBlkDev *bd;
|
||||
CDrv *dv;
|
||||
@@ -87,7 +87,7 @@ public Bool MakeOSDrvBootInstall(U8 src_drv=0,U8 dst_drv=0)
|
||||
|
||||
public U0 MasterBootOldRead(U8 src_drv,U8 dst_drv)
|
||||
{//Reads MBR from disk drive containing src partition.
|
||||
//Writes a single blk file to dst /0000Boot directory.
|
||||
//Writes a single blk file to dst BOOT_DIR.
|
||||
CBlkDev *bd=Let2BlkDev(src_drv);
|
||||
CDrv *dv;
|
||||
CMasterBoot mbr;
|
||||
@@ -96,7 +96,7 @@ public U0 MasterBootOldRead(U8 src_drv,U8 dst_drv)
|
||||
if (dv->type!=DVT_REDSEA && dv->type!=DVT_FAT32)
|
||||
PrintErr("Not RedSea Drv\n");
|
||||
else {
|
||||
//Bypass partition bounds-checking
|
||||
//Bypass partition bounds-checking
|
||||
BlkDevLock(bd);
|
||||
ATAReadBlks(bd,&mbr,0,1);
|
||||
BlkDevUnlock(bd);
|
||||
@@ -108,13 +108,13 @@ public U0 MasterBootOldRead(U8 src_drv,U8 dst_drv)
|
||||
}
|
||||
|
||||
public U0 MasterBootOldWrite(U8 src_drv,U8 dst_drv)
|
||||
{//Reads OldMBR from src drive /0000Boot directory
|
||||
//writes it to the MBR of the drive with dst partition.
|
||||
{//Reads OldMBR from src drive BOOT_DIR.
|
||||
//writes it to the MBR of the drive with dst partition.
|
||||
CBlkDev *bd=Let2BlkDev(dst_drv);
|
||||
CMasterBoot *mbr;
|
||||
Drv(src_drv);
|
||||
if (mbr=FileRead(BOOT_DIR_OLDMBR_BIN_C)) {
|
||||
//Bypass partition bounds-checking
|
||||
//Bypass partition bounds-checking
|
||||
BlkDevLock(bd);
|
||||
ATAWriteBlks(bd,mbr,0,1);
|
||||
BlkDevUnlock(bd);
|
||||
@@ -125,15 +125,15 @@ public U0 MasterBootOldWrite(U8 src_drv,U8 dst_drv)
|
||||
public U0 MasterBootZero(U8 dst_drv)
|
||||
{//Set MBR of disk with dst partition to zero.
|
||||
|
||||
//This is dangerous!!
|
||||
//The TempleOS partitioner doesn't play well
|
||||
//with other operating systems at this time and you need
|
||||
//to do this on a drive partitioned by TempleOS
|
||||
//if you wish to partition with another operating system.
|
||||
//This is dangerous!!
|
||||
//The TempleOS partitioner doesn't play well
|
||||
//with other operating systems at this time and you need
|
||||
//to do this on a drive partitioned by TempleOS
|
||||
//if you wish to partition with another operating system.
|
||||
CBlkDev *bd=Let2BlkDev(dst_drv);
|
||||
CMasterBoot mbr;
|
||||
MemSet(&mbr,0,BLK_SIZE);
|
||||
//Bypass partition bounds-checking
|
||||
//Bypass partition bounds-checking
|
||||
BlkDevLock(bd);
|
||||
ATAWriteBlks(bd,&mbr,0,1);
|
||||
BlkDevUnlock(bd);
|
||||
@@ -141,13 +141,13 @@ public U0 MasterBootZero(U8 dst_drv)
|
||||
|
||||
public Bool MasterBootIntall(U8 drv_let,U8 *drv_lst=NULL)
|
||||
{//Create new MBR on the disk that has drv_let as a partition.
|
||||
//Puts stage 2 in /0000Boot dir of drv_let.
|
||||
//Puts stage 2 in BOOT_DIR of drv_let.
|
||||
CBlkDev *bd,*bd1;
|
||||
CDrv *dv,*p1;
|
||||
CMasterBoot mbr;
|
||||
CDirEntry de;
|
||||
I64 i,j,size,*_q;
|
||||
U8 *menu_ptr,*ptr,ch,buf[128];
|
||||
U8 *menu_ptr,*ptr,ch,buf[STR_LEN];
|
||||
Bool result=FALSE;
|
||||
|
||||
try {
|
||||
@@ -209,7 +209,7 @@ public Bool MasterBootIntall(U8 drv_let,U8 *drv_lst=NULL)
|
||||
Free(de.full_name);
|
||||
*BMHD_BLK_CNT(U16 *)=(size+BLK_SIZE-1)>>BLK_SIZE_BITS;
|
||||
*BMHD_DAP_BLK(I64 *)=Cluster2Blk(dv,de.cluster);
|
||||
//Bypass partition bounds-checking
|
||||
//Bypass partition bounds-checking
|
||||
BlkDevLock(bd);
|
||||
ATAReadBlks(bd,&mbr,0,1);
|
||||
for (i=0;i<BMHD_END-BMHD_CODE;i++)
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#define MODULE_SIZE 1*BLK_SIZE
|
||||
#define BOOT_HIGH_LOC_MHD ((BOOT_RAM_LIMIT-(BOOT_STK_SIZE+MODULE_SIZE))>>4)
|
||||
#define BOOT_HIGH_LOC_MHD ((BOOT_RAM_LIMIT-\
|
||||
(BOOT_STK_SIZE+MODULE_SIZE))>>4)
|
||||
|
||||
DefinePrint(
|
||||
"DD_BOOT_HIGH_LOC_MHD","%08X",BOOT_HIGH_LOC_MHD<<4);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#define MODULE_SIZE 2*BLK_SIZE
|
||||
#define BOOT_HIGH_LOC_MHD2 ((BOOT_RAM_LIMIT-(BOOT_STK_SIZE+MODULE_SIZE))>>4)
|
||||
#define BOOT_HIGH_LOC_MHD2 ((BOOT_RAM_LIMIT-\
|
||||
(BOOT_STK_SIZE+MODULE_SIZE))>>4)
|
||||
|
||||
DefinePrint(
|
||||
"DD_BOOT_HIGH_LOC_MHD2","%08X",BOOT_HIGH_LOC_MHD2<<4);
|
||||
|
||||
@@ -29,9 +29,9 @@ I64 CDFileCreate2(CFile *out_file,CDirEntry *tempde,
|
||||
CFile *in_file;
|
||||
U8 *buf=MAlloc(CD_BLK_SIZE),*ptr1,*ptr2;
|
||||
CISO1DirEntry *dir_blk_buf =CAlloc(CD_BLK_SIZE*128),
|
||||
*de =dir_blk_buf, *de1,
|
||||
*dir_blk_buf2=CAlloc(CD_BLK_SIZE*128),
|
||||
*de2=dir_blk_buf2,*de12;
|
||||
*de =dir_blk_buf, *de1,
|
||||
*dir_blk_buf2=CAlloc(CD_BLK_SIZE*128),
|
||||
*de2=dir_blk_buf2,*de12;
|
||||
I64 i,n;
|
||||
|
||||
tempc=parent->user_data;
|
||||
@@ -87,7 +87,8 @@ I64 CDFileCreate2(CFile *out_file,CDirEntry *tempde,
|
||||
de1=de;
|
||||
de12=de2;
|
||||
if (tempde1->attr & RS_ATTR_DIR) {
|
||||
n=CDFileCreate2(out_file,tempde1,de,de2,_cur_blk,tempde,write,stage2_filename,_stage2_blk);
|
||||
n=CDFileCreate2(out_file,tempde1,de,de2,_cur_blk,
|
||||
tempde,write,stage2_filename,_stage2_blk);
|
||||
de(U8 *)+=sizeof(CISO1DirEntry)-1+n;
|
||||
de2(U8 *)+=sizeof(CISO1DirEntry)-1+n<<1;
|
||||
} else {
|
||||
@@ -145,20 +146,22 @@ I64 CDFileCreate2(CFile *out_file,CDirEntry *tempde,
|
||||
FClose(in_file);
|
||||
}
|
||||
if ((de1(U8 *)-dir_blk_buf(U8 *))/CD_BLK_SIZE!=
|
||||
(de(U8 *) -dir_blk_buf(U8 *))/CD_BLK_SIZE) {
|
||||
(de(U8 *) -dir_blk_buf(U8 *))/CD_BLK_SIZE) {
|
||||
i=de1->len;
|
||||
MemCpy(buf,de1,i);
|
||||
MemSet(de1,0,i);
|
||||
de=dir_blk_buf(U8 *)+(de(U8 *)-dir_blk_buf(U8 *))/CD_BLK_SIZE*CD_BLK_SIZE;
|
||||
de=dir_blk_buf(U8 *)+(de(U8 *)
|
||||
-dir_blk_buf(U8 *))/CD_BLK_SIZE*CD_BLK_SIZE;
|
||||
MemCpy(de,buf,i);
|
||||
de(U8 *)+=i;
|
||||
}
|
||||
if ((de12(U8 *)-dir_blk_buf2(U8 *))/CD_BLK_SIZE!=
|
||||
(de2(U8 *) -dir_blk_buf2(U8 *))/CD_BLK_SIZE) {
|
||||
(de2(U8 *) -dir_blk_buf2(U8 *))/CD_BLK_SIZE) {
|
||||
i=de12->len;
|
||||
MemCpy(buf,de12,i);
|
||||
MemSet(de12,0,i);
|
||||
de2(U8 *)=dir_blk_buf2(U8 *)+(de2(U8 *)-dir_blk_buf2(U8 *))/CD_BLK_SIZE*CD_BLK_SIZE;
|
||||
de2(U8 *)=dir_blk_buf2(U8 *)+(de2(U8 *)
|
||||
-dir_blk_buf2(U8 *))/CD_BLK_SIZE*CD_BLK_SIZE;
|
||||
MemCpy(de2,buf,i);
|
||||
de2(U8 *)+=i;
|
||||
}
|
||||
@@ -250,14 +253,15 @@ I64 CDTableLen(CDirEntry *tempde,I64 *size1,I64 *size2,I64 cur_depth)
|
||||
|
||||
U0 CDFillPathTable(CDirEntry *tempde,
|
||||
CISO1PathEntry **_itabbuf,CISO1PathEntry **_itabbuf2,
|
||||
I64 parent_entry_num,Bool big_endian,I64 *first_free,I64 cur_level,I64 output_level)
|
||||
I64 parent_entry_num,Bool big_endian,I64 *first_free,
|
||||
I64 cur_level,I64 output_level)
|
||||
{
|
||||
U8 *ptr1,*ptr2;
|
||||
I64 i;
|
||||
CISO1PathEntry *tabbuf=*_itabbuf,*tabbuf2=*_itabbuf2;
|
||||
CDirEntry *tempde1=tempde->sub,*tempde2;
|
||||
CCCDUserData *tempc;
|
||||
|
||||
|
||||
if (cur_level==output_level) {
|
||||
while (tempde1) {
|
||||
if (tempde1->attr & RS_ATTR_DIR) {
|
||||
@@ -273,7 +277,8 @@ U0 CDFillPathTable(CDirEntry *tempde,
|
||||
}
|
||||
StrCpy(&tabbuf->name,tempde1->name);
|
||||
|
||||
tabbuf(U8 *)+=sizeof(CISO1PathEntry)-2+(StrLen(tempde1->name)+1) & -0x2;
|
||||
tabbuf(U8 *)+=sizeof(CISO1PathEntry)-2+
|
||||
(StrLen(tempde1->name)+1) & -0x2;
|
||||
|
||||
tabbuf2->name_len=StrLen(tempde1->name)<<1;
|
||||
if (big_endian) {
|
||||
@@ -290,7 +295,7 @@ U0 CDFillPathTable(CDirEntry *tempde,
|
||||
*ptr1++=*ptr2++;
|
||||
}
|
||||
tabbuf2(U8 *)+=sizeof(CISO1PathEntry)-2+
|
||||
StrLen(tempde1->name)<<1;
|
||||
StrLen(tempde1->name)<<1;
|
||||
*first_free+=1;
|
||||
}
|
||||
tempde1=tempde1->next;
|
||||
@@ -304,7 +309,7 @@ U0 CDFillPathTable(CDirEntry *tempde,
|
||||
if (tempde1->attr & RS_ATTR_DIR) {
|
||||
tempc=tempde1->user_data;
|
||||
CDFillPathTable(tempde1,_itabbuf,_itabbuf2,tempc->path_entry_num,
|
||||
big_endian,first_free,cur_level+1,output_level);
|
||||
big_endian,first_free,cur_level+1,output_level);
|
||||
}
|
||||
tempde1=tempde2;
|
||||
}
|
||||
@@ -323,24 +328,23 @@ class CElTorito
|
||||
U8 zero2[20];
|
||||
};
|
||||
|
||||
public I64 CDFileCreate(U8 *_filename=NULL,U8 *src_files_find_mask,U8 *fu_flags=NULL,
|
||||
U8 *_stage2_filename=NULL)
|
||||
public I64 ISOFileCreate(U8 *_filename=NULL,U8 *src_files_find_mask,
|
||||
U8 *fu_flags=NULL,U8 *_stage2_filename=NULL)
|
||||
{//See $LK,"::/Misc/MakeDistro.CPP"$
|
||||
//Use "C:/Distro/*" if you want all files in the C:/Distro directory.
|
||||
//Default flags are "+r" recurse.
|
||||
//Default flags are "+r" recurse.
|
||||
CISO1PriDesc *iso_pri=CAlloc(CD_BLK_SIZE),
|
||||
*iso_boot=CAlloc(CD_BLK_SIZE),
|
||||
*iso_sup=CAlloc(CD_BLK_SIZE),
|
||||
*iso_term=CAlloc(CD_BLK_SIZE);
|
||||
*iso_boot=CAlloc(CD_BLK_SIZE),
|
||||
*iso_sup=CAlloc(CD_BLK_SIZE),
|
||||
*iso_term=CAlloc(CD_BLK_SIZE);
|
||||
CDirEntry *rootdir=CAlloc(sizeof(CDirEntry));
|
||||
I64 i,j,stage2_blk=(CD_FILE_OFFSET+1<<2+CD_BOOT_LOADER_SIZE/BLK_SIZE)>>2,stage2_size,
|
||||
cur_blk=0,tabsize,tabsize2,first_free,max_depth,
|
||||
fuf_flags=0;
|
||||
I64 i,j,stage2_blk=(CD_FILE_OFFSET+1<<2+CD_BOOT_LOADER_SIZE/BLK_SIZE)>>2,
|
||||
stage2_size,cur_blk=0,tabsize,tabsize2,first_free,max_depth,fuf_flags=0;
|
||||
U32 *d;
|
||||
CElTorito *et=CAlloc(CD_BLK_SIZE);
|
||||
U8 *filename,*stage2_filename,
|
||||
*stage1_buf=CAlloc(CD_BOOT_LOADER_SIZE),
|
||||
*zero_buf=CAlloc(CD_BLK_SIZE);
|
||||
*stage1_buf=CAlloc(CD_BOOT_LOADER_SIZE),
|
||||
*zero_buf=CAlloc(CD_BLK_SIZE);
|
||||
CISO1PathEntry *tabbuf=NULL,*tabbuf2=NULL,*itabbuf,*itabbuf2;
|
||||
CFile *out_file=NULL;
|
||||
CISO1DirEntry *tempi;
|
||||
@@ -369,9 +373,9 @@ public I64 CDFileCreate(U8 *_filename=NULL,U8 *src_files_find_mask,U8 *fu_flags=
|
||||
if (stage2_filename) //preboot and bootloader
|
||||
cur_blk+=1+CD_BOOT_LOADER_SIZE/CD_BLK_SIZE;
|
||||
CDFileCreate2(out_file,rootdir,
|
||||
&iso_pri->root_dir_record,
|
||||
&iso_sup->root_dir_record,
|
||||
&cur_blk,rootdir,FALSE,stage2_filename,&stage2_blk);
|
||||
&iso_pri->root_dir_record,
|
||||
&iso_sup->root_dir_record,
|
||||
&cur_blk,rootdir,FALSE,stage2_filename,&stage2_blk);
|
||||
tabsize=sizeof(CISO1PathEntry);
|
||||
tabsize2=sizeof(CISO1PathEntry);
|
||||
max_depth=CDTableLen(rootdir,&tabsize,&tabsize2,1);
|
||||
@@ -437,7 +441,8 @@ public I64 CDFileCreate(U8 *_filename=NULL,U8 *src_files_find_mask,U8 *fu_flags=
|
||||
}
|
||||
|
||||
CDFileCreate2(out_file,rootdir,&iso_pri->root_dir_record,
|
||||
&iso_sup->root_dir_record,&cur_blk,rootdir,TRUE,stage2_filename,&stage2_blk);
|
||||
&iso_sup->root_dir_record,&cur_blk,rootdir,TRUE,
|
||||
stage2_filename,&stage2_blk);
|
||||
|
||||
tabbuf=CAlloc(tabsize*CD_BLK_SIZE);
|
||||
iso_pri->type_l_path_table=cur_blk;
|
||||
@@ -503,15 +508,16 @@ public I64 CDFileCreate(U8 *_filename=NULL,U8 *src_files_find_mask,U8 *fu_flags=
|
||||
MemCpy(stage1_buf,BCD_START,BCD_END-BCD_START);
|
||||
*(BCD_BLK_CNT-BCD_START+stage1_buf)(U16 *)=stage2_size;
|
||||
*(BCD_BLK_LO -BCD_START+stage1_buf)(U32 *)=stage2_blk;
|
||||
"$$RED$$!!! Boot Stage 2 !!! %X-%X$$FG$$\n",stage2_blk,stage2_blk+stage2_size-1;
|
||||
"$$RED$$!!! Boot Stage 2 !!! %X-%X$$FG$$\n",
|
||||
stage2_blk,stage2_blk+stage2_size-1;
|
||||
FWBlks(out_file,stage1_buf,
|
||||
CD_FILE_OFFSET+1<<2,CD_BOOT_LOADER_SIZE/BLK_SIZE);
|
||||
CD_FILE_OFFSET+1<<2,CD_BOOT_LOADER_SIZE/BLK_SIZE);
|
||||
} else {
|
||||
FWBlks(out_file,iso_sup,17<<2,4);
|
||||
FWBlks(out_file,iso_term,18<<2,4);
|
||||
}
|
||||
|
||||
cf_done:
|
||||
cf_done:
|
||||
FClose(out_file);
|
||||
Free(tabbuf);
|
||||
Free(tabbuf2);
|
||||
Reference in new issue
Block a user