Add total memory report to MemBIOSRep

This commit is contained in:
xmm15 2020-02-21 02:57:37 -06:00
parent 32363328e9
commit b09ee0e580
8 changed files with 1854 additions and 1860 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -212,7 +212,6 @@ GET_IP: POP BX
BTS U32 [SYS_RUN_LEVEL], RLf_VESA
@@10:
//Get mem maps.
//Get E801 memory map.
//Output: AX = Memory between 1MiB and 16MiB in KiB (max 0x3C00 == 15 MiB)
// BX = Memory after 16MiB until first memory hole in 64KiB blocks.
@ -226,11 +225,12 @@ GET_IP: POP BX
@@12: MOV U16 [MEM_E801], AX
MOV U16 [MEM_E801+2], BX
 MOV CX,MEM_E820_ENTRIES_NUM - 1 //Leave one to terminate
XOR EBX ,EBX
MOV AX, DS
MOV ES, AX
MOV DI, MEM_E820
//Get E820 memory map.
MOV CX , MEM_E820_ENTRIES_NUM - 1 //Leave one to terminate
XOR EBX, EBX
PUSH DS
POP ES
MOV DI , MEM_E820
@@15: PUSH CX
MOV EAX, 0xE820
MOV ECX, sizeof(CMemE820)
@ -239,37 +239,37 @@ GET_IP: POP BX
JC @@20
CMP EAX, 'PAMS'
JNE @@20
TEST EBX,EBX
TEST EBX, EBX
JZ @@20
ADD DI, sizeof(CMemE820)
ADD DI , sizeof(CMemE820)
POP CX
LOOP @@15
SUB SP, 2
@@20: ADD SP, 2
SUB SP , 2
@@20: ADD SP , 2 //if called failed we want to nullify the PUSHed CX value.
//Find how much space to map, start with E801 limit.
XOR EAX,EAX
MOV AX,[MEM_E801+2]
MOV AX, [MEM_E801+2]
SHL EAX,16
ADD EAX,SYS_16MEG_AREA_LIMIT
XOR EDX,EDX
//Find max of E820 to set mapped space.
MOV SI,MEM_E820
@@25: MOV CL,CMemE820.type[SI]
TEST CL,CL
MOV SI , MEM_E820
@@25: MOV CL , CMemE820.type[SI]
TEST CL , CL
JZ @@35
MOV EBX,CMemE820.base[SI]
MOV ECX,CMemE820.base+4[SI]
ADD EBX,CMemE820.len[SI]
ADC ECX,CMemE820.len+4[SI]
SUB EBX,EAX
SBB ECX,EDX
MOV EBX, CMemE820.base [SI]
MOV ECX, CMemE820.base+4[SI]
 ADD EBX, CMemE820.len [SI]
ADC ECX, CMemE820.len+4 [SI]
SUB EBX, EAX
SBB ECX, EDX
JC @@30
MOV EAX,CMemE820.base[SI]
MOV EDX,CMemE820.base+4[SI]
ADD EAX,CMemE820.len[SI]
ADC EDX,CMemE820.len+4[SI]
MOV EAX, CMemE820.base[SI]
MOV EDX, CMemE820.base+4[SI]
ADD EAX, CMemE820.len[SI]
ADC EDX, CMemE820.len+4[SI]
@@30: ADD SI,sizeof(CMemE820)
JMP @@25

File diff suppressed because it is too large Load diff

View file

@ -334,29 +334,44 @@ public class CMathODE
#define MP_PROCESSORS_NUM 128
#define SYS_START_CR0 0x0031
//Control register flag bits
#define CR0f_MP 1 //Monitor coprocessor
#define CR0f_EM 2 //Emulation of coprocessor
#define CR0f_TS 3 //Task switched, some irrelevant x87 task management stuff
#define CR0f_NE 5 //Numeric error
#define CR0f_PG 31//Enable paging
#define RFLAGf_CARRY 0
#define RFLAGf_PARITY 2
#define RFLAGf_AUX_CARRY 4
#define RFLAGf_ZERO 6
#define RFLAGf_SIGN 7
#define RFLAGf_TRAP 8 //Single Step
#define RFLAGf_INT 9
#define RFLAGf_DIR 10
#define RFLAGf_OVERFLOW 11
#define RFLAGf_IOPL0 12 // I/O Privilege Level
#define RFLAGf_IOPL1 13
#define RFLAGf_NESTED_TASK 14
#define RFLAGf_RESUME 16
#define RFLAGf_V8086 17
#define RFLAGf_ALIGN_CHECK 18
#define RFLAGf_VINT 19 //Virtual Interrupt
#define RFLAGf_VINT_PENDING 20
#define RFLAGf_ID 21
#define CR4f_PAE 5 //Physical Address Extension, required by long mode
#define CR4f_PGE 7 //Page-Global Enable
#define CR4f_OSFXSR 9 //FXSAVE/FXRSTOR support enabled
#define RFLAGG_START 0x0000
#define RFLAGG_NORMAL (1<<RFLAGf_INT)
#define CR4F_PAE (1<<CR4f_PAE)
#define CR4F_PGE (1<<CR4f_PGE)
#define CR4F_OSFXSR (1<<CR4f_OSFXSR)
#define SYS_START_CR0 0x0031
#define RFLAGf_CARRY 0
#define RFLAGf_PARITY 2
#define RFLAGf_AUX_CARRY 4
#define RFLAGf_ZERO 6
#define RFLAGf_SIGN 7
#define RFLAGf_TRAP 8 //Single Step
#define RFLAGf_INT 9
#define RFLAGf_DIR 10
#define RFLAGf_OVERFLOW 11
#define RFLAGf_IOPL0 12 // I/O Privilege Level
#define RFLAGf_IOPL1 13
#define RFLAGf_NESTED_TASK 14
#define RFLAGf_RESUME 16
#define RFLAGf_V8086 17
#define RFLAGf_ALIGN_CHECK 18
#define RFLAGf_VINT 19 //Virtual Interrupt
#define RFLAGf_VINT_PENDING 20
#define RFLAGf_ID 21
#define RFLAGG_START 0x0000
#define RFLAGG_NORMAL (1<<RFLAGf_INT)
//Global Descriptor Table
class CGDTEntry
@ -385,13 +400,13 @@ class CSysLimitBase
};
#help_index "Memory/Info"
#define MEM_E820_ENTRIES_NUM 48
#define MEM_E820t_USABLE 1
#define MEM_E820t_RESERVED 2
#define MEM_E820t_ACPI 3
#define MEM_E820t_ACPI_NVS 4
#define MEM_E820t_BAD_MEM 5
#define MEM_E820t_PERM_MEM 7
#define MEM_E820_ENTRIES_NUM 24
#define MEM_E820t_USABLE 1
#define MEM_E820t_RESERVED 2
#define MEM_E820t_ACPI 3
#define MEM_E820t_ACPI_NVS 4
#define MEM_E820t_BAD_MEM 5
#define MEM_E820t_PERM_MEM 7
class CMemE820
{
@ -584,20 +599,6 @@ class CKernel
#define RLF_ONCE_USER (1<<RLf_ONCE_USER)
#help_index "Processor"
//Control register flag bits
#define CR0f_MP 1 //Monitor coprocessor
#define CR0f_EM 2 //Emulation of coprocessor
#define CR0f_TS 3 //Task switched, some irrelevant x87 task management stuff
#define CR0f_NE 5 //Numeric error
#define CR0f_PG 31//Enable paging
#define CR4f_PAE 5 //Physical Address Extension, required by long mode
#define CR4f_PGE 7 //Page-Global Enable
#define CR4f_OSFXSR 9 //FXSAVE/FXRSTOR support enabled
#define CR4F_PAE (1<<CR4f_PAE)
#define CR4F_PGE (1<<CR4f_PGE)
#define CR4F_OSFXSR (1<<CR4f_OSFXSR)
//Model specific regs.
#define IA32F_SCE 0x001
@ -1593,7 +1594,7 @@ class CWinMgrTimingGlobals
};
#define WINMGR_FPS (30000.0/1001)
#define WINMGR_PERIOD (1001/30000.0)
#define WINMGR_PERIOD (1001/30000.0)
public class CWinMgrGlobals
{

Binary file not shown.

View file

@ -225,10 +225,10 @@ public U0 MemBIOSRep()
CMemRange *tmpmr;
"$$PURPLE$$Standard Addresses$$FG$$\n"
"FEE00000-FEE00FFF See $$LK,\"APIC\",A=\"MN:LAPIC_BASE\"$$\n\n"
"FEE00000-FEE00FFF See $LK,"APIC",A="MN:LAPIC_BASE"$\n\n"
"$$PURPLE$$VBE Linear Framebuffer$$FG$$\n"
"%08X-%08X See $$LK,\"VBE Mode\",A=\"FF:::/Kernel/KernelA.HH,framebuffer\"$$\n", text.fb_alias,
"%08X-%08X See $LK,"VBE Mode",A="FF:::/Kernel/KernelA.HH,framebuffer"$\n", text.fb_alias,
text.fb_alias(U8 *) + text.buffer_size - 1;
"\n$$PURPLE$$32 Bit Device Mem$$FG$$\n";
while (LBts(&sys_semas[SEMA_DEV_MEM],0))
@ -242,7 +242,7 @@ public U0 MemBIOSRep()
LBtr(&sys_semas[SEMA_DEV_MEM],0);
"\n$$PURPLE$$BIOS Memory Report 15:E801$$FG$$\n"
"0000000000000000-%016X\n", 0x100000 + m01[0] * 1024 - 1;
"0000000000000000-%016X\n", 0x100000 + m01[0] * 1024 - 1;
"0000000001000000-%016X\n", SYS_16MEG_AREA_LIMIT + m01[1] * 64 * 1024 - 1;
if (m20->type)
@ -273,6 +273,11 @@ public U0 MemBIOSRep()
m20++;
}
}
"\n$$PURPLE$$BIOS Total Memory Report$$FG$$: ";
if (MemBIOSTotal < 1024 * 1024 * 1024)
"%03d MiB\n", MemBIOSTotal / 1024 / 1024;
else
"%04d GiB\n", MemBIOSTotal / 1024 / 1024 / 1024;
}
public U0 MemPageRep()