[semi-solved] memory mapping throwing error at 476MiB mark
Posted: Sat Jan 30, 2021 1:04 pm
Note: no error is reported when running without KVM, but the behaviour is still unexpected behaviour
I'm getting a KVM internal error:
RIP points to a line in the printf function.
Unrelated.
This seems to be a memory mapping issue, because I never called printf.
Also, in the serial output I get:
which comes from a function I didn't call.
Now, I did do some debugging.
The error comes from this chunk of code:
which most likely arises when calling map_memory.
However, the issue does not lie in the map_memory function itself, but rather the parameters.
The first time the function is called, everything is fine. I am yet to discover which iteration it is when the error is thrown but I am working on that right now.
If you need more source, dig in:
Referenced source file above: https://github.com/microNET-OS/microCOR ... onfigf.cxx
Source file with paging code, including the map_memory function: https://github.com/microNET-OS/microCOR ... memory.cxx
I'm getting a KVM internal error:
Code: Select all
KVM internal error. Suberror: 3
extra data[0]: 80000306
extra data[1]: 31
extra data[2]: 182
extra data[3]: ee8ce968
RAX=000000000000001d RBX=0000000000151de8 RCX=0000000000001d00 RDX=00000000ee77296c
RSI=00000000ee8ce8b4 RDI=0000000000107c67 RBP=000000001dc00000 RSP=00000000ee8ce97c
R8 =000000001ffa0000 R9 =0000000000000030 R10=0000000000000017 R11=0000000000400000
R12=0000000000000000 R13=0000000000000000 R14=0000000000012770 R15=0000000000011000
RIP=0000000000100c31 RFL=00010082 [--S----] CPL=0 II=0 A20=1 SMM=0 HLT=0
ES =0010 0000000000000000 00000000 00009300 DPL=0 DS [-WA]
CS =0008 0000000000000000 f0000fff 00a09b00 DPL=0 CS64 [-RA]
SS =0010 0000000000000000 00000000 00009300 DPL=0 DS [-WA]
DS =0010 0000000000000000 00000000 00009300 DPL=0 DS [-WA]
FS =0010 0000000000000000 00000000 00009300 DPL=0 DS [-WA]
GS =0010 0000000000000000 00000000 00009300 DPL=0 DS [-WA]
LDT=0000 0000000000000000 0000ffff 00008200 DPL=0 LDT
TR =0000 0000000000000000 0000ffff 00008b00 DPL=0 TSS64-busy
GDT= 00000000001021f1 00000017
IDT= 0000000000111260 00000fff
CR0=80010033 CR2=ffffffffffffffad CR3=000000001fc01000 CR4=00000668
DR0=0000000000000000 DR1=0000000000000000 DR2=0000000000000000 DR3=0000000000000000
DR6=00000000ffff0ff0 DR7=0000000000000400
EFER=0000000000000d00
Code=00 00 00 03 40 b8 1d 00 00 00 00 03 50 b8 1d 00 00 00 00 03 <60> b8 1d 00 00 00 00 03 70 b8 1d 00 00 00 00 03 80 b8 1d 00 00 00 00 03 90 b8 1d 00 00 00
Unrelated.
This seems to be a memory mapping issue, because I never called printf.
Also, in the serial output I get:
Code: Select all
text buffer at 12
Now, I did do some debugging.
The error comes from this chunk of code:
Code: Select all
for (uint64_t t = 0; t < memory::allocation::get_total_memory_size(bootloader_info->memory_map,
bootloader_info->mmap_size,
bootloader_info->mmap_descriptor_size); t += 0x1000)
memory::paging::map_memory((void*)t, (void*)t);
However, the issue does not lie in the map_memory function itself, but rather the parameters.
The first time the function is called, everything is fine. I am yet to discover which iteration it is when the error is thrown but I am working on that right now.
If you need more source, dig in:
Referenced source file above: https://github.com/microNET-OS/microCOR ... onfigf.cxx
Source file with paging code, including the map_memory function: https://github.com/microNET-OS/microCOR ... memory.cxx