1/*
2 * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23#ifndef RLD
24#import <mach-o/hppa/swap.h>
25
26void
27swap_hppa_integer_thread_state(
28struct hp_pa_integer_thread_state *regs,
29enum NXByteOrder target_byte_order)
30{
31	regs->ts_gr1 = OSSwapInt32(regs->ts_gr1);
32	regs->ts_gr2 = OSSwapInt32(regs->ts_gr2);
33	regs->ts_gr3 = OSSwapInt32(regs->ts_gr3);
34	regs->ts_gr4 = OSSwapInt32(regs->ts_gr4);
35	regs->ts_gr5 = OSSwapInt32(regs->ts_gr5);
36	regs->ts_gr6 = OSSwapInt32(regs->ts_gr6);
37	regs->ts_gr7 = OSSwapInt32(regs->ts_gr7);
38	regs->ts_gr8 = OSSwapInt32(regs->ts_gr8);
39	regs->ts_gr9 = OSSwapInt32(regs->ts_gr9);
40	regs->ts_gr10 = OSSwapInt32(regs->ts_gr10);
41	regs->ts_gr11 = OSSwapInt32(regs->ts_gr11);
42	regs->ts_gr12 = OSSwapInt32(regs->ts_gr12);
43	regs->ts_gr13 = OSSwapInt32(regs->ts_gr13);
44	regs->ts_gr14 = OSSwapInt32(regs->ts_gr14);
45	regs->ts_gr15 = OSSwapInt32(regs->ts_gr15);
46	regs->ts_gr16 = OSSwapInt32(regs->ts_gr16);
47	regs->ts_gr17 = OSSwapInt32(regs->ts_gr17);
48	regs->ts_gr18 = OSSwapInt32(regs->ts_gr18);
49	regs->ts_gr19 = OSSwapInt32(regs->ts_gr19);
50	regs->ts_gr20 = OSSwapInt32(regs->ts_gr20);
51	regs->ts_gr21 = OSSwapInt32(regs->ts_gr21);
52	regs->ts_gr22 = OSSwapInt32(regs->ts_gr22);
53	regs->ts_gr23 = OSSwapInt32(regs->ts_gr23);
54	regs->ts_gr24 = OSSwapInt32(regs->ts_gr24);
55	regs->ts_gr25 = OSSwapInt32(regs->ts_gr25);
56	regs->ts_gr26 = OSSwapInt32(regs->ts_gr26);
57	regs->ts_gr27 = OSSwapInt32(regs->ts_gr27);
58	regs->ts_gr28 = OSSwapInt32(regs->ts_gr28);
59	regs->ts_gr29 = OSSwapInt32(regs->ts_gr29);
60	regs->ts_gr30 = OSSwapInt32(regs->ts_gr30);
61	regs->ts_gr31 = OSSwapInt32(regs->ts_gr31);
62	regs->ts_sr0 = OSSwapInt32(regs->ts_sr0);
63	regs->ts_sr1 = OSSwapInt32(regs->ts_sr1);
64	regs->ts_sr2 = OSSwapInt32(regs->ts_sr2);
65	regs->ts_sr3 = OSSwapInt32(regs->ts_sr3);
66	regs->ts_sar = OSSwapInt32(regs->ts_sar);
67}
68
69void swap_hppa_frame_thread_state(
70struct hp_pa_frame_thread_state *frame,
71enum NXByteOrder target_byte_order)
72{
73	frame->ts_pcsq_front = OSSwapInt32(frame->ts_pcsq_front);
74	frame->ts_pcsq_back = OSSwapInt32(frame->ts_pcsq_back);
75	frame->ts_pcoq_front = OSSwapInt32(frame->ts_pcoq_front);
76	frame->ts_pcoq_back = OSSwapInt32(frame->ts_pcoq_back);
77	frame->ts_psw = OSSwapInt32(frame->ts_psw);
78	frame->ts_unaligned_faults = OSSwapInt32(frame->ts_unaligned_faults);
79	frame->ts_fault_address = OSSwapInt32(frame->ts_fault_address);
80	frame->ts_step_range_start = OSSwapInt32(frame->ts_step_range_start);
81	frame->ts_step_range_stop = OSSwapInt32(frame->ts_step_range_stop);
82}
83
84void swap_hppa_fp_thread_state(
85struct hp_pa_fp_thread_state *fp,
86enum NXByteOrder target_byte_order)
87{
88	fp->ts_fp0 = OSSwapInt64(fp->ts_fp0);
89	fp->ts_fp1 = OSSwapInt64(fp->ts_fp1);
90	fp->ts_fp2 = OSSwapInt64(fp->ts_fp2);
91	fp->ts_fp3 = OSSwapInt64(fp->ts_fp3);
92	fp->ts_fp4 = OSSwapInt64(fp->ts_fp4);
93	fp->ts_fp5 = OSSwapInt64(fp->ts_fp5);
94	fp->ts_fp6 = OSSwapInt64(fp->ts_fp6);
95	fp->ts_fp7 = OSSwapInt64(fp->ts_fp7);
96	fp->ts_fp8 = OSSwapInt64(fp->ts_fp8);
97	fp->ts_fp9 = OSSwapInt64(fp->ts_fp9);
98	fp->ts_fp10 = OSSwapInt64(fp->ts_fp10);
99	fp->ts_fp11 = OSSwapInt64(fp->ts_fp11);
100	fp->ts_fp12 = OSSwapInt64(fp->ts_fp12);
101	fp->ts_fp13 = OSSwapInt64(fp->ts_fp13);
102	fp->ts_fp14 = OSSwapInt64(fp->ts_fp14);
103	fp->ts_fp15 = OSSwapInt64(fp->ts_fp15);
104	fp->ts_fp16 = OSSwapInt64(fp->ts_fp16);
105	fp->ts_fp17 = OSSwapInt64(fp->ts_fp17);
106	fp->ts_fp18 = OSSwapInt64(fp->ts_fp18);
107	fp->ts_fp19 = OSSwapInt64(fp->ts_fp19);
108	fp->ts_fp20 = OSSwapInt64(fp->ts_fp20);
109	fp->ts_fp21 = OSSwapInt64(fp->ts_fp21);
110	fp->ts_fp22 = OSSwapInt64(fp->ts_fp22);
111	fp->ts_fp23 = OSSwapInt64(fp->ts_fp23);
112	fp->ts_fp24 = OSSwapInt64(fp->ts_fp24);
113	fp->ts_fp25 = OSSwapInt64(fp->ts_fp25);
114	fp->ts_fp26 = OSSwapInt64(fp->ts_fp26);
115	fp->ts_fp27 = OSSwapInt64(fp->ts_fp27);
116	fp->ts_fp28 = OSSwapInt64(fp->ts_fp28);
117	fp->ts_fp29 = OSSwapInt64(fp->ts_fp29);
118	fp->ts_fp30 = OSSwapInt64(fp->ts_fp30);
119	fp->ts_fp31 = OSSwapInt64(fp->ts_fp31);
120}
121#endif /* !defined(RLD) */
122