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:
Gunnar Beutner 2021-06-23 21:47:19 +02:00 committed by Andreas Kling
parent f2d6cac692
commit c9a8dfa1bf
Notes: sideshowbarker 2024-07-18 11:36:06 +09:00
5 changed files with 21 additions and 2 deletions

View file

@ -8,6 +8,7 @@
#include <AK/ByteBuffer.h>
#include <AK/Demangle.h>
#include <AK/OwnPtr.h>
#include <AK/Platform.h>
#include <AK/StringBuilder.h>
#include <LibC/sys/arch/i386/regs.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)
{
#if ARCH(I386)
auto ebp_val = regs.ebp;
auto eip_val = regs.eip;
outln("Backtrace:");
@ -98,6 +100,10 @@ static bool handle_backtrace_command(const PtraceRegisters& regs)
eip_val = (u32)next_eip.value();
ebp_val = (u32)next_ebp.value();
}
#else
(void)regs;
TODO();
#endif
return true;
}

View file

@ -6,6 +6,7 @@
#include <AK/LexicalPath.h>
#include <AK/MappedFile.h>
#include <AK/Platform.h>
#include <AK/StringBuilder.h>
#include <AK/Types.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)
: m_thread_info(move(thread_info))
{
#if ARCH(I386)
uint32_t* ebp = (uint32_t*)m_thread_info.regs.ebp;
uint32_t* eip = (uint32_t*)m_thread_info.regs.eip;
bool first_frame = true;
@ -70,6 +72,10 @@ Backtrace::Backtrace(const Reader& coredump, const ELF::Core::ThreadInfo& thread
eip = (uint32_t*)next_eip.value();
ebp = (uint32_t*)next_ebp.value();
}
#else
(void)coredump;
TODO();
#endif
}
Backtrace::~Backtrace()

View file

@ -9,6 +9,7 @@
#include <AK/JsonValue.h>
#include <AK/LexicalPath.h>
#include <AK/Optional.h>
#include <AK/Platform.h>
#include <LibCore/File.h>
#include <LibRegex/Regex.h>
#include <stdlib.h>
@ -336,7 +337,11 @@ void* DebugSession::single_step()
regs = get_registers();
regs.eflags &= ~(TRAP_FLAG);
set_registers(regs);
#if ARCH(I386)
return (void*)regs.eip;
#else
TODO();
#endif
}
void DebugSession::detach()

View file

@ -12,7 +12,7 @@
namespace Debug::Dwarf::Expression {
Value evaluate(ReadonlyBytes bytes, PtraceRegisters const& regs)
Value evaluate(ReadonlyBytes bytes, [[maybe_unused]] PtraceRegisters const& regs)
{
InputMemoryStream stream(bytes);
@ -21,6 +21,7 @@ Value evaluate(ReadonlyBytes bytes, PtraceRegisters const& regs)
stream >> opcode;
switch (static_cast<Operations>(opcode)) {
#if ARCH(I386)
case Operations::RegEbp: {
ssize_t offset = 0;
stream.read_LEB128_signed(offset);
@ -32,6 +33,7 @@ Value evaluate(ReadonlyBytes bytes, PtraceRegisters const& regs)
stream.read_LEB128_signed(offset);
return Value { Type::UnsignedIntetger, regs.ebp + 2 * sizeof(size_t) + offset };
}
#endif
default:
dbgln("DWARF expr addr: {}", (const void*)bytes.data());

View file

@ -66,7 +66,7 @@ static int create_thread(pthread_t* thread, void* (*entry)(void*), void* argumen
while (((uintptr_t)stack - 16) % 16 != 0)
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(argument);
push_on_stack((void*)entry);