2021-07-03 05:07:57 +01:00
< ! DOCTYPE HTML >
< html >
< head >
< meta http - equiv = " Content-Type " content = " text/html;charset=US-ASCII " >
< meta name = " generator " content = " ZealOS V0.05 " >
< style type = " text/css " >
body { background - color : # 000000 ; }
. cF0 { color : # ffffff ; background - color : # 000000 ; }
. cF1 { color : # 3465 a4 ; background - color : # 000000 ; }
. cF2 { color : # 4e9 a06 ; background - color : # 000000 ; }
. cF3 { color : # 06 989 a ; background - color : # 000000 ; }
. cF4 { color : # a24444 ; background - color : # 000000 ; }
. cF5 { color : # 75507 b ; background - color : # 000000 ; }
. cF6 { color : # ce982f ; background - color : # 000000 ; }
. cF7 { color : # bcc0b9 ; background - color : # 000000 ; }
. cF8 { color : # 555753 ; background - color : # 000000 ; }
. cF9 { color : # 729f cf ; background - color : # 000000 ; }
. cFA { color : # 82 bc49 ; background - color : # 000000 ; }
. cFB { color : # 34e2 e2 ; background - color : # 000000 ; }
. cFC { color : # ac3535 ; background - color : # 000000 ; }
. cFD { color : # ad7fa8 ; background - color : # 000000 ; }
. cFE { color : # fce94f ; background - color : # 000000 ; }
. cFF { color : # 000000 ; background - color : # 000000 ; }
< / style >
< / head >
< body >
2021-07-05 01:12:38 +01:00
< pre style = " font-family:monospace;font-size:12pt " >
2021-07-03 05:07:57 +01:00
< a name = " l1 " > < / a > < span class = cF1 > asm < / span > < span class = cF0 > {
< a name = " l2 " > < / a > < / span > < span class = cF2 > //************************************</span><span class=cF0>
2021-07-03 07:51:43 +01:00
< a name = " l3 " > < / a > < / span > < span class = cF2 > //See </span><a href="https://tomawezome.github.io/ZealOS/Doc/Credits.html#l1"><span class=cF4>::/Doc/Credits.DD</span></a><span class=cF2>.</span><span class=cF0>
2021-07-03 05:07:57 +01:00
< a name = " l4 " > < / a > < / span > < span class = cFD > _MALLOC < / span > < span class = cF0 > : :
< a name = " l5 " > < / a > < / span > < span class = cF2 > // Throws 'OutMem'</span><span class=cF0>
2021-07-04 23:11:34 +01:00
< a name = " l6 " > < / a > < / span > < span class = cF1 > PUSH < / span > < span class = cF0 > < / span > < span class = cFC > RBP < / span > < span class = cF0 >
< a name = " l7 " > < / a > < / span > < span class = cF1 > MOV < / span > < span class = cF0 > < / span > < span class = cFC > RBP < / span > < span class = cF0 > , < / span > < span class = cFC > RSP < / span > < span class = cF0 >
< a name = " l8 " > < / a > < / span > < span class = cF1 > PUSH < / span > < span class = cF0 > < / span > < span class = cFC > RSI < / span > < span class = cF0 >
< a name = " l9 " > < / a > < / span > < span class = cF1 > PUSH < / span > < span class = cF0 > < / span > < span class = cFC > RDI < / span > < span class = cF0 >
2021-07-03 05:07:57 +01:00
< a name = " l10 " > < / a >
2021-07-04 23:11:34 +01:00
< a name = " l11 " > < / a > < / span > < span class = cF1 > XOR < / span > < span class = cF0 > < / span > < span class = cFC > RBX < / span > < span class = cF0 > , < / span > < span class = cFC > RBX < / span > < span class = cF0 >
< a name = " l12 " > < / a > < / span > < span class = cF1 > MOV < / span > < span class = cF0 > < / span > < span class = cFC > RDX < / span > < span class = cF0 > , < / span > < span class = cF9 > U64 < / span > < span class = cF0 > < / span > < span class = cF3 > SF_ARG2 < / span > < span class = cF0 > [ < / span > < span class = cFC > RBP < / span > < span class = cF0 > ]
< a name = " l13 " > < / a > < / span > < span class = cF1 > TEST < / span > < span class = cF0 > < / span > < span class = cFC > RDX < / span > < span class = cF0 > , < / span > < span class = cFC > RDX < / span > < span class = cF0 >
< a name = " l14 " > < / a > < / span > < span class = cF1 > JNZ < / span > < span class = cF0 > @ @ 05
< a name = " l15 " > < / a > < / span > < span class = cF1 > MOV < / span > < span class = cF0 > < / span > < span class = cFC > RDX < / span > < span class = cF0 > , < / span > < span class = cF9 > U64 < / span > < span class = cF0 > < / span > < span class = cFC > FS < / span > < span class = cF0 > : < / span > < span class = cF9 > CTask < / span > < span class = cF0 > . addr [ < / span > < span class = cFC > RBX < / span > < span class = cF0 > ]
< a name = " l16 " > < / a > @ @ 05 : < / span > < span class = cF1 > CMP < / span > < span class = cF0 > < / span > < span class = cF9 > U32 < / span > < span class = cF0 > < / span > < span class = cF9 > CTask < / span > < span class = cF0 > . task_signature [ < / span > < span class = cFC > RDX < / span > < span class = cF0 > ] , < / span > < span class = cF3 > TASK_SIGNATURE_VAL < / span > < span class = cF0 >
2021-07-03 05:07:57 +01:00
< a name = " l17 " > < / a >
< a name = " l18 " > < / a > # < / span > < span class = cF1 > assert < / span > < span class = cF0 > < / span > < span class = cF9 > CTask < / span > < span class = cF0 > . task_signature = = < / span > < span class = cF9 > CHeapCtrl < / span > < span class = cF0 > . hc_signature < / span > < span class = cF2 > //location signature same</span><span class=cF0>
< a name = " l19 " > < / a >
2021-07-04 23:11:34 +01:00
< a name = " l20 " > < / a > < / span > < span class = cF1 > JNE < / span > < span class = cF0 > @ @ 10
< a name = " l21 " > < / a > < / span > < span class = cF1 > MOV < / span > < span class = cF0 > < / span > < span class = cFC > RDX < / span > < span class = cF0 > , < / span > < span class = cF9 > U64 < / span > < span class = cF0 > < / span > < span class = cF9 > CTask < / span > < span class = cF0 > . data_heap [ < / span > < span class = cFC > RDX < / span > < span class = cF0 > ]
< a name = " l22 " > < / a > @ @ 10 : < / span > < span class = cF1 > CMP < / span > < span class = cF0 > < / span > < span class = cF9 > U32 < / span > < span class = cF0 > < / span > < span class = cF9 > CHeapCtrl < / span > < span class = cF0 > . hc_signature [ < / span > < span class = cFC > RDX < / span > < span class = cF0 > ] , < / span > < span class = cF3 > HEAP_CTRL_SIGNATURE_VAL < / span > < span class = cF0 >
< a name = " l23 " > < / a > < / span > < span class = cF1 > JE < / span > < span class = cF0 > @ @ 15
< a name = " l24 " > < / a > < / span > < span class = cF1 > PUSH < / span > < span class = cF0 > < / span > < span class = cFC > RDX < / span > < span class = cF0 >
< a name = " l25 " > < / a > < / span > < span class = cF1 > CALL < / span > < span class = cF0 > & amp ; < / span > < span class = cFD > SysBadMAlloc < / span > < span class = cF0 >
< a name = " l26 " > < / a > < / span > < span class = cF1 > JMP < / span > < span class = cF0 > < / span > < span class = cF9 > I32 < / span > < span class = cF0 > < / span > < span class = cFD > _SYS_HLT < / span > < span class = cF0 >
2021-07-03 05:07:57 +01:00
< a name = " l27 " > < / a >
2021-07-04 23:11:34 +01:00
< a name = " l28 " > < / a > @ @ 15 : < / span > < span class = cF1 > MOV < / span > < span class = cF0 > < / span > < span class = cFC > RAX < / span > < span class = cF0 > , < / span > < span class = cF9 > U64 < / span > < span class = cF0 > < / span > < span class = cF3 > SF_ARG1 < / span > < span class = cF0 > [ < / span > < span class = cFC > RBP < / span > < span class = cF0 > ]
< a name = " l29 " > < / a > < / span > < span class = cF1 > PUSHFD < / span > < span class = cF0 >
< a name = " l30 " > < / a > < / span > < span class = cF1 > ADD < / span > < span class = cF0 > < / span > < span class = cFC > RAX < / span > < span class = cF0 > , < / span > < span class = cF9 > CMemUsed < / span > < span class = cF0 > . < / span > < span class = cF1 > start < / span > < span class = cF0 > + < / span > < span class = cFE > 7 < / span > < span class = cF0 > < / span > < span class = cF2 > //round-up to I64</span><span class=cF0>
< a name = " l31 " > < / a > < / span > < span class = cF1 > AND < / span > < span class = cF0 > < / span > < span class = cFC > AL < / span > < span class = cF0 > , < / span > < span class = cFE > 0xF8 < / span > < span class = cF0 >
2021-07-03 05:07:57 +01:00
< a name = " l32 " > < / a > # < / span > < span class = cF1 > assert < / span > < span class = cF0 > < / span > < span class = cF9 > CMemUsed < / span > < span class = cF0 > . < / span > < span class = cF1 > start < / span > < span class = cF0 > & gt ; = < / span > < span class = cF1 > sizeof < / span > < span class = cF0 > ( < / span > < span class = cF9 > CMemUnused < / span > < span class = cF0 > )
2021-07-04 23:11:34 +01:00
< a name = " l33 " > < / a > < / span > < span class = cF1 > CMP < / span > < span class = cF0 > < / span > < span class = cFC > RAX < / span > < span class = cF0 > , < / span > < span class = cF9 > CMemUsed < / span > < span class = cF0 > . < / span > < span class = cF1 > start < / span > < span class = cF0 >
< a name = " l34 " > < / a > < / span > < span class = cF1 > JAE < / span > < span class = cF0 > @ @ 20
< a name = " l35 " > < / a > < / span > < span class = cF1 > MOV < / span > < span class = cF0 > < / span > < span class = cFC > RAX < / span > < span class = cF0 > , < / span > < span class = cF9 > CMemUsed < / span > < span class = cF0 > . < / span > < span class = cF1 > start < / span > < span class = cF0 >
2021-07-03 05:07:57 +01:00
< a name = " l36 " > < / a > @ @ 20 :
< a name = " l37 " > < / a >
2021-07-04 23:11:34 +01:00
< a name = " l38 " > < / a > < / span > < span class = cF1 > CLI < / span > < span class = cF0 >
< a name = " l39 " > < / a > @ @ 25 : < / span > < span class = cF1 > LOCK < / span > < span class = cF0 >
< a name = " l40 " > < / a > < / span > < span class = cF1 > BTS < / span > < span class = cF0 > < / span > < span class = cF9 > U32 < / span > < span class = cF0 > < / span > < span class = cF9 > CHeapCtrl < / span > < span class = cF0 > . locked_flags [ < / span > < span class = cFC > RDX < / span > < span class = cF0 > ] , < / span > < span class = cF3 > HClf_LOCKED < / span > < span class = cF0 >
< a name = " l41 " > < / a > < / span > < span class = cF1 > PAUSE < / span > < span class = cF0 > < / span > < span class = cF2 > //don't know if this inst helps</span><span class=cF0>
< a name = " l42 " > < / a > < / span > < span class = cF1 > JC < / span > < span class = cF0 > @ @ 25
2021-07-03 05:07:57 +01:00
< a name = " l43 " > < / a >
2021-07-04 23:11:34 +01:00
< a name = " l44 " > < / a > < / span > < span class = cF1 > CMP < / span > < span class = cF0 > < / span > < span class = cFC > RAX < / span > < span class = cF0 > , < / span > < span class = cF3 > MEM_HEAP_HASH_SIZE < / span > < span class = cF0 >
< a name = " l45 " > < / a > < / span > < span class = cF1 > JAE < / span > < span class = cF0 > @ @ 30
< a name = " l46 " > < / a > < / span > < span class = cF1 > MOV < / span > < span class = cF0 > < / span > < span class = cFC > RSI < / span > < span class = cF0 > , < / span > < span class = cF9 > U64 < / span > < span class = cF0 > < / span > < span class = cF9 > CHeapCtrl < / span > < span class = cF0 > . heap_hash [ < / span > < span class = cFC > RAX < / span > < span class = cF0 > + < / span > < span class = cFC > RDX < / span > < span class = cF0 > ]
< a name = " l47 " > < / a > < / span > < span class = cF1 > TEST < / span > < span class = cF0 > < / span > < span class = cFC > RSI < / span > < span class = cF0 > , < / span > < span class = cFC > RSI < / span > < span class = cF0 >
< a name = " l48 " > < / a > < / span > < span class = cF1 > JZ < / span > < span class = cF0 > @ @ 35
< a name = " l49 " > < / a > < / span > < span class = cF1 > MOV < / span > < span class = cF0 > < / span > < span class = cFC > RCX < / span > < span class = cF0 > , < / span > < span class = cF9 > U64 < / span > < span class = cF0 > < / span > < span class = cF9 > CMemUnused < / span > < span class = cF0 > . next [ < / span > < span class = cFC > RSI < / span > < span class = cF0 > ]
< a name = " l50 " > < / a > < / span > < span class = cF1 > MOV < / span > < span class = cF0 > < / span > < span class = cF9 > U64 < / span > < span class = cF0 > < / span > < span class = cF9 > CHeapCtrl < / span > < span class = cF0 > . heap_hash [ < / span > < span class = cFC > RAX < / span > < span class = cF0 > + < / span > < span class = cFC > RDX < / span > < span class = cF0 > ] , < / span > < span class = cFC > RCX < / span > < span class = cF0 >
< a name = " l51 " > < / a > < / span > < span class = cF1 > JMP < / span > < span class = cF0 > < / span > < span class = cF9 > I32 < / span > < span class = cF0 > MALLOC_ALMOST_DONE
2021-07-03 05:07:57 +01:00
< a name = " l52 " > < / a >
< a name = " l53 " > < / a > < / span > < span class = cF2 > //Big allocation</span><span class=cF0>
2021-07-04 23:11:34 +01:00
< a name = " l54 " > < / a > @ @ 30 : < / span > < span class = cF1 > ADD < / span > < span class = cF0 > < / span > < span class = cFC > RAX < / span > < span class = cF0 > , < / span > < span class = cF1 > sizeof < / span > < span class = cF0 > ( < / span > < span class = cF9 > CMemBlk < / span > < span class = cF0 > ) + < / span > < span class = cF3 > MEM_PAG_SIZE < / span > < span class = cF0 > - < / span > < span class = cFE > 1 < / span > < span class = cF0 >
< a name = " l55 " > < / a > < / span > < span class = cF1 > SHR < / span > < span class = cF0 > < / span > < span class = cFC > RAX < / span > < span class = cF0 > , < / span > < span class = cF3 > MEM_PAG_BITS < / span > < span class = cF0 >
2021-07-03 05:07:57 +01:00
< a name = " l56 " > < / a >
2021-07-04 23:11:34 +01:00
< a name = " l57 " > < / a > < / span > < span class = cF1 > PUSH < / span > < span class = cF0 > < / span > < span class = cFC > RDX < / span > < span class = cF0 > < / span > < span class = cF2 > //preserve HeapCtrl</span><span class=cF0>
< a name = " l58 " > < / a > < / span > < span class = cF1 > PUSH < / span > < span class = cF0 > < / span > < span class = cFC > RDX < / span > < span class = cF0 >
< a name = " l59 " > < / a > < / span > < span class = cF1 > PUSH < / span > < span class = cF0 > < / span > < span class = cFC > RAX < / span > < span class = cF0 >
< a name = " l60 " > < / a > < / span > < span class = cF1 > CALL < / span > < span class = cF0 > & amp ; < / span > < span class = cFD > MemPagTaskAlloc < / span > < span class = cF0 >
< a name = " l61 " > < / a > < / span > < span class = cF1 > POP < / span > < span class = cF0 > < / span > < span class = cFC > RDX < / span > < span class = cF0 >
< a name = " l62 " > < / a > < / span > < span class = cF1 > TEST < / span > < span class = cF0 > < / span > < span class = cFC > RAX < / span > < span class = cF0 > , < / span > < span class = cFC > RAX < / span > < span class = cF0 >
< a name = " l63 " > < / a > < / span > < span class = cF1 > JZ < / span > < span class = cF0 > @ @ 45 < / span > < span class = cF2 > //Out of memory</span><span class=cF0>
< a name = " l64 " > < / a > < / span > < span class = cF1 > MOV < / span > < span class = cF0 > < / span > < span class = cFC > RSI < / span > < span class = cF0 > , < / span > < span class = cFC > RAX < / span > < span class = cF0 >
< a name = " l65 " > < / a > < / span > < span class = cF1 > MOV < / span > < span class = cF0 > < / span > < span class = cFC > EAX < / span > < span class = cF0 > , < / span > < span class = cF9 > U32 < / span > < span class = cF0 > < / span > < span class = cF9 > CMemBlk < / span > < span class = cF0 > . pags [ < / span > < span class = cFC > RSI < / span > < span class = cF0 > ]
2021-07-03 05:07:57 +01:00
< a name = " l66 " > < / a >
2021-07-04 23:11:34 +01:00
< a name = " l67 " > < / a > < / span > < span class = cF1 > SHL < / span > < span class = cF0 > < / span > < span class = cFC > RAX < / span > < span class = cF0 > , < / span > < span class = cF3 > MEM_PAG_BITS < / span > < span class = cF0 >
< a name = " l68 " > < / a > < / span > < span class = cF1 > SUB < / span > < span class = cF0 > < / span > < span class = cFC > RAX < / span > < span class = cF0 > , < / span > < span class = cF1 > sizeof < / span > < span class = cF0 > ( < / span > < span class = cF9 > CMemBlk < / span > < span class = cF0 > )
< a name = " l69 " > < / a > < / span > < span class = cF1 > ADD < / span > < span class = cF0 > < / span > < span class = cFC > RSI < / span > < span class = cF0 > , < / span > < span class = cF1 > sizeof < / span > < span class = cF0 > ( < / span > < span class = cF9 > CMemBlk < / span > < span class = cF0 > )
< a name = " l70 " > < / a > < / span > < span class = cF1 > JMP < / span > < span class = cF0 > < / span > < span class = cF9 > I32 < / span > < span class = cF0 > MALLOC_ALMOST_DONE
2021-07-03 05:07:57 +01:00
< a name = " l71 " > < / a >
< a name = " l72 " > < / a > < / span > < span class = cF2 > //Little allocation, chunk-off piece from free list chunks</span><span class=cF0>
2021-07-04 23:11:34 +01:00
< a name = " l73 " > < / a > @ @ 35 : < / span > < span class = cF1 > LEA < / span > < span class = cF0 > < / span > < span class = cFC > RSI < / span > < span class = cF0 > , < / span > < span class = cF9 > U64 < / span > < span class = cF0 > < / span > < span class = cF9 > CHeapCtrl < / span > < span class = cF0 > . malloc_free_list - < / span > < span class = cF9 > CMemUnused < / span > < span class = cF0 > . next [ < / span > < span class = cFC > RDX < / span > < span class = cF0 > ]
2021-07-03 05:07:57 +01:00
< a name = " l74 " > < / a >
2021-07-04 23:11:34 +01:00
< a name = " l75 " > < / a > @ @ 40 : < / span > < span class = cF1 > MOV < / span > < span class = cF0 > < / span > < span class = cFC > RBX < / span > < span class = cF0 > , < / span > < span class = cFC > RSI < / span > < span class = cF0 >
< a name = " l76 " > < / a > < / span > < span class = cF1 > MOV < / span > < span class = cF0 > < / span > < span class = cFC > RSI < / span > < span class = cF0 > , < / span > < span class = cF9 > U64 < / span > < span class = cF0 > < / span > < span class = cF9 > CMemUnused < / span > < span class = cF0 > . next [ < / span > < span class = cFC > RBX < / span > < span class = cF0 > ]
< a name = " l77 " > < / a > < / span > < span class = cF1 > TEST < / span > < span class = cF0 > < / span > < span class = cFC > RSI < / span > < span class = cF0 > , < / span > < span class = cFC > RSI < / span > < span class = cF0 >
< a name = " l78 " > < / a > < / span > < span class = cF1 > JNZ < / span > < span class = cF0 > < / span > < span class = cF9 > I32 < / span > < span class = cF0 > @ @ 60
< a name = " l79 " > < / a > < / span > < span class = cF1 > PUSH < / span > < span class = cF0 > < / span > < span class = cFC > RAX < / span > < span class = cF0 > < / span > < span class = cF2 > //-**** save byte size</span><span class=cF0>
< a name = " l80 " > < / a > < / span > < span class = cF1 > ADD < / span > < span class = cF0 > < / span > < span class = cFC > RAX < / span > < span class = cF0 > , < / span > < span class = cFE > 16 < / span > < span class = cF0 > * < / span > < span class = cF3 > MEM_PAG_SIZE < / span > < span class = cF0 > - < / span > < span class = cFE > 1 < / span > < span class = cF0 >
< a name = " l81 " > < / a > < / span > < span class = cF1 > SHR < / span > < span class = cF0 > < / span > < span class = cFC > RAX < / span > < span class = cF0 > , < / span > < span class = cF3 > MEM_PAG_BITS < / span > < span class = cF0 >
2021-07-03 05:07:57 +01:00
< a name = " l82 " > < / a >
2021-07-04 23:11:34 +01:00
< a name = " l83 " > < / a > < / span > < span class = cF1 > PUSH < / span > < span class = cF0 > < / span > < span class = cFC > RDX < / span > < span class = cF0 > < / span > < span class = cF2 > //preserve HeapCtrl</span><span class=cF0>
< a name = " l84 " > < / a > < / span > < span class = cF1 > PUSH < / span > < span class = cF0 > < / span > < span class = cFC > RDX < / span > < span class = cF0 >
< a name = " l85 " > < / a > < / span > < span class = cF1 > PUSH < / span > < span class = cF0 > < / span > < span class = cFC > RAX < / span > < span class = cF0 >
< a name = " l86 " > < / a > < / span > < span class = cF1 > CALL < / span > < span class = cF0 > & amp ; < / span > < span class = cFD > MemPagTaskAlloc < / span > < span class = cF0 >
< a name = " l87 " > < / a > < / span > < span class = cF1 > POP < / span > < span class = cF0 > < / span > < span class = cFC > RDX < / span > < span class = cF0 >
< a name = " l88 " > < / a > < / span > < span class = cF1 > TEST < / span > < span class = cF0 > < / span > < span class = cFC > RAX < / span > < span class = cF0 > , < / span > < span class = cFC > RAX < / span > < span class = cF0 >
< a name = " l89 " > < / a > < / span > < span class = cF1 > JNZ < / span > < span class = cF0 > @ @ 50
2021-07-03 05:07:57 +01:00
< a name = " l90 " > < / a >
< a name = " l91 " > < / a > < / span > < span class = cF2 > //Out of memory</span><span class=cF0>
2021-07-04 23:11:34 +01:00
< a name = " l92 " > < / a > @ @ 45 : < / span > < span class = cF1 > LOCK < / span > < span class = cF0 >
< a name = " l93 " > < / a > < / span > < span class = cF1 > BTR < / span > < span class = cF0 > < / span > < span class = cF9 > U32 < / span > < span class = cF0 > < / span > < span class = cF9 > CHeapCtrl < / span > < span class = cF0 > . locked_flags [ < / span > < span class = cFC > RDX < / span > < span class = cF0 > ] , < / span > < span class = cF3 > HClf_LOCKED < / span > < span class = cF0 >
< a name = " l94 " > < / a > < / span > < span class = cF1 > POPFD < / span > < span class = cF0 >
< a name = " l95 " > < / a > < / span > < span class = cF1 > PUSH < / span > < span class = cF0 > < / span > < span class = cF3 > TRUE < / span > < span class = cF0 >
< a name = " l96 " > < / a > < / span > < span class = cF1 > MOV < / span > < span class = cF0 > < / span > < span class = cFC > RAX < / span > < span class = cF0 > , < / span > < span class = cF6 > ' OutMem ' < / span > < span class = cF0 >
< a name = " l97 " > < / a > < / span > < span class = cF1 > PUSH < / span > < span class = cF0 > < / span > < span class = cFC > RAX < / span > < span class = cF0 >
< a name = " l98 " > < / a > < / span > < span class = cF1 > CALL < / span > < span class = cF0 > < / span > < span class = cF9 > I32 < / span > < span class = cF0 > & amp ; < / span > < span class = cF5 > throw < / span > < span class = cF0 >
< a name = " l99 " > < / a > < / span > < span class = cF1 > JMP < / span > < span class = cF0 > < / span > < span class = cF9 > I32 < / span > < span class = cF0 > MALLOC_FINAL_EXIT < / span > < span class = cF2 > //Never gets here, hopefully.</span><span class=cF0>
2021-07-03 05:07:57 +01:00
< a name = " l100 " > < / a >
2021-07-04 23:11:34 +01:00
< a name = " l101 " > < / a > @ @ 50 : < / span > < span class = cF1 > MOV < / span > < span class = cF0 > < / span > < span class = cFC > RSI < / span > < span class = cF0 > , < / span > < span class = cFC > RAX < / span > < span class = cF0 >
< a name = " l102 " > < / a > < / span > < span class = cF1 > MOV < / span > < span class = cF0 > < / span > < span class = cFC > EAX < / span > < span class = cF0 > , < / span > < span class = cF9 > U32 < / span > < span class = cF0 > < / span > < span class = cF9 > CMemBlk < / span > < span class = cF0 > . pags [ < / span > < span class = cFC > RSI < / span > < span class = cF0 > ]
< a name = " l103 " > < / a > < / span > < span class = cF1 > SHL < / span > < span class = cF0 > < / span > < span class = cFC > RAX < / span > < span class = cF0 > , < / span > < span class = cF3 > MEM_PAG_BITS < / span > < span class = cF0 >
2021-07-03 05:07:57 +01:00
< a name = " l104 " > < / a >
< a name = " l105 " > < / a > < / span > < span class = cF2 > //Can it be combined with last chunk? (Never Free these chunks.)</span><span class=cF0>
2021-07-04 23:11:34 +01:00
< a name = " l106 " > < / a > < / span > < span class = cF1 > MOV < / span > < span class = cF0 > < / span > < span class = cFC > RDI < / span > < span class = cF0 > , < / span > < span class = cF9 > U64 < / span > < span class = cF0 > < / span > < span class = cF9 > CHeapCtrl < / span > < span class = cF0 > . last_mergable [ < / span > < span class = cFC > RDX < / span > < span class = cF0 > ]
< a name = " l107 " > < / a > < / span > < span class = cF1 > LEA < / span > < span class = cF0 > < / span > < span class = cFC > RBX < / span > < span class = cF0 > , < / span > < span class = cF9 > U64 < / span > < span class = cF0 > [ < / span > < span class = cFC > RSI < / span > < span class = cF0 > + < / span > < span class = cFC > RAX < / span > < span class = cF0 > ]
< a name = " l108 " > < / a > < / span > < span class = cF1 > CMP < / span > < span class = cF0 > < / span > < span class = cFC > RDI < / span > < span class = cF0 > , < / span > < span class = cFC > RBX < / span > < span class = cF0 >
< a name = " l109 " > < / a > < / span > < span class = cF1 > JNE < / span > < span class = cF0 > @ @ 55
2021-07-03 05:07:57 +01:00
< a name = " l110 " > < / a >
2021-07-04 23:11:34 +01:00
< a name = " l111 " > < / a > < / span > < span class = cF1 > PUSH < / span > < span class = cF0 > < / span > < span class = cFC > RAX < / span > < span class = cF0 >
< a name = " l112 " > < / a > < / span > < span class = cF1 > MOV < / span > < span class = cF0 > < / span > < span class = cFC > EAX < / span > < span class = cF0 > , < / span > < span class = cF9 > U32 < / span > < span class = cF0 > < / span > < span class = cF9 > CMemBlk < / span > < span class = cF0 > . pags [ < / span > < span class = cFC > RDI < / span > < span class = cF0 > ]
< a name = " l113 " > < / a > < / span > < span class = cF1 > ADD < / span > < span class = cF0 > < / span > < span class = cF9 > U32 < / span > < span class = cF0 > < / span > < span class = cF9 > CMemBlk < / span > < span class = cF0 > . pags [ < / span > < span class = cFC > RSI < / span > < span class = cF0 > ] , < / span > < span class = cFC > EAX < / span > < span class = cF0 >
2021-07-03 05:07:57 +01:00
< a name = " l114 " > < / a > < / span > < span class = cF2 > //QueueRemove</span><span class=cF0>
2021-07-04 23:11:34 +01:00
< a name = " l115 " > < / a > < / span > < span class = cF1 > MOV < / span > < span class = cF0 > < / span > < span class = cFC > RAX < / span > < span class = cF0 > , < / span > < span class = cF9 > U64 < / span > < span class = cF0 > < / span > < span class = cF9 > CMemBlk < / span > < span class = cF0 > . next [ < / span > < span class = cFC > RDI < / span > < span class = cF0 > ]
< a name = " l116 " > < / a > < / span > < span class = cF1 > MOV < / span > < span class = cF0 > < / span > < span class = cFC > RBX < / span > < span class = cF0 > , < / span > < span class = cF9 > U64 < / span > < span class = cF0 > < / span > < span class = cF9 > CMemBlk < / span > < span class = cF0 > . last [ < / span > < span class = cFC > RDI < / span > < span class = cF0 > ]
< a name = " l117 " > < / a > < / span > < span class = cF1 > MOV < / span > < span class = cF0 > < / span > < span class = cF9 > U64 < / span > < span class = cF0 > < / span > < span class = cF9 > CMemBlk < / span > < span class = cF0 > . last [ < / span > < span class = cFC > RAX < / span > < span class = cF0 > ] , < / span > < span class = cFC > RBX < / span > < span class = cF0 >
< a name = " l118 " > < / a > < / span > < span class = cF1 > MOV < / span > < span class = cF0 > < / span > < span class = cF9 > U64 < / span > < span class = cF0 > < / span > < span class = cF9 > CMemBlk < / span > < span class = cF0 > . next [ < / span > < span class = cFC > RBX < / span > < span class = cF0 > ] , < / span > < span class = cFC > RAX < / span > < span class = cF0 >
< a name = " l119 " > < / a > < / span > < span class = cF1 > POP < / span > < span class = cF0 > < / span > < span class = cFC > RAX < / span > < span class = cF0 >
2021-07-03 05:07:57 +01:00
< a name = " l120 " > < / a >
2021-07-04 23:11:34 +01:00
< a name = " l121 " > < / a > @ @ 55 : < / span > < span class = cF1 > MOV < / span > < span class = cF0 > < / span > < span class = cF9 > U64 < / span > < span class = cF0 > < / span > < span class = cF9 > CHeapCtrl < / span > < span class = cF0 > . last_mergable [ < / span > < span class = cFC > RDX < / span > < span class = cF0 > ] , < / span > < span class = cFC > RSI < / span > < span class = cF0 >
< a name = " l122 " > < / a > < / span > < span class = cF1 > LEA < / span > < span class = cF0 > < / span > < span class = cFC > RSI < / span > < span class = cF0 > , < / span > < span class = cF9 > U64 < / span > < span class = cF0 > < / span > < span class = cF1 > sizeof < / span > < span class = cF0 > ( < / span > < span class = cF9 > CMemBlk < / span > < span class = cF0 > ) [ < / span > < span class = cFC > RSI < / span > < span class = cF0 > ]
< a name = " l123 " > < / a > < / span > < span class = cF1 > SUB < / span > < span class = cF0 > < / span > < span class = cFC > RAX < / span > < span class = cF0 > , < / span > < span class = cF1 > sizeof < / span > < span class = cF0 > ( < / span > < span class = cF9 > CMemBlk < / span > < span class = cF0 > )
< a name = " l124 " > < / a > < / span > < span class = cF1 > LEA < / span > < span class = cF0 > < / span > < span class = cFC > RBX < / span > < span class = cF0 > , < / span > < span class = cF9 > U64 < / span > < span class = cF0 > < / span > < span class = cF9 > CHeapCtrl < / span > < span class = cF0 > . malloc_free_list - < / span > < span class = cF9 > CMemUnused < / span > < span class = cF0 > . next [ < / span > < span class = cFC > RDX < / span > < span class = cF0 > ]
< a name = " l125 " > < / a > < / span > < span class = cF1 > MOV < / span > < span class = cF0 > < / span > < span class = cFC > RDI < / span > < span class = cF0 > , < / span > < span class = cF9 > U64 < / span > < span class = cF0 > < / span > < span class = cF9 > CMemUnused < / span > < span class = cF0 > . next [ < / span > < span class = cFC > RBX < / span > < span class = cF0 > ]
< a name = " l126 " > < / a > < / span > < span class = cF1 > MOV < / span > < span class = cF0 > < / span > < span class = cF9 > U64 < / span > < span class = cF0 > < / span > < span class = cF9 > CMemUnused < / span > < span class = cF0 > . next [ < / span > < span class = cFC > RSI < / span > < span class = cF0 > ] , < / span > < span class = cFC > RDI < / span > < span class = cF0 >
< a name = " l127 " > < / a > < / span > < span class = cF1 > MOV < / span > < span class = cF0 > < / span > < span class = cF9 > U64 < / span > < span class = cF0 > < / span > < span class = cF9 > CMemUnused < / span > < span class = cF0 > . size [ < / span > < span class = cFC > RSI < / span > < span class = cF0 > ] , < / span > < span class = cFC > RAX < / span > < span class = cF0 >
< a name = " l128 " > < / a > < / span > < span class = cF1 > MOV < / span > < span class = cF0 > < / span > < span class = cF9 > U64 < / span > < span class = cF0 > < / span > < span class = cF9 > CMemUnused < / span > < span class = cF0 > . next [ < / span > < span class = cFC > RBX < / span > < span class = cF0 > ] , < / span > < span class = cFC > RSI < / span > < span class = cF0 >
< a name = " l129 " > < / a > < / span > < span class = cF1 > POP < / span > < span class = cF0 > < / span > < span class = cFC > RAX < / span > < span class = cF0 > < / span > < span class = cF2 > //+****</span><span class=cF0>
< a name = " l130 " > < / a > < / span > < span class = cF1 > JMP < / span > < span class = cF0 > @ @ 70
< a name = " l131 " > < / a > @ @ 60 : < / span > < span class = cF1 > CMP < / span > < span class = cF0 > < / span > < span class = cF9 > U64 < / span > < span class = cF0 > < / span > < span class = cF9 > CMemUnused < / span > < span class = cF0 > . size [ < / span > < span class = cFC > RSI < / span > < span class = cF0 > ] , < / span > < span class = cFC > RAX < / span > < span class = cF0 >
< a name = " l132 " > < / a > < / span > < span class = cF1 > JB < / span > < span class = cF0 > < / span > < span class = cF9 > I32 < / span > < span class = cF0 > @ @ 40
< a name = " l133 " > < / a > < / span > < span class = cF1 > JNE < / span > < span class = cF0 > @ @ 70
2021-07-03 05:07:57 +01:00
< a name = " l134 " > < / a >
2021-07-04 23:11:34 +01:00
< a name = " l135 " > < / a > @ @ 65 : < / span > < span class = cF1 > MOV < / span > < span class = cF0 > < / span > < span class = cFC > RDI < / span > < span class = cF0 > , < / span > < span class = cF9 > U64 < / span > < span class = cF0 > < / span > < span class = cF9 > CMemUnused < / span > < span class = cF0 > . next [ < / span > < span class = cFC > RSI < / span > < span class = cF0 > ]
< a name = " l136 " > < / a > < / span > < span class = cF1 > MOV < / span > < span class = cF0 > < / span > < span class = cF9 > U64 < / span > < span class = cF0 > < / span > < span class = cF9 > CMemUnused < / span > < span class = cF0 > . next [ < / span > < span class = cFC > RBX < / span > < span class = cF0 > ] , < / span > < span class = cFC > RDI < / span > < span class = cF0 >
< a name = " l137 " > < / a > < / span > < span class = cF1 > JMP < / span > < span class = cF0 > MALLOC_ALMOST_DONE
2021-07-03 05:07:57 +01:00
< a name = " l138 " > < / a >
2021-07-04 23:11:34 +01:00
< a name = " l139 " > < / a > @ @ 70 : < / span > < span class = cF1 > SUB < / span > < span class = cF0 > < / span > < span class = cF9 > U64 < / span > < span class = cF0 > < / span > < span class = cF9 > CMemUnused < / span > < span class = cF0 > . size [ < / span > < span class = cFC > RSI < / span > < span class = cF0 > ] , < / span > < span class = cFC > RAX < / span > < span class = cF0 > < / span > < span class = cF2 > //UPDATE FREE ENTRY</span><span class=cF0>
< a name = " l140 " > < / a > < / span > < span class = cF1 > CMP < / span > < span class = cF0 > < / span > < span class = cF9 > U64 < / span > < span class = cF0 > < / span > < span class = cF9 > CMemUnused < / span > < span class = cF0 > . size [ < / span > < span class = cFC > RSI < / span > < span class = cF0 > ] , < / span > < span class = cF1 > sizeof < / span > < span class = cF0 > ( < / span > < span class = cF9 > CMemUnused < / span > < span class = cF0 > )
< a name = " l141 " > < / a > < / span > < span class = cF1 > JAE < / span > < span class = cF0 > @ @ 75 < / span > < span class = cF2 > //take from top of block</span><span class=cF0>
< a name = " l142 " > < / a > < / span > < span class = cF1 > ADD < / span > < span class = cF0 > < / span > < span class = cF9 > U64 < / span > < span class = cF0 > < / span > < span class = cF9 > CMemUnused < / span > < span class = cF0 > . size [ < / span > < span class = cFC > RSI < / span > < span class = cF0 > ] , < / span > < span class = cFC > RAX < / span > < span class = cF0 > < / span > < span class = cF2 > //doesn't fit, undo</span><span class=cF0>
< a name = " l143 " > < / a > < / span > < span class = cF1 > JMP < / span > < span class = cF0 > < / span > < span class = cF9 > I32 < / span > < span class = cF0 > @ @ 40
2021-07-03 05:07:57 +01:00
< a name = " l144 " > < / a >
2021-07-04 23:11:34 +01:00
< a name = " l145 " > < / a > @ @ 75 : < / span > < span class = cF1 > ADD < / span > < span class = cF0 > < / span > < span class = cFC > RSI < / span > < span class = cF0 > , < / span > < span class = cF9 > U64 < / span > < span class = cF0 > < / span > < span class = cF9 > CMemUnused < / span > < span class = cF0 > . size [ < / span > < span class = cFC > RSI < / span > < span class = cF0 > ]
2021-07-03 05:07:57 +01:00
< a name = " l146 " > < / a >
< a name = " l147 " > < / a > MALLOC_ALMOST_DONE :
< a name = " l148 " > < / a > < / span > < span class = cF2 > //RSI = res - CMemUsed.size</span><span class=cF0>
< a name = " l149 " > < / a > < / span > < span class = cF2 > //RAX = size + CMemUsed.size</span><span class=cF0>
< a name = " l150 " > < / a > < / span > < span class = cF2 > //RDX = HeapCtrl</span><span class=cF0>
2021-07-04 23:11:34 +01:00
< a name = " l151 " > < / a > < / span > < span class = cF1 > ADD < / span > < span class = cF0 > < / span > < span class = cF9 > U64 < / span > < span class = cF0 > < / span > < span class = cF9 > CHeapCtrl < / span > < span class = cF0 > . used_u8s [ < / span > < span class = cFC > RDX < / span > < span class = cF0 > ] , < / span > < span class = cFC > RAX < / span > < span class = cF0 >
2021-07-03 05:07:57 +01:00
< a name = " l152 " > < / a >
< a name = " l153 " > < / a > # < / span > < span class = cF1 > if < / span > < span class = cF0 > < / span > < span class = cF3 > _CONFIG_HEAP_DEBUG < / span > < span class = cF0 >
< a name = " l154 " > < / a > < / span > < span class = cF2 > //QueueInsert</span><span class=cF0>
2021-07-04 23:11:34 +01:00
< a name = " l155 " > < / a > < / span > < span class = cF1 > MOV < / span > < span class = cF0 > < / span > < span class = cFC > RDI < / span > < span class = cF0 > , < / span > < span class = cF9 > U64 < / span > < span class = cF0 > < / span > < span class = cF9 > CHeapCtrl < / span > < span class = cF0 > . last_um [ < / span > < span class = cFC > RDX < / span > < span class = cF0 > ]
< a name = " l156 " > < / a > < / span > < span class = cF1 > MOV < / span > < span class = cF0 > < / span > < span class = cF9 > U64 < / span > < span class = cF0 > < / span > < span class = cF9 > CMemUsed < / span > < span class = cF0 > . next [ < / span > < span class = cFC > RDI < / span > < span class = cF0 > ] , < / span > < span class = cFC > RSI < / span > < span class = cF0 >
< a name = " l157 " > < / a > < / span > < span class = cF1 > MOV < / span > < span class = cF0 > < / span > < span class = cF9 > U64 < / span > < span class = cF0 > < / span > < span class = cF9 > CHeapCtrl < / span > < span class = cF0 > . last_um [ < / span > < span class = cFC > RDX < / span > < span class = cF0 > ] , < / span > < span class = cFC > RSI < / span > < span class = cF0 >
< a name = " l158 " > < / a > < / span > < span class = cF1 > MOV < / span > < span class = cF0 > < / span > < span class = cF9 > U64 < / span > < span class = cF0 > < / span > < span class = cF9 > CMemUsed < / span > < span class = cF0 > . last [ < / span > < span class = cFC > RSI < / span > < span class = cF0 > ] , < / span > < span class = cFC > RDI < / span > < span class = cF0 >
< a name = " l159 " > < / a > < / span > < span class = cF1 > LEA < / span > < span class = cF0 > < / span > < span class = cFC > RDI < / span > < span class = cF0 > , < / span > < span class = cF9 > U64 < / span > < span class = cF0 > < / span > < span class = cF9 > CHeapCtrl < / span > < span class = cF0 > . next_um - < / span > < span class = cF9 > CMemUsed < / span > < span class = cF0 > . next [ < / span > < span class = cFC > RDX < / span > < span class = cF0 > ]
< a name = " l160 " > < / a > < / span > < span class = cF1 > MOV < / span > < span class = cF0 > < / span > < span class = cF9 > U64 < / span > < span class = cF0 > < / span > < span class = cF9 > CMemUsed < / span > < span class = cF0 > . next [ < / span > < span class = cFC > RSI < / span > < span class = cF0 > ] , < / span > < span class = cFC > RDI < / span > < span class = cF0 >
2021-07-03 05:07:57 +01:00
< a name = " l161 " > < / a >
< a name = " l162 " > < / a > < / span > < span class = cF2 > //Caller1/Caller2</span><span class=cF0>
2021-07-04 23:11:34 +01:00
< a name = " l163 " > < / a > < / span > < span class = cF1 > PUSH < / span > < span class = cF0 > < / span > < span class = cFC > RDX < / span > < span class = cF0 >
< a name = " l164 " > < / a > < / span > < span class = cF1 > MOV < / span > < span class = cF0 > < / span > < span class = cFC > RDX < / span > < span class = cF0 > , < / span > < span class = cF9 > U64 < / span > < span class = cF0 > [ < / span > < span class = cFD > MEM_HEAP_LIMIT < / span > < span class = cF0 > ]
< a name = " l165 " > < / a > < / span > < span class = cF1 > MOV < / span > < span class = cF0 > < / span > < span class = cFC > RDI < / span > < span class = cF0 > , < / span > < span class = cF9 > U64 < / span > < span class = cF0 > < / span > < span class = cF3 > SF_RIP < / span > < span class = cF0 > [ < / span > < span class = cFC > RBP < / span > < span class = cF0 > ]
< a name = " l166 " > < / a > < / span > < span class = cF1 > CMP < / span > < span class = cF0 > < / span > < span class = cFC > RDI < / span > < span class = cF0 > , < / span > < span class = cFC > RDX < / span > < span class = cF0 >
< a name = " l167 " > < / a > < / span > < span class = cF1 > JB < / span > < span class = cF0 > @ @ 80
< a name = " l168 " > < / a > < / span > < span class = cF1 > XOR < / span > < span class = cF0 > < / span > < span class = cFC > RDI < / span > < span class = cF0 > , < / span > < span class = cFC > RDI < / span > < span class = cF0 >
< a name = " l169 " > < / a > < / span > < span class = cF1 > MOV < / span > < span class = cF0 > < / span > < span class = cF9 > U64 < / span > < span class = cF0 > < / span > < span class = cF9 > CMemUsed < / span > < span class = cF0 > . caller1 [ < / span > < span class = cFC > RSI < / span > < span class = cF0 > ] , < / span > < span class = cFC > RDI < / span > < span class = cF0 >
< a name = " l170 " > < / a > < / span > < span class = cF1 > JMP < / span > < span class = cF0 > @ @ 90
< a name = " l171 " > < / a > @ @ 80 : < / span > < span class = cF1 > MOV < / span > < span class = cF0 > < / span > < span class = cF9 > U64 < / span > < span class = cF0 > < / span > < span class = cF9 > CMemUsed < / span > < span class = cF0 > . caller1 [ < / span > < span class = cFC > RSI < / span > < span class = cF0 > ] , < / span > < span class = cFC > RDI < / span > < span class = cF0 >
< a name = " l172 " > < / a > < / span > < span class = cF1 > MOV < / span > < span class = cF0 > < / span > < span class = cFC > RDI < / span > < span class = cF0 > , < / span > < span class = cF9 > U64 < / span > < span class = cF0 > < / span > < span class = cF3 > SF_RBP < / span > < span class = cF0 > [ < / span > < span class = cFC > RBP < / span > < span class = cF0 > ]
< a name = " l173 " > < / a > < / span > < span class = cF1 > CMP < / span > < span class = cF0 > < / span > < span class = cFC > RDI < / span > < span class = cF0 > , < / span > < span class = cFC > RDX < / span > < span class = cF0 >
< a name = " l174 " > < / a > < / span > < span class = cF1 > JB < / span > < span class = cF0 > @ @ 85
< a name = " l175 " > < / a > < / span > < span class = cF1 > XOR < / span > < span class = cF0 > < / span > < span class = cFC > RDI < / span > < span class = cF0 > , < / span > < span class = cFC > RDI < / span > < span class = cF0 >
< a name = " l176 " > < / a > < / span > < span class = cF1 > JMP < / span > < span class = cF0 > @ @ 90
< a name = " l177 " > < / a > @ @ 85 : < / span > < span class = cF1 > MOV < / span > < span class = cF0 > < / span > < span class = cFC > RDI < / span > < span class = cF0 > , < / span > < span class = cF9 > U64 < / span > < span class = cF0 > < / span > < span class = cF3 > SF_RIP < / span > < span class = cF0 > [ < / span > < span class = cFC > RDI < / span > < span class = cF0 > ]
< a name = " l178 " > < / a > < / span > < span class = cF1 > CMP < / span > < span class = cF0 > < / span > < span class = cFC > RDI < / span > < span class = cF0 > , < / span > < span class = cFC > RDX < / span > < span class = cF0 >
< a name = " l179 " > < / a > < / span > < span class = cF1 > JB < / span > < span class = cF0 > @ @ 90
< a name = " l180 " > < / a > < / span > < span class = cF1 > XOR < / span > < span class = cF0 > < / span > < span class = cFC > RDI < / span > < span class = cF0 > , < / span > < span class = cFC > RDI < / span > < span class = cF0 >
< a name = " l181 " > < / a > @ @ 90 : < / span > < span class = cF1 > MOV < / span > < span class = cF0 > < / span > < span class = cF9 > U64 < / span > < span class = cF0 > < / span > < span class = cF9 > CMemUsed < / span > < span class = cF0 > . caller2 [ < / span > < span class = cFC > RSI < / span > < span class = cF0 > ] , < / span > < span class = cFC > RDI < / span > < span class = cF0 >
< a name = " l182 " > < / a > < / span > < span class = cF1 > POP < / span > < span class = cF0 > < / span > < span class = cFC > RDX < / span > < span class = cF0 >
2021-07-03 05:07:57 +01:00
< a name = " l183 " > < / a >
< a name = " l184 " > < / a > # < / span > < span class = cF1 > endif < / span > < span class = cF0 >
2021-07-04 23:11:34 +01:00
< a name = " l185 " > < / a > < / span > < span class = cF1 > LOCK < / span > < span class = cF0 >
< a name = " l186 " > < / a > < / span > < span class = cF1 > BTR < / span > < span class = cF0 > < / span > < span class = cF9 > U32 < / span > < span class = cF0 > < / span > < span class = cF9 > CHeapCtrl < / span > < span class = cF0 > . locked_flags [ < / span > < span class = cFC > RDX < / span > < span class = cF0 > ] , < / span > < span class = cF3 > HClf_LOCKED < / span > < span class = cF0 >
< a name = " l187 " > < / a > < / span > < span class = cF1 > POPFD < / span > < span class = cF0 >
2021-07-03 05:07:57 +01:00
< a name = " l188 " > < / a >
2021-07-04 23:11:34 +01:00
< a name = " l189 " > < / a > < / span > < span class = cF1 > MOV < / span > < span class = cF0 > < / span > < span class = cF9 > U64 < / span > < span class = cF0 > < / span > < span class = cF9 > CMemUsed < / span > < span class = cF0 > . size [ < / span > < span class = cFC > RSI < / span > < span class = cF0 > ] , < / span > < span class = cFC > RAX < / span > < span class = cF0 >
< a name = " l190 " > < / a > < / span > < span class = cF1 > MOV < / span > < span class = cF0 > < / span > < span class = cF9 > U64 < / span > < span class = cF0 > < / span > < span class = cF9 > CMemUsed < / span > < span class = cF0 > . hc [ < / span > < span class = cFC > RSI < / span > < span class = cF0 > ] , < / span > < span class = cFC > RDX < / span > < span class = cF0 >
< a name = " l191 " > < / a > < / span > < span class = cF1 > LEA < / span > < span class = cF0 > < / span > < span class = cFC > RAX < / span > < span class = cF0 > , < / span > < span class = cF9 > U64 < / span > < span class = cF0 > < / span > < span class = cF9 > CMemUsed < / span > < span class = cF0 > . < / span > < span class = cF1 > start < / span > < span class = cF0 > [ < / span > < span class = cFC > RSI < / span > < span class = cF0 > ]
2021-07-03 05:07:57 +01:00
< a name = " l192 " > < / a >
2021-07-04 23:11:34 +01:00
< a name = " l193 " > < / a > < / span > < span class = cF1 > TEST < / span > < span class = cF0 > < / span > < span class = cF1 > U8 < / span > < span class = cF0 > [ < / span > < span class = cFD > SYS_SEMAS < / span > < span class = cF0 > + < / span > < span class = cF3 > SEMA_HEAPLOG_ACTIVE < / span > < span class = cF0 > * < / span > < span class = cF3 > DEFAULT_CACHE_LINE_WIDTH < / span > < span class = cF0 > ] , < / span > < span class = cFE > 1 < / span > < span class = cF0 >
< a name = " l194 " > < / a > < / span > < span class = cF1 > JZ < / span > < span class = cF0 > @ @ 105
< a name = " l195 " > < / a > < / span > < span class = cF1 > PUSH < / span > < span class = cF0 > < / span > < span class = cFC > RAX < / span > < span class = cF0 >
< a name = " l196 " > < / a > < / span > < span class = cF1 > PUSH < / span > < span class = cF0 > < / span > < span class = cFC > RAX < / span > < span class = cF0 >
< a name = " l197 " > < / a > < / span > < span class = cF1 > MOV < / span > < span class = cF0 > < / span > < span class = cFC > RAX < / span > < span class = cF0 > , < / span > < span class = cF9 > U64 < / span > < span class = cF0 > [ < / span > < span class = cFD > SYS_EXTERN_TABLE < / span > < span class = cF0 > ]
< a name = " l198 " > < / a > < / span > < span class = cF1 > MOV < / span > < span class = cF0 > < / span > < span class = cFC > RAX < / span > < span class = cF0 > , < / span > < span class = cF9 > U64 < / span > < span class = cF0 > < / span > < span class = cF3 > EXT_HEAPLOG_MALLOC < / span > < span class = cF0 > * < / span > < span class = cFE > 8 < / span > < span class = cF0 > [ < / span > < span class = cFC > RAX < / span > < span class = cF0 > ]
< a name = " l199 " > < / a > < / span > < span class = cF1 > TEST < / span > < span class = cF0 > < / span > < span class = cFC > RAX < / span > < span class = cF0 > , < / span > < span class = cFC > RAX < / span > < span class = cF0 >
< a name = " l200 " > < / a > < / span > < span class = cF1 > JZ < / span > < span class = cF0 > @ @ 95
< a name = " l201 " > < / a > < / span > < span class = cF1 > CALL < / span > < span class = cF0 > < / span > < span class = cFC > RAX < / span > < span class = cF0 >
< a name = " l202 " > < / a > < / span > < span class = cF1 > JMP < / span > < span class = cF0 > @ @ 100
< a name = " l203 " > < / a > @ @ 95 : < / span > < span class = cF1 > ADD < / span > < span class = cF0 > < / span > < span class = cFC > RSP < / span > < span class = cF0 > , < / span > < span class = cFE > 8 < / span > < span class = cF0 >
< a name = " l204 " > < / a > @ @ 100 : < / span > < span class = cF1 > POP < / span > < span class = cF0 > < / span > < span class = cFC > RAX < / span > < span class = cF0 >
2021-07-03 05:07:57 +01:00
< a name = " l205 " > < / a >
2021-07-04 23:11:34 +01:00
< a name = " l206 " > < / a > @ @ 105 : < / span > < span class = cF1 > TEST < / span > < span class = cF0 > < / span > < span class = cF1 > U8 < / span > < span class = cF0 > [ < / span > < span class = cFD > SYS_HEAP_INIT_FLAG < / span > < span class = cF0 > ] , < / span > < span class = cFE > 1 < / span > < span class = cF0 >
< a name = " l207 " > < / a > < / span > < span class = cF1 > JZ < / span > < span class = cF0 > MALLOC_FINAL_EXIT
2021-07-03 05:07:57 +01:00
< a name = " l208 " > < / a >
2021-07-04 23:11:34 +01:00
< a name = " l209 " > < / a > < / span > < span class = cF1 > PUSH < / span > < span class = cF0 > < / span > < span class = cFC > RAX < / span > < span class = cF0 >
< a name = " l210 " > < / a > < / span > < span class = cF1 > MOV < / span > < span class = cF0 > < / span > < span class = cFC > RCX < / span > < span class = cF0 > , < / span > < span class = cF9 > U64 < / span > < span class = cF0 > < / span > < span class = cF9 > CMemUsed < / span > < span class = cF0 > . size - < / span > < span class = cF9 > CMemUsed < / span > < span class = cF0 > . < / span > < span class = cF1 > start < / span > < span class = cF0 > [ < / span > < span class = cFC > RAX < / span > < span class = cF0 > ]
< a name = " l211 " > < / a > < / span > < span class = cF1 > SUB < / span > < span class = cF0 > < / span > < span class = cFC > RCX < / span > < span class = cF0 > , < / span > < span class = cF9 > CMemUsed < / span > < span class = cF0 > . < / span > < span class = cF1 > start < / span > < span class = cF0 >
< a name = " l212 " > < / a > < / span > < span class = cF1 > MOV < / span > < span class = cF0 > < / span > < span class = cFC > RDI < / span > < span class = cF0 > , < / span > < span class = cFC > RAX < / span > < span class = cF0 >
< a name = " l213 " > < / a > < / span > < span class = cF1 > MOV < / span > < span class = cF0 > < / span > < span class = cFC > AL < / span > < span class = cF0 > , < / span > < span class = cF1 > U8 < / span > < span class = cF0 > [ < / span > < span class = cFD > SYS_HEAP_INIT_VAL < / span > < span class = cF0 > ]
< a name = " l214 " > < / a > < / span > < span class = cF1 > REP_STOSB < / span > < span class = cF0 >
< a name = " l215 " > < / a > < / span > < span class = cF1 > POP < / span > < span class = cF0 > < / span > < span class = cFC > RAX < / span > < span class = cF0 >
2021-07-03 05:07:57 +01:00
< a name = " l216 " > < / a >
< a name = " l217 " > < / a > MALLOC_FINAL_EXIT :
2021-07-04 23:11:34 +01:00
< a name = " l218 " > < / a > < / span > < span class = cF1 > POP < / span > < span class = cF0 > < / span > < span class = cFC > RDI < / span > < span class = cF0 >
< a name = " l219 " > < / a > < / span > < span class = cF1 > POP < / span > < span class = cF0 > < / span > < span class = cFC > RSI < / span > < span class = cF0 >
< a name = " l220 " > < / a > < / span > < span class = cF1 > POP < / span > < span class = cF0 > < / span > < span class = cFC > RBP < / span > < span class = cF0 >
< a name = " l221 " > < / a > < / span > < span class = cF1 > RET1 < / span > < span class = cF0 > < / span > < span class = cFE > 16 < / span > < span class = cF0 >
2021-07-03 05:07:57 +01:00
< a name = " l222 " > < / a >
< a name = " l223 " > < / a > < / span > < span class = cF2 > //************************************</span><span class=cF0>
< a name = " l224 " > < / a > < / span > < span class = cFD > _FREE < / span > < span class = cF0 > : :
2021-07-03 07:51:43 +01:00
< a name = " l225 " > < / a > < / span > < span class = cF2 > //Be aware of </span><a href="https://tomawezome.github.io/ZealOS/Kernel/Memory/MAllocFree.html#l44"><span class=cF4>heap_hash</span></a><span class=cF2> in </span><a href="https://tomawezome.github.io/ZealOS/Kernel/Memory/MemPag.html#l140"><span class=cF4>MemPagTaskAlloc</span></a><span class=cF2>().</span><span class=cF0>
2021-07-04 23:11:34 +01:00
< a name = " l226 " > < / a > < / span > < span class = cF1 > PUSH < / span > < span class = cF0 > < / span > < span class = cFC > RBP < / span > < span class = cF0 >
< a name = " l227 " > < / a > < / span > < span class = cF1 > MOV < / span > < span class = cF0 > < / span > < span class = cFC > RBP < / span > < span class = cF0 > , < / span > < span class = cFC > RSP < / span > < span class = cF0 >
< a name = " l228 " > < / a > < / span > < span class = cF1 > PUSH < / span > < span class = cF0 > < / span > < span class = cFC > RSI < / span > < span class = cF0 >
< a name = " l229 " > < / a > < / span > < span class = cF1 > PUSH < / span > < span class = cF0 > < / span > < span class = cFC > RDI < / span > < span class = cF0 >
2021-07-03 05:07:57 +01:00
< a name = " l230 " > < / a >
2021-07-04 23:11:34 +01:00
< a name = " l231 " > < / a > < / span > < span class = cF1 > TEST < / span > < span class = cF0 > < / span > < span class = cF1 > U8 < / span > < span class = cF0 > [ < / span > < span class = cFD > SYS_SEMAS < / span > < span class = cF0 > + < / span > < span class = cF3 > SEMA_HEAPLOG_ACTIVE < / span > < span class = cF0 > * < / span > < span class = cF3 > DEFAULT_CACHE_LINE_WIDTH < / span > < span class = cF0 > ] , < / span > < span class = cFE > 1 < / span > < span class = cF0 >
< a name = " l232 " > < / a > < / span > < span class = cF1 > JZ < / span > < span class = cF0 > @ @ 15
< a name = " l233 " > < / a > < / span > < span class = cF1 > MOV < / span > < span class = cF0 > < / span > < span class = cFC > RBX < / span > < span class = cF0 > , < / span > < span class = cF9 > U64 < / span > < span class = cF0 > < / span > < span class = cF3 > SF_ARG1 < / span > < span class = cF0 > [ < / span > < span class = cFC > RBP < / span > < span class = cF0 > ]
< a name = " l234 " > < / a > < / span > < span class = cF1 > TEST < / span > < span class = cF0 > < / span > < span class = cFC > RBX < / span > < span class = cF0 > , < / span > < span class = cFC > RBX < / span > < span class = cF0 >
< a name = " l235 " > < / a > < / span > < span class = cF1 > JZ < / span > < span class = cF0 > @ @ 05
< a name = " l236 " > < / a > < / span > < span class = cF1 > MOV < / span > < span class = cF0 > < / span > < span class = cFC > RAX < / span > < span class = cF0 > , < / span > < span class = cF9 > U64 < / span > < span class = cF0 > < / span > < span class = cF9 > CMemUsed < / span > < span class = cF0 > . size - < / span > < span class = cF9 > CMemUsed < / span > < span class = cF0 > . < / span > < span class = cF1 > start < / span > < span class = cF0 > [ < / span > < span class = cFC > RBX < / span > < span class = cF0 > ]
< a name = " l237 " > < / a > < / span > < span class = cF1 > TEST < / span > < span class = cF0 > < / span > < span class = cFC > RAX < / span > < span class = cF0 > , < / span > < span class = cFC > RAX < / span > < span class = cF0 >
< a name = " l238 " > < / a > < / span > < span class = cF1 > JGE < / span > < span class = cF0 > @ @ 05 < / span > < span class = cF2 > //Aligned alloced chunks have neg size</span><span class=cF0>
< a name = " l239 " > < / a > < / span > < span class = cF1 > ADD < / span > < span class = cF0 > < / span > < span class = cFC > RBX < / span > < span class = cF0 > , < / span > < span class = cFC > RAX < / span > < span class = cF0 >
< a name = " l240 " > < / a > @ @ 05 : < / span > < span class = cF1 > PUSH < / span > < span class = cF0 > < / span > < span class = cFC > RBX < / span > < span class = cF0 >
< a name = " l241 " > < / a > < / span > < span class = cF1 > MOV < / span > < span class = cF0 > < / span > < span class = cFC > RAX < / span > < span class = cF0 > , < / span > < span class = cF9 > U64 < / span > < span class = cF0 > [ < / span > < span class = cFD > SYS_EXTERN_TABLE < / span > < span class = cF0 > ]
< a name = " l242 " > < / a > < / span > < span class = cF1 > MOV < / span > < span class = cF0 > < / span > < span class = cFC > RAX < / span > < span class = cF0 > , < / span > < span class = cF9 > U64 < / span > < span class = cF0 > < / span > < span class = cF3 > EXT_HEAPLOG_FREE < / span > < span class = cF0 > * < / span > < span class = cFE > 8 < / span > < span class = cF0 > [ < / span > < span class = cFC > RAX < / span > < span class = cF0 > ]
< a name = " l243 " > < / a > < / span > < span class = cF1 > TEST < / span > < span class = cF0 > < / span > < span class = cFC > RAX < / span > < span class = cF0 > , < / span > < span class = cFC > RAX < / span > < span class = cF0 >
< a name = " l244 " > < / a > < / span > < span class = cF1 > JZ < / span > < span class = cF0 > @ @ 10
< a name = " l245 " > < / a > < / span > < span class = cF1 > CALL < / span > < span class = cF0 > < / span > < span class = cFC > RAX < / span > < span class = cF0 >
< a name = " l246 " > < / a > < / span > < span class = cF1 > JMP < / span > < span class = cF0 > @ @ 15
< a name = " l247 " > < / a > @ @ 10 : < / span > < span class = cF1 > ADD < / span > < span class = cF0 > < / span > < span class = cFC > RSP < / span > < span class = cF0 > , < / span > < span class = cFE > 8 < / span > < span class = cF0 >
2021-07-03 05:07:57 +01:00
< a name = " l248 " > < / a >
2021-07-04 23:11:34 +01:00
< a name = " l249 " > < / a > @ @ 15 : < / span > < span class = cF1 > MOV < / span > < span class = cF0 > < / span > < span class = cFC > RSI < / span > < span class = cF0 > , < / span > < span class = cF9 > U64 < / span > < span class = cF0 > < / span > < span class = cF3 > SF_ARG1 < / span > < span class = cF0 > [ < / span > < span class = cFC > RBP < / span > < span class = cF0 > ]
< a name = " l250 " > < / a > < / span > < span class = cF1 > TEST < / span > < span class = cF0 > < / span > < span class = cFC > RSI < / span > < span class = cF0 > , < / span > < span class = cFC > RSI < / span > < span class = cF0 >
2021-07-03 05:07:57 +01:00
< a name = " l251 " > < / a >
< a name = " l252 " > < / a > # < / span > < span class = cF1 > if < / span > < span class = cF0 > < / span > < span class = cF3 > _CONFIG_HEAP_DEBUG < / span > < span class = cF0 >
2021-07-04 23:11:34 +01:00
< a name = " l253 " > < / a > < / span > < span class = cF1 > JZ < / span > < span class = cF0 > < / span > < span class = cF9 > I32 < / span > < span class = cF0 > FREE_DONE
2021-07-03 05:07:57 +01:00
< a name = " l254 " > < / a > # < / span > < span class = cF1 > else < / span > < span class = cF0 >
2021-07-04 23:11:34 +01:00
< a name = " l255 " > < / a > < / span > < span class = cF1 > JZ < / span > < span class = cF0 > FREE_DONE
2021-07-03 05:07:57 +01:00
< a name = " l256 " > < / a > # < / span > < span class = cF1 > endif < / span > < span class = cF0 >
< a name = " l257 " > < / a >
2021-07-04 23:11:34 +01:00
< a name = " l258 " > < / a > < / span > < span class = cF1 > MOV < / span > < span class = cF0 > < / span > < span class = cFC > RAX < / span > < span class = cF0 > , < / span > < span class = cF9 > U64 < / span > < span class = cF0 > < / span > < span class = cF9 > CMemUsed < / span > < span class = cF0 > . size - < / span > < span class = cF9 > CMemUsed < / span > < span class = cF0 > . < / span > < span class = cF1 > start < / span > < span class = cF0 > [ < / span > < span class = cFC > RSI < / span > < span class = cF0 > ]
< a name = " l259 " > < / a > < / span > < span class = cF1 > TEST < / span > < span class = cF0 > < / span > < span class = cFC > RAX < / span > < span class = cF0 > , < / span > < span class = cFC > RAX < / span > < span class = cF0 >
< a name = " l260 " > < / a > < / span > < span class = cF1 > JGE < / span > < span class = cF0 > @ @ 20 < / span > < span class = cF2 > //Aligned alloced chunks have neg size.</span><span class=cF0>
< a name = " l261 " > < / a > < / span > < span class = cF2 > //The neg size is offset to start of </span><a href="https://tomawezome.github.io/ZealOS/Kernel/KernelA.html#l3463"><span class=cF4>CMemUsed</span></a><span class=cF2> struct.</span><span class=cF0>
< a name = " l262 " > < / a > < / span > < span class = cF1 > ADD < / span > < span class = cF0 > < / span > < span class = cFC > RSI < / span > < span class = cF0 > , < / span > < span class = cFC > RAX < / span > < span class = cF0 >
2021-07-03 05:07:57 +01:00
< a name = " l263 " > < / a >
2021-07-04 23:11:34 +01:00
< a name = " l264 " > < / a > @ @ 20 : < / span > < span class = cF1 > PUSHFD < / span > < span class = cF0 >
< a name = " l265 " > < / a > < / span > < span class = cF1 > SUB < / span > < span class = cF0 > < / span > < span class = cFC > RSI < / span > < span class = cF0 > , < / span > < span class = cF9 > CMemUsed < / span > < span class = cF0 > . < / span > < span class = cF1 > start < / span > < span class = cF0 >
< a name = " l266 " > < / a > < / span > < span class = cF1 > MOV < / span > < span class = cF0 > < / span > < span class = cFC > RDX < / span > < span class = cF0 > , < / span > < span class = cF9 > U64 < / span > < span class = cF0 > < / span > < span class = cF9 > CMemUsed < / span > < span class = cF0 > . hc [ < / span > < span class = cFC > RSI < / span > < span class = cF0 > ]
< a name = " l267 " > < / a > < / span > < span class = cF1 > CMP < / span > < span class = cF0 > < / span > < span class = cF9 > U32 < / span > < span class = cF0 > < / span > < span class = cF9 > CHeapCtrl < / span > < span class = cF0 > . hc_signature [ < / span > < span class = cFC > RDX < / span > < span class = cF0 > ] , < / span > < span class = cF3 > HEAP_CTRL_SIGNATURE_VAL < / span > < span class = cF0 >
< a name = " l268 " > < / a > < / span > < span class = cF1 > JE < / span > < span class = cF0 > @ @ 25
< a name = " l269 " > < / a > < / span > < span class = cF1 > ADD < / span > < span class = cF0 > < / span > < span class = cFC > RSI < / span > < span class = cF0 > , < / span > < span class = cF9 > CMemUsed < / span > < span class = cF0 > . < / span > < span class = cF1 > start < / span > < span class = cF0 >
< a name = " l270 " > < / a > < / span > < span class = cF1 > PUSH < / span > < span class = cF0 > < / span > < span class = cFC > RSI < / span > < span class = cF0 >
< a name = " l271 " > < / a > < / span > < span class = cF1 > CALL < / span > < span class = cF0 > & amp ; < / span > < span class = cFD > SysBadFree < / span > < span class = cF0 >
< a name = " l272 " > < / a > < / span > < span class = cF1 > JMP < / span > < span class = cF0 > < / span > < span class = cF9 > I32 < / span > < span class = cF0 > < / span > < span class = cFD > _SYS_HLT < / span > < span class = cF0 >
2021-07-03 05:07:57 +01:00
< a name = " l273 " > < / a >
2021-07-04 23:11:34 +01:00
< a name = " l274 " > < / a > @ @ 25 : < / span > < span class = cF1 > MOV < / span > < span class = cF0 > < / span > < span class = cFC > RAX < / span > < span class = cF0 > , < / span > < span class = cF9 > U64 < / span > < span class = cF0 > < / span > < span class = cF9 > CMemUsed < / span > < span class = cF0 > . size [ < / span > < span class = cFC > RSI < / span > < span class = cF0 > ]
< a name = " l275 " > < / a > < / span > < span class = cF1 > SUB < / span > < span class = cF0 > < / span > < span class = cF9 > U64 < / span > < span class = cF0 > < / span > < span class = cF9 > CHeapCtrl < / span > < span class = cF0 > . used_u8s [ < / span > < span class = cFC > RDX < / span > < span class = cF0 > ] , < / span > < span class = cFC > RAX < / span > < span class = cF0 >
< a name = " l276 " > < / a > < / span > < span class = cF1 > CLI < / span > < span class = cF0 >
< a name = " l277 " > < / a > @ @ 30 : < / span > < span class = cF1 > LOCK < / span > < span class = cF0 >
< a name = " l278 " > < / a > < / span > < span class = cF1 > BTS < / span > < span class = cF0 > < / span > < span class = cF9 > U32 < / span > < span class = cF0 > < / span > < span class = cF9 > CHeapCtrl < / span > < span class = cF0 > . locked_flags [ < / span > < span class = cFC > RDX < / span > < span class = cF0 > ] , < / span > < span class = cF3 > HClf_LOCKED < / span > < span class = cF0 >
< a name = " l279 " > < / a > < / span > < span class = cF1 > PAUSE < / span > < span class = cF0 >
< a name = " l280 " > < / a > < / span > < span class = cF1 > JC < / span > < span class = cF0 > @ @ 30
2021-07-03 05:07:57 +01:00
< a name = " l281 " > < / a > # < / span > < span class = cF1 > if < / span > < span class = cF0 > < / span > < span class = cF3 > _CONFIG_HEAP_DEBUG < / span > < span class = cF0 >
< a name = " l282 " > < / a > < / span > < span class = cF2 > //QueueRemove</span><span class=cF0>
2021-07-04 23:11:34 +01:00
< a name = " l283 " > < / a > < / span > < span class = cF1 > MOV < / span > < span class = cF0 > < / span > < span class = cFC > RDX < / span > < span class = cF0 > , < / span > < span class = cF9 > U64 < / span > < span class = cF0 > < / span > < span class = cF9 > CMemUsed < / span > < span class = cF0 > . next [ < / span > < span class = cFC > RSI < / span > < span class = cF0 > ]
< a name = " l284 " > < / a > < / span > < span class = cF1 > MOV < / span > < span class = cF0 > < / span > < span class = cFC > RDI < / span > < span class = cF0 > , < / span > < span class = cF9 > U64 < / span > < span class = cF0 > < / span > < span class = cF9 > CMemUsed < / span > < span class = cF0 > . last [ < / span > < span class = cFC > RSI < / span > < span class = cF0 > ]
< a name = " l285 " > < / a > < / span > < span class = cF1 > MOV < / span > < span class = cF0 > < / span > < span class = cF9 > U64 < / span > < span class = cF0 > < / span > < span class = cF9 > CMemUsed < / span > < span class = cF0 > . last [ < / span > < span class = cFC > RDX < / span > < span class = cF0 > ] , < / span > < span class = cFC > RDI < / span > < span class = cF0 >
< a name = " l286 " > < / a > < / span > < span class = cF1 > MOV < / span > < span class = cF0 > < / span > < span class = cF9 > U64 < / span > < span class = cF0 > < / span > < span class = cF9 > CMemUsed < / span > < span class = cF0 > . next [ < / span > < span class = cFC > RDI < / span > < span class = cF0 > ] , < / span > < span class = cFC > RDX < / span > < span class = cF0 >
2021-07-03 05:07:57 +01:00
< a name = " l287 " > < / a >
< a name = " l288 " > < / a > < / span > < span class = cF2 > //Caller1/Caller2</span><span class=cF0>
2021-07-04 23:11:34 +01:00
< a name = " l289 " > < / a > < / span > < span class = cF1 > MOV < / span > < span class = cF0 > < / span > < span class = cFC > RDX < / span > < span class = cF0 > , < / span > < span class = cF9 > U64 < / span > < span class = cF0 > [ < / span > < span class = cFD > MEM_HEAP_LIMIT < / span > < span class = cF0 > ]
< a name = " l290 " > < / a > < / span > < span class = cF1 > MOV < / span > < span class = cF0 > < / span > < span class = cFC > RDI < / span > < span class = cF0 > , < / span > < span class = cF9 > U64 < / span > < span class = cF0 > < / span > < span class = cF3 > SF_RIP < / span > < span class = cF0 > [ < / span > < span class = cFC > RBP < / span > < span class = cF0 > ]
< a name = " l291 " > < / a > < / span > < span class = cF1 > CMP < / span > < span class = cF0 > < / span > < span class = cFC > RDI < / span > < span class = cF0 > , < / span > < span class = cFC > RDX < / span > < span class = cF0 >
< a name = " l292 " > < / a > < / span > < span class = cF1 > JB < / span > < span class = cF0 > @ @ 35
< a name = " l293 " > < / a > < / span > < span class = cF1 > XOR < / span > < span class = cF0 > < / span > < span class = cFC > RDI < / span > < span class = cF0 > , < / span > < span class = cFC > RDI < / span > < span class = cF0 >
< a name = " l294 " > < / a > < / span > < span class = cF1 > MOV < / span > < span class = cF0 > < / span > < span class = cF9 > U64 < / span > < span class = cF0 > < / span > < span class = cF9 > CMemUnused < / span > < span class = cF0 > . caller1 [ < / span > < span class = cFC > RSI < / span > < span class = cF0 > ] , < / span > < span class = cFC > RDI < / span > < span class = cF0 >
< a name = " l295 " > < / a > < / span > < span class = cF1 > JMP < / span > < span class = cF0 > @ @ 45
< a name = " l296 " > < / a > @ @ 35 : < / span > < span class = cF1 > MOV < / span > < span class = cF0 > < / span > < span class = cF9 > U64 < / span > < span class = cF0 > < / span > < span class = cF9 > CMemUnused < / span > < span class = cF0 > . caller1 [ < / span > < span class = cFC > RSI < / span > < span class = cF0 > ] , < / span > < span class = cFC > RDI < / span > < span class = cF0 >
< a name = " l297 " > < / a > < / span > < span class = cF1 > MOV < / span > < span class = cF0 > < / span > < span class = cFC > RDI < / span > < span class = cF0 > , < / span > < span class = cF9 > U64 < / span > < span class = cF0 > < / span > < span class = cF3 > SF_RBP < / span > < span class = cF0 > [ < / span > < span class = cFC > RBP < / span > < span class = cF0 > ]
< a name = " l298 " > < / a > < / span > < span class = cF1 > CMP < / span > < span class = cF0 > < / span > < span class = cFC > RDI < / span > < span class = cF0 > , < / span > < span class = cFC > RDX < / span > < span class = cF0 >
< a name = " l299 " > < / a > < / span > < span class = cF1 > JB < / span > < span class = cF0 > @ @ 40
< a name = " l300 " > < / a > < / span > < span class = cF1 > XOR < / span > < span class = cF0 > < / span > < span class = cFC > RDI < / span > < span class = cF0 > , < / span > < span class = cFC > RDI < / span > < span class = cF0 >
< a name = " l301 " > < / a > < / span > < span class = cF1 > JMP < / span > < span class = cF0 > @ @ 45
< a name = " l302 " > < / a > @ @ 40 : < / span > < span class = cF1 > MOV < / span > < span class = cF0 > < / span > < span class = cFC > RDI < / span > < span class = cF0 > , < / span > < span class = cF9 > U64 < / span > < span class = cF0 > < / span > < span class = cF3 > SF_RIP < / span > < span class = cF0 > [ < / span > < span class = cFC > RDI < / span > < span class = cF0 > ]
< a name = " l303 " > < / a > < / span > < span class = cF1 > CMP < / span > < span class = cF0 > < / span > < span class = cFC > RDI < / span > < span class = cF0 > , < / span > < span class = cFC > RDX < / span > < span class = cF0 >
< a name = " l304 " > < / a > < / span > < span class = cF1 > JB < / span > < span class = cF0 > @ @ 45
< a name = " l305 " > < / a > < / span > < span class = cF1 > XOR < / span > < span class = cF0 > < / span > < span class = cFC > RDI < / span > < span class = cF0 > , < / span > < span class = cFC > RDI < / span > < span class = cF0 >
< a name = " l306 " > < / a > @ @ 45 : < / span > < span class = cF1 > MOV < / span > < span class = cF0 > < / span > < span class = cF9 > U64 < / span > < span class = cF0 > < / span > < span class = cF9 > CMemUnused < / span > < span class = cF0 > . caller2 [ < / span > < span class = cFC > RSI < / span > < span class = cF0 > ] , < / span > < span class = cFC > RDI < / span > < span class = cF0 >
2021-07-03 05:07:57 +01:00
< a name = " l307 " > < / a >
2021-07-04 23:11:34 +01:00
< a name = " l308 " > < / a > < / span > < span class = cF1 > MOV < / span > < span class = cF0 > < / span > < span class = cFC > RDX < / span > < span class = cF0 > , < / span > < span class = cF9 > U64 < / span > < span class = cF0 > < / span > < span class = cF9 > CMemUsed < / span > < span class = cF0 > . hc [ < / span > < span class = cFC > RSI < / span > < span class = cF0 > ]
2021-07-03 05:07:57 +01:00
< a name = " l309 " > < / a > # < / span > < span class = cF1 > endif < / span > < span class = cF0 >
2021-07-04 23:11:34 +01:00
< a name = " l310 " > < / a > < / span > < span class = cF1 > CMP < / span > < span class = cF0 > < / span > < span class = cFC > RAX < / span > < span class = cF0 > , < / span > < span class = cF3 > MEM_HEAP_HASH_SIZE < / span > < span class = cF0 >
< a name = " l311 " > < / a > < / span > < span class = cF1 > JAE < / span > < span class = cF0 > @ @ 50
2021-07-03 05:07:57 +01:00
< a name = " l312 " > < / a >
< a name = " l313 " > < / a > # < / span > < span class = cF1 > assert < / span > < span class = cF0 > < / span > < span class = cF9 > CMemUnused < / span > < span class = cF0 > . size = = < / span > < span class = cF9 > CMemUsed < / span > < span class = cF0 > . size
2021-07-04 23:11:34 +01:00
< a name = " l314 " > < / a > < / span > < span class = cF2 > //</span><span class=cF0> </span><span class=cF2>MOV </span><span class=cF0> </span><span class=cF2>U64 CMemUnused.size[RSI], RAX</span><span class=cF0>
2021-07-03 05:07:57 +01:00
< a name = " l315 " > < / a >
2021-07-04 23:11:34 +01:00
< a name = " l316 " > < / a > < / span > < span class = cF1 > MOV < / span > < span class = cF0 > < / span > < span class = cFC > RBX < / span > < span class = cF0 > , < / span > < span class = cF9 > U64 < / span > < span class = cF0 > < / span > < span class = cF9 > CHeapCtrl < / span > < span class = cF0 > . heap_hash [ < / span > < span class = cFC > RAX < / span > < span class = cF0 > + < / span > < span class = cFC > RDX < / span > < span class = cF0 > ]
< a name = " l317 " > < / a > < / span > < span class = cF1 > MOV < / span > < span class = cF0 > < / span > < span class = cF9 > U64 < / span > < span class = cF0 > < / span > < span class = cF9 > CMemUnused < / span > < span class = cF0 > . next [ < / span > < span class = cFC > RSI < / span > < span class = cF0 > ] , < / span > < span class = cFC > RBX < / span > < span class = cF0 >
< a name = " l318 " > < / a > < / span > < span class = cF1 > MOV < / span > < span class = cF0 > < / span > < span class = cF9 > U64 < / span > < span class = cF0 > < / span > < span class = cF9 > CHeapCtrl < / span > < span class = cF0 > . heap_hash [ < / span > < span class = cFC > RAX < / span > < span class = cF0 > + < / span > < span class = cFC > RDX < / span > < span class = cF0 > ] , < / span > < span class = cFC > RSI < / span > < span class = cF0 >
< a name = " l319 " > < / a > < / span > < span class = cF1 > JMP < / span > < span class = cF0 > @ @ 55
2021-07-03 05:07:57 +01:00
< a name = " l320 " > < / a >
2021-07-04 23:11:34 +01:00
< a name = " l321 " > < / a > @ @ 50 : < / span > < span class = cF1 > SUB < / span > < span class = cF0 > < / span > < span class = cFC > RSI < / span > < span class = cF0 > , < / span > < span class = cF1 > sizeof < / span > < span class = cF0 > ( < / span > < span class = cF9 > CMemBlk < / span > < span class = cF0 > )
< a name = " l322 " > < / a > < / span > < span class = cF1 > PUSH < / span > < span class = cF0 > < / span > < span class = cFC > RDX < / span > < span class = cF0 >
< a name = " l323 " > < / a > < / span > < span class = cF1 > PUSH < / span > < span class = cF0 > < / span > < span class = cFC > RDX < / span > < span class = cF0 >
< a name = " l324 " > < / a > < / span > < span class = cF1 > PUSH < / span > < span class = cF0 > < / span > < span class = cFC > RSI < / span > < span class = cF0 >
< a name = " l325 " > < / a > < / span > < span class = cF1 > CALL < / span > < span class = cF0 > & amp ; < / span > < span class = cFD > MemPagTaskFree < / span > < span class = cF0 >
< a name = " l326 " > < / a > < / span > < span class = cF1 > POP < / span > < span class = cF0 > < / span > < span class = cFC > RDX < / span > < span class = cF0 >
2021-07-03 05:07:57 +01:00
< a name = " l327 " > < / a >
2021-07-04 23:11:34 +01:00
< a name = " l328 " > < / a > @ @ 55 : < / span > < span class = cF1 > LOCK < / span > < span class = cF0 >
< a name = " l329 " > < / a > < / span > < span class = cF1 > BTR < / span > < span class = cF0 > < / span > < span class = cF9 > U32 < / span > < span class = cF0 > < / span > < span class = cF9 > CHeapCtrl < / span > < span class = cF0 > . locked_flags [ < / span > < span class = cFC > RDX < / span > < span class = cF0 > ] , < / span > < span class = cF3 > HClf_LOCKED < / span > < span class = cF0 >
< a name = " l330 " > < / a > < / span > < span class = cF1 > POPFD < / span > < span class = cF0 >
2021-07-03 05:07:57 +01:00
< a name = " l331 " > < / a > FREE_DONE :
2021-07-04 23:11:34 +01:00
< a name = " l332 " > < / a > < / span > < span class = cF1 > POP < / span > < span class = cF0 > < / span > < span class = cFC > RDI < / span > < span class = cF0 >
< a name = " l333 " > < / a > < / span > < span class = cF1 > POP < / span > < span class = cF0 > < / span > < span class = cFC > RSI < / span > < span class = cF0 >
< a name = " l334 " > < / a > < / span > < span class = cF1 > POP < / span > < span class = cF0 > < / span > < span class = cFC > RBP < / span > < span class = cF0 >
< a name = " l335 " > < / a > < / span > < span class = cF1 > RET1 < / span > < span class = cF0 > < / span > < span class = cFE > 8 < / span > < span class = cF0 >
2021-07-03 05:07:57 +01:00
< a name = " l336 " > < / a >
< a name = " l337 " > < / a > < / span > < span class = cF2 > //************************************</span><span class=cF0>
< a name = " l338 " > < / a > < / span > < span class = cFD > _MSIZE < / span > < span class = cF0 > : :
2021-07-04 23:11:34 +01:00
< a name = " l339 " > < / a > < / span > < span class = cF1 > PUSH < / span > < span class = cF0 > < / span > < span class = cFC > RBP < / span > < span class = cF0 >
< a name = " l340 " > < / a > < / span > < span class = cF1 > MOV < / span > < span class = cF0 > < / span > < span class = cFC > RBP < / span > < span class = cF0 > , < / span > < span class = cFC > RSP < / span > < span class = cF0 >
< a name = " l341 " > < / a > < / span > < span class = cF1 > MOV < / span > < span class = cF0 > < / span > < span class = cFC > RBX < / span > < span class = cF0 > , < / span > < span class = cF9 > U64 < / span > < span class = cF0 > < / span > < span class = cF3 > SF_ARG1 < / span > < span class = cF0 > [ < / span > < span class = cFC > RBP < / span > < span class = cF0 > ]
< a name = " l342 " > < / a > < / span > < span class = cF1 > XOR < / span > < span class = cF0 > < / span > < span class = cFC > RAX < / span > < span class = cF0 > , < / span > < span class = cFC > RAX < / span > < span class = cF0 >
< a name = " l343 " > < / a > < / span > < span class = cF1 > TEST < / span > < span class = cF0 > < / span > < span class = cFC > RBX < / span > < span class = cF0 > , < / span > < span class = cFC > RBX < / span > < span class = cF0 >
< a name = " l344 " > < / a > < / span > < span class = cF1 > JZ < / span > < span class = cF0 > @ @ 10
< a name = " l345 " > < / a > < / span > < span class = cF1 > MOV < / span > < span class = cF0 > < / span > < span class = cFC > RAX < / span > < span class = cF0 > , < / span > < span class = cF9 > U64 < / span > < span class = cF0 > < / span > < span class = cF9 > CMemUsed < / span > < span class = cF0 > . size - < / span > < span class = cF9 > CMemUsed < / span > < span class = cF0 > . < / span > < span class = cF1 > start < / span > < span class = cF0 > [ < / span > < span class = cFC > RBX < / span > < span class = cF0 > ]
< a name = " l346 " > < / a > < / span > < span class = cF1 > TEST < / span > < span class = cF0 > < / span > < span class = cFC > RAX < / span > < span class = cF0 > , < / span > < span class = cFC > RAX < / span > < span class = cF0 >
< a name = " l347 " > < / a > < / span > < span class = cF1 > JGE < / span > < span class = cF0 > @ @ 05 < / span > < span class = cF2 > //Aligned alloced chunks have neg size</span><span class=cF0>
< a name = " l348 " > < / a > < / span > < span class = cF1 > ADD < / span > < span class = cF0 > < / span > < span class = cFC > RBX < / span > < span class = cF0 > , < / span > < span class = cFC > RAX < / span > < span class = cF0 >
< a name = " l349 " > < / a > < / span > < span class = cF1 > MOV < / span > < span class = cF0 > < / span > < span class = cFC > RAX < / span > < span class = cF0 > , < / span > < span class = cF9 > U64 < / span > < span class = cF0 > < / span > < span class = cF9 > CMemUsed < / span > < span class = cF0 > . size - < / span > < span class = cF9 > CMemUsed < / span > < span class = cF0 > . < / span > < span class = cF1 > start < / span > < span class = cF0 > [ < / span > < span class = cFC > RBX < / span > < span class = cF0 > ]
< a name = " l350 " > < / a > @ @ 05 : < / span > < span class = cF1 > SUB < / span > < span class = cF0 > < / span > < span class = cFC > RAX < / span > < span class = cF0 > , < / span > < span class = cF9 > CMemUsed < / span > < span class = cF0 > . < / span > < span class = cF1 > start < / span > < span class = cF0 >
< a name = " l351 " > < / a > @ @ 10 : < / span > < span class = cF1 > POP < / span > < span class = cF0 > < / span > < span class = cFC > RBP < / span > < span class = cF0 >
< a name = " l352 " > < / a > < / span > < span class = cF1 > RET1 < / span > < span class = cF0 > < / span > < span class = cFE > 8 < / span > < span class = cF0 >
2021-07-03 05:07:57 +01:00
< a name = " l353 " > < / a >
< a name = " l354 " > < / a > < / span > < span class = cF2 > //************************************</span><span class=cF0>
< a name = " l355 " > < / a > < / span > < span class = cFD > _MSIZE2 < / span > < span class = cF0 > : :
2021-07-04 23:11:34 +01:00
< a name = " l356 " > < / a > < / span > < span class = cF1 > PUSH < / span > < span class = cF0 > < / span > < span class = cFC > RBP < / span > < span class = cF0 >
< a name = " l357 " > < / a > < / span > < span class = cF1 > MOV < / span > < span class = cF0 > < / span > < span class = cFC > RBP < / span > < span class = cF0 > , < / span > < span class = cFC > RSP < / span > < span class = cF0 >
< a name = " l358 " > < / a > < / span > < span class = cF1 > MOV < / span > < span class = cF0 > < / span > < span class = cFC > RBX < / span > < span class = cF0 > , < / span > < span class = cF9 > U64 < / span > < span class = cF0 > < / span > < span class = cF3 > SF_ARG1 < / span > < span class = cF0 > [ < / span > < span class = cFC > RBP < / span > < span class = cF0 > ]
< a name = " l359 " > < / a > < / span > < span class = cF1 > XOR < / span > < span class = cF0 > < / span > < span class = cFC > RAX < / span > < span class = cF0 > , < / span > < span class = cFC > RAX < / span > < span class = cF0 >
< a name = " l360 " > < / a > < / span > < span class = cF1 > TEST < / span > < span class = cF0 > < / span > < span class = cFC > RBX < / span > < span class = cF0 > , < / span > < span class = cFC > RBX < / span > < span class = cF0 >
< a name = " l361 " > < / a > < / span > < span class = cF1 > JZ < / span > < span class = cF0 > @ @ 10
< a name = " l362 " > < / a > < / span > < span class = cF1 > MOV < / span > < span class = cF0 > < / span > < span class = cFC > RAX < / span > < span class = cF0 > , < / span > < span class = cF9 > U64 < / span > < span class = cF0 > < / span > < span class = cF9 > CMemUsed < / span > < span class = cF0 > . size - < / span > < span class = cF9 > CMemUsed < / span > < span class = cF0 > . < / span > < span class = cF1 > start < / span > < span class = cF0 > [ < / span > < span class = cFC > RBX < / span > < span class = cF0 > ]
< a name = " l363 " > < / a > < / span > < span class = cF1 > TEST < / span > < span class = cF0 > < / span > < span class = cFC > RAX < / span > < span class = cF0 > , < / span > < span class = cFC > RAX < / span > < span class = cF0 >
< a name = " l364 " > < / a > < / span > < span class = cF1 > JGE < / span > < span class = cF0 > @ @ 05 < / span > < span class = cF2 > //Aligned alloced chunks have neg size</span><span class=cF0>
< a name = " l365 " > < / a > < / span > < span class = cF1 > ADD < / span > < span class = cF0 > < / span > < span class = cFC > RBX < / span > < span class = cF0 > , < / span > < span class = cFC > RAX < / span > < span class = cF0 >
< a name = " l366 " > < / a > @ @ 05 : < / span > < span class = cF1 > MOV < / span > < span class = cF0 > < / span > < span class = cFC > RAX < / span > < span class = cF0 > , < / span > < span class = cF9 > U64 < / span > < span class = cF0 > < / span > < span class = cF9 > CMemUsed < / span > < span class = cF0 > . size - < / span > < span class = cF9 > CMemUsed < / span > < span class = cF0 > . < / span > < span class = cF1 > start < / span > < span class = cF0 > [ < / span > < span class = cFC > RBX < / span > < span class = cF0 > ]
< a name = " l367 " > < / a > @ @ 10 : < / span > < span class = cF1 > POP < / span > < span class = cF0 > < / span > < span class = cFC > RBP < / span > < span class = cF0 >
< a name = " l368 " > < / a > < / span > < span class = cF1 > RET1 < / span > < span class = cF0 > < / span > < span class = cFE > 8 < / span > < span class = cF0 >
2021-07-03 05:07:57 +01:00
< a name = " l369 " > < / a >
< a name = " l370 " > < / a > < / span > < span class = cF2 > //************************************</span><span class=cF0>
< a name = " l371 " > < / a > < / span > < span class = cFD > _MHEAP_CTRL < / span > < span class = cF0 > : :
2021-07-04 23:11:34 +01:00
< a name = " l372 " > < / a > < / span > < span class = cF1 > PUSH < / span > < span class = cF0 > < / span > < span class = cFC > RBP < / span > < span class = cF0 >
< a name = " l373 " > < / a > < / span > < span class = cF1 > MOV < / span > < span class = cF0 > < / span > < span class = cFC > RBP < / span > < span class = cF0 > , < / span > < span class = cFC > RSP < / span > < span class = cF0 >
< a name = " l374 " > < / a > < / span > < span class = cF1 > MOV < / span > < span class = cF0 > < / span > < span class = cFC > RBX < / span > < span class = cF0 > , < / span > < span class = cF9 > U64 < / span > < span class = cF0 > < / span > < span class = cF3 > SF_ARG1 < / span > < span class = cF0 > [ < / span > < span class = cFC > RBP < / span > < span class = cF0 > ]
< a name = " l375 " > < / a > < / span > < span class = cF1 > XOR < / span > < span class = cF0 > < / span > < span class = cFC > RAX < / span > < span class = cF0 > , < / span > < span class = cFC > RAX < / span > < span class = cF0 >
< a name = " l376 " > < / a > < / span > < span class = cF1 > TEST < / span > < span class = cF0 > < / span > < span class = cFC > RBX < / span > < span class = cF0 > , < / span > < span class = cFC > RBX < / span > < span class = cF0 >
< a name = " l377 " > < / a > < / span > < span class = cF1 > JZ < / span > < span class = cF0 > @ @ 10
< a name = " l378 " > < / a > < / span > < span class = cF1 > MOV < / span > < span class = cF0 > < / span > < span class = cFC > RAX < / span > < span class = cF0 > , < / span > < span class = cF9 > U64 < / span > < span class = cF0 > < / span > < span class = cF9 > CMemUsed < / span > < span class = cF0 > . size - < / span > < span class = cF9 > CMemUsed < / span > < span class = cF0 > . < / span > < span class = cF1 > start < / span > < span class = cF0 > [ < / span > < span class = cFC > RBX < / span > < span class = cF0 > ]
< a name = " l379 " > < / a > < / span > < span class = cF1 > TEST < / span > < span class = cF0 > < / span > < span class = cFC > RAX < / span > < span class = cF0 > , < / span > < span class = cFC > RAX < / span > < span class = cF0 >
< a name = " l380 " > < / a > < / span > < span class = cF1 > JGE < / span > < span class = cF0 > @ @ 05 < / span > < span class = cF2 > //Aligned alloced chunks have neg size</span><span class=cF0>
< a name = " l381 " > < / a > < / span > < span class = cF1 > ADD < / span > < span class = cF0 > < / span > < span class = cFC > RBX < / span > < span class = cF0 > , < / span > < span class = cFC > RAX < / span > < span class = cF0 >
< a name = " l382 " > < / a > @ @ 05 : < / span > < span class = cF1 > MOV < / span > < span class = cF0 > < / span > < span class = cFC > RAX < / span > < span class = cF0 > , < / span > < span class = cF9 > U64 < / span > < span class = cF0 > < / span > < span class = cF9 > CMemUsed < / span > < span class = cF0 > . hc - < / span > < span class = cF9 > CMemUsed < / span > < span class = cF0 > . < / span > < span class = cF1 > start < / span > < span class = cF0 > [ < / span > < span class = cFC > RBX < / span > < span class = cF0 > ]
< a name = " l383 " > < / a > @ @ 10 : < / span > < span class = cF1 > POP < / span > < span class = cF0 > < / span > < span class = cFC > RBP < / span > < span class = cF0 >
< a name = " l384 " > < / a > < / span > < span class = cF1 > RET1 < / span > < span class = cF0 > < / span > < span class = cFE > 8 < / span > < span class = cF0 >
2021-07-03 05:07:57 +01:00
< a name = " l385 " > < / a > }
< a name = " l386 " > < / a >
2021-07-04 23:11:34 +01:00
< a name = " l387 " > < / a > < / span > < span class = cF1 > _extern < / span > < span class = cF0 > < / span > < span class = cFD > _FREE < / span > < span class = cF0 > < / span > < span class = cF1 > U0 < / span > < span class = cF0 > < / span > < span class = cF5 > Free < / span > < span class = cF0 > ( < / span > < span class = cF1 > U8 < / span > < span class = cF0 > * addr ) ; < / span > < span class = cF2 > //Free </span><a href="https://tomawezome.github.io/ZealOS/Kernel/Memory/MAllocFree.html#l391"><span class=cF4>MAlloc</span></a><span class=cF2>()ed memory chunk.</span><span class=cF0>
< a name = " l388 " > < / a > < / span > < span class = cF1 > _extern < / span > < span class = cF0 > < / span > < span class = cFD > _MSIZE < / span > < span class = cF0 > < / span > < span class = cF9 > I64 < / span > < span class = cF0 > < / span > < span class = cF5 > MSize < / span > < span class = cF0 > ( < / span > < span class = cF1 > U8 < / span > < span class = cF0 > * src ) ; < / span > < span class = cF2 > //Size of heap object.</span><span class=cF0>
< a name = " l389 " > < / a > < / span > < span class = cF1 > _extern < / span > < span class = cF0 > < / span > < span class = cFD > _MSIZE2 < / span > < span class = cF0 > < / span > < span class = cF9 > I64 < / span > < span class = cF0 > < / span > < span class = cF5 > MSize2 < / span > < span class = cF0 > ( < / span > < span class = cF1 > U8 < / span > < span class = cF0 > * src ) ; < / span > < span class = cF2 > //Internal size of heap object.</span><span class=cF0>
< a name = " l390 " > < / a > < / span > < span class = cF1 > _extern < / span > < span class = cF0 > < / span > < span class = cFD > _MHEAP_CTRL < / span > < span class = cF0 > < / span > < span class = cF9 > CHeapCtrl < / span > < span class = cF0 > * < / span > < span class = cF5 > MHeapCtrl < / span > < span class = cF0 > ( < / span > < span class = cF1 > U8 < / span > < span class = cF0 > * src ) ; < / span > < span class = cF2 > //</span><a href="https://tomawezome.github.io/ZealOS/Kernel/KernelA.html#l3527"><span class=cF4>CHeapCtrl</span></a><span class=cF2> of object.</span><span class=cF0>
< a name = " l391 " > < / a > < / span > < span class = cF1 > _extern < / span > < span class = cF0 > < / span > < span class = cFD > _MALLOC < / span > < span class = cF0 > < / span > < span class = cF1 > U8 < / span > < span class = cF0 > * < / span > < span class = cF5 > MAlloc < / span > < span class = cF0 > ( < / span > < span class = cF9 > I64 < / span > < span class = cF0 > size , < / span > < span class = cF9 > CTask < / span > < span class = cF0 > * mem_task = < / span > < span class = cF3 > NULL < / span > < span class = cF0 > ) ; < / span > < span class = cF2 > //Alloc memory chunk.</span><span class=cF0>
2021-07-03 07:51:43 +01:00
< a name = " l392 " > < / a > < / span > < span class = cF2 > //Accepts a </span><a href="https://tomawezome.github.io/ZealOS/Kernel/KernelA.html#l3939"><span class=cF4>CTask</span></a><span class=cF2> or </span><a href="https://tomawezome.github.io/ZealOS/Kernel/KernelA.html#l3527"><span class=cF4>CHeapCtrl</span></a><span class=cF2>. NULL allocs off current task's heap.</span><span class=cF0>
2021-07-03 05:07:57 +01:00
< a name = " l393 " > < / a >
< a name = " l394 " > < / a > < / span > < span class = cF1 > U8 < / span > < span class = cF0 > * < / span > < span class = cF5 > ZMAlloc < / span > < span class = cF0 > ( < / span > < span class = cF9 > I64 < / span > < span class = cF0 > size )
< a name = " l395 " > < / a > { < / span > < span class = cF2 > //Alloc memory in System task's heap.</span><span class=cF0>
2021-07-04 23:11:34 +01:00
< a name = " l396 " > < / a > < / span > < span class = cF1 > return < / span > < span class = cF0 > < / span > < span class = cF5 > MAlloc < / span > < span class = cF0 > ( size , < / span > < span class = cFB > sys_task < / span > < span class = cF0 > ) ;
2021-07-03 05:07:57 +01:00
< a name = " l397 " > < / a > }
< a name = " l398 " > < / a >
< a name = " l399 " > < / a > < / span > < span class = cF1 > U8 < / span > < span class = cF0 > * < / span > < span class = cF5 > CAlloc < / span > < span class = cF0 > ( < / span > < span class = cF9 > I64 < / span > < span class = cF0 > size , < / span > < span class = cF9 > CTask < / span > < span class = cF0 > * mem_task = < / span > < span class = cF3 > NULL < / span > < span class = cF0 > )
2021-07-03 07:51:43 +01:00
< a name = " l400 " > < / a > { < / span > < span class = cF2 > //Accepts a </span><a href="https://tomawezome.github.io/ZealOS/Kernel/KernelA.html#l3939"><span class=cF4>CTask</span></a><span class=cF2> or </span><a href="https://tomawezome.github.io/ZealOS/Kernel/KernelA.html#l3527"><span class=cF4>CHeapCtrl</span></a><span class=cF2>. NULL allocs off current task's heap.</span><span class=cF0>
2021-07-04 23:11:34 +01:00
< a name = " l401 " > < / a > < / span > < span class = cF1 > U8 < / span > < span class = cF0 > * res = < / span > < span class = cF5 > MAlloc < / span > < span class = cF0 > ( size , mem_task ) ;
2021-07-03 05:07:57 +01:00
< a name = " l402 " > < / a >
2021-07-04 23:11:34 +01:00
< a name = " l403 " > < / a > < / span > < span class = cF5 > MemSet < / span > < span class = cF0 > ( res , < / span > < span class = cFE > 0 < / span > < span class = cF0 > , size ) ;
2021-07-03 05:07:57 +01:00
< a name = " l404 " > < / a >
2021-07-04 23:11:34 +01:00
< a name = " l405 " > < / a > < / span > < span class = cF1 > return < / span > < span class = cF0 > res ;
2021-07-03 05:07:57 +01:00
< a name = " l406 " > < / a > }
< a name = " l407 " > < / a >
< a name = " l408 " > < / a > < / span > < span class = cF1 > U8 < / span > < span class = cF0 > * < / span > < span class = cF5 > ZCAlloc < / span > < span class = cF0 > ( < / span > < span class = cF9 > I64 < / span > < span class = cF0 > size )
< a name = " l409 " > < / a > { < / span > < span class = cF2 > //Alloc and set to zero memory in System task's heap.</span><span class=cF0>
2021-07-04 23:11:34 +01:00
< a name = " l410 " > < / a > < / span > < span class = cF1 > return < / span > < span class = cF0 > < / span > < span class = cF5 > CAlloc < / span > < span class = cF0 > ( size , < / span > < span class = cFB > sys_task < / span > < span class = cF0 > ) ;
2021-07-03 05:07:57 +01:00
< a name = " l411 " > < / a > }
< a name = " l412 " > < / a >
< a name = " l413 " > < / a > < / span > < span class = cF1 > U8 < / span > < span class = cF0 > * < / span > < span class = cF5 > MAllocIdent < / span > < span class = cF0 > ( < / span > < span class = cF1 > U8 < / span > < span class = cF0 > * src , < / span > < span class = cF9 > CTask < / span > < span class = cF0 > * mem_task = < / span > < span class = cF3 > NULL < / span > < span class = cF0 > )
2021-07-03 07:51:43 +01:00
< a name = " l414 " > < / a > { < / span > < span class = cF2 > //Accepts a </span><a href="https://tomawezome.github.io/ZealOS/Kernel/KernelA.html#l3939"><span class=cF4>CTask</span></a><span class=cF2> or </span><a href="https://tomawezome.github.io/ZealOS/Kernel/KernelA.html#l3527"><span class=cF4>CHeapCtrl</span></a><span class=cF2>. NULL allocs off current task's heap.</span><span class=cF0>
2021-07-04 23:11:34 +01:00
< a name = " l415 " > < / a > < / span > < span class = cF1 > U8 < / span > < span class = cF0 > * res ;
< a name = " l416 " > < / a > < / span > < span class = cF9 > I64 < / span > < span class = cF0 > size ;
2021-07-03 05:07:57 +01:00
< a name = " l417 " > < / a >
2021-07-04 23:11:34 +01:00
< a name = " l418 " > < / a > < / span > < span class = cF1 > if < / span > < span class = cF0 > ( ! src )
< a name = " l419 " > < / a > < / span > < span class = cF1 > return < / span > < span class = cF0 > < / span > < span class = cF3 > NULL < / span > < span class = cF0 > ;
< a name = " l420 " > < / a > size = < / span > < span class = cF5 > MSize < / span > < span class = cF0 > ( src ) ;
< a name = " l421 " > < / a > res = < / span > < span class = cF5 > MAlloc < / span > < span class = cF0 > ( size , mem_task ) ;
< a name = " l422 " > < / a > < / span > < span class = cF5 > MemCopy < / span > < span class = cF0 > ( res , src , size ) ;
2021-07-03 05:07:57 +01:00
< a name = " l423 " > < / a >
2021-07-04 23:11:34 +01:00
< a name = " l424 " > < / a > < / span > < span class = cF1 > return < / span > < span class = cF0 > res ;
2021-07-03 05:07:57 +01:00
< a name = " l425 " > < / a > }
< a name = " l426 " > < / a >
< a name = " l427 " > < / a > < / span > < span class = cF1 > U8 < / span > < span class = cF0 > * < / span > < span class = cF5 > ZMAllocIdent < / span > < span class = cF0 > ( < / span > < span class = cF1 > U8 < / span > < span class = cF0 > * src )
< a name = " l428 " > < / a > { < / span > < span class = cF2 > //Alloc in System task's heap, ident copy of heap node.</span><span class=cF0>
2021-07-04 23:11:34 +01:00
< a name = " l429 " > < / a > < / span > < span class = cF1 > return < / span > < span class = cF0 > < / span > < span class = cF5 > MAllocIdent < / span > < span class = cF0 > ( src , < / span > < span class = cFB > sys_task < / span > < span class = cF0 > ) ;
2021-07-03 05:07:57 +01:00
< a name = " l430 " > < / a > }
< a name = " l431 " > < / a >
< a name = " l432 " > < / a > < / span > < span class = cF1 > U8 < / span > < span class = cF0 > * < / span > < span class = cF5 > MAllocAligned < / span > < span class = cF0 > ( < / span > < span class = cF9 > I64 < / span > < span class = cF0 > size , < / span > < span class = cF9 > I64 < / span > < span class = cF0 > alignment , < / span > < span class = cF9 > CTask < / span > < span class = cF0 > * mem_task = < / span > < span class = cF3 > NULL < / span > < span class = cF0 > , < / span > < span class = cF9 > I64 < / span > < span class = cF0 > misalignment = < / span > < span class = cFE > 0 < / span > < span class = cF0 > )
< a name = " l433 " > < / a > { < / span > < span class = cF2 > //Only powers of two alignment. This is awful.</span><span class=cF0>
2021-07-04 23:11:34 +01:00
< a name = " l434 " > < / a > < / span > < span class = cF9 > I64 < / span > < span class = cF0 > mask = alignment - < / span > < span class = cFE > 1 < / span > < span class = cF0 > ;
< a name = " l435 " > < / a > < / span > < span class = cF1 > U8 < / span > < span class = cF0 > * ptr = < / span > < span class = cF5 > MAlloc < / span > < span class = cF0 > ( size + mask + < / span > < span class = cF1 > sizeof < / span > < span class = cF7 > ( < / span > < span class = cF9 > I64 < / span > < span class = cF7 > ) < / span > < span class = cF0 > + misalignment , mem_task ) ,
< a name = " l436 " > < / a > * res = ( ptr + < / span > < span class = cF1 > sizeof < / span > < span class = cF7 > ( < / span > < span class = cF9 > I64 < / span > < span class = cF7 > ) < / span > < span class = cF0 > + mask ) & amp ; ~ mask + misalignment ;
2021-07-03 05:07:57 +01:00
< a name = " l437 " > < / a >
2021-07-04 23:11:34 +01:00
< a name = " l438 " > < / a > res ( < / span > < span class = cF9 > I64 < / span > < span class = cF0 > * ) [ - < / span > < span class = cFE > 1 < / span > < span class = cF0 > ] = ptr - res ;
2021-07-03 05:07:57 +01:00
< a name = " l439 " > < / a > # < / span > < span class = cF1 > assert < / span > < span class = cF0 > < / span > < span class = cF1 > offset < / span > < span class = cF0 > ( < / span > < span class = cF9 > CMemUsed < / span > < span class = cF0 > . size ) = = < / span > < span class = cF1 > offset < / span > < span class = cF0 > ( < / span > < span class = cF9 > CMemUsed < / span > < span class = cF0 > . < / span > < span class = cF1 > start < / span > < span class = cF0 > ) - < / span > < span class = cF1 > sizeof < / span > < span class = cF0 > ( < / span > < span class = cF9 > I64 < / span > < span class = cF0 > )
< a name = " l440 " > < / a >
2021-07-04 23:11:34 +01:00
< a name = " l441 " > < / a > < / span > < span class = cF1 > return < / span > < span class = cF0 > res ;
2021-07-03 05:07:57 +01:00
< a name = " l442 " > < / a > }
< a name = " l443 " > < / a >
< a name = " l444 " > < / a > < / span > < span class = cF1 > U8 < / span > < span class = cF0 > * < / span > < span class = cF5 > CAllocAligned < / span > < span class = cF0 > ( < / span > < span class = cF9 > I64 < / span > < span class = cF0 > size , < / span > < span class = cF9 > I64 < / span > < span class = cF0 > alignment , < / span > < span class = cF9 > CTask < / span > < span class = cF0 > * mem_task = < / span > < span class = cF3 > NULL < / span > < span class = cF0 > , < / span > < span class = cF9 > I64 < / span > < span class = cF0 > misalignment = < / span > < span class = cFE > 0 < / span > < span class = cF0 > )
< a name = " l445 " > < / a > { < / span > < span class = cF2 > //Only powers of two alignment. This is awful.</span><span class=cF0>
2021-07-04 23:11:34 +01:00
< a name = " l446 " > < / a > < / span > < span class = cF9 > I64 < / span > < span class = cF0 > mask = alignment - < / span > < span class = cFE > 1 < / span > < span class = cF0 > ;
< a name = " l447 " > < / a > < / span > < span class = cF1 > U8 < / span > < span class = cF0 > * ptr = < / span > < span class = cF5 > MAlloc < / span > < span class = cF0 > ( size + mask + < / span > < span class = cF1 > sizeof < / span > < span class = cF7 > ( < / span > < span class = cF9 > I64 < / span > < span class = cF7 > ) < / span > < span class = cF0 > + misalignment , mem_task ) ,
< a name = " l448 " > < / a > * res = ( ptr + < / span > < span class = cF1 > sizeof < / span > < span class = cF7 > ( < / span > < span class = cF9 > I64 < / span > < span class = cF7 > ) < / span > < span class = cF0 > + mask ) & amp ; ~ mask + misalignment ;
2021-07-03 05:07:57 +01:00
< a name = " l449 " > < / a >
2021-07-04 23:11:34 +01:00
< a name = " l450 " > < / a > res ( < / span > < span class = cF9 > I64 < / span > < span class = cF0 > * ) [ - < / span > < span class = cFE > 1 < / span > < span class = cF0 > ] = ptr - res ;
2021-07-03 05:07:57 +01:00
< a name = " l451 " > < / a > # < / span > < span class = cF1 > assert < / span > < span class = cF0 > < / span > < span class = cF1 > offset < / span > < span class = cF0 > ( < / span > < span class = cF9 > CMemUsed < / span > < span class = cF0 > . size ) = = < / span > < span class = cF1 > offset < / span > < span class = cF0 > ( < / span > < span class = cF9 > CMemUsed < / span > < span class = cF0 > . < / span > < span class = cF1 > start < / span > < span class = cF0 > ) - < / span > < span class = cF1 > sizeof < / span > < span class = cF0 > ( < / span > < span class = cF9 > I64 < / span > < span class = cF0 > )
2021-07-04 23:11:34 +01:00
< a name = " l452 " > < / a > < / span > < span class = cF5 > MemSet < / span > < span class = cF0 > ( res , < / span > < span class = cFE > 0 < / span > < span class = cF0 > , size ) ;
2021-07-03 05:07:57 +01:00
< a name = " l453 " > < / a >
2021-07-04 23:11:34 +01:00
< a name = " l454 " > < / a > < / span > < span class = cF1 > return < / span > < span class = cF0 > res ;
2021-07-03 05:07:57 +01:00
< a name = " l455 " > < / a > }
< a name = " l456 " > < / a >
< a name = " l457 " > < / a > < / span > < span class = cF1 > U8 < / span > < span class = cF0 > * < / span > < span class = cF5 > ReAlloc < / span > < span class = cF0 > ( < / span > < span class = cF1 > U8 < / span > < span class = cF0 > * ptr , < / span > < span class = cF9 > U64 < / span > < span class = cF0 > new_size , < / span > < span class = cF9 > CTask < / span > < span class = cF0 > * mem_task = < / span > < span class = cF3 > NULL < / span > < span class = cF0 > )
< a name = " l458 " > < / a > { < / span > < span class = cF2 > //Resize previously MAlloc'ed chunk. If new_size is zero then act as Free.</span><span class=cF0>
< a name = " l459 " > < / a > < / span > < span class = cF2 > //If ptr is NULL then act as MAlloc. if both are NULL/0 does nothing (Free(NULL))</span><span class=cF0>
< a name = " l460 " > < / a > < / span > < span class = cF2 > //Useless for changing chunk sizes smaller than 8 bytes because MAlloc allocs 8 bytes at a time.</span><span class=cF0>
2021-07-04 23:11:34 +01:00
< a name = " l461 " > < / a > < / span > < span class = cF1 > U8 < / span > < span class = cF0 > * res ;
2021-07-03 05:07:57 +01:00
< a name = " l462 " > < / a >
2021-07-04 23:11:34 +01:00
< a name = " l463 " > < / a > < / span > < span class = cF1 > if < / span > < span class = cF0 > ( ! new_size )
< a name = " l464 " > < / a > < / span > < span class = cF7 > { < / span > < span class = cF0 >
< a name = " l465 " > < / a > < / span > < span class = cF5 > Free < / span > < span class = cF0 > ( ptr ) ; < / span > < span class = cF2 > //we can free NULL</span><span class=cF0>
< a name = " l466 " > < / a > < / span > < span class = cF1 > return < / span > < span class = cF0 > < / span > < span class = cF3 > NULL < / span > < span class = cF0 > ;
< a name = " l467 " > < / a > < / span > < span class = cF7 > } < / span > < span class = cF0 >
2021-07-03 05:07:57 +01:00
< a name = " l468 " > < / a >
2021-07-04 23:11:34 +01:00
< a name = " l469 " > < / a > res = < / span > < span class = cF5 > MAlloc < / span > < span class = cF0 > ( new_size , mem_task ) ;
< a name = " l470 " > < / a > < / span > < span class = cF1 > if < / span > < span class = cF0 > ( ! ptr )
< a name = " l471 " > < / a > < / span > < span class = cF1 > return < / span > < span class = cF0 > res ;
2021-07-03 05:07:57 +01:00
< a name = " l472 " > < / a >
2021-07-04 23:11:34 +01:00
< a name = " l473 " > < / a > < / span > < span class = cF5 > MemCopy < / span > < span class = cF0 > ( res , ptr , < / span > < span class = cF5 > MinI64 < / span > < span class = cF7 > ( < / span > < span class = cF5 > MSize < / span > < span class = cF0 > ( ptr ) , new_size < / span > < span class = cF7 > ) < / span > < span class = cF0 > ) ;
< a name = " l474 " > < / a > < / span > < span class = cF5 > Free < / span > < span class = cF0 > ( ptr ) ;
2021-07-03 05:07:57 +01:00
< a name = " l475 " > < / a >
2021-07-04 23:11:34 +01:00
< a name = " l476 " > < / a > < / span > < span class = cF1 > return < / span > < span class = cF0 > res ;
2021-07-03 05:07:57 +01:00
< a name = " l477 " > < / a > }
< a name = " l478 " > < / a >
< a name = " l479 " > < / a > < / span > < span class = cF1 > U8 < / span > < span class = cF0 > * < / span > < span class = cF5 > ZReAlloc < / span > < span class = cF0 > ( < / span > < span class = cF1 > U8 < / span > < span class = cF0 > * ptr , < / span > < span class = cF9 > I64 < / span > < span class = cF0 > new_size )
< a name = " l480 " > < / a > { < / span > < span class = cF2 > //Realloc in System task's heap.</span><span class=cF0>
2021-07-04 23:11:34 +01:00
< a name = " l481 " > < / a > < / span > < span class = cF1 > return < / span > < span class = cF0 > < / span > < span class = cF5 > ReAlloc < / span > < span class = cF0 > ( ptr , new_size , < / span > < span class = cFB > sys_task < / span > < span class = cF0 > ) ;
2021-07-03 05:07:57 +01:00
< a name = " l482 " > < / a > }
< a name = " l483 " > < / a >
< a name = " l484 " > < / a > < / span > < span class = cF1 > U8 < / span > < span class = cF0 > * < / span > < span class = cF5 > StrNew < / span > < span class = cF0 > ( < / span > < span class = cF1 > U8 < / span > < span class = cF0 > * buf , < / span > < span class = cF9 > CTask < / span > < span class = cF0 > * mem_task = < / span > < span class = cF3 > NULL < / span > < span class = cF0 > )
2021-07-03 07:51:43 +01:00
< a name = " l485 " > < / a > { < / span > < span class = cF2 > //Accepts a </span><a href="https://tomawezome.github.io/ZealOS/Kernel/KernelA.html#l3939"><span class=cF4>CTask</span></a><span class=cF2> or </span><a href="https://tomawezome.github.io/ZealOS/Kernel/KernelA.html#l3527"><span class=cF4>CHeapCtrl</span></a><span class=cF2>. NULL allocs off current task's heap.</span><span class=cF0>
2021-07-04 23:11:34 +01:00
< a name = " l486 " > < / a > < / span > < span class = cF1 > U8 < / span > < span class = cF0 > * res ;
< a name = " l487 " > < / a > < / span > < span class = cF9 > I64 < / span > < span class = cF0 > size ;
2021-07-03 05:07:57 +01:00
< a name = " l488 " > < / a >
2021-07-04 23:11:34 +01:00
< a name = " l489 " > < / a > < / span > < span class = cF1 > if < / span > < span class = cF0 > ( buf )
< a name = " l490 " > < / a > < / span > < span class = cF7 > { < / span > < span class = cF0 >
< a name = " l491 " > < / a > size = < / span > < span class = cF5 > StrLen < / span > < span class = cF0 > ( buf ) + < / span > < span class = cFE > 1 < / span > < span class = cF0 > ;
< a name = " l492 " > < / a > res = < / span > < span class = cF5 > MAlloc < / span > < span class = cF0 > ( size , mem_task ) ;
< a name = " l493 " > < / a > < / span > < span class = cF5 > MemCopy < / span > < span class = cF0 > ( res , buf , size ) ;
< a name = " l494 " > < / a > < / span > < span class = cF7 > } < / span > < span class = cF0 >
< a name = " l495 " > < / a > < / span > < span class = cF1 > else < / span > < span class = cF0 >
< a name = " l496 " > < / a > < / span > < span class = cF7 > { < / span > < span class = cF0 >
< a name = " l497 " > < / a > res = < / span > < span class = cF5 > MAlloc < / span > < span class = cF0 > ( < / span > < span class = cFE > 1 < / span > < span class = cF0 > , mem_task ) ;
< a name = " l498 " > < / a > * res = < / span > < span class = cFE > 0 < / span > < span class = cF0 > ;
< a name = " l499 " > < / a > < / span > < span class = cF7 > } < / span > < span class = cF0 >
< a name = " l500 " > < / a > < / span > < span class = cF1 > return < / span > < span class = cF0 > res ;
2021-07-03 05:07:57 +01:00
< a name = " l501 " > < / a > }
< a name = " l502 " > < / a >
< a name = " l503 " > < / a > < / span > < span class = cF1 > U8 < / span > < span class = cF0 > * < / span > < span class = cF5 > ZStrNew < / span > < span class = cF0 > ( < / span > < span class = cF1 > U8 < / span > < span class = cF0 > * buf )
< a name = " l504 " > < / a > { < / span > < span class = cF2 > //Alloc copy of string in System task's heap.</span><span class=cF0>
2021-07-04 23:11:34 +01:00
< a name = " l505 " > < / a > < / span > < span class = cF1 > return < / span > < span class = cF0 > < / span > < span class = cF5 > StrNew < / span > < span class = cF0 > ( buf , < / span > < span class = cFB > sys_task < / span > < span class = cF0 > ) ;
2021-07-03 05:07:57 +01:00
< a name = " l506 " > < / a > }
< / span > < / pre > < / body >
< / html >