mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 14:57:35 +00:00
Userland: Add more TODO()s for arch-specific code
This enables building more of the userspace applications for x86_64.
This commit is contained in:
parent
f2d6cac692
commit
c9a8dfa1bf
5 changed files with 21 additions and 2 deletions
|
@ -8,6 +8,7 @@
|
||||||
#include <AK/ByteBuffer.h>
|
#include <AK/ByteBuffer.h>
|
||||||
#include <AK/Demangle.h>
|
#include <AK/Demangle.h>
|
||||||
#include <AK/OwnPtr.h>
|
#include <AK/OwnPtr.h>
|
||||||
|
#include <AK/Platform.h>
|
||||||
#include <AK/StringBuilder.h>
|
#include <AK/StringBuilder.h>
|
||||||
#include <LibC/sys/arch/i386/regs.h>
|
#include <LibC/sys/arch/i386/regs.h>
|
||||||
#include <LibCore/ArgsParser.h>
|
#include <LibCore/ArgsParser.h>
|
||||||
|
@ -81,6 +82,7 @@ static bool handle_disassemble_command(const String& command, void* first_instru
|
||||||
|
|
||||||
static bool handle_backtrace_command(const PtraceRegisters& regs)
|
static bool handle_backtrace_command(const PtraceRegisters& regs)
|
||||||
{
|
{
|
||||||
|
#if ARCH(I386)
|
||||||
auto ebp_val = regs.ebp;
|
auto ebp_val = regs.ebp;
|
||||||
auto eip_val = regs.eip;
|
auto eip_val = regs.eip;
|
||||||
outln("Backtrace:");
|
outln("Backtrace:");
|
||||||
|
@ -98,6 +100,10 @@ static bool handle_backtrace_command(const PtraceRegisters& regs)
|
||||||
eip_val = (u32)next_eip.value();
|
eip_val = (u32)next_eip.value();
|
||||||
ebp_val = (u32)next_ebp.value();
|
ebp_val = (u32)next_ebp.value();
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
(void)regs;
|
||||||
|
TODO();
|
||||||
|
#endif
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
|
|
||||||
#include <AK/LexicalPath.h>
|
#include <AK/LexicalPath.h>
|
||||||
#include <AK/MappedFile.h>
|
#include <AK/MappedFile.h>
|
||||||
|
#include <AK/Platform.h>
|
||||||
#include <AK/StringBuilder.h>
|
#include <AK/StringBuilder.h>
|
||||||
#include <AK/Types.h>
|
#include <AK/Types.h>
|
||||||
#include <LibCore/File.h>
|
#include <LibCore/File.h>
|
||||||
|
@ -51,6 +52,7 @@ static const ELFObjectInfo* object_info_for_region(const ELF::Core::MemoryRegion
|
||||||
Backtrace::Backtrace(const Reader& coredump, const ELF::Core::ThreadInfo& thread_info)
|
Backtrace::Backtrace(const Reader& coredump, const ELF::Core::ThreadInfo& thread_info)
|
||||||
: m_thread_info(move(thread_info))
|
: m_thread_info(move(thread_info))
|
||||||
{
|
{
|
||||||
|
#if ARCH(I386)
|
||||||
uint32_t* ebp = (uint32_t*)m_thread_info.regs.ebp;
|
uint32_t* ebp = (uint32_t*)m_thread_info.regs.ebp;
|
||||||
uint32_t* eip = (uint32_t*)m_thread_info.regs.eip;
|
uint32_t* eip = (uint32_t*)m_thread_info.regs.eip;
|
||||||
bool first_frame = true;
|
bool first_frame = true;
|
||||||
|
@ -70,6 +72,10 @@ Backtrace::Backtrace(const Reader& coredump, const ELF::Core::ThreadInfo& thread
|
||||||
eip = (uint32_t*)next_eip.value();
|
eip = (uint32_t*)next_eip.value();
|
||||||
ebp = (uint32_t*)next_ebp.value();
|
ebp = (uint32_t*)next_ebp.value();
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
(void)coredump;
|
||||||
|
TODO();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
Backtrace::~Backtrace()
|
Backtrace::~Backtrace()
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
#include <AK/JsonValue.h>
|
#include <AK/JsonValue.h>
|
||||||
#include <AK/LexicalPath.h>
|
#include <AK/LexicalPath.h>
|
||||||
#include <AK/Optional.h>
|
#include <AK/Optional.h>
|
||||||
|
#include <AK/Platform.h>
|
||||||
#include <LibCore/File.h>
|
#include <LibCore/File.h>
|
||||||
#include <LibRegex/Regex.h>
|
#include <LibRegex/Regex.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
@ -336,7 +337,11 @@ void* DebugSession::single_step()
|
||||||
regs = get_registers();
|
regs = get_registers();
|
||||||
regs.eflags &= ~(TRAP_FLAG);
|
regs.eflags &= ~(TRAP_FLAG);
|
||||||
set_registers(regs);
|
set_registers(regs);
|
||||||
|
#if ARCH(I386)
|
||||||
return (void*)regs.eip;
|
return (void*)regs.eip;
|
||||||
|
#else
|
||||||
|
TODO();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebugSession::detach()
|
void DebugSession::detach()
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
|
|
||||||
namespace Debug::Dwarf::Expression {
|
namespace Debug::Dwarf::Expression {
|
||||||
|
|
||||||
Value evaluate(ReadonlyBytes bytes, PtraceRegisters const& regs)
|
Value evaluate(ReadonlyBytes bytes, [[maybe_unused]] PtraceRegisters const& regs)
|
||||||
{
|
{
|
||||||
InputMemoryStream stream(bytes);
|
InputMemoryStream stream(bytes);
|
||||||
|
|
||||||
|
@ -21,6 +21,7 @@ Value evaluate(ReadonlyBytes bytes, PtraceRegisters const& regs)
|
||||||
stream >> opcode;
|
stream >> opcode;
|
||||||
|
|
||||||
switch (static_cast<Operations>(opcode)) {
|
switch (static_cast<Operations>(opcode)) {
|
||||||
|
#if ARCH(I386)
|
||||||
case Operations::RegEbp: {
|
case Operations::RegEbp: {
|
||||||
ssize_t offset = 0;
|
ssize_t offset = 0;
|
||||||
stream.read_LEB128_signed(offset);
|
stream.read_LEB128_signed(offset);
|
||||||
|
@ -32,6 +33,7 @@ Value evaluate(ReadonlyBytes bytes, PtraceRegisters const& regs)
|
||||||
stream.read_LEB128_signed(offset);
|
stream.read_LEB128_signed(offset);
|
||||||
return Value { Type::UnsignedIntetger, regs.ebp + 2 * sizeof(size_t) + offset };
|
return Value { Type::UnsignedIntetger, regs.ebp + 2 * sizeof(size_t) + offset };
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
default:
|
default:
|
||||||
dbgln("DWARF expr addr: {}", (const void*)bytes.data());
|
dbgln("DWARF expr addr: {}", (const void*)bytes.data());
|
||||||
|
|
|
@ -66,7 +66,7 @@ static int create_thread(pthread_t* thread, void* (*entry)(void*), void* argumen
|
||||||
while (((uintptr_t)stack - 16) % 16 != 0)
|
while (((uintptr_t)stack - 16) % 16 != 0)
|
||||||
push_on_stack(nullptr);
|
push_on_stack(nullptr);
|
||||||
|
|
||||||
push_on_stack((void*)thread_params->m_stack_size);
|
push_on_stack((void*)(uintptr_t)thread_params->m_stack_size);
|
||||||
push_on_stack(thread_params->m_stack_location);
|
push_on_stack(thread_params->m_stack_location);
|
||||||
push_on_stack(argument);
|
push_on_stack(argument);
|
||||||
push_on_stack((void*)entry);
|
push_on_stack((void*)entry);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue