Commit 2c71699c authored by David Howells's avatar David Howells Committed by Linus Torvalds

[PATCH] FRV: Remaining Fujitsu FR-V arch include files

The attached patch provides the remaining arch-specific include files for
the Fujitsu FR-V CPU arch.
Signed-Off-By: default avatarDavid Howells <dhowells@redhat.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent b3511aec
/* unaligned.h: unaligned access handler
*
* Copyright (C) 2004 Red Hat, Inc. All Rights Reserved.
* Written by David Howells (dhowells@redhat.com)
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*/
#ifndef _ASM_UNALIGNED_H
#define _ASM_UNALIGNED_H
#include <linux/config.h>
/*
* Unaligned accesses on uClinux can't be performed in a fault handler - the
* CPU detects them as imprecise exceptions making this impossible.
*
* With the FR451, however, they are precise, and so we used to fix them up in
* the memory access fault handler. However, instruction bundling make this
* impractical. So, now we fall back to using memcpy.
*/
#ifdef CONFIG_MMU
/*
* The asm statement in the macros below is a way to get GCC to copy a
* value from one variable to another without having any clue it's
* actually doing so, so that it won't have any idea that the values
* in the two variables are related.
*/
#define get_unaligned(ptr) ({ \
typeof((*(ptr))) __x; \
void *__ptrcopy; \
asm("" : "=r" (__ptrcopy) : "0" (ptr)); \
memcpy(&__x, __ptrcopy, sizeof(*(ptr))); \
__x; \
})
#define put_unaligned(val, ptr) ({ \
typeof((*(ptr))) __x = (val); \
void *__ptrcopy; \
asm("" : "=r" (__ptrcopy) : "0" (ptr)); \
memcpy(__ptrcopy, &__x, sizeof(*(ptr))); \
})
extern int handle_misalignment(unsigned long esr0, unsigned long ear0, unsigned long epcr0);
#else
#define get_unaligned(ptr) \
({ \
typeof(*(ptr)) x; \
const char *__p = (const char *) (ptr); \
\
switch (sizeof(x)) { \
case 1: \
x = *(ptr); \
break; \
case 2: \
{ \
uint8_t a; \
asm(" ldub%I2 %M2,%0 \n" \
" ldub%I3.p %M3,%1 \n" \
" slli %0,#8,%0 \n" \
" or %0,%1,%0 \n" \
: "=&r"(x), "=&r"(a) \
: "m"(__p[0]), "m"(__p[1]) \
); \
break; \
} \
\
case 4: \
{ \
uint8_t a; \
asm(" ldub%I2 %M2,%0 \n" \
" ldub%I3.p %M3,%1 \n" \
" slli %0,#8,%0 \n" \
" or %0,%1,%0 \n" \
" ldub%I4.p %M4,%1 \n" \
" slli %0,#8,%0 \n" \
" or %0,%1,%0 \n" \
" ldub%I5.p %M5,%1 \n" \
" slli %0,#8,%0 \n" \
" or %0,%1,%0 \n" \
: "=&r"(x), "=&r"(a) \
: "m"(__p[0]), "m"(__p[1]), "m"(__p[2]), "m"(__p[3]) \
); \
break; \
} \
\
case 8: \
{ \
union { uint64_t x; u32 y[2]; } z; \
uint8_t a; \
asm(" ldub%I3 %M3,%0 \n" \
" ldub%I4.p %M4,%2 \n" \
" slli %0,#8,%0 \n" \
" or %0,%2,%0 \n" \
" ldub%I5.p %M5,%2 \n" \
" slli %0,#8,%0 \n" \
" or %0,%2,%0 \n" \
" ldub%I6.p %M6,%2 \n" \
" slli %0,#8,%0 \n" \
" or %0,%2,%0 \n" \
" ldub%I7 %M7,%1 \n" \
" ldub%I8.p %M8,%2 \n" \
" slli %1,#8,%1 \n" \
" or %1,%2,%1 \n" \
" ldub%I9.p %M9,%2 \n" \
" slli %1,#8,%1 \n" \
" or %1,%2,%1 \n" \
" ldub%I10.p %M10,%2 \n" \
" slli %1,#8,%1 \n" \
" or %1,%2,%1 \n" \
: "=&r"(z.y[0]), "=&r"(z.y[1]), "=&r"(a) \
: "m"(__p[0]), "m"(__p[1]), "m"(__p[2]), "m"(__p[3]), \
"m"(__p[4]), "m"(__p[5]), "m"(__p[6]), "m"(__p[7]) \
); \
x = z.x; \
break; \
} \
\
default: \
x = 0; \
BUG(); \
break; \
} \
\
x; \
})
#define put_unaligned(val, ptr) \
do { \
char *__p = (char *) (ptr); \
int x; \
\
switch (sizeof(*ptr)) { \
case 2: \
{ \
asm(" stb%I1.p %0,%M1 \n" \
" srli %0,#8,%0 \n" \
" stb%I2 %0,%M2 \n" \
: "=r"(x), "=m"(__p[1]), "=m"(__p[0]) \
: "0"(val) \
); \
break; \
} \
\
case 4: \
{ \
asm(" stb%I1.p %0,%M1 \n" \
" srli %0,#8,%0 \n" \
" stb%I2.p %0,%M2 \n" \
" srli %0,#8,%0 \n" \
" stb%I3.p %0,%M3 \n" \
" srli %0,#8,%0 \n" \
" stb%I4 %0,%M4 \n" \
: "=r"(x), "=m"(__p[3]), "=m"(__p[2]), "=m"(__p[1]), "=m"(__p[0]) \
: "0"(val) \
); \
break; \
} \
\
case 8: \
{ \
uint32_t __high, __low; \
__high = (uint64_t)val >> 32; \
__low = val & 0xffffffff; \
asm(" stb%I2.p %0,%M2 \n" \
" srli %0,#8,%0 \n" \
" stb%I3.p %0,%M3 \n" \
" srli %0,#8,%0 \n" \
" stb%I4.p %0,%M4 \n" \
" srli %0,#8,%0 \n" \
" stb%I5.p %0,%M5 \n" \
" srli %0,#8,%0 \n" \
" stb%I6.p %1,%M6 \n" \
" srli %1,#8,%1 \n" \
" stb%I7.p %1,%M7 \n" \
" srli %1,#8,%1 \n" \
" stb%I8.p %1,%M8 \n" \
" srli %1,#8,%1 \n" \
" stb%I9 %1,%M9 \n" \
: "=&r"(__low), "=&r"(__high), "=m"(__p[7]), "=m"(__p[6]), \
"=m"(__p[5]), "=m"(__p[4]), "=m"(__p[3]), "=m"(__p[2]), \
"=m"(__p[1]), "=m"(__p[0]) \
: "0"(__low), "1"(__high) \
); \
break; \
} \
\
default: \
*(ptr) = (val); \
break; \
} \
} while(0)
#endif
#endif
This diff is collapsed.
/* user.h: FR-V core file format stuff
*
* Copyright (C) 2003 Red Hat, Inc. All Rights Reserved.
* Written by David Howells (dhowells@redhat.com)
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*/
#ifndef _ASM_USER_H
#define _ASM_USER_H
#include <asm/page.h>
#include <asm/registers.h>
/* Core file format: The core file is written in such a way that gdb
* can understand it and provide useful information to the user (under
* linux we use the 'trad-core' bfd). There are quite a number of
* obstacles to being able to view the contents of the floating point
* registers, and until these are solved you will not be able to view
* the contents of them. Actually, you can read in the core file and
* look at the contents of the user struct to find out what the
* floating point registers contain.
*
* The actual file contents are as follows:
* UPAGE:
* 1 page consisting of a user struct that tells gdb what is present
* in the file. Directly after this is a copy of the task_struct,
* which is currently not used by gdb, but it may come in useful at
* some point. All of the registers are stored as part of the
* upage. The upage should always be only one page.
*
* DATA:
* The data area is stored. We use current->end_text to
* current->brk to pick up all of the user variables, plus any
* memory that may have been malloced. No attempt is made to
* determine if a page is demand-zero or if a page is totally
* unused, we just cover the entire range. All of the addresses are
* rounded in such a way that an integral number of pages is
* written.
*
* STACK:
* We need the stack information in order to get a meaningful
* backtrace. We need to write the data from (esp) to
* current->start_stack, so we round each of these off in order to
* be able to write an integer number of pages. The minimum core
* file size is 3 pages, or 12288 bytes.
*/
/* When the kernel dumps core, it starts by dumping the user struct -
* this will be used by gdb to figure out where the data and stack segments
* are within the file, and what virtual addresses to use.
*/
struct user {
/* We start with the registers, to mimic the way that "memory" is returned
* from the ptrace(3,...) function. */
struct user_context regs;
/* The rest of this junk is to help gdb figure out what goes where */
unsigned long u_tsize; /* Text segment size (pages). */
unsigned long u_dsize; /* Data segment size (pages). */
unsigned long u_ssize; /* Stack segment size (pages). */
unsigned long start_code; /* Starting virtual address of text. */
unsigned long start_stack; /* Starting virtual address of stack area.
* This is actually the bottom of the stack,
* the top of the stack is always found in the
* esp register. */
long int signal; /* Signal that caused the core dump. */
unsigned long magic; /* To uniquely identify a core file */
char u_comm[32]; /* User command that was responsible */
};
#define NBPG PAGE_SIZE
#define UPAGES 1
#define HOST_TEXT_START_ADDR (u.start_code)
#define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG)
#endif
/* virtconvert.h: virtual/physical/page address convertion
*
* Copyright (C) 2004 Red Hat, Inc. All Rights Reserved.
* Written by David Howells (dhowells@redhat.com)
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*/
#ifndef _ASM_VIRTCONVERT_H
#define _ASM_VIRTCONVERT_H
/*
* Macros used for converting between virtual and physical mappings.
*/
#ifdef __KERNEL__
#include <linux/config.h>
#include <asm/setup.h>
#ifdef CONFIG_MMU
#define phys_to_virt(vaddr) ((void *) ((unsigned long)(vaddr) + PAGE_OFFSET))
#define virt_to_phys(vaddr) ((unsigned long) (vaddr) - PAGE_OFFSET)
#else
#define phys_to_virt(vaddr) ((void *) (vaddr))
#define virt_to_phys(vaddr) ((unsigned long) (vaddr))
#endif
#define virt_to_bus virt_to_phys
#define bus_to_virt phys_to_virt
#define __page_address(page) (PAGE_OFFSET + (((page) - mem_map) << PAGE_SHIFT))
#define page_to_phys(page) virt_to_phys((void *)__page_address(page))
#endif
#endif
...@@ -36,8 +36,9 @@ typedef __s64 Elf64_Sxword; ...@@ -36,8 +36,9 @@ typedef __s64 Elf64_Sxword;
#define PT_NOTE 4 #define PT_NOTE 4
#define PT_SHLIB 5 #define PT_SHLIB 5
#define PT_PHDR 6 #define PT_PHDR 6
#define PT_LOOS 0x60000000 #define PT_TLS 7 /* Thread local storage segment */
#define PT_HIOS 0x6fffffff #define PT_LOOS 0x60000000 /* OS-specific */
#define PT_HIOS 0x6fffffff /* OS-specific */
#define PT_LOPROC 0x70000000 #define PT_LOPROC 0x70000000
#define PT_HIPROC 0x7fffffff #define PT_HIPROC 0x7fffffff
#define PT_GNU_EH_FRAME 0x6474e550 #define PT_GNU_EH_FRAME 0x6474e550
...@@ -109,6 +110,8 @@ typedef __s64 Elf64_Sxword; ...@@ -109,6 +110,8 @@ typedef __s64 Elf64_Sxword;
*/ */
#define EM_S390_OLD 0xA390 #define EM_S390_OLD 0xA390
#define EM_FRV 0x5441 /* Fujitsu FR-V */
/* This is the info that is needed to parse the dynamic section of the file */ /* This is the info that is needed to parse the dynamic section of the file */
#define DT_NULL 0 #define DT_NULL 0
#define DT_NEEDED 1 #define DT_NEEDED 1
......
#ifndef _LINUX_SWSUSP_H #ifndef _LINUX_SWSUSP_H
#define _LINUX_SWSUSP_H #define _LINUX_SWSUSP_H
#ifdef CONFIG_X86 #if defined(CONFIG_X86) || defined(CONFIG_FRV)
#include <asm/suspend.h> #include <asm/suspend.h>
#endif #endif
#include <linux/swap.h> #include <linux/swap.h>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment