]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - contrib/gcc/config/arm/unaligned-funcs.c
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / contrib / gcc / config / arm / unaligned-funcs.c
1 /* EABI unaligned read/write functions.
2
3    Copyright (C) 2005 Free Software Foundation, Inc.
4    Contributed by CodeSourcery, LLC.
5
6    This file is free software; you can redistribute it and/or modify it
7    under the terms of the GNU General Public License as published by the
8    Free Software Foundation; either version 2, or (at your option) any
9    later version.
10
11    In addition to the permissions in the GNU General Public License, the
12    Free Software Foundation gives you unlimited permission to link the
13    compiled version of this file into combinations with other programs,
14    and to distribute those combinations without any restriction coming
15    from the use of this file.  (The General Public License restrictions
16    do apply in other respects; for example, they cover modification of
17    the file, and distribution when not linked into a combine
18    executable.)
19
20    This file is distributed in the hope that it will be useful, but
21    WITHOUT ANY WARRANTY; without even the implied warranty of
22    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
23    General Public License for more details.
24
25    You should have received a copy of the GNU General Public License
26    along with this program; see the file COPYING.  If not, write to
27    the Free Software Foundation, 51 Franklin Street, Fifth Floor,
28    Boston, MA 02110-1301, USA.  */
29
30 int __aeabi_uread4 (void *);
31 int __aeabi_uwrite4 (int, void *);
32 long long __aeabi_uread8 (void *);
33 long long __aeabi_uwrite8 (long long, void *);
34
35 struct __attribute__((packed)) u4 { int data; };
36 struct __attribute__((packed)) u8 { long long data; };
37
38 int
39 __aeabi_uread4 (void *ptr)
40 {
41   return ((struct u4 *) ptr)->data;
42 }
43
44 int
45 __aeabi_uwrite4 (int data, void *ptr)
46 {
47   ((struct u4 *) ptr)->data = data;
48   return data;
49 }
50
51 long long
52 __aeabi_uread8 (void *ptr)
53 {
54   return ((struct u8 *) ptr)->data;
55 }
56
57 long long
58 __aeabi_uwrite8 (long long data, void *ptr)
59 {
60   ((struct u8 *) ptr)->data = data;
61   return data;
62 }