Move the system heap and the framebuffers to their own segments (#1488)

* make segments for the systemheap and the framebuffers

* define in the makefile

* undefined syms

* Make segments for the pre boot buffers too

* Update spec

Co-authored-by: Parker <20159000+jpburnett@users.noreply.github.com>

* review

* Update spec

Co-authored-by: Parker <20159000+jpburnett@users.noreply.github.com>

* Update Makefile

Co-authored-by: Dragorn421 <Dragorn421@users.noreply.github.com>

* comments

* comment

* move comment about the hardcoded address to buffers.h

* rewrite SYSTEM_HEAP_END_ADDR in terms of other symbols

* Use `ALIGNED` on all the buffers

* Rename SYSTEM_HEAP_END_ADDR to FRAMEBUFFERS_START_ADDR

* Put ALIGNED at the right like the rest of the codebase

* merge

* gLoBuffer

* gHiBuffer

* Add a static assert to ensure the address of gHiBuffer haven't shifted without the user noticing

* smol include cleanup

---------

Co-authored-by: Parker <20159000+jpburnett@users.noreply.github.com>
Co-authored-by: Dragorn421 <Dragorn421@users.noreply.github.com>
This commit is contained in:
Anghelo Carvajal
2023-11-26 09:47:21 -03:00
committed by GitHub
parent b25e64d1bd
commit 34492a4386
22 changed files with 152 additions and 49 deletions
+10 -5
View File
@@ -1,4 +1,5 @@
#include "prevent_bss_reordering.h"
#include "buffers.h"
#include "irqmgr.h"
#include "main.h"
#include "stack.h"
@@ -41,10 +42,10 @@ void Main_InitFramebuffer(u32* framebuffer, size_t numBytes, u32 value) {
}
void Main_InitScreen(void) {
Main_InitFramebuffer((u32*)gFramebuffer1, sizeof(gFramebuffer1),
Main_InitFramebuffer((u32*)gLoBuffer.framebuffer, sizeof(gLoBuffer.framebuffer),
(GPACK_RGBA5551(0, 0, 0, 1) << 16) | GPACK_RGBA5551(0, 0, 0, 1));
ViConfig_UpdateVi(false);
osViSwapBuffer(gFramebuffer1);
osViSwapBuffer(gLoBuffer.framebuffer);
osViBlack(false);
}
@@ -52,9 +53,13 @@ void Main_InitMemory(void) {
void* memStart = (void*)0x80000400;
void* memEnd = OS_PHYSICAL_TO_K0(osMemSize);
Main_ClearMemory(memStart, gFramebuffer1);
Main_ClearMemory(D_80025D00, bootproc);
Main_ClearMemory(gGfxSPTaskYieldBuffer, memEnd);
Main_ClearMemory(memStart, SEGMENT_START(framebuffer_lo));
// Clear the rest of the buffer that was not initialized by Main_InitScreen
Main_ClearMemory(&gLoBuffer.skyboxBuffer, SEGMENT_END(framebuffer_lo));
// Clear all the buffers after the `code` segment, up to the end of the available RAM space
Main_ClearMemory(SEGMENT_END(code), memEnd);
}
void Main_Init(void) {