summaryrefslogtreecommitdiffstats
path: root/arch/arm/lib
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/lib')
-rw-r--r--arch/arm/lib/Makefile27
-rw-r--r--arch/arm/lib/extractconstants.pl46
-rw-r--r--arch/arm/lib/getconsdata.c61
-rw-r--r--arch/arm/lib/io-acorn.S4
-rw-r--r--arch/arm/lib/io-ebsa285.S109
-rw-r--r--arch/arm/lib/ll_char_wr.S25
-rw-r--r--arch/arm/lib/memcpy.S11
-rw-r--r--arch/arm/lib/uaccess.S35
8 files changed, 263 insertions, 55 deletions
diff --git a/arch/arm/lib/Makefile b/arch/arm/lib/Makefile
index 10fad6b43..8ec13266d 100644
--- a/arch/arm/lib/Makefile
+++ b/arch/arm/lib/Makefile
@@ -5,17 +5,13 @@
#
L_TARGET := lib.a
-L_OBJS := backtrace.o bitops.o delay.o fp_support.o \
+L_OBJS := backtrace.o bitops.o checksum.o delay.o fp_support.o \
loaders.o memcpy.o memfastset.o system.o string.o uaccess.o
ifeq ($(PROCESSOR),armo)
L_OBJS += uaccess-armo.o
endif
-ifdef CONFIG_INET
- L_OBJS += checksum.o
-endif
-
ifdef CONFIG_ARCH_ACORN
L_OBJS += ll_char_wr.o io-acorn.o
ifdef CONFIG_ARCH_A5K
@@ -26,30 +22,27 @@ ifdef CONFIG_ARCH_ACORN
endif
endif
-ifdef CONFIG_ARCH_EBSA110
+ifeq ($(MACHINE),ebsa110)
L_OBJS += io-ebsa110.o
endif
-include $(TOPDIR)/Rules.make
+ifeq ($(MACHINE),ebsa285)
+ L_OBJS += io-ebsa285.o
+endif
-constants.h: getconstants
- ./getconstants > constants.h
+include $(TOPDIR)/Rules.make
-getconstants: getconstants.c getconstants.h
- $(HOSTCC) -D__KERNEL__ -o getconstants getconstants.c
+constants.h: getconsdata.o extractconstants.pl
+ $(PERL) extractconstants.pl $(OBJDUMP) > $@
-getconstants.h: getconsdata.c
+getconsdata.o: getconsdata.c
$(CC) $(CFLAGS) -c getconsdata.c
- $(PERL) extractinfo.perl $(OBJDUMP) > $@
%.o: %.S
-ifndef $(CONFIG_BINUTILS_NEW)
+ifneq ($(CONFIG_BINUTILS_NEW),y)
$(CC) $(CFLAGS) -D__ASSEMBLY__ -E $< | tr ';$$' '\n#' > ..tmp.$<.s
$(CC) $(CFLAGS:-pipe=) -c -o $@ ..tmp.$<.s
$(RM) ..tmp.$<.s
else
$(CC) $(CFLAGS) -D__ASSEMBLY__ -c -o $@ $<
endif
-
-clean:
- $(RM) getconstants constants.h getconstants.h
diff --git a/arch/arm/lib/extractconstants.pl b/arch/arm/lib/extractconstants.pl
new file mode 100644
index 000000000..ff095a232
--- /dev/null
+++ b/arch/arm/lib/extractconstants.pl
@@ -0,0 +1,46 @@
+#!/usr/bin/perl
+
+$OBJDUMP=$ARGV[0];
+
+sub swapdata {
+ local ($num) = @_;
+
+ return substr($num, 6, 2).substr($num, 4, 2).substr ($num, 2, 2).substr ($num, 0, 2);
+}
+
+open (DATA, $OBJDUMP.' --full-contents --section=.data getconsdata.o | grep \'^ 00\' |') ||
+ die ('Cant objdump!');
+while (<DATA>) {
+ ($addr, $data0, $data1, $data2, $data3) = split (' ');
+ $dat[hex($addr)] = hex(&swapdata($data0));
+ $dat[hex($addr)+4] = hex(&swapdata($data1));
+ $dat[hex($addr)+8] = hex(&swapdata($data2));
+ $dat[hex($addr)+12] = hex(&swapdata($data3));
+}
+close (DATA);
+
+open (DATA, $OBJDUMP.' --syms getconsdata.o |') || die ('Cant objdump!');
+while (<DATA>) {
+ /elf32/ && ( $elf = 1 );
+ /a.out/ && ( $aout = 1 );
+ next if ($aout && ! / 07 /);
+ next if ($elf && ! (/^00...... g/ && /.data/));
+ next if (!$aout && !$elf);
+
+ if ($aout) {
+ ($addr, $flags, $sect, $a1, $a2, $a3, $name) = split (' ');
+ $nam[hex($addr)] = substr($name, 1);
+ }
+ if ($elf) {
+ chomp;
+ $addr = substr ($_, 0, 8);
+ $name = substr ($_, 32);
+ $nam[hex($addr)] = $name;
+ }
+}
+close (DATA);
+
+print "/*\n * *** This file is automatically generated from getconsdata.c. Do not edit! ***\n */\n";
+for ($i = 0; $i < hex($addr)+4; $i += 4) {
+ print "#define $nam[$i] $dat[$i]\n";
+}
diff --git a/arch/arm/lib/getconsdata.c b/arch/arm/lib/getconsdata.c
index 901c1ad16..bdf09d5a3 100644
--- a/arch/arm/lib/getconsdata.c
+++ b/arch/arm/lib/getconsdata.c
@@ -1,9 +1,8 @@
/*
* linux/arch/arm/lib/getconsdata.c
*
- * Copyright (C) 1995, 1996 Russell King
+ * Copyright (C) 1995-1998 Russell King
*/
-
#include <linux/config.h>
#include <linux/sched.h>
#include <linux/mm.h>
@@ -15,17 +14,55 @@
#define OFF_MM(n) (unsigned long)&(((struct mm_struct *)0)->n)
#ifdef KERNEL_DOMAIN
-unsigned long kernel_domain = KERNEL_DOMAIN;
+unsigned long DOM_KERNELDOMAIN = KERNEL_DOMAIN;
#endif
#ifdef USER_DOMAIN
-unsigned long user_domain = USER_DOMAIN;
-#endif
-unsigned long addr_limit = OFF_TSK(addr_limit);
-unsigned long tss_memmap = OFF_TSK(tss.memmap);
-unsigned long mm = OFF_TSK(mm);
-unsigned long pgd = OFF_MM(pgd);
-unsigned long tss_save = OFF_TSK(tss.save);
-unsigned long tss_fpesave = OFF_TSK(tss.fpstate.soft.save);
+unsigned long DOM_USERDOMAIN = USER_DOMAIN;
+#endif
+
+unsigned long TSK_STATE = OFF_TSK(state);
+unsigned long TSK_FLAGS = OFF_TSK(flags);
+unsigned long TSK_SIGPENDING = OFF_TSK(sigpending);
+unsigned long TSK_ADDR_LIMIT = OFF_TSK(addr_limit);
+
+unsigned long MM = OFF_TSK(mm);
+unsigned long PGD = OFF_MM(pgd);
+
+unsigned long TSS_MEMMAP = OFF_TSK(tss.memmap);
+unsigned long TSS_SAVE = OFF_TSK(tss.save);
+unsigned long TSS_FPESAVE = OFF_TSK(tss.fpstate.soft.save);
#if defined(CONFIG_CPU_ARM2) || defined(CONFIG_CPU_ARM3)
-unsigned long tss_memcmap = OFF_TSK(tss.memcmap);
+unsigned long TSS_MEMCMAP = OFF_TSK(tss.memcmap);
+#endif
+
+#ifdef _PAGE_PRESENT
+unsigned long PAGE_PRESENT = _PAGE_PRESENT;
+#endif
+#ifdef _PAGE_RW
+unsigned long PAGE_RW = _PAGE_RW;
#endif
+#ifdef _PAGE_USER
+unsigned long PAGE_USER = _PAGE_USER;
+#endif
+#ifdef _PAGE_ACCESSED
+unsigned long PAGE_ACCESSED = _PAGE_ACCESSED;
+#endif
+#ifdef _PAGE_DIRTY
+unsigned long PAGE_DIRTY = _PAGE_DIRTY;
+#endif
+#ifdef _PAGE_READONLY
+unsigned long PAGE_READONLY = _PAGE_READONLY;
+#endif
+#ifdef _PAGE_NOT_USER
+unsigned long PAGE_NOT_USER = _PAGE_NOT_USER;
+#endif
+#ifdef _PAGE_OLD
+unsigned long PAGE_OLD = _PAGE_OLD;
+#endif
+#ifdef _PAGE_CLEAN
+unsigned long PAGE_CLEAN = _PAGE_CLEAN;
+#endif
+
+unsigned long KSWI_BASE = 0x900000;
+unsigned long KSWI_SYS_BASE = 0x9f0000;
+unsigned long SYS_ERROR0 = 0x9f0000;
diff --git a/arch/arm/lib/io-acorn.S b/arch/arm/lib/io-acorn.S
index 172783b02..51550e014 100644
--- a/arch/arm/lib/io-acorn.S
+++ b/arch/arm/lib/io-acorn.S
@@ -57,7 +57,7 @@ ENTRY(insw)
mov r2, r2, lsl#1
ENTRY(inswb)
mov ip, sp
- stmfd sp!, {r4 - r10 ,fp ,ip ,lr ,pc}
+ stmfd sp!, {r4 - r10, fp, ip, lr, pc}
sub fp, ip, #4
addr r3, r0
add r0, r3, r0, lsl #2
@@ -70,7 +70,7 @@ ENTRY(inswb)
strgeb r4, [r1], #1
movgt r4, r4, LSR#8
strgtb r4, [r1], #1
- ldmleea fp, {r4 - r10, fp, sp, pc}^
+ LOADREGS(leea, fp, {r4 - r10, fp, sp, pc})
sub r2, r2, #2
Linswok: mov ip, #0xFF
orr ip, ip, ip, lsl #8
diff --git a/arch/arm/lib/io-ebsa285.S b/arch/arm/lib/io-ebsa285.S
new file mode 100644
index 000000000..a5c6386f0
--- /dev/null
+++ b/arch/arm/lib/io-ebsa285.S
@@ -0,0 +1,109 @@
+#define __ASSEMBLER__
+#include <linux/linkage.h>
+
+ENTRY(insl)
+ add r0, r0, #0xff000000
+ add r0, r0, #0x00e00000
+ ands ip, r1, #3
+ bne 2f
+
+1: ldr r3, [r0]
+ str r3, [r1], #4
+ subs r2, r2, #1
+ bne 1b
+ mov pc, lr
+
+2: cmp ip, #2
+ ldr ip, [r0]
+ blt 3f
+ bgt 4f
+
+ strh ip, [r1], #2
+ mov ip, ip, lsr #16
+1: subs r2, r2, #1
+ ldrne r3, [r0]
+ orrne ip, ip, r3, lsl #16
+ strne ip, [r1], #4
+ movne ip, r3, lsr #16
+ bne 1b
+ strh ip, [r1], #2
+ mov pc, lr
+
+3: strb ip, [r1], #1
+ mov ip, ip, lsr #8
+ strh ip, [r1], #2
+ mov ip, ip, lsr #16
+1: subs r2, r2, #1
+ ldrne r3, [r0]
+ orrne ip, ip, r3, lsl #8
+ strne ip, [r1], #4
+ movne ip, r3, lsr #24
+ bne 1b
+ strb ip, [r1], #1
+ mov pc, lr
+
+4: strb ip, [r1], #1
+ mov ip, ip, lsr #8
+1: subs r2, r2, #1
+ ldrne r3, [r0]
+ orrne ip, ip, r3, lsl #24
+ strne ip, [r1], #4
+ movne ip, r3, lsr #8
+ bne 1b
+ strb ip, [r1], #1
+ mov ip, ip, lsr #8
+ strh ip, [r1], #2
+ mov pc, lr
+
+ENTRY(outsl)
+ add r0, r0, #0xff000000
+ add r0, r0, #0x00e00000
+ ands ip, r1, #3
+ bne 2f
+
+1: ldr r3, [r1], #4
+ str r3, [r0]
+ subs r2, r2, #1
+ bne 1b
+ mov pc, lr
+
+2: bic r1, r1, #3
+ cmp ip, #2
+ ldr ip, [r1], #4
+ mov ip, ip, lsr #16
+ blt 3f
+ bgt 4f
+
+1: ldr r3, [r1], #4
+ orr ip, ip, r3, lsl #16
+ str ip, [r0]
+ mov ip, r3, lsr #16
+ subs r2, r2, #1
+ bne 1b
+ mov pc, lr
+
+3: ldr r3, [r1], #4
+ orr ip, ip, r3, lsl #8
+ str ip, [r0]
+ mov ip, r3, lsr #24
+ subs r2, r2, #1
+ bne 3b
+ mov pc, lr
+
+4: ldr r3, [r1], #4
+ orr ip, ip, r3, lsl #24
+ str ip, [r0]
+ mov ip, r3, lsr #8
+ subs r2, r2, #1
+ bne 4b
+ mov pc, lr
+
+
+ENTRY(outsw)
+ENTRY(outswb)
+ mov pc, lr
+
+ENTRY(insw)
+ENTRY(inswb)
+ mov pc, lr
+
diff --git a/arch/arm/lib/ll_char_wr.S b/arch/arm/lib/ll_char_wr.S
index 7df08d93b..fb1a5c5a4 100644
--- a/arch/arm/lib/ll_char_wr.S
+++ b/arch/arm/lib/ll_char_wr.S
@@ -3,9 +3,10 @@
*
* Copyright (C) 1995, 1996 Russell King.
*
- * Speedups & 1bpp code (C) 1996 Philip Blundel & Russell King.
+ * Speedups & 1bpp code (C) 1996 Philip Blundell & Russell King.
*
* 10-04-96 RMK Various cleanups & reduced register usage.
+ * 08-04-98 RMK Shifts re-ordered
*/
@ Regs: [] = corruptable
@@ -32,22 +33,22 @@ ENTRY(ll_write_char)
@
@ Smashable regs: {r0 - r3}, [r4 - r7], (r8 - fp), [ip], (sp), [lr], (pc)
@
- eor ip, r1, #UNDERLINE << 24
+ eor ip, r1, #UNDERLINE << 9
/*
* calculate colours
*/
- tst r1, #INVERSE << 24
- moveq r2, r1, lsr #8
- moveq r3, r1, lsr #16
- movne r2, r1, lsr #16
- movne r3, r1, lsr #8
+ tst r1, #INVERSE << 9
+ moveq r2, r1, lsr #16
+ moveq r3, r1, lsr #24
+ movne r2, r1, lsr #24
+ movne r3, r1, lsr #16
and r3, r3, #255
and r2, r2, #255
/*
* calculate offset into character table
*/
- and r1, r1, #255
- mov r1, r1, lsl #3
+ mov r1, r1, lsl #23
+ mov r1, r1, lsr #20
/*
* calculate offset required for each row [maybe I should make this an argument to this fn.
* Have to see what the register usage is like in the calling routines.
@@ -67,7 +68,7 @@ ENTRY(ll_write_char)
add r0, r0, r5, lsl #3 @ Move to bottom of character
add r1, r1, #7
ldrb r7, [r6, r1]
- tst ip, #UNDERLINE << 24
+ tst ip, #UNDERLINE << 9
eoreq r7, r7, #255
teq r4, #8
beq Lrow8bpplp
@@ -131,7 +132,7 @@ Lrow8bpplp: mov ip, r7, lsr #4
@
Lrow1bpp: add r6, r6, r1
ldmia r6, {r4, r7}
- tst ip, #INVERSE << 24
+ tst ip, #INVERSE << 9
mvnne r4, r4
mvnne r7, r7
strb r4, [r0], r5
@@ -147,7 +148,7 @@ Lrow1bpp: add r6, r6, r1
mov r7, r7, lsr #8
strb r7, [r0], r5
mov r7, r7, lsr #8
- tst ip, #UNDERLINE << 24
+ tst ip, #UNDERLINE << 9
mvneq r7, r7
strb r7, [r0], r5
LOADREGS(fd, sp!, {r4 - r7, pc})
diff --git a/arch/arm/lib/memcpy.S b/arch/arm/lib/memcpy.S
index 209768f9f..f26e6cb1c 100644
--- a/arch/arm/lib/memcpy.S
+++ b/arch/arm/lib/memcpy.S
@@ -8,6 +8,12 @@
#include <asm/assembler.h>
#include <linux/linkage.h>
+#ifndef ENTRY
+#define ENTRY(x...) \
+ .globl _##x; \
+_##x:
+#endif
+
.text
#define ENTER \
mov ip,sp ;\
@@ -84,6 +90,7 @@ ENTRY(memmove)
blt 6b
ands ip, r1, #3
beq 1b
+
8: bic r1, r1, #3
ldr r7, [r1], #4
cmp ip, #2
@@ -105,14 +112,14 @@ ENTRY(memmove)
subs r2, r2, #16
bge 9b
adds r2, r2, #12
- blt 1b
+ blt 100f
10: mov r3, r7, lsr #8
ldr r7, [r1], #4
orr r3, r3, r7, lsl #24
str r3, [r0], #4
subs r2, r2, #4
bge 10b
- sub r1, r1, #3
+100: sub r1, r1, #3
b 6b
11: cmp r2, #12
diff --git a/arch/arm/lib/uaccess.S b/arch/arm/lib/uaccess.S
index a1524bee9..78256b319 100644
--- a/arch/arm/lib/uaccess.S
+++ b/arch/arm/lib/uaccess.S
@@ -13,13 +13,21 @@
#include <asm/errno.h>
.text
-
+#ifdef ENTRY
#define USER(x...) \
9999: x; \
.section __ex_table,"a"; \
.align 3; \
.long 9999b,9001f; \
.previous
+#else
+#define USER(x...) \
+ x
+#define ENTRY(x...) \
+ .globl _##x; \
+_##x:
+#define TESTING
+#endif
#define PAGE_SHIFT 12
@@ -278,12 +286,12 @@ USER( strgebt r3, [r0], #1) // May fault
USER( strgtbt r3, [r0], #1) // May fault
b .c2u_finished
+#ifndef TESTING
.section .fixup,"ax"
.align 0
9001: LOADREGS(fd,sp!, {r0, r4 - r7, pc})
.previous
-
-
+#endif
/* Prototype: unsigned long __arch_copy_from_user(void *to,const void *from,unsigned long n);
* Purpose : copy a block from user memory to kernel memory
@@ -538,10 +546,12 @@ USER( ldrget r3, [r1], #0) // May fault
strgtb r3, [r0], #1
b .cfu_finished
+#ifndef TESTING
.section .fixup,"ax"
.align 0
9001: LOADREGS(fd,sp!, {r0, r4 - r7, pc})
.previous
+#endif
/* Prototype: int __arch_clear_user(void *addr, size_t sz)
* Purpose : clear some user memory
@@ -556,7 +566,7 @@ ENTRY(__arch_clear_user)
blt 2f
ands ip, r0, #3
beq 1f
- cmp ip, #1
+ cmp ip, #2
USER( strbt r2, [r0], #1)
USER( strlebt r2, [r0], #1)
USER( strltbt r2, [r0], #1)
@@ -566,9 +576,9 @@ USER( strltbt r2, [r0], #1)
USER( strplt r2, [r0], #4)
USER( strplt r2, [r0], #4)
bpl 1b
-2: adds r1, r1, #4 @ 3 2 1 0 -1 -2 -3
+ adds r1, r1, #4 @ 3 2 1 0 -1 -2 -3
USER( strplt r2, [r0], #4)
- tst r1, #2 @ 1x 1x 0x 0x 1x 1x 0x
+2: tst r1, #2 @ 1x 1x 0x 0x 1x 1x 0x
USER( strnebt r2, [r0], #1)
USER( strnebt r2, [r0], #1)
tst r1, #1 @ x1 x0 x1 x0 x1 x0 x1
@@ -576,6 +586,7 @@ USER( strnebt r2, [r0], #1)
mov r0, #0
LOADREGS(fd,sp!, {r1, pc})
+#ifndef TESTING
.section .fixup,"ax"
.align 0
9001: LOADREGS(fd,sp!, {r0, pc})
@@ -611,21 +622,25 @@ USER( ldrbt r1, [r0], #1)
*/
ENTRY(__arch_strncpy_from_user)
stmfd sp!, {lr}
- mov ip, r2
+ add ip, r1, #1
1: subs r2, r2, #1
bmi 2f
USER( ldrbt r3, [r1], #1)
strb r3, [r0], #1
teq r3, #0
bne 1b
-2: subs r0, ip, r2
- LOADREGS(fd,sp!, {pc})
+ sub r0, r1, ip
+ LOADREGS(fd, sp!, {pc})
+2: sub ip, ip, #1
+ sub r0, r1, ip
+ LOADREGS(fd, sp!, {pc})
.section .fixup,"ax"
.align 0
9001: mov r0, #-EFAULT
- LOADREGS(fd,sp!, {pc})
+ LOADREGS(fd, sp!, {pc})
.previous
.align
+#endif