1 //===-- RegisterContextFreeBSDKernel_i386.cpp -----------------------------===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 #include "RegisterContextFreeBSDKernel_i386.h"
11 #include "lldb/Target/Process.h"
12 #include "lldb/Target/Thread.h"
13 #include "lldb/Utility/RegisterValue.h"
14 #include "llvm/Support/Endian.h"
17 using namespace lldb_private
;
19 RegisterContextFreeBSDKernel_i386::RegisterContextFreeBSDKernel_i386(
20 Thread
&thread
, RegisterInfoInterface
*register_info
, lldb::addr_t pcb_addr
)
21 : RegisterContextPOSIX_x86(thread
, 0, register_info
), m_pcb_addr(pcb_addr
) {
24 bool RegisterContextFreeBSDKernel_i386::ReadGPR() { return true; }
26 bool RegisterContextFreeBSDKernel_i386::ReadFPR() { return true; }
28 bool RegisterContextFreeBSDKernel_i386::WriteGPR() {
33 bool RegisterContextFreeBSDKernel_i386::WriteFPR() {
38 bool RegisterContextFreeBSDKernel_i386::ReadRegister(
39 const RegisterInfo
*reg_info
, RegisterValue
&value
) {
40 if (m_pcb_addr
== LLDB_INVALID_ADDRESS
)
44 llvm::support::ulittle32_t edi
;
45 llvm::support::ulittle32_t esi
;
46 llvm::support::ulittle32_t ebp
;
47 llvm::support::ulittle32_t esp
;
48 llvm::support::ulittle32_t ebx
;
49 llvm::support::ulittle32_t eip
;
54 m_thread
.GetProcess()->ReadMemory(m_pcb_addr
, &pcb
, sizeof(pcb
), error
);
55 if (rd
!= sizeof(pcb
))
58 uint32_t reg
= reg_info
->kinds
[lldb::eRegisterKindLLDB
];
61 case lldb_##x##_i386: \
80 bool RegisterContextFreeBSDKernel_i386::WriteRegister(
81 const RegisterInfo
*reg_info
, const RegisterValue
&value
) {