2008-01-25 Douglas Gregor <doug.gregor@gmail.com>
[official-gcc.git] / gcc / config / arm / unaligned-funcs.c
blob66cfd3bbbda1f936a8a2d9dd87d4bcb189ef641f
1 /* EABI unaligned read/write functions.
3 Copyright (C) 2005 Free Software Foundation, Inc.
4 Contributed by CodeSourcery, LLC.
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.
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.)
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.
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. */
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 *);
35 struct __attribute__((packed)) u4 { int data; };
36 struct __attribute__((packed)) u8 { long long data; };
38 int
39 __aeabi_uread4 (void *ptr)
41 return ((struct u4 *) ptr)->data;
44 int
45 __aeabi_uwrite4 (int data, void *ptr)
47 ((struct u4 *) ptr)->data = data;
48 return data;
51 long long
52 __aeabi_uread8 (void *ptr)
54 return ((struct u8 *) ptr)->data;
57 long long
58 __aeabi_uwrite8 (long long data, void *ptr)
60 ((struct u8 *) ptr)->data = data;
61 return data;