Download Kernel/Mem/HeapCtrl.txt from hschumann2/TempleOS-Source-Code: direct link, hf CLI and curl.
- Browser
- Download file 775 Bytes
-
https://huggingface.co/datasets/hschumann2/TempleOS-Source-Code/resolve/main/Kernel/Mem/HeapCtrl.txt
- Command line
-
hf download hf://datasets/hschumann2/TempleOS-Source-Code/Kernel/Mem/HeapCtrl.txt
-
curl -L -o HeapCtrl.txt https://huggingface.co/datasets/hschumann2/TempleOS-Source-Code/resolve/main/Kernel/Mem/HeapCtrl.txt
775 Bytes
| CHeapCtrl *HeapCtrlInit(CHeapCtrl *hc=NULL,CTask *task=NULL,CBlkPool *bp) | |
| {//See HeapLog() for an example. | |
| //Duplicated for Adam Task. | |
| if (!hc) | |
| hc=ACAlloc(sizeof(CHeapCtrl)); | |
| hc->hc_signature=HEAP_CTRL_SIGNATURE_VAL; | |
| hc->mem_task=task; | |
| hc->bp=bp; | |
| QueInit(&hc->next_mem_blk); | |
| hc->last_mergable=NULL; | |
| hc->next_um=hc->last_um=(&hc->next_um)(U8 *)-offset(CMemUsed.next); | |
| return hc; | |
| } | |
| U0 HeapCtrlDel(CHeapCtrl *hc) | |
| {//Free all blks alloced to a HeapCtrl. | |
| CMemBlk *m,*m1; | |
| if (hc) { | |
| PUSHFD | |
| CLI | |
| while (LBts(&hc->locked_flags,HClf_LOCKED)) | |
| PAUSE | |
| m=hc->next_mem_blk; | |
| while (m!=&hc->next_mem_blk) { | |
| m1=m->next; | |
| MemPagTaskFree(m,hc); | |
| m=m1; | |
| } | |
| LBtr(&hc->locked_flags,HClf_LOCKED); | |
| POPFD | |
| Free(hc); | |
| } | |
| } | |