1169689Skan/* EABI unaligned read/write functions.
2169689Skan
3169689Skan   Copyright (C) 2005 Free Software Foundation, Inc.
4169689Skan   Contributed by CodeSourcery, LLC.
5169689Skan
6169689Skan   This file is free software; you can redistribute it and/or modify it
7169689Skan   under the terms of the GNU General Public License as published by the
8169689Skan   Free Software Foundation; either version 2, or (at your option) any
9169689Skan   later version.
10169689Skan
11169689Skan   In addition to the permissions in the GNU General Public License, the
12169689Skan   Free Software Foundation gives you unlimited permission to link the
13169689Skan   compiled version of this file into combinations with other programs,
14169689Skan   and to distribute those combinations without any restriction coming
15169689Skan   from the use of this file.  (The General Public License restrictions
16169689Skan   do apply in other respects; for example, they cover modification of
17169689Skan   the file, and distribution when not linked into a combine
18169689Skan   executable.)
19169689Skan
20169689Skan   This file is distributed in the hope that it will be useful, but
21169689Skan   WITHOUT ANY WARRANTY; without even the implied warranty of
22169689Skan   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
23169689Skan   General Public License for more details.
24169689Skan
25169689Skan   You should have received a copy of the GNU General Public License
26169689Skan   along with this program; see the file COPYING.  If not, write to
27169689Skan   the Free Software Foundation, 51 Franklin Street, Fifth Floor,
28169689Skan   Boston, MA 02110-1301, USA.  */
29169689Skan
30169689Skanint __aeabi_uread4 (void *);
31169689Skanint __aeabi_uwrite4 (int, void *);
32169689Skanlong long __aeabi_uread8 (void *);
33169689Skanlong long __aeabi_uwrite8 (long long, void *);
34169689Skan
35169689Skanstruct __attribute__((packed)) u4 { int data; };
36169689Skanstruct __attribute__((packed)) u8 { long long data; };
37169689Skan
38169689Skanint
39169689Skan__aeabi_uread4 (void *ptr)
40169689Skan{
41169689Skan  return ((struct u4 *) ptr)->data;
42169689Skan}
43169689Skan
44169689Skanint
45169689Skan__aeabi_uwrite4 (int data, void *ptr)
46169689Skan{
47169689Skan  ((struct u4 *) ptr)->data = data;
48169689Skan  return data;
49169689Skan}
50169689Skan
51169689Skanlong long
52169689Skan__aeabi_uread8 (void *ptr)
53169689Skan{
54169689Skan  return ((struct u8 *) ptr)->data;
55169689Skan}
56169689Skan
57169689Skanlong long
58169689Skan__aeabi_uwrite8 (long long data, void *ptr)
59169689Skan{
60169689Skan  ((struct u8 *) ptr)->data = data;
61169689Skan  return data;
62169689Skan}
63