Commit abeb6692 authored by Ian Molton's avatar Ian Molton Committed by Russell King

[ARM PATCH] 1456/1: removes CONFIG_CPU_{26,32} from arch/arm/lib

Patch from Ian Molton

see summary
parent 897f7e68
......@@ -39,8 +39,6 @@ obj-$(v3) += io-readsw-armv3.o io-writesw-armv3.o io-readsl-armv3.o
obj-$(v4) += io-readsw-armv4.o io-writesw-armv4.o io-readsl-armv4.o
obj-y += io-writesl.o
obj-$(CONFIG_CPU_26) += uaccess-armo.o
$(obj)/csumpartialcopy.o: $(obj)/csumpartialcopygeneric.S
$(obj)/csumpartialcopyuser.o: $(obj)/csumpartialcopygeneric.S
......@@ -6,6 +6,9 @@
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* 27/03/03 Ian Molton Clean up CONFIG_CPU
*
*/
#include <linux/config.h>
#include <linux/linkage.h>
......@@ -31,13 +34,9 @@ ENTRY(c_backtrace)
#else
stmfd sp!, {r4 - r8, lr} @ Save an extra register so we have a location...
#ifdef CONFIG_CPU_32
tst r1, #0x10 @ 26 or 32-bit?
moveq mask, #0xfc000003
movne mask, #0
#else
mov mask, #0xfc000003
#endif
tst mask, r0
movne r0, #0
movs frame, r0
......
......@@ -6,8 +6,10 @@
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* 27/03/03 Ian Molton Clean up CONFIG_CPU
*
*/
#include <linux/config.h>
#include <linux/linkage.h>
#include <asm/assembler.h>
#include <asm/errno.h>
......@@ -15,8 +17,6 @@
.text
#if defined(CONFIG_CPU_32)
.macro save_regs
stmfd sp!, {r1 - r2, r4 - r8, fp, ip, lr, pc}
.endm
......@@ -72,82 +72,6 @@
.previous
.endm
#elif defined(CONFIG_CPU_26)
.macro save_regs
stmfd sp!, {r1 - r2, r4 - r9, fp, ip, lr, pc}
mov r9, sp, lsr #13
mov r9, r9, lsl #13
ldr r9, [r9, #TSK_ADDR_LIMIT]
mov r9, r9, lsr #24
.endm
.macro load_regs,flags
ldm\flags fp, {r1, r2, r4-r9, fp, sp, pc}^
.endm
.macro load1b, reg1
tst r9, #0x01
9999: ldreqbt \reg1, [r0], #1
ldrneb \reg1, [r0], #1
.section __ex_table, "a"
.align 3
.long 9999b, 6001f
.previous
.endm
.macro load2b, reg1, reg2
tst r9, #0x01
9999: ldreqbt \reg1, [r0], #1
ldrneb \reg1, [r0], #1
9998: ldreqbt \reg2, [r0], #1
ldrneb \reg2, [r0], #1
.section __ex_table, "a"
.long 9999b, 6001f
.long 9998b, 6001f
.previous
.endm
.macro load1l, reg1
tst r9, #0x01
9999: ldreqt \reg1, [r0], #4
ldrne \reg1, [r0], #4
.section __ex_table, "a"
.align 3
.long 9999b, 6001f
.previous
.endm
.macro load2l, reg1, reg2
tst r9, #0x01
ldmneia r0!, {\reg1, \reg2}
9999: ldreqt \reg1, [r0], #4
9998: ldreqt \reg2, [r0], #4
.section __ex_table, "a"
.long 9999b, 6001f
.long 9998b, 6001f
.previous
.endm
.macro load4l, reg1, reg2, reg3, reg4
tst r9, #0x01
ldmneia r0!, {\reg1, \reg2, \reg3, \reg4}
9999: ldreqt \reg1, [r0], #4
9998: ldreqt \reg2, [r0], #4
9997: ldreqt \reg3, [r0], #4
9996: ldreqt \reg4, [r0], #4
.section __ex_table, "a"
.long 9999b, 6001f
.long 9998b, 6001f
.long 9997b, 6001f
.long 9996b, 6001f
.previous
.endm
#else
#error Unknown CPU architecture
#endif
/*
* unsigned int
* csum_partial_copy_from_user(const char *src, char *dst, int len, int sum, int *err_ptr)
......@@ -165,9 +89,7 @@
* so properly, we would have to add in whatever registers were loaded before
* the fault, which, with the current asm above is not predictable.
*/
#if defined(CONFIG_CPU_32)
.section .fixup,"ax"
#endif
.align 4
6001: mov r4, #-EFAULT
ldr r5, [fp, #4] @ *err_ptr
......@@ -179,6 +101,4 @@
strneb r0, [r1], #1
bne 6002b
load_regs ea
#if defined(CONFIG_CPU_32)
.previous
#endif
......@@ -6,19 +6,17 @@
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* 27/03/03 Ian Molton Clean up CONFIG_CPU
*
*/
#include <linux/config.h> /* for CONFIG_CPU_nn */
#include <linux/linkage.h>
#include <asm/assembler.h>
#include <asm/hardware.h>
#ifdef CONFIG_CPU_26
#define CPSR2SPSR(rt)
#else
#define CPSR2SPSR(rt) \
mrs rt, cpsr; \
msr spsr, rt
#endif
@ Purpose: call an expansion card loader to read bytes.
@ Proto : char read_loader(int offset, char *card_base, char *loader);
......
......@@ -6,8 +6,10 @@
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* 27/03/03 Ian Molton Clean up CONFIG_CPU
*
*/
#include <linux/config.h> /* for CONFIG_CPU_nn */
#include <linux/linkage.h>
#include <asm/assembler.h>
#include <asm/hardware.h>
......@@ -53,21 +55,3 @@ ENTRY(outsl)
adr r0, .iosl_warning
mov r1, lr
b printk
@ Purpose: write a memc register
@ Proto : void memc_write(int register, int value);
@ Returns: nothing
#ifdef CONFIG_CPU_26
ENTRY(memc_write)
cmp r0, #7
RETINSTR(movgt,pc,lr)
mov r0, r0, lsl #17
mov r1, r1, lsl #15
mov r1, r1, lsr #17
orr r0, r0, r1, lsl #2
add r0, r0, #0x03600000
strb r0, [r0]
RETINSTR(mov,pc,lr)
#endif
......@@ -33,23 +33,19 @@ Boston, MA 02111-1307, USA. */
This exception does not however invalidate any other reasons why
the executable file might be covered by the GNU General Public License.
*/
/* This code is derived from gcc 2.95.3 */
/* I Molton 29/07/01 */
/* This code is derived from gcc 2.95.3
* 29/07/01 Adapted for linux
* 27/03/03 Ian Molton Clean up CONFIG_CPU
*/
#include <linux/linkage.h>
#include <asm/assembler.h>
#include <asm/hardware.h>
#include <linux/config.h>
#ifdef CONFIG_CPU_26
#define RET movs
#define RETc(x) mov##x##s
#define RETCOND ^
#else
#define RET mov
#define RETc(x) mov##x
#define RETCOND
#endif
dividend .req r0
divisor .req r1
......
/*
* linux/arch/arm/lib/uaccess-armo.S
*
* Copyright (C) 1998 Russell King
*
* Note! Some code fragments found in here have a special calling
* convention - they are not APCS compliant!
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
#include <linux/linkage.h>
#include <asm/assembler.h>
.text
.globl uaccess_user
uaccess_user:
.word uaccess_user_put_byte
.word uaccess_user_get_byte
.word uaccess_user_put_half
.word uaccess_user_get_half
.word uaccess_user_put_word
.word uaccess_user_get_word
.word __arch_copy_from_user
.word __arch_copy_to_user
.word __arch_clear_user
.word __arch_strncpy_from_user
.word __arch_strnlen_user
@ In : r0 = x, r1 = addr, r2 = error
@ Out: r2 = error
uaccess_user_put_byte:
stmfd sp!, {lr}
USER( strbt r0, [r1])
ldmfd sp!, {pc}^
@ In : r0 = x, r1 = addr, r2 = error
@ Out: r2 = error
uaccess_user_put_half:
stmfd sp!, {lr}
USER( strbt r0, [r1], #1)
mov r0, r0, lsr #8
USER( strbt r0, [r1])
ldmfd sp!, {pc}^
@ In : r0 = x, r1 = addr, r2 = error
@ Out: r2 = error
uaccess_user_put_word:
stmfd sp!, {lr}
USER( strt r0, [r1])
ldmfd sp!, {pc}^
9001: mov r2, #-EFAULT
ldmfd sp!, {pc}^
@ In : r0 = addr, r1 = error
@ Out: r0 = x, r1 = error
uaccess_user_get_byte:
stmfd sp!, {lr}
USER( ldrbt r0, [r0])
ldmfd sp!, {pc}^
@ In : r0 = addr, r1 = error
@ Out: r0 = x, r1 = error
uaccess_user_get_half:
stmfd sp!, {lr}
USER( ldrt r0, [r0])
mov r0, r0, lsl #16
mov r0, r0, lsr #16
ldmfd sp!, {pc}^
@ In : r0 = addr, r1 = error
@ Out: r0 = x, r1 = error
uaccess_user_get_word:
stmfd sp!, {lr}
USER( ldrt r0, [r0])
ldmfd sp!, {pc}^
9001: mov r1, #-EFAULT
ldmfd sp!, {pc}^
.globl uaccess_kernel
uaccess_kernel:
.word uaccess_kernel_put_byte
.word uaccess_kernel_get_byte
.word uaccess_kernel_put_half
.word uaccess_kernel_get_half
.word uaccess_kernel_put_word
.word uaccess_kernel_get_word
.word uaccess_kernel_copy
.word uaccess_kernel_copy
.word uaccess_kernel_clear
.word uaccess_kernel_strncpy_from
.word uaccess_kernel_strnlen
@ In : r0 = x, r1 = addr, r2 = error
@ Out: r2 = error
uaccess_kernel_put_byte:
stmfd sp!, {lr}
strb r0, [r1]
ldmfd sp!, {pc}^
@ In : r0 = x, r1 = addr, r2 = error
@ Out: r2 = error
uaccess_kernel_put_half:
stmfd sp!, {lr}
strb r0, [r1]
mov r0, r0, lsr #8
strb r0, [r1, #1]
ldmfd sp!, {pc}^
@ In : r0 = x, r1 = addr, r2 = error
@ Out: r2 = error
uaccess_kernel_put_word:
stmfd sp!, {lr}
str r0, [r1]
ldmfd sp!, {pc}^
@ In : r0 = addr, r1 = error
@ Out: r0 = x, r1 = error
uaccess_kernel_get_byte:
stmfd sp!, {lr}
ldrb r0, [r0]
ldmfd sp!, {pc}^
@ In : r0 = addr, r1 = error
@ Out: r0 = x, r1 = error
uaccess_kernel_get_half:
stmfd sp!, {lr}
ldr r0, [r0]
mov r0, r0, lsl #16
mov r0, r0, lsr #16
ldmfd sp!, {pc}^
@ In : r0 = addr, r1 = error
@ Out: r0 = x, r1 = error
uaccess_kernel_get_word:
stmfd sp!, {lr}
ldr r0, [r0]
ldmfd sp!, {pc}^
/* Prototype: int uaccess_kernel_copy(void *to, const char *from, size_t n)
* Purpose : copy a block to kernel memory from kernel memory
* Params : to - kernel memory
* : from - kernel memory
* : n - number of bytes to copy
* Returns : Number of bytes NOT copied.
*/
uaccess_kernel_copy:
stmfd sp!, {lr}
bl memcpy
mov r0, #0
ldmfd sp!, {pc}^
/* Prototype: int uaccess_kernel_clear(void *addr, size_t sz)
* Purpose : clear some kernel memory
* Params : addr - kernel memory address to clear
* : sz - number of bytes to clear
* Returns : number of bytes NOT cleared
*/
uaccess_kernel_clear:
stmfd sp!, {lr}
mov r2, #0
cmp r1, #4
blt 2f
ands ip, r0, #3
beq 1f
cmp ip, #1
strb r2, [r0], #1
strleb r2, [r0], #1
strltb r2, [r0], #1
rsb ip, ip, #4
sub r1, r1, ip @ 7 6 5 4 3 2 1
1: subs r1, r1, #8 @ -1 -2 -3 -4 -5 -6 -7
bmi 2f
str r2, [r0], #4
str r2, [r0], #4
b 1b
2: adds r1, r1, #4 @ 3 2 1 0 -1 -2 -3
strpl r2, [r0], #4
tst r1, #2 @ 1x 1x 0x 0x 1x 1x 0x
strneb r2, [r0], #1
strneb r2, [r0], #1
tst r1, #1 @ x1 x0 x1 x0 x1 x0 x1
strneb r2, [r0], #1
mov r0, #0
ldmfd sp!, {pc}^
/* Prototype: size_t uaccess_kernel_strncpy_from(char *dst, char *src, size_t len)
* Purpose : copy a string from kernel memory to kernel memory
* Params : dst - kernel memory destination
* : src - kernel memory source
* : len - maximum length of string
* Returns : number of characters copied
*/
uaccess_kernel_strncpy_from:
stmfd sp!, {lr}
mov ip, r2
1: subs r2, r2, #1
bmi 2f
ldrb r3, [r1], #1
strb r3, [r0], #1
teq r3, #0
bne 1b
2: subs r0, ip, r2
ldmfd sp!, {pc}^
/* Prototype: int uaccess_kernel_strlen(char *str, long n)
* Purpose : get length of a string in kernel memory
* Params : str - address of string in kernel memory
* Returns : length of string *including terminator*,
* or zero on exception, or n + 1 if too long
*/
uaccess_kernel_strnlen:
stmfd sp!, {lr}
mov r2, r0
1: ldrb r1, [r0], #1
teq r1, #0
beq 2f
subs r1, r1, #1
bne 1b
add r0, r0, #1
2: sub r0, r0, r2
ldmfd sp!, {pc}^
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