mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-03 14:50:18 +00:00
Move kernel symbolication code out of init.cpp and into its own KSym files.
Also use a simple array of { dword, const char* } for the KSyms and put the whole shebang in kmalloc_eternal() memory. This was a fugly source of kmalloc perma-frag.
This commit is contained in:
parent
6a9fa3e41a
commit
503e32552c
Notes:
sideshowbarker
2024-07-19 16:07:27 +09:00
Author: https://github.com/awesomekling
Commit: 503e32552c
7 changed files with 163 additions and 157 deletions
|
@ -5,6 +5,7 @@
|
|||
#include "MemoryManager.h"
|
||||
#include "StdLib.h"
|
||||
#include "i386.h"
|
||||
#include "KSyms.h"
|
||||
|
||||
static ProcFS* s_the;
|
||||
|
||||
|
@ -116,15 +117,14 @@ ByteBuffer procfs$pid_stack(Process& process)
|
|||
}
|
||||
size_t bytesNeeded = 0;
|
||||
for (auto& symbol : recognizedSymbols) {
|
||||
bytesNeeded += symbol.ksym->name.length() + 8 + 16;
|
||||
bytesNeeded += strlen(symbol.ksym->name) + 8 + 16;
|
||||
}
|
||||
auto buffer = ByteBuffer::create_uninitialized(bytesNeeded);
|
||||
char* bufptr = (char*)buffer.pointer();
|
||||
|
||||
for (auto& symbol : recognizedSymbols) {
|
||||
// FIXME: This doesn't actually create a file!
|
||||
unsigned offset = symbol.address - symbol.ksym->address;
|
||||
bufptr += ksprintf(bufptr, "%p %s +%u\n", symbol.address, symbol.ksym->name.characters(), offset);
|
||||
bufptr += ksprintf(bufptr, "%p %s +%u\n", symbol.address, symbol.ksym->name, offset);
|
||||
}
|
||||
buffer.trim(bufptr - (char*)buffer.pointer());
|
||||
return buffer;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue