2021-07-03 05:07:57 +01:00
<!DOCTYPE HTML>
< html >
< head >
< meta http-equiv = "Content-Type" content = "text/html;charset=US-ASCII" >
2021-07-25 09:07:40 +01:00
< meta name = "generator" content = "ZealOS V0.10" >
2021-07-03 05:07:57 +01:00
< style type = "text/css" >
body {background-color:#000000;}
.cF0{color:#ffffff;background-color:#000000;}
.cF1{color:#3465a4;background-color:#000000;}
.cF2{color:#4e9a06;background-color:#000000;}
.cF3{color:#06989a;background-color:#000000;}
.cF4{color:#a24444;background-color:#000000;}
.cF5{color:#75507b;background-color:#000000;}
.cF6{color:#ce982f;background-color:#000000;}
.cF7{color:#bcc0b9;background-color:#000000;}
.cF8{color:#555753;background-color:#000000;}
.cF9{color:#729fcf;background-color:#000000;}
.cFA{color:#82bc49;background-color:#000000;}
.cFB{color:#34e2e2;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 > Bool< / span > < span class = cF0 > < / span > < span class = cFD > Mem32DevIns< / span > < span class = cF0 > (< / span > < span class = cF9 > CMemRange< / span > < span class = cF0 > *tmpmr)
< a name = "l2" > < / a > {
2021-07-04 23:11:34 +01:00
< a name = "l3" > < / a > < / span > < span class = cF9 > CMemRange< / span > < span class = cF0 > *tmpmr1 = < / span > < span class = cFB > dev< / span > < span class = cF0 > .mem32_head.next, *tmpmr2;
2021-07-03 05:07:57 +01:00
< a name = "l4" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l5" > < / a > < / span > < span class = cF1 > while< / span > < span class = cF0 > (tmpmr1 != & < / span > < span class = cFB > dev< / span > < span class = cF0 > .mem32_head)
< a name = "l6" > < / a > < / span > < span class = cF7 > {< / span > < span class = cF0 >
< a name = "l7" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (!tmpmr1-> type & & tmpmr-> base > = tmpmr1-> base & & tmpmr-> base + tmpmr-> size < = tmpmr1-> base + tmpmr1-> size)
< a name = "l8" > < / a > {
< a name = "l9" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (tmpmr-> base > tmpmr1-> base)
< a name = "l10" > < / a > < / span > < span class = cF7 > {< / span > < span class = cF0 >
2021-07-06 21:15:26 +01:00
< a name = "l11" > < / a > tmpmr2 = < / span > < span class = cF5 > SysMAlloc< / span > < span class = cF0 > (< / span > < span class = cF1 > sizeof< / span > < span class = cF7 > (< / span > < span class = cF9 > CMemRange< / span > < span class = cF7 > )< / span > < span class = cF0 > );
2021-07-04 23:11:34 +01:00
< a name = "l12" > < / a > tmpmr2-> type = < / span > < span class = cF3 > MRT_UNUSED< / span > < span class = cF0 > ;
< a name = "l13" > < / a > tmpmr2-> flags = < / span > < span class = cFE > 0< / span > < span class = cF0 > ;
< a name = "l14" > < / a > tmpmr2-> base = tmpmr1-> base;
< a name = "l15" > < / a > tmpmr2-> size = tmpmr-> base - tmpmr1-> base;
< a name = "l16" > < / a > < / span > < span class = cF5 > QueueInsertRev< / span > < span class = cF0 > (tmpmr2, tmpmr1);
< a name = "l17" > < / a > < / span > < span class = cF7 > }< / span > < span class = cF0 >
< a name = "l18" > < / a > < / span > < span class = cF5 > QueueInsertRev< / span > < span class = cF0 > (tmpmr, tmpmr1);
< a name = "l19" > < / a > tmpmr1-> size = tmpmr1-> base + tmpmr1-> size - (tmpmr-> base + tmpmr-> size);
< a name = "l20" > < / a > tmpmr1-> base = tmpmr-> base + tmpmr-> size;
< a name = "l21" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (!tmpmr1-> size)
< a name = "l22" > < / a > < / span > < span class = cF7 > {< / span > < span class = cF0 >
< a name = "l23" > < / a > < / span > < span class = cF5 > QueueRemove< / span > < span class = cF0 > (tmpmr1);
< a name = "l24" > < / a > < / span > < span class = cF5 > Free< / span > < span class = cF0 > (tmpmr1);
< a name = "l25" > < / a > < / span > < span class = cF7 > }< / span > < span class = cF0 >
< a name = "l26" > < / a > < / span > < span class = cF1 > return< / span > < span class = cF0 > < / span > < span class = cF3 > TRUE< / span > < span class = cF0 > ;
< a name = "l27" > < / a > }
< a name = "l28" > < / a > tmpmr1 = tmpmr1-> next;
< a name = "l29" > < / a > < / span > < span class = cF7 > }< / span > < span class = cF0 >
2021-07-03 05:07:57 +01:00
< a name = "l30" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l31" > < / a > < / span > < span class = cF1 > return< / span > < span class = cF0 > < / span > < span class = cF3 > FALSE< / span > < span class = cF0 > ;
2021-07-03 05:07:57 +01:00
< a name = "l32" > < / a > }
< a name = "l33" > < / a >
< a name = "l34" > < / a > < / span > < span class = cF1 > U0< / span > < span class = cF0 > < / span > < span class = cFD > Mem32DevInit< / span > < span class = cF0 > ()
< a name = "l35" > < / a > {
2021-07-04 23:11:34 +01:00
< a name = "l36" > < / a > < / span > < span class = cF9 > CMemRange< / span > < span class = cF0 > *tmpmr;
< a name = "l37" > < / a > < / span > < span class = cF9 > CMemE820< / span > < span class = cF0 > *m20 = < / span > < span class = cFD > MEM_E820< / span > < span class = cF0 > ;
2021-07-03 05:07:57 +01:00
< a name = "l38" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l39" > < / a > < / span > < span class = cF5 > QueueInit< / span > < span class = cF0 > (& < / span > < span class = cFB > dev< / span > < span class = cF0 > .mem32_head);
2021-07-06 21:15:26 +01:00
< a name = "l40" > < / a > tmpmr = < / span > < span class = cF5 > SysMAlloc< / span > < span class = cF0 > (< / span > < span class = cF1 > sizeof< / span > < span class = cF7 > (< / span > < span class = cF9 > CMemRange< / span > < span class = cF7 > )< / span > < span class = cF0 > );
2021-07-04 23:11:34 +01:00
< a name = "l41" > < / a > tmpmr-> type = < / span > < span class = cF3 > MRT_UNUSED< / span > < span class = cF0 > ;
< a name = "l42" > < / a > tmpmr-> flags = < / span > < span class = cFE > 0< / span > < span class = cF0 > ;
2021-07-03 05:07:57 +01:00
< a name = "l43" > < / a > < / span > < span class = cF2 > //Maybe !!! Change this to 0xF0000000 !!!< / span > < span class = cF0 >
2021-07-04 23:11:34 +01:00
< a name = "l44" > < / a > tmpmr-> base = < / span > < span class = cFE > 0xE0000000< / span > < span class = cF0 > ;
< a name = "l45" > < / a > tmpmr-> size = < / span > < span class = cFE > 0x10000000< / span > < span class = cF0 > ;
< a name = "l46" > < / a > < / span > < span class = cF5 > QueueInsert< / span > < span class = cF0 > (tmpmr, < / span > < span class = cFB > dev< / span > < span class = cF0 > .mem32_head.last);
2021-07-03 05:07:57 +01:00
< a name = "l47" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l48" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (m20-> type)
< a name = "l49" > < / a > < / span > < span class = cF7 > {< / span > < span class = cF0 >
< a name = "l50" > < / a > < / span > < span class = cF1 > while< / span > < span class = cF0 > (m20-> type)
< a name = "l51" > < / a > {
2021-07-06 21:15:26 +01:00
< a name = "l52" > < / a > tmpmr = < / span > < span class = cF5 > SysMAlloc< / span > < span class = cF0 > (< / span > < span class = cF1 > sizeof< / span > < span class = cF7 > (< / span > < span class = cF9 > CMemRange< / span > < span class = cF7 > )< / span > < span class = cF0 > );
2021-07-04 23:11:34 +01:00
< a name = "l53" > < / a > tmpmr-> type = m20-> type;
< a name = "l54" > < / a > tmpmr-> flags = < / span > < span class = cFE > 0< / span > < span class = cF0 > ;
< a name = "l55" > < / a > tmpmr-> base = m20-> base;
< a name = "l56" > < / a > tmpmr-> size = m20-> len;
< a name = "l57" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (!< / span > < span class = cFD > Mem32DevIns< / span > < span class = cF7 > (< / span > < span class = cF0 > tmpmr< / span > < span class = cF7 > )< / span > < span class = cF0 > )
< a name = "l58" > < / a > < / span > < span class = cF5 > Free< / span > < span class = cF0 > (tmpmr);
< a name = "l59" > < / a > m20++;
< a name = "l60" > < / a > }
< a name = "l61" > < / a > < / span > < span class = cF7 > }< / span > < span class = cF0 >
2021-07-03 05:07:57 +01:00
< a name = "l62" > < / a > }
< a name = "l63" > < / a >
< a name = "l64" > < / a > < / span > < span class = cF1 > U8< / span > < span class = cF0 > *< / span > < span class = cF5 > Mem32DevAlloc< / span > < span class = cF0 > (< / span > < span class = cF9 > I64< / span > < span class = cF0 > size, < / span > < span class = cF9 > I64< / span > < span class = cF0 > alignment)
< a name = "l65" > < / a > {< / span > < span class = cF2 > //Alloc 32-bit addr space for device. (Doesn't work.) Not used.< / span > < span class = cF0 >
< a name = "l66" > < / a > < / span > < span class = cF2 > //For this to work the BIOS E820 map must be searched for gaps in< / span > < span class = cF0 >
2021-07-04 23:11:34 +01:00
< a name = "l67" > < / a > < / span > < span class = cF2 > //the 32-bit range and the pool initialized to the gaps.< / span > < span class = cF0 >
< a name = "l68" > < / a > < / span > < span class = cF1 > U8< / span > < span class = cF0 > *base, *limit;
< a name = "l69" > < / a > < / span > < span class = cF9 > CMemRange< / span > < span class = cF0 > *tmpmr, *tmpmr1;
2021-07-03 05:07:57 +01:00
< a name = "l70" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l71" > < / a > < / span > < span class = cF1 > while< / span > < span class = cF0 > (< / span > < span class = cF5 > LBts< / span > < span class = cF7 > (< / span > < span class = cF0 > & < / span > < span class = cFB > sys_semas< / span > < span class = cF0 > [< / span > < span class = cF3 > SEMA_DEV_MEM< / span > < span class = cF0 > ], < / span > < span class = cFE > 0< / span > < span class = cF7 > )< / span > < span class = cF0 > )
< a name = "l72" > < / a > < / span > < span class = cF5 > Yield< / span > < span class = cF0 > ;
< a name = "l73" > < / a > tmpmr1 = < / span > < span class = cFB > dev< / span > < span class = cF0 > .mem32_head.next;
< a name = "l74" > < / a > < / span > < span class = cF1 > while< / span > < span class = cF0 > (tmpmr1 != & < / span > < span class = cFB > dev< / span > < span class = cF0 > .mem32_head)
< a name = "l75" > < / a > < / span > < span class = cF7 > {< / span > < span class = cF0 >
< a name = "l76" > < / a > base = (tmpmr1-> base + alignment - < / span > < span class = cFE > 1< / span > < span class = cF0 > ) & ~(alignment - < / span > < span class = cFE > 1< / span > < span class = cF0 > );
< a name = "l77" > < / a > limit = base + size - < / span > < span class = cFE > 1< / span > < span class = cF0 > ;
< a name = "l78" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (!tmpmr1-> type & & limit < tmpmr1-> base + tmpmr1-> size)
< a name = "l79" > < / a > {
2021-07-06 21:15:26 +01:00
< a name = "l80" > < / a > tmpmr = < / span > < span class = cF5 > SysMAlloc< / span > < span class = cF0 > (< / span > < span class = cF1 > sizeof< / span > < span class = cF7 > (< / span > < span class = cF9 > CMemRange< / span > < span class = cF7 > )< / span > < span class = cF0 > );
2021-07-04 23:11:34 +01:00
< a name = "l81" > < / a > tmpmr-> type = < / span > < span class = cF3 > MRT_DEV< / span > < span class = cF0 > ;
< a name = "l82" > < / a > tmpmr-> flags = < / span > < span class = cFE > 0< / span > < span class = cF0 > ;
< a name = "l83" > < / a > tmpmr-> base = base;
< a name = "l84" > < / a > tmpmr-> size = size;
< a name = "l85" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (!< / span > < span class = cFD > Mem32DevIns< / span > < span class = cF7 > (< / span > < span class = cF0 > tmpmr< / span > < span class = cF7 > )< / span > < span class = cF0 > )
< a name = "l86" > < / a > < / span > < span class = cF7 > {< / span > < span class = cF0 >
< a name = "l87" > < / a > < / span > < span class = cF5 > Free< / span > < span class = cF0 > (tmpmr);
< a name = "l88" > < / a > < / span > < span class = cF5 > LBtr< / span > < span class = cF0 > (& < / span > < span class = cFB > sys_semas< / span > < span class = cF0 > [< / span > < span class = cF3 > SEMA_DEV_MEM< / span > < span class = cF0 > ], < / span > < span class = cFE > 0< / span > < span class = cF0 > );
< a name = "l89" > < / a > < / span > < span class = cF1 > return< / span > < span class = cF0 > < / span > < span class = cF3 > NULL< / span > < span class = cF0 > ;
< a name = "l90" > < / a > < / span > < span class = cF7 > }< / span > < span class = cF0 >
< a name = "l91" > < / a > < / span > < span class = cF5 > LBtr< / span > < span class = cF0 > (& < / span > < span class = cFB > sys_semas< / span > < span class = cF0 > [< / span > < span class = cF3 > SEMA_DEV_MEM< / span > < span class = cF0 > ], < / span > < span class = cFE > 0< / span > < span class = cF0 > );
< a name = "l92" > < / a > < / span > < span class = cF1 > return< / span > < span class = cF0 > tmpmr-> base;
< a name = "l93" > < / a > }
< a name = "l94" > < / a > tmpmr1 = tmpmr1-> next;
< a name = "l95" > < / a > < / span > < span class = cF7 > }< / span > < span class = cF0 >
< a name = "l96" > < / a > < / span > < span class = cF5 > LBtr< / span > < span class = cF0 > (& < / span > < span class = cFB > sys_semas< / span > < span class = cF0 > [< / span > < span class = cF3 > SEMA_DEV_MEM< / span > < span class = cF0 > ], < / span > < span class = cFE > 0< / span > < span class = cF0 > );
2021-07-03 05:07:57 +01:00
< a name = "l97" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l98" > < / a > < / span > < span class = cF1 > return< / span > < span class = cF0 > < / span > < span class = cF3 > NULL< / span > < span class = cF0 > ;
2021-07-03 05:07:57 +01:00
< a name = "l99" > < / a > }
< a name = "l100" > < / a >
< a name = "l101" > < / a > < / span > < span class = cF1 > U0< / span > < span class = cF0 > < / span > < span class = cF5 > Mem32DevFree< / span > < span class = cF0 > (< / span > < span class = cF1 > U8< / span > < span class = cF0 > *base)
< a name = "l102" > < / a > {< / span > < span class = cF2 > //Free 32-bit device address space.< / span > < span class = cF0 >
2021-07-04 23:11:34 +01:00
< a name = "l103" > < / a > < / span > < span class = cF9 > CMemRange< / span > < span class = cF0 > *tmpmr;
2021-07-03 05:07:57 +01:00
< a name = "l104" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l105" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (!base)
< a name = "l106" > < / a > < / span > < span class = cF1 > return< / span > < span class = cF0 > ;
< a name = "l107" > < / a > < / span > < span class = cF1 > while< / span > < span class = cF0 > (< / span > < span class = cF5 > LBts< / span > < span class = cF7 > (< / span > < span class = cF0 > & < / span > < span class = cFB > sys_semas< / span > < span class = cF0 > [< / span > < span class = cF3 > SEMA_DEV_MEM< / span > < span class = cF0 > ], < / span > < span class = cFE > 0< / span > < span class = cF7 > )< / span > < span class = cF0 > )
< a name = "l108" > < / a > < / span > < span class = cF5 > Yield< / span > < span class = cF0 > ;
< a name = "l109" > < / a > tmpmr = < / span > < span class = cFB > dev< / span > < span class = cF0 > .mem32_head.next;
< a name = "l110" > < / a > < / span > < span class = cF1 > while< / span > < span class = cF0 > (tmpmr != & < / span > < span class = cFB > dev< / span > < span class = cF0 > .mem32_head)
< a name = "l111" > < / a > < / span > < span class = cF7 > {< / span > < span class = cF0 >
< a name = "l112" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (tmpmr-> base == base)
< a name = "l113" > < / a > {
< a name = "l114" > < / a > tmpmr-> type = < / span > < span class = cF3 > MRT_UNUSED< / span > < span class = cF0 > ;
< a name = "l115" > < / a > < / span > < span class = cF1 > break< / span > < span class = cF0 > ;
< a name = "l116" > < / a > }
< a name = "l117" > < / a > tmpmr = tmpmr-> next;
< a name = "l118" > < / a > < / span > < span class = cF7 > }< / span > < span class = cF0 >
< a name = "l119" > < / a > < / span > < span class = cF5 > LBtr< / span > < span class = cF0 > (& < / span > < span class = cFB > sys_semas< / span > < span class = cF0 > [< / span > < span class = cF3 > SEMA_DEV_MEM< / span > < span class = cF0 > ], < / span > < span class = cFE > 0< / span > < span class = cF0 > );
2021-07-03 05:07:57 +01:00
< a name = "l120" > < / a > }
< a name = "l121" > < / a >
< a name = "l122" > < / a > < / span > < span class = cF1 > U8< / span > < span class = cF0 > *< / span > < span class = cF5 > Mem64DevAlloc< / span > < span class = cF0 > (< / span > < span class = cF9 > I64< / span > < span class = cF0 > *_pages1Gig)
< a name = "l123" > < / a > {< / span > < span class = cF2 > //Alloc 64-bit addr space for device.< / span > < span class = cF0 >
2021-07-04 23:11:34 +01:00
< a name = "l124" > < / a > < / span > < span class = cF1 > U8< / span > < span class = cF0 > *a;
< a name = "l125" > < / a > < / span > < span class = cF9 > I64< / span > < span class = cF0 > i = *_pages1Gig, *pte;
2021-07-03 05:07:57 +01:00
< a name = "l126" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l127" > < / a > < / span > < span class = cF1 > while< / span > < span class = cF0 > (< / span > < span class = cF5 > LBts< / span > < span class = cF7 > (< / span > < span class = cF0 > & < / span > < span class = cFB > sys_semas< / span > < span class = cF0 > [< / span > < span class = cF3 > SEMA_DEV_MEM< / span > < span class = cF0 > ], < / span > < span class = cFE > 0< / span > < span class = cF7 > )< / span > < span class = cF0 > )
< a name = "l128" > < / a > < / span > < span class = cF5 > Yield< / span > < span class = cF0 > ;
< a name = "l129" > < / a > < / span > < span class = cF1 > while< / span > < span class = cF0 > (i--)
< a name = "l130" > < / a > < / span > < span class = cF7 > {< / span > < span class = cF0 >
< a name = "l131" > < / a > a = < / span > < span class = cFB > dev< / span > < span class = cF0 > .mem64_ptr -= < / span > < span class = cFE > 1< / span > < span class = cF0 > < < < / span > < span class = cFE > 30< / span > < span class = cF0 > ;
< a name = "l132" > < / a > < / span > < span class = cF1 > do< / span > < span class = cF0 >
< a name = "l133" > < / a > {
< a name = "l134" > < / a > pte = < / span > < span class = cF5 > MemPageTable< / span > < span class = cF0 > (a);
< a name = "l135" > < / a > *pte = *pte & ~< / span > < span class = cFE > 0x18< / span > < span class = cF0 > | < / span > < span class = cFE > 0x11< / span > < span class = cF0 > ; < / span > < span class = cF2 > //Uncached and present< / span > < span class = cF0 >
< a name = "l136" > < / a > < / span > < span class = cF5 > InvalidatePage< / span > < span class = cF0 > (< / span > < span class = cFB > dev< / span > < span class = cF0 > .mem64_ptr);
< a name = "l137" > < / a > a += < / span > < span class = cFB > mem_page_size< / span > < span class = cF0 > ;
< a name = "l138" > < / a > }
< a name = "l139" > < / a > < / span > < span class = cF1 > while< / span > < span class = cF0 > (a - < / span > < span class = cFB > dev< / span > < span class = cF0 > .mem64_ptr < < / span > < span class = cFE > 1< / span > < span class = cF0 > < < < / span > < span class = cFE > 30< / span > < span class = cF0 > );
< a name = "l140" > < / a > < / span > < span class = cF7 > }< / span > < span class = cF0 >
< a name = "l141" > < / a > < / span > < span class = cF5 > LBtr< / span > < span class = cF0 > (& < / span > < span class = cFB > sys_semas< / span > < span class = cF0 > [< / span > < span class = cF3 > SEMA_DEV_MEM< / span > < span class = cF0 > ], < / span > < span class = cFE > 0< / span > < span class = cF0 > );
< a name = "l142" > < / a > < / span > < span class = cF1 > return< / span > < span class = cF0 > < / span > < span class = cFB > dev< / span > < span class = cF0 > .mem64_ptr;
2021-07-03 05:07:57 +01:00
< a name = "l143" > < / a > }
< a name = "l144" > < / a >
< a name = "l145" > < / a > < / span > < span class = cF1 > U0< / span > < span class = cF0 > < / span > < span class = cF5 > Mem64DevFree< / span > < span class = cF0 > (< / span > < span class = cF1 > U8< / span > < span class = cF0 > *base, < / span > < span class = cF9 > I64< / span > < span class = cF0 > pages1Gig)
< a name = "l146" > < / a > {< / span > < span class = cF2 > //Free 64-bit device address space.< / span > < span class = cF0 >
2021-07-04 23:11:34 +01:00
< a name = "l147" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (!base)
< a name = "l148" > < / a > < / span > < span class = cF1 > return< / span > < span class = cF0 > ;
< a name = "l149" > < / a > < / span > < span class = cF1 > while< / span > < span class = cF0 > (< / span > < span class = cF5 > LBts< / span > < span class = cF7 > (< / span > < span class = cF0 > & < / span > < span class = cFB > sys_semas< / span > < span class = cF0 > [< / span > < span class = cF3 > SEMA_DEV_MEM< / span > < span class = cF0 > ], < / span > < span class = cFE > 0< / span > < span class = cF7 > )< / span > < span class = cF0 > )
< a name = "l150" > < / a > < / span > < span class = cF5 > Yield< / span > < span class = cF0 > ;
< a name = "l151" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (base == < / span > < span class = cFB > dev< / span > < span class = cF0 > .mem64_ptr)
< a name = "l152" > < / a > < / span > < span class = cFB > dev< / span > < span class = cF0 > .mem64_ptr += pages1Gig * < / span > < span class = cFE > 1< / span > < span class = cF0 > < < < / span > < span class = cFE > 30< / span > < span class = cF0 > ;
2021-07-03 05:07:57 +01:00
< a name = "l153" > < / a > < / span > < span class = cF2 > //else not freed< / span > < span class = cF0 >
2021-07-04 23:11:34 +01:00
< a name = "l154" > < / a > < / span > < span class = cF5 > LBtr< / span > < span class = cF0 > (& < / span > < span class = cFB > sys_semas< / span > < span class = cF0 > [< / span > < span class = cF3 > SEMA_DEV_MEM< / span > < span class = cF0 > ], < / span > < span class = cFE > 0< / span > < span class = cF0 > );
2021-07-03 05:07:57 +01:00
< a name = "l155" > < / a > }
< a name = "l156" > < / a >
< a name = "l157" > < / a > < / span > < span class = cF1 > U0< / span > < span class = cF0 > < / span > < span class = cFD > UncachedAliasAlloc< / span > < span class = cF0 > () < / span > < span class = cF2 > //Make uncached alias for 4 lowest Gig.< / span > < span class = cF0 >
< a name = "l158" > < / a > {
2021-07-04 23:11:34 +01:00
< a name = "l159" > < / a > < / span > < span class = cF9 > I64< / span > < span class = cF0 > i = < / span > < span class = cFE > 4< / span > < span class = cF0 > , *pte;
< a name = "l160" > < / a > < / span > < span class = cF1 > U8< / span > < span class = cF0 > *a;
2021-07-03 05:07:57 +01:00
< a name = "l161" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l162" > < / a > a = < / span > < span class = cFB > dev< / span > < span class = cF0 > .uncached_alias = < / span > < span class = cF5 > Mem64DevAlloc< / span > < span class = cF0 > (& i);
< a name = "l163" > < / a > < / span > < span class = cF1 > do< / span > < span class = cF0 >
< a name = "l164" > < / a > < / span > < span class = cF7 > {< / span > < span class = cF0 >
< a name = "l165" > < / a > pte = < / span > < span class = cF5 > MemPageTable< / span > < span class = cF0 > (a);
< a name = "l166" > < / a > *pte = < / span > < span class = cFE > 0x197< / span > < span class = cF0 > + a - < / span > < span class = cFB > dev< / span > < span class = cF0 > .uncached_alias;
< a name = "l167" > < / a > < / span > < span class = cF5 > InvalidatePage< / span > < span class = cF0 > (a);
< a name = "l168" > < / a > a += < / span > < span class = cFB > mem_page_size< / span > < span class = cF0 > ;
< a name = "l169" > < / a > < / span > < span class = cF7 > }< / span > < span class = cF0 >
< a name = "l170" > < / a > < / span > < span class = cF1 > while< / span > < span class = cF0 > (a - < / span > < span class = cFB > dev< / span > < span class = cF0 > .uncached_alias < < / span > < span class = cFE > 1< / span > < span class = cF0 > < < < / span > < span class = cFE > 32< / span > < span class = cF0 > );
2021-07-03 05:07:57 +01:00
< a name = "l171" > < / a > }
< a name = "l172" > < / a >
< a name = "l173" > < / a > < / span > < span class = cF9 > I64< / span > < span class = cF0 > < / span > < span class = cF5 > MemBIOSTotal< / span > < span class = cF0 > ()
< a name = "l174" > < / a > {< / span > < span class = cF2 > //Returns max of either E801 or E820 mem map.< / span > < span class = cF0 >
2021-07-04 23:11:34 +01:00
< a name = "l175" > < / a > < / span > < span class = cF9 > I64< / span > < span class = cF0 > total01 = < / span > < span class = cFE > 0x100000< / span > < span class = cF0 > , total20 = < / span > < span class = cFE > 0< / span > < span class = cF0 > ;
< a name = "l176" > < / a > < / span > < span class = cF9 > U16< / span > < span class = cF0 > *mem01 = < / span > < span class = cFD > MEM_E801< / span > < span class = cF0 > ;
< a name = "l177" > < / a > < / span > < span class = cF9 > CMemE820< / span > < span class = cF0 > *mem20 = < / span > < span class = cFD > MEM_E820< / span > < span class = cF0 > ;
2021-07-03 05:07:57 +01:00
< a name = "l178" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l179" > < / a > total01 += mem01[< / span > < span class = cFE > 0< / span > < span class = cF0 > ] * < / span > < span class = cFE > 1024< / span > < span class = cF0 > ; < / span > < span class = cF2 > //First U16 is mem between 1MiB and 16 MiB in KiB.< / span > < span class = cF0 >
< a name = "l180" > < / a > total01 += mem01[< / span > < span class = cFE > 1< / span > < span class = cF0 > ] * < / span > < span class = cFE > 64< / span > < span class = cF0 > * < / span > < span class = cFE > 1024< / span > < span class = cF0 > ;< / span > < span class = cF2 > //Second U16 is mem above 16MiB (until it encounters a hole) in 64KiB blocks.< / span > < span class = cF0 >
2021-07-03 05:07:57 +01:00
< a name = "l181" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l182" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (mem20-> type)
< a name = "l183" > < / a > < / span > < span class = cF7 > {< / span > < span class = cF0 >
< a name = "l184" > < / a > < / span > < span class = cF1 > while< / span > < span class = cF0 > (mem20-> type)
< a name = "l185" > < / a > {
< a name = "l186" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (mem20-> type == < / span > < span class = cF3 > MEM_E820t_USABLE< / span > < span class = cF0 > )
< a name = "l187" > < / a > total20 += mem20-> len;
< a name = "l188" > < / a > mem20++;
< a name = "l189" > < / a > }
< a name = "l190" > < / a > < / span > < span class = cF7 > }< / span > < span class = cF0 >
< a name = "l191" > < / a > < / span > < span class = cF1 > return< / span > < span class = cF0 > < / span > < span class = cF5 > MaxI64< / span > < span class = cF0 > (total01, total20);
2021-07-03 05:07:57 +01:00
< a name = "l192" > < / a > }
< a name = "l193" > < / a >
< a name = "l194" > < / a > < / span > < span class = cF9 > I64< / span > < span class = cF0 > < / span > < span class = cF5 > Scale2Mem< / span > < span class = cF0 > (< / span > < span class = cF9 > I64< / span > < span class = cF0 > min, < / span > < span class = cF9 > I64< / span > < span class = cF0 > max, < / span > < span class = cF9 > I64< / span > < span class = cF0 > limit=< / span > < span class = cFE > 2< / span > < span class = cF0 > *< / span > < span class = cFE > 1024< / span > < span class = cF0 > *< / span > < span class = cFE > 1024< / span > < span class = cF0 > *< / span > < span class = cFE > 1024< / span > < span class = cF0 > )
< a name = "l195" > < / a > {< / span > < span class = cF2 > //Helps pick DiskCache and RAMDisk sizes.< / span > < span class = cF0 >
2021-07-25 09:07:40 +01:00
< a name = "l196" > < / a > < / span > < span class = cF2 > //Can be used in < / span > < a href = "https://tomawezome.github.io/ZealOS/System/Boot/BootHDIns.CC.html#l25" > < span class = cF4 > BootHDIns< / span > < / a > < span class = cF2 > () config scripts.< / span > < span class = cF0 >
2021-07-04 23:11:34 +01:00
< a name = "l197" > < / a > < / span > < span class = cF9 > I64< / span > < span class = cF0 > i;
2021-07-03 05:07:57 +01:00
< a name = "l198" > < / a >
2021-07-04 23:11:34 +01:00
< a name = "l199" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (< / span > < span class = cFB > sys_data_bp< / span > < span class = cF0 > )
< a name = "l200" > < / a > i = < / span > < span class = cFB > sys_data_bp< / span > < span class = cF0 > -> alloced_u8s;
< a name = "l201" > < / a > < / span > < span class = cF1 > else< / span > < span class = cF0 >
< a name = "l202" > < / a > i = < / span > < span class = cFB > sys_code_bp< / span > < span class = cF0 > -> alloced_u8s;
< a name = "l203" > < / a > < / span > < span class = cF1 > if< / span > < span class = cF0 > (i > = limit)
< a name = "l204" > < / a > < / span > < span class = cF1 > return< / span > < span class = cF0 > max;
< a name = "l205" > < / a > < / span > < span class = cF1 > else< / span > < span class = cF0 >
< a name = "l206" > < / a > < / span > < span class = cF1 > return< / span > < span class = cF0 > min + (max - min) * i / limit;
2021-07-03 05:07:57 +01:00
< a name = "l207" > < / a > }
< a name = "l208" > < / a >
< a name = "l209" > < / a > < / span > < span class = cF9 > I64< / span > < span class = cF0 > < / span > < span class = cF5 > Seg2Linear< / span > < span class = cF0 > (< / span > < span class = cF9 > U32< / span > < span class = cF0 > *ptr)
< a name = "l210" > < / a > {< / span > < span class = cF2 > //Convert 32-bit segmented farptr to linear address. Modify in place.< / span > < span class = cF0 >
2021-07-04 23:11:34 +01:00
< a name = "l211" > < / a > *ptr = *ptr > > < / span > < span class = cFE > 16< / span > < span class = cF0 > < < < / span > < span class = cFE > 4< / span > < span class = cF0 > + *ptr & < / span > < span class = cFE > 0xFFFF< / span > < span class = cF0 > ;
< a name = "l212" > < / a > < / span > < span class = cF1 > return< / span > < span class = cF0 > *ptr;
2021-07-03 05:07:57 +01:00
< a name = "l213" > < / a > }< / span > < / pre > < / body >
< / html >