13958f8060ac0adccd977c0fab7a53d45f3fce58dChristopher Ferris/*
23958f8060ac0adccd977c0fab7a53d45f3fce58dChristopher Ferris * Copyright (C) 2016 The Android Open Source Project
33958f8060ac0adccd977c0fab7a53d45f3fce58dChristopher Ferris * All rights reserved.
43958f8060ac0adccd977c0fab7a53d45f3fce58dChristopher Ferris *
53958f8060ac0adccd977c0fab7a53d45f3fce58dChristopher Ferris * Redistribution and use in source and binary forms, with or without
63958f8060ac0adccd977c0fab7a53d45f3fce58dChristopher Ferris * modification, are permitted provided that the following conditions
73958f8060ac0adccd977c0fab7a53d45f3fce58dChristopher Ferris * are met:
83958f8060ac0adccd977c0fab7a53d45f3fce58dChristopher Ferris *  * Redistributions of source code must retain the above copyright
93958f8060ac0adccd977c0fab7a53d45f3fce58dChristopher Ferris *    notice, this list of conditions and the following disclaimer.
103958f8060ac0adccd977c0fab7a53d45f3fce58dChristopher Ferris *  * Redistributions in binary form must reproduce the above copyright
113958f8060ac0adccd977c0fab7a53d45f3fce58dChristopher Ferris *    notice, this list of conditions and the following disclaimer in
123958f8060ac0adccd977c0fab7a53d45f3fce58dChristopher Ferris *    the documentation and/or other materials provided with the
133958f8060ac0adccd977c0fab7a53d45f3fce58dChristopher Ferris *    distribution.
143958f8060ac0adccd977c0fab7a53d45f3fce58dChristopher Ferris *
153958f8060ac0adccd977c0fab7a53d45f3fce58dChristopher Ferris * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
163958f8060ac0adccd977c0fab7a53d45f3fce58dChristopher Ferris * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
173958f8060ac0adccd977c0fab7a53d45f3fce58dChristopher Ferris * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
183958f8060ac0adccd977c0fab7a53d45f3fce58dChristopher Ferris * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
193958f8060ac0adccd977c0fab7a53d45f3fce58dChristopher Ferris * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
203958f8060ac0adccd977c0fab7a53d45f3fce58dChristopher Ferris * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
213958f8060ac0adccd977c0fab7a53d45f3fce58dChristopher Ferris * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
223958f8060ac0adccd977c0fab7a53d45f3fce58dChristopher Ferris * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
233958f8060ac0adccd977c0fab7a53d45f3fce58dChristopher Ferris * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
243958f8060ac0adccd977c0fab7a53d45f3fce58dChristopher Ferris * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
253958f8060ac0adccd977c0fab7a53d45f3fce58dChristopher Ferris * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
263958f8060ac0adccd977c0fab7a53d45f3fce58dChristopher Ferris * SUCH DAMAGE.
273958f8060ac0adccd977c0fab7a53d45f3fce58dChristopher Ferris */
283958f8060ac0adccd977c0fab7a53d45f3fce58dChristopher Ferris
293958f8060ac0adccd977c0fab7a53d45f3fce58dChristopher Ferris#ifndef _LIBUNWINDSTACK_USER_H
303958f8060ac0adccd977c0fab7a53d45f3fce58dChristopher Ferris#define _LIBUNWINDSTACK_USER_H
313958f8060ac0adccd977c0fab7a53d45f3fce58dChristopher Ferris
323958f8060ac0adccd977c0fab7a53d45f3fce58dChristopher Ferrisstruct x86_user_regs {
333958f8060ac0adccd977c0fab7a53d45f3fce58dChristopher Ferris  uint32_t ebx;
343958f8060ac0adccd977c0fab7a53d45f3fce58dChristopher Ferris  uint32_t ecx;
353958f8060ac0adccd977c0fab7a53d45f3fce58dChristopher Ferris  uint32_t edx;
363958f8060ac0adccd977c0fab7a53d45f3fce58dChristopher Ferris  uint32_t esi;
373958f8060ac0adccd977c0fab7a53d45f3fce58dChristopher Ferris  uint32_t edi;
383958f8060ac0adccd977c0fab7a53d45f3fce58dChristopher Ferris  uint32_t ebp;
393958f8060ac0adccd977c0fab7a53d45f3fce58dChristopher Ferris  uint32_t eax;
403958f8060ac0adccd977c0fab7a53d45f3fce58dChristopher Ferris  uint32_t xds;
413958f8060ac0adccd977c0fab7a53d45f3fce58dChristopher Ferris  uint32_t xes;
423958f8060ac0adccd977c0fab7a53d45f3fce58dChristopher Ferris  uint32_t xfs;
433958f8060ac0adccd977c0fab7a53d45f3fce58dChristopher Ferris  uint32_t xgs;
443958f8060ac0adccd977c0fab7a53d45f3fce58dChristopher Ferris  uint32_t orig_eax;
453958f8060ac0adccd977c0fab7a53d45f3fce58dChristopher Ferris  uint32_t eip;
463958f8060ac0adccd977c0fab7a53d45f3fce58dChristopher Ferris  uint32_t xcs;
473958f8060ac0adccd977c0fab7a53d45f3fce58dChristopher Ferris  uint32_t eflags;
483958f8060ac0adccd977c0fab7a53d45f3fce58dChristopher Ferris  uint32_t esp;
493958f8060ac0adccd977c0fab7a53d45f3fce58dChristopher Ferris  uint32_t xss;
503958f8060ac0adccd977c0fab7a53d45f3fce58dChristopher Ferris};
513958f8060ac0adccd977c0fab7a53d45f3fce58dChristopher Ferris
523958f8060ac0adccd977c0fab7a53d45f3fce58dChristopher Ferrisstruct x86_64_user_regs {
533958f8060ac0adccd977c0fab7a53d45f3fce58dChristopher Ferris  uint64_t r15;
543958f8060ac0adccd977c0fab7a53d45f3fce58dChristopher Ferris  uint64_t r14;
553958f8060ac0adccd977c0fab7a53d45f3fce58dChristopher Ferris  uint64_t r13;
563958f8060ac0adccd977c0fab7a53d45f3fce58dChristopher Ferris  uint64_t r12;
573958f8060ac0adccd977c0fab7a53d45f3fce58dChristopher Ferris  uint64_t rbp;
583958f8060ac0adccd977c0fab7a53d45f3fce58dChristopher Ferris  uint64_t rbx;
593958f8060ac0adccd977c0fab7a53d45f3fce58dChristopher Ferris  uint64_t r11;
603958f8060ac0adccd977c0fab7a53d45f3fce58dChristopher Ferris  uint64_t r10;
613958f8060ac0adccd977c0fab7a53d45f3fce58dChristopher Ferris  uint64_t r9;
623958f8060ac0adccd977c0fab7a53d45f3fce58dChristopher Ferris  uint64_t r8;
633958f8060ac0adccd977c0fab7a53d45f3fce58dChristopher Ferris  uint64_t rax;
643958f8060ac0adccd977c0fab7a53d45f3fce58dChristopher Ferris  uint64_t rcx;
653958f8060ac0adccd977c0fab7a53d45f3fce58dChristopher Ferris  uint64_t rdx;
663958f8060ac0adccd977c0fab7a53d45f3fce58dChristopher Ferris  uint64_t rsi;
673958f8060ac0adccd977c0fab7a53d45f3fce58dChristopher Ferris  uint64_t rdi;
683958f8060ac0adccd977c0fab7a53d45f3fce58dChristopher Ferris  uint64_t orig_rax;
693958f8060ac0adccd977c0fab7a53d45f3fce58dChristopher Ferris  uint64_t rip;
703958f8060ac0adccd977c0fab7a53d45f3fce58dChristopher Ferris  uint64_t cs;
713958f8060ac0adccd977c0fab7a53d45f3fce58dChristopher Ferris  uint64_t eflags;
723958f8060ac0adccd977c0fab7a53d45f3fce58dChristopher Ferris  uint64_t rsp;
733958f8060ac0adccd977c0fab7a53d45f3fce58dChristopher Ferris  uint64_t ss;
743958f8060ac0adccd977c0fab7a53d45f3fce58dChristopher Ferris  uint64_t fs_base;
753958f8060ac0adccd977c0fab7a53d45f3fce58dChristopher Ferris  uint64_t gs_base;
763958f8060ac0adccd977c0fab7a53d45f3fce58dChristopher Ferris  uint64_t ds;
773958f8060ac0adccd977c0fab7a53d45f3fce58dChristopher Ferris  uint64_t es;
783958f8060ac0adccd977c0fab7a53d45f3fce58dChristopher Ferris  uint64_t fs;
793958f8060ac0adccd977c0fab7a53d45f3fce58dChristopher Ferris  uint64_t gs;
803958f8060ac0adccd977c0fab7a53d45f3fce58dChristopher Ferris};
813958f8060ac0adccd977c0fab7a53d45f3fce58dChristopher Ferris
823958f8060ac0adccd977c0fab7a53d45f3fce58dChristopher Ferrisstruct arm_user_regs {
833958f8060ac0adccd977c0fab7a53d45f3fce58dChristopher Ferris  uint32_t regs[18];
843958f8060ac0adccd977c0fab7a53d45f3fce58dChristopher Ferris};
853958f8060ac0adccd977c0fab7a53d45f3fce58dChristopher Ferris
863958f8060ac0adccd977c0fab7a53d45f3fce58dChristopher Ferrisstruct arm64_user_regs {
873958f8060ac0adccd977c0fab7a53d45f3fce58dChristopher Ferris  uint64_t regs[31];
883958f8060ac0adccd977c0fab7a53d45f3fce58dChristopher Ferris  uint64_t sp;
893958f8060ac0adccd977c0fab7a53d45f3fce58dChristopher Ferris  uint64_t pc;
903958f8060ac0adccd977c0fab7a53d45f3fce58dChristopher Ferris  uint64_t pstate;
913958f8060ac0adccd977c0fab7a53d45f3fce58dChristopher Ferris};
923958f8060ac0adccd977c0fab7a53d45f3fce58dChristopher Ferris
933958f8060ac0adccd977c0fab7a53d45f3fce58dChristopher Ferris// The largest user structure.
943958f8060ac0adccd977c0fab7a53d45f3fce58dChristopher Ferrisconstexpr size_t MAX_USER_REGS_SIZE = sizeof(arm64_user_regs) + 10;
953958f8060ac0adccd977c0fab7a53d45f3fce58dChristopher Ferris
963958f8060ac0adccd977c0fab7a53d45f3fce58dChristopher Ferris#endif  // _LIBUNWINDSTACK_USER_H
97