unaligned-funcs.c revision 256281
1219820Sjeff/* EABI unaligned read/write functions. 2219820Sjeff 3219820Sjeff Copyright (C) 2005 Free Software Foundation, Inc. 4219820Sjeff Contributed by CodeSourcery, LLC. 5294505Shselasky 6219820Sjeff This file is free software; you can redistribute it and/or modify it 7219820Sjeff under the terms of the GNU General Public License as published by the 8219820Sjeff Free Software Foundation; either version 2, or (at your option) any 9219820Sjeff later version. 10219820Sjeff 11219820Sjeff In addition to the permissions in the GNU General Public License, the 12219820Sjeff Free Software Foundation gives you unlimited permission to link the 13219820Sjeff compiled version of this file into combinations with other programs, 14219820Sjeff and to distribute those combinations without any restriction coming 15219820Sjeff from the use of this file. (The General Public License restrictions 16219820Sjeff do apply in other respects; for example, they cover modification of 17219820Sjeff the file, and distribution when not linked into a combine 18219820Sjeff executable.) 19219820Sjeff 20219820Sjeff This file is distributed in the hope that it will be useful, but 21219820Sjeff WITHOUT ANY WARRANTY; without even the implied warranty of 22219820Sjeff MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 23219820Sjeff General Public License for more details. 24219820Sjeff 25219820Sjeff You should have received a copy of the GNU General Public License 26219820Sjeff along with this program; see the file COPYING. If not, write to 27219820Sjeff the Free Software Foundation, 51 Franklin Street, Fifth Floor, 28219820Sjeff Boston, MA 02110-1301, USA. */ 29219820Sjeff 30289644Shselaskyint __aeabi_uread4 (void *); 31289644Shselaskyint __aeabi_uwrite4 (int, void *); 32289644Shselaskylong long __aeabi_uread8 (void *); 33219820Sjefflong long __aeabi_uwrite8 (long long, void *); 34219820Sjeff 35219820Sjeffstruct __attribute__((packed)) u4 { int data; }; 36219820Sjeffstruct __attribute__((packed)) u8 { long long data; }; 37219820Sjeff 38219820Sjeffint 39219820Sjeff__aeabi_uread4 (void *ptr) 40219820Sjeff{ 41219820Sjeff return ((struct u4 *) ptr)->data; 42219820Sjeff} 43219820Sjeff 44219820Sjeffint 45219820Sjeff__aeabi_uwrite4 (int data, void *ptr) 46219820Sjeff{ 47219820Sjeff ((struct u4 *) ptr)->data = data; 48219820Sjeff return data; 49219820Sjeff} 50219820Sjeff 51219820Sjefflong long 52219820Sjeff__aeabi_uread8 (void *ptr) 53219820Sjeff{ 54219820Sjeff return ((struct u8 *) ptr)->data; 55219820Sjeff} 56227293Sed 57219820Sjefflong long 58219820Sjeff__aeabi_uwrite8 (long long data, void *ptr) 59219820Sjeff{ 60219820Sjeff ((struct u8 *) ptr)->data = data; 61219820Sjeff return data; 62219820Sjeff} 63219820Sjeff