moros icon indicating copy to clipboard operation
moros copied to clipboard

Add userspace allocator

Open vinc opened this issue 3 years ago • 1 comments

WIP

vinc avatar Jun 15 '22 19:06 vinc

If I start again from trunk with some debug output and add a string allocation in the hello program after the line printing an already allocated byte array I got this:

[0.250962] MOROS v0.8.0
[0.252961] MEM [0x00000000000000-0x00000000000FFF] FrameZero
[0.252961] MEM [0x00000000001000-0x00000000004FFF] PageTable
[0.252961] MEM [0x00000000005000-0x00000000016FFF] Bootloader
[0.252961] MEM [0x00000000017000-0x00000000017FFF] BootInfo
[0.252961] MEM [0x00000000018000-0x00000000026FFF] Kernel
[0.252961] MEM [0x00000000027000-0x0000000009EFFF] KernelStack
[0.252961] MEM [0x0000000009F000-0x0000000009FFFF] Reserved
[0.252961] MEM [0x000000000F0000-0x000000000FFFFF] Reserved
[0.252961] MEM [0x00000000100000-0x00000000287FFF] KernelStack
[0.252961] MEM [0x00000000288000-0x000000003FFFFF] Usable
[0.252961] MEM [0x00000000400000-0x00000000B22FFF] Kernel
[0.252961] MEM [0x00000000B23000-0x00000000B32FFF] PageTable
[0.252961] MEM [0x00000000B33000-0x00000001FDFFFF] Usable
[0.252961] MEM [0x00000001FE0000-0x00000001FFFFFF] Reserved
[0.252961] MEM [0x000000FEFFC000-0x000000FEFFFFFF] Reserved
[0.252961] MEM [0x000000FFFC0000-0x000000FFFFFFFF] Reserved
[0.252961] MEM 32720 KB
DEBUG: Alloc page Page[4KiB](0x444444440000)
DEBUG: Allocate frame #0
DEBUG: Alloc frame PhysFrame[4KiB](0x288000)
DEBUG: Allocate frame #1
DEBUG: Allocate frame #2
DEBUG: Allocate frame #3
DEBUG: Alloc page Page[4KiB](0x444444441000)
DEBUG: Allocate frame #4
DEBUG: Alloc frame PhysFrame[4KiB](0x28c000)
DEBUG: Alloc page Page[4KiB](0x444444442000)
DEBUG: Allocate frame #5
DEBUG: Alloc frame PhysFrame[4KiB](0x28d000)
DEBUG: Alloc page Page[4KiB](0x444444443000)
DEBUG: Allocate frame #6
DEBUG: Alloc frame PhysFrame[4KiB](0x28e000)
DEBUG: Alloc page Page[4KiB](0x444444444000)
DEBUG: Allocate frame #7
DEBUG: Alloc frame PhysFrame[4KiB](0x28f000)
DEBUG: Alloc page Page[4KiB](0x444444445000)
DEBUG: Allocate frame #8
DEBUG: Alloc frame PhysFrame[4KiB](0x290000)
DEBUG: Alloc page Page[4KiB](0x444444446000)

...

DEBUG: Alloc page Page[4KiB](0x444445436000)
DEBUG: Allocate frame #4097
DEBUG: Alloc frame PhysFrame[4KiB](0x19bc000)
DEBUG: Alloc page Page[4KiB](0x444445437000)
DEBUG: Allocate frame #4098
DEBUG: Alloc frame PhysFrame[4KiB](0x19bd000)
DEBUG: Alloc page Page[4KiB](0x444445438000)
DEBUG: Allocate frame #4099
DEBUG: Alloc frame PhysFrame[4KiB](0x19be000)
DEBUG: Alloc page Page[4KiB](0x444445439000)
DEBUG: Allocate frame #4100
DEBUG: Alloc frame PhysFrame[4KiB](0x19bf000)
[0.270959] [CPU GenuineIntel
[0.312952] CPU Intel(R) Pentium(R) CPU  N3710  @ 1.60GHz
[0.394940] PCI 0000:00:00 [8086:1237]
[0.432934] PCI 0000:01:00 [8086:7000]
[0.468929] PCI 0000:01:01 [8086:7010]
[0.498924] PCI 0000:01:03 [8086:7113]
[0.535918] PCI 0000:02:00 [1234:1111]
[0.544917] PCI 0000:03:00 [10EC:8139]
[17.576324] NET RTL8139 MAC 52-54-00-12-34-56
[18.883125] ATA 0:0 QEMU HARDDISK QM00001 (32 MB)
[20.671852] RTC 2022-08-31 08:01:12 +0000
MFS is not mounted to '/'
Running console in diskless mode

...

> hello
DEBUG: EXCEPTION: PAGE FAULT
DEBUG: Alloc pages (addr=0x444445640000, size=1)
DEBUG: Alloc page Page[4KiB](0x444445640000)
DEBUG: Allocate frame #4101
DEBUG: Alloc frame PhysFrame[4KiB](0x19c0000)
DEBUG: Allocate frame #4102
DEBUG: EXCEPTION: PAGE FAULT
DEBUG: Alloc pages (addr=0x444445641000, size=1)
DEBUG: Alloc page Page[4KiB](0x444445641000)
DEBUG: Allocate frame #4103
DEBUG: Alloc frame PhysFrame[4KiB](0x19c2000)
DEBUG: EXCEPTION: PAGE FAULT
DEBUG: Alloc pages (addr=0x444445642260, size=1)
DEBUG: Alloc page Page[4KiB](0x444445642000)
DEBUG: Allocate frame #4104
DEBUG: Alloc frame PhysFrame[4KiB](0x19c3000)
DEBUG: EXCEPTION: PAGE FAULT
DEBUG: Alloc pages (addr=0x444445643000, size=1)
DEBUG: Alloc page Page[4KiB](0x444445643000)
DEBUG: Allocate frame #4105
DEBUG: Alloc frame PhysFrame[4KiB](0x19c4000)
DEBUG: EXCEPTION: PAGE FAULT
DEBUG: Alloc pages (addr=0x444445644000, size=1)
DEBUG: Alloc page Page[4KiB](0x444445644000)
DEBUG: Allocate frame #4106
DEBUG: Alloc frame PhysFrame[4KiB](0x19c5000)
DEBUG: EXCEPTION: PAGE FAULT
DEBUG: Alloc pages (addr=0x444445645000, size=1)
DEBUG: Alloc page Page[4KiB](0x444445645000)
DEBUG: Allocate frame #4107
DEBUG: Alloc frame PhysFrame[4KiB](0x19c6000)
DEBUG: EXCEPTION: PAGE FAULT
DEBUG: Alloc pages (addr=0x444445646b28, size=1)
DEBUG: Alloc page Page[4KiB](0x444445646000)
DEBUG: Allocate frame #4108
DEBUG: Alloc frame PhysFrame[4KiB](0x19c7000)
DEBUG: Alloc pages (addr=0x4444454c0000, size=1)
DEBUG: Alloc page Page[4KiB](0x4444454c0000)
DEBUG: Allocate frame #4109
DEBUG: Alloc frame PhysFrame[4KiB](0x19c8000)
DEBUG: EXCEPTION: PAGE FAULT
DEBUG: Alloc pages (addr=0x44444553fff8, size=1)
DEBUG: Alloc page Page[4KiB](0x44444553f000)
DEBUG: Allocate frame #4110
DEBUG: Alloc frame PhysFrame[4KiB](0x19c9000)
Hello, World!
DEBUG: EXCEPTION: PAGE FAULT
DEBUG: Alloc pages (addr=0x207fd8, size=1)
DEBUG: Alloc page Page[4KiB](0x207000)
DEBUG: Allocate frame #4111
DEBUG: Alloc frame PhysFrame[4KiB](0x19ca000)
DEBUG: Could not map Page[4KiB](0x207000)
DEBUG: EXCEPTION: PAGE FAULT
DEBUG: Alloc pages (addr=0x207fd8, size=1)
DEBUG: Alloc page Page[4KiB](0x207000)
DEBUG: Allocate frame #4112
DEBUG: Alloc frame PhysFrame[4KiB](0x19cb000)
DEBUG: Could not map Page[4KiB](0x207000)
DEBUG: EXCEPTION: PAGE FAULT
DEBUG: Alloc pages (addr=0x207fd8, size=1)
DEBUG: Alloc page Page[4KiB](0x207000)
DEBUG: Allocate frame #4113

The address of the page that the program is trying to allocate looks like the address of a physical frame.

vinc avatar Aug 31 '22 08:08 vinc

This PR is too old and there's too many conflicts with the main branch. Work will be restarted on a new branch.

vinc avatar Nov 18 '23 08:11 vinc