diff options
author | Christopher Ferris <cferris@google.com> | 2018-02-08 19:27:47 -0800 |
---|---|---|
committer | Christopher Ferris <cferris@google.com> | 2018-02-08 19:29:08 -0800 |
commit | 53914165e4a19e4a320cf3394e4fabff4e89d7c6 (patch) | |
tree | 7b48d5313031761ea5b8714c58a52457f2aa2977 /libunwindstack/include/unwindstack | |
parent | 2ccde89153321d2c98787d6320ac15602494a78d (diff) | |
download | system_core-53914165e4a19e4a320cf3394e4fabff4e89d7c6.tar.gz system_core-53914165e4a19e4a320cf3394e4fabff4e89d7c6.tar.bz2 system_core-53914165e4a19e4a320cf3394e4fabff4e89d7c6.zip |
Expose per arch headers.
Bug: 73013352
Test: Compiles.
Change-Id: Ic05660db7d7858a9857143ee5e58cdaddcf52a35
Diffstat (limited to 'libunwindstack/include/unwindstack')
18 files changed, 1068 insertions, 0 deletions
diff --git a/libunwindstack/include/unwindstack/MachineArm.h b/libunwindstack/include/unwindstack/MachineArm.h new file mode 100644 index 000000000..3f902b194 --- /dev/null +++ b/libunwindstack/include/unwindstack/MachineArm.h @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2017 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef _LIBUNWINDSTACK_MACHINE_ARM_H +#define _LIBUNWINDSTACK_MACHINE_ARM_H + +#include <stdint.h> + +namespace unwindstack { + +enum ArmReg : uint16_t { + ARM_REG_R0 = 0, + ARM_REG_R1, + ARM_REG_R2, + ARM_REG_R3, + ARM_REG_R4, + ARM_REG_R5, + ARM_REG_R6, + ARM_REG_R7, + ARM_REG_R8, + ARM_REG_R9, + ARM_REG_R10, + ARM_REG_R11, + ARM_REG_R12, + ARM_REG_R13, + ARM_REG_R14, + ARM_REG_R15, + ARM_REG_LAST, + + ARM_REG_SP = ARM_REG_R13, + ARM_REG_LR = ARM_REG_R14, + ARM_REG_PC = ARM_REG_R15, +}; + +} // namespace unwindstack + +#endif // _LIBUNWINDSTACK_MACHINE_ARM_H diff --git a/libunwindstack/include/unwindstack/MachineArm64.h b/libunwindstack/include/unwindstack/MachineArm64.h new file mode 100644 index 000000000..e8b778b13 --- /dev/null +++ b/libunwindstack/include/unwindstack/MachineArm64.h @@ -0,0 +1,66 @@ +/* + * Copyright (C) 2017 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef _LIBUNWINDSTACK_MACHINE_ARM64_H +#define _LIBUNWINDSTACK_MACHINE_ARM64_H + +#include <stdint.h> + +namespace unwindstack { + +enum Arm64Reg : uint16_t { + ARM64_REG_R0 = 0, + ARM64_REG_R1, + ARM64_REG_R2, + ARM64_REG_R3, + ARM64_REG_R4, + ARM64_REG_R5, + ARM64_REG_R6, + ARM64_REG_R7, + ARM64_REG_R8, + ARM64_REG_R9, + ARM64_REG_R10, + ARM64_REG_R11, + ARM64_REG_R12, + ARM64_REG_R13, + ARM64_REG_R14, + ARM64_REG_R15, + ARM64_REG_R16, + ARM64_REG_R17, + ARM64_REG_R18, + ARM64_REG_R19, + ARM64_REG_R20, + ARM64_REG_R21, + ARM64_REG_R22, + ARM64_REG_R23, + ARM64_REG_R24, + ARM64_REG_R25, + ARM64_REG_R26, + ARM64_REG_R27, + ARM64_REG_R28, + ARM64_REG_R29, + ARM64_REG_R30, + ARM64_REG_R31, + ARM64_REG_PC, + ARM64_REG_LAST, + + ARM64_REG_SP = ARM64_REG_R31, + ARM64_REG_LR = ARM64_REG_R30, +}; + +} // namespace unwindstack + +#endif // _LIBUNWINDSTACK_MACHINE_ARM64_H diff --git a/libunwindstack/include/unwindstack/MachineMips.h b/libunwindstack/include/unwindstack/MachineMips.h new file mode 100644 index 000000000..2dfb1e940 --- /dev/null +++ b/libunwindstack/include/unwindstack/MachineMips.h @@ -0,0 +1,66 @@ +/* + * Copyright (C) 2017 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef _LIBUNWINDSTACK_MACHINE_MIPS_H +#define _LIBUNWINDSTACK_MACHINE_MIPS_H + +#include <stdint.h> + +namespace unwindstack { + +enum MipsReg : uint16_t { + MIPS_REG_R0 = 0, + MIPS_REG_R1, + MIPS_REG_R2, + MIPS_REG_R3, + MIPS_REG_R4, + MIPS_REG_R5, + MIPS_REG_R6, + MIPS_REG_R7, + MIPS_REG_R8, + MIPS_REG_R9, + MIPS_REG_R10, + MIPS_REG_R11, + MIPS_REG_R12, + MIPS_REG_R13, + MIPS_REG_R14, + MIPS_REG_R15, + MIPS_REG_R16, + MIPS_REG_R17, + MIPS_REG_R18, + MIPS_REG_R19, + MIPS_REG_R20, + MIPS_REG_R21, + MIPS_REG_R22, + MIPS_REG_R23, + MIPS_REG_R24, + MIPS_REG_R25, + MIPS_REG_R26, + MIPS_REG_R27, + MIPS_REG_R28, + MIPS_REG_R29, + MIPS_REG_R30, + MIPS_REG_R31, + MIPS_REG_PC, + MIPS_REG_LAST, + + MIPS_REG_SP = MIPS_REG_R29, + MIPS_REG_RA = MIPS_REG_R31, +}; + +} // namespace unwindstack + +#endif // _LIBUNWINDSTACK_MACHINE_MIPS_H
\ No newline at end of file diff --git a/libunwindstack/include/unwindstack/MachineMips64.h b/libunwindstack/include/unwindstack/MachineMips64.h new file mode 100644 index 000000000..34addf24d --- /dev/null +++ b/libunwindstack/include/unwindstack/MachineMips64.h @@ -0,0 +1,66 @@ +/* + * Copyright (C) 2017 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef _LIBUNWINDSTACK_MACHINE_MIPS64_H +#define _LIBUNWINDSTACK_MACHINE_MIPS64_H + +#include <stdint.h> + +namespace unwindstack { + +enum Mips64Reg : uint16_t { + MIPS64_REG_R0 = 0, + MIPS64_REG_R1, + MIPS64_REG_R2, + MIPS64_REG_R3, + MIPS64_REG_R4, + MIPS64_REG_R5, + MIPS64_REG_R6, + MIPS64_REG_R7, + MIPS64_REG_R8, + MIPS64_REG_R9, + MIPS64_REG_R10, + MIPS64_REG_R11, + MIPS64_REG_R12, + MIPS64_REG_R13, + MIPS64_REG_R14, + MIPS64_REG_R15, + MIPS64_REG_R16, + MIPS64_REG_R17, + MIPS64_REG_R18, + MIPS64_REG_R19, + MIPS64_REG_R20, + MIPS64_REG_R21, + MIPS64_REG_R22, + MIPS64_REG_R23, + MIPS64_REG_R24, + MIPS64_REG_R25, + MIPS64_REG_R26, + MIPS64_REG_R27, + MIPS64_REG_R28, + MIPS64_REG_R29, + MIPS64_REG_R30, + MIPS64_REG_R31, + MIPS64_REG_PC, + MIPS64_REG_LAST, + + MIPS64_REG_SP = MIPS64_REG_R29, + MIPS64_REG_RA = MIPS64_REG_R31, +}; + +} // namespace unwindstack + +#endif // _LIBUNWINDSTACK_MACHINE_MIPS64_H
\ No newline at end of file diff --git a/libunwindstack/include/unwindstack/MachineX86.h b/libunwindstack/include/unwindstack/MachineX86.h new file mode 100644 index 000000000..02adb98c3 --- /dev/null +++ b/libunwindstack/include/unwindstack/MachineX86.h @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2017 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef _LIBUNWINDSTACK_MACHINE_X86_H +#define _LIBUNWINDSTACK_MACHINE_X86_H + +#include <stdint.h> + +namespace unwindstack { + +// Matches the numbers for the registers as generated by compilers. +// If this is changed, then unwinding will fail. +enum X86Reg : uint16_t { + X86_REG_EAX = 0, + X86_REG_ECX = 1, + X86_REG_EDX = 2, + X86_REG_EBX = 3, + X86_REG_ESP = 4, + X86_REG_EBP = 5, + X86_REG_ESI = 6, + X86_REG_EDI = 7, + X86_REG_EIP = 8, + X86_REG_EFL = 9, + X86_REG_CS = 10, + X86_REG_SS = 11, + X86_REG_DS = 12, + X86_REG_ES = 13, + X86_REG_FS = 14, + X86_REG_GS = 15, + X86_REG_LAST, + + X86_REG_SP = X86_REG_ESP, + X86_REG_PC = X86_REG_EIP, +}; + +} // namespace unwindstack + +#endif // _LIBUNWINDSTACK_MACHINE_X86_H diff --git a/libunwindstack/include/unwindstack/MachineX86_64.h b/libunwindstack/include/unwindstack/MachineX86_64.h new file mode 100644 index 000000000..af33fea80 --- /dev/null +++ b/libunwindstack/include/unwindstack/MachineX86_64.h @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2017 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef _LIBUNWINDSTACK_MACHINE_X86_64_H +#define _LIBUNWINDSTACK_MACHINE_X86_64_H + +#include <stdint.h> + +namespace unwindstack { + +// Matches the numbers for the registers as generated by compilers. +// If this is changed, then unwinding will fail. +enum X86_64Reg : uint16_t { + X86_64_REG_RAX = 0, + X86_64_REG_RDX = 1, + X86_64_REG_RCX = 2, + X86_64_REG_RBX = 3, + X86_64_REG_RSI = 4, + X86_64_REG_RDI = 5, + X86_64_REG_RBP = 6, + X86_64_REG_RSP = 7, + X86_64_REG_R8 = 8, + X86_64_REG_R9 = 9, + X86_64_REG_R10 = 10, + X86_64_REG_R11 = 11, + X86_64_REG_R12 = 12, + X86_64_REG_R13 = 13, + X86_64_REG_R14 = 14, + X86_64_REG_R15 = 15, + X86_64_REG_RIP = 16, + X86_64_REG_LAST, + + X86_64_REG_SP = X86_64_REG_RSP, + X86_64_REG_PC = X86_64_REG_RIP, +}; + +} // namespace unwindstack + +#endif // _LIBUNWINDSTACK_MACHINE_X86_64_H diff --git a/libunwindstack/include/unwindstack/UcontextArm.h b/libunwindstack/include/unwindstack/UcontextArm.h new file mode 100644 index 000000000..7d1ec3b9a --- /dev/null +++ b/libunwindstack/include/unwindstack/UcontextArm.h @@ -0,0 +1,63 @@ +/* + * Copyright (C) 2016 The Android Open Source Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef _LIBUNWINDSTACK_UCONTEXT_ARM_H +#define _LIBUNWINDSTACK_UCONTEXT_ARM_H + +#include <stdint.h> + +#include <unwindstack/MachineArm.h> + +namespace unwindstack { + +struct arm_stack_t { + uint32_t ss_sp; // void __user* + int32_t ss_flags; // int + uint32_t ss_size; // size_t +}; + +struct arm_mcontext_t { + uint32_t trap_no; // unsigned long + uint32_t error_code; // unsigned long + uint32_t oldmask; // unsigned long + uint32_t regs[ARM_REG_LAST]; // unsigned long + uint32_t cpsr; // unsigned long + uint32_t fault_address; // unsigned long +}; + +struct arm_ucontext_t { + uint32_t uc_flags; // unsigned long + uint32_t uc_link; // struct ucontext* + arm_stack_t uc_stack; + arm_mcontext_t uc_mcontext; + // Nothing else is used, so don't define it. +}; + +} // namespace unwindstack + +#endif // _LIBUNWINDSTACK_UCONTEXT_ARM_H diff --git a/libunwindstack/include/unwindstack/UcontextArm64.h b/libunwindstack/include/unwindstack/UcontextArm64.h new file mode 100644 index 000000000..a68be3b64 --- /dev/null +++ b/libunwindstack/include/unwindstack/UcontextArm64.h @@ -0,0 +1,69 @@ +/* + * Copyright (C) 2016 The Android Open Source Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef _LIBUNWINDSTACK_UCONTEXT_ARM64_H +#define _LIBUNWINDSTACK_UCONTEXT_ARM64_H + +#include <stdint.h> + +#include <unwindstack/MachineArm64.h> + +namespace unwindstack { + +struct arm64_stack_t { + uint64_t ss_sp; // void __user* + int32_t ss_flags; // int + uint64_t ss_size; // size_t +}; + +struct arm64_sigset_t { + uint64_t sig; // unsigned long +}; + +struct arm64_mcontext_t { + uint64_t fault_address; // __u64 + uint64_t regs[ARM64_REG_LAST]; // __u64 + uint64_t pstate; // __u64 + // Nothing else is used, so don't define it. +}; + +struct arm64_ucontext_t { + uint64_t uc_flags; // unsigned long + uint64_t uc_link; // struct ucontext* + arm64_stack_t uc_stack; + arm64_sigset_t uc_sigmask; + // The kernel adds extra padding after uc_sigmask to match glibc sigset_t on ARM64. + char __padding[128 - sizeof(arm64_sigset_t)]; + // The full structure requires 16 byte alignment, but our partial structure + // doesn't, so force the alignment. + arm64_mcontext_t uc_mcontext __attribute__((aligned(16))); +}; + +} // namespace unwindstack + +#endif // _LIBUNWINDSTACK_UCONTEXT_ARM64_H diff --git a/libunwindstack/include/unwindstack/UcontextMips.h b/libunwindstack/include/unwindstack/UcontextMips.h new file mode 100644 index 000000000..02e33b64e --- /dev/null +++ b/libunwindstack/include/unwindstack/UcontextMips.h @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2017 The Android Open Source Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef _LIBUNWINDSTACK_UCONTEXT_MIPS_H +#define _LIBUNWINDSTACK_UCONTEXT_MIPS_H + +#include <stdint.h> + +#include <unwindstack/MachineMips.h> + +namespace unwindstack { + +struct mips_stack_t { + uint32_t ss_sp; // void __user* + uint32_t ss_size; // size_t + int32_t ss_flags; // int +}; + +struct mips_mcontext_t { + uint32_t sc_regmask; + uint32_t sc_status; + uint64_t sc_pc; + uint64_t sc_regs[32]; + // Nothing else is used, so don't define it. +}; + +struct mips_ucontext_t { + uint32_t uc_flags; // unsigned long + uint32_t uc_link; // struct ucontext* + mips_stack_t uc_stack; + mips_mcontext_t uc_mcontext; + // Nothing else is used, so don't define it. +}; + +} // namespace unwindstack + +#endif // _LIBUNWINDSTACK_UCONTEXT_MIPS_H diff --git a/libunwindstack/include/unwindstack/UcontextMips64.h b/libunwindstack/include/unwindstack/UcontextMips64.h new file mode 100644 index 000000000..5b92a55ae --- /dev/null +++ b/libunwindstack/include/unwindstack/UcontextMips64.h @@ -0,0 +1,69 @@ +/* + * Copyright (C) 2017 The Android Open Source Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef _LIBUNWINDSTACK_UCONTEXT_MIPS64_H +#define _LIBUNWINDSTACK_UCONTEXT_MIPS64_H + +#include <stdint.h> + +#include <unwindstack/MachineMips64.h> + +namespace unwindstack { + +struct mips64_stack_t { + uint64_t ss_sp; // void __user* + uint64_t ss_size; // size_t + int32_t ss_flags; // int +}; + +struct mips64_mcontext_t { + uint64_t sc_regs[32]; + uint64_t sc_fpregs[32]; + uint64_t sc_mdhi; + uint64_t sc_hi1; + uint64_t sc_hi2; + uint64_t sc_hi3; + uint64_t sc_mdlo; + uint64_t sc_lo1; + uint64_t sc_lo2; + uint64_t sc_lo3; + uint64_t sc_pc; + // Nothing else is used, so don't define it. +}; + +struct mips64_ucontext_t { + uint64_t uc_flags; // unsigned long + uint64_t uc_link; // struct ucontext* + mips64_stack_t uc_stack; + mips64_mcontext_t uc_mcontext; + // Nothing else is used, so don't define it. +}; + +} // namespace unwindstack + +#endif // _LIBUNWINDSTACK_UCONTEXT_MIPS64_H diff --git a/libunwindstack/include/unwindstack/UcontextX86.h b/libunwindstack/include/unwindstack/UcontextX86.h new file mode 100644 index 000000000..c96ebb70b --- /dev/null +++ b/libunwindstack/include/unwindstack/UcontextX86.h @@ -0,0 +1,77 @@ +/* + * Copyright (C) 2016 The Android Open Source Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef _LIBUNWINDSTACK_UCONTEXT_X86_H +#define _LIBUNWINDSTACK_UCONTEXT_X86_H + +#include <stdint.h> + +#include <unwindstack/MachineX86.h> + +namespace unwindstack { + +struct x86_stack_t { + uint32_t ss_sp; // void __user* + int32_t ss_flags; // int + uint32_t ss_size; // size_t +}; + +struct x86_mcontext_t { + uint32_t gs; + uint32_t fs; + uint32_t es; + uint32_t ds; + uint32_t edi; + uint32_t esi; + uint32_t ebp; + uint32_t esp; + uint32_t ebx; + uint32_t edx; + uint32_t ecx; + uint32_t eax; + uint32_t trapno; + uint32_t err; + uint32_t eip; + uint32_t cs; + uint32_t efl; + uint32_t uesp; + uint32_t ss; + // Only care about the registers, skip everything else. +}; + +struct x86_ucontext_t { + uint32_t uc_flags; // unsigned long + uint32_t uc_link; // struct ucontext* + x86_stack_t uc_stack; + x86_mcontext_t uc_mcontext; + // Nothing else is used, so don't define it. +}; + +} // namespace unwindstack + +#endif // _LIBUNWINDSTACK_UCONTEXT_X86_H diff --git a/libunwindstack/include/unwindstack/UcontextX86_64.h b/libunwindstack/include/unwindstack/UcontextX86_64.h new file mode 100644 index 000000000..4e163e5d4 --- /dev/null +++ b/libunwindstack/include/unwindstack/UcontextX86_64.h @@ -0,0 +1,82 @@ +/* + * Copyright (C) 2016 The Android Open Source Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef _LIBUNWINDSTACK_UCONTEXT_X86_64_H +#define _LIBUNWINDSTACK_UCONTEXT_X86_64_H + +#include <stdint.h> + +#include <unwindstack/MachineX86_64.h> + +namespace unwindstack { + +struct x86_64_stack_t { + uint64_t ss_sp; // void __user* + int32_t ss_flags; // int + int32_t pad; + uint64_t ss_size; // size_t +}; + +struct x86_64_mcontext_t { + uint64_t r8; + uint64_t r9; + uint64_t r10; + uint64_t r11; + uint64_t r12; + uint64_t r13; + uint64_t r14; + uint64_t r15; + uint64_t rdi; + uint64_t rsi; + uint64_t rbp; + uint64_t rbx; + uint64_t rdx; + uint64_t rax; + uint64_t rcx; + uint64_t rsp; + uint64_t rip; + uint64_t efl; + uint64_t csgsfs; + uint64_t err; + uint64_t trapno; + uint64_t oldmask; + uint64_t cr2; + // Only care about the registers, skip everything else. +}; + +struct x86_64_ucontext_t { + uint64_t uc_flags; // unsigned long + uint64_t uc_link; // struct ucontext* + x86_64_stack_t uc_stack; + x86_64_mcontext_t uc_mcontext; + // Nothing else is used, so don't define it. +}; + +} // namespace unwindstack + +#endif // _LIBUNWINDSTACK_UCONTEXT_X86_64_H diff --git a/libunwindstack/include/unwindstack/UserArm.h b/libunwindstack/include/unwindstack/UserArm.h new file mode 100644 index 000000000..7388c03e4 --- /dev/null +++ b/libunwindstack/include/unwindstack/UserArm.h @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2016 The Android Open Source Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef _LIBUNWINDSTACK_USER_ARM_H +#define _LIBUNWINDSTACK_USER_ARM_H + +namespace unwindstack { + +struct arm_user_regs { + uint32_t regs[18]; +}; + +} // namespace unwindstack + +#endif // _LIBUNWINDSTACK_USER_ARM_H diff --git a/libunwindstack/include/unwindstack/UserArm64.h b/libunwindstack/include/unwindstack/UserArm64.h new file mode 100644 index 000000000..d74983fec --- /dev/null +++ b/libunwindstack/include/unwindstack/UserArm64.h @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2016 The Android Open Source Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef _LIBUNWINDSTACK_USER_ARM64_H +#define _LIBUNWINDSTACK_USER_ARM64_H + +namespace unwindstack { + +struct arm64_user_regs { + uint64_t regs[31]; + uint64_t sp; + uint64_t pc; + uint64_t pstate; +}; + +} // namespace unwindstack + +#endif // _LIBUNWINDSTACK_USER_ARM64_H diff --git a/libunwindstack/include/unwindstack/UserMips.h b/libunwindstack/include/unwindstack/UserMips.h new file mode 100644 index 000000000..184be4f39 --- /dev/null +++ b/libunwindstack/include/unwindstack/UserMips.h @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2017 The Android Open Source Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef _LIBUNWINDSTACK_USER_MIPS_H +#define _LIBUNWINDSTACK_USER_MIPS_H + +namespace unwindstack { + +enum Mips32UserReg : uint16_t { + MIPS32_EF_R0 = 6, + MIPS32_EF_CP0_EPC = 40, +}; + +struct mips_user_regs { + uint32_t regs[45]; +}; + +} // namespace unwindstack + +#endif // _LIBUNWINDSTACK_USER_MIPS_H diff --git a/libunwindstack/include/unwindstack/UserMips64.h b/libunwindstack/include/unwindstack/UserMips64.h new file mode 100644 index 000000000..c46befd4f --- /dev/null +++ b/libunwindstack/include/unwindstack/UserMips64.h @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2017 The Android Open Source Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef _LIBUNWINDSTACK_USER_MIPS64_H +#define _LIBUNWINDSTACK_USER_MIPS64_H + +namespace unwindstack { + +enum Mips64UserReg : uint16_t { + MIPS64_EF_R0 = 0, + MIPS64_EF_CP0_EPC = 34, +}; + +struct mips64_user_regs { + uint64_t regs[45]; +}; + +} // namespace unwindstack + +#endif // _LIBUNWINDSTACK_USER_MIPS64_H diff --git a/libunwindstack/include/unwindstack/UserX86.h b/libunwindstack/include/unwindstack/UserX86.h new file mode 100644 index 000000000..a040560c7 --- /dev/null +++ b/libunwindstack/include/unwindstack/UserX86.h @@ -0,0 +1,56 @@ +/* + * Copyright (C) 2016 The Android Open Source Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef _LIBUNWINDSTACK_USER_X86_H +#define _LIBUNWINDSTACK_USER_X86_H + +namespace unwindstack { + +struct x86_user_regs { + uint32_t ebx; + uint32_t ecx; + uint32_t edx; + uint32_t esi; + uint32_t edi; + uint32_t ebp; + uint32_t eax; + uint32_t xds; + uint32_t xes; + uint32_t xfs; + uint32_t xgs; + uint32_t orig_eax; + uint32_t eip; + uint32_t xcs; + uint32_t eflags; + uint32_t esp; + uint32_t xss; +}; + +} // namespace unwindstack + +#endif // _LIBUNWINDSTACK_USER_X86_H diff --git a/libunwindstack/include/unwindstack/UserX86_64.h b/libunwindstack/include/unwindstack/UserX86_64.h new file mode 100644 index 000000000..b80d201d5 --- /dev/null +++ b/libunwindstack/include/unwindstack/UserX86_64.h @@ -0,0 +1,66 @@ +/* + * Copyright (C) 2016 The Android Open Source Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef _LIBUNWINDSTACK_USER_X86_64_H +#define _LIBUNWINDSTACK_USER_X86_64_H + +namespace unwindstack { + +struct x86_64_user_regs { + uint64_t r15; + uint64_t r14; + uint64_t r13; + uint64_t r12; + uint64_t rbp; + uint64_t rbx; + uint64_t r11; + uint64_t r10; + uint64_t r9; + uint64_t r8; + uint64_t rax; + uint64_t rcx; + uint64_t rdx; + uint64_t rsi; + uint64_t rdi; + uint64_t orig_rax; + uint64_t rip; + uint64_t cs; + uint64_t eflags; + uint64_t rsp; + uint64_t ss; + uint64_t fs_base; + uint64_t gs_base; + uint64_t ds; + uint64_t es; + uint64_t fs; + uint64_t gs; +}; + +} // namespace unwindstack + +#endif // _LIBUNWINDSTACK_USER_X86_64_H |