mirror of https://github.com/hak5/openwrt.git
parent
f53f060299
commit
437f2bd5c1
|
@ -236,7 +236,12 @@ static inline int atomic_add_unless(atomic_t *v, int a, int u)
|
|||
|
||||
#define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0)
|
||||
|
||||
#include <linux/version.h>
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32)
|
||||
#include <asm-generic/atomic-long.h>
|
||||
#else
|
||||
#include <asm-generic/atomic.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The following is not a real function. The compiler should remove the function
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
#include <asm-generic/bitsperlong.h>
|
|
@ -28,10 +28,12 @@
|
|||
#ifndef _ASM_UBICOM32_PAGE_H
|
||||
#define _ASM_UBICOM32_PAGE_H
|
||||
|
||||
#include <linux/const.h>
|
||||
|
||||
/* PAGE_SHIFT determines the page size */
|
||||
|
||||
#define PAGE_SHIFT 12
|
||||
#define PAGE_SIZE (1 << PAGE_SHIFT)
|
||||
#define PAGE_SHIFT (12)
|
||||
#define PAGE_SIZE (_AC(1,UL) << PAGE_SHIFT)
|
||||
#define PAGE_MASK (~(PAGE_SIZE-1))
|
||||
|
||||
#include <asm/setup.h>
|
||||
|
@ -99,7 +101,15 @@ extern unsigned long memory_end;
|
|||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
|
||||
#ifdef __KERNEL__
|
||||
#define VM_DATA_DEFAULT_FLAGS \
|
||||
(VM_READ | VM_WRITE | \
|
||||
((current->personality & READ_IMPLIES_EXEC) ? VM_EXEC : 0 ) | \
|
||||
VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
|
||||
|
||||
#include <linux/version.h>
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32)
|
||||
#include <asm-generic/getorder.h>
|
||||
#else
|
||||
#include <asm-generic/page.h>
|
||||
#endif
|
||||
|
||||
|
|
|
@ -114,11 +114,15 @@ extern inline void flush_pages_to_ram (unsigned long address, int n)
|
|||
#define VMALLOC_START 0
|
||||
#define VMALLOC_END 0xffffffff
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32)
|
||||
#include <asm-generic/pgtable.h>
|
||||
#else
|
||||
#define arch_enter_lazy_mmu_mode() do {} while (0)
|
||||
#define arch_leave_lazy_mmu_mode() do {} while (0)
|
||||
#define arch_flush_lazy_mmu_mode() do {} while (0)
|
||||
#define arch_enter_lazy_cpu_mode() do {} while (0)
|
||||
#define arch_leave_lazy_cpu_mode() do {} while (0)
|
||||
#define arch_flush_lazy_cpu_mode() do {} while (0)
|
||||
#endif
|
||||
|
||||
#endif /* _ASM_UBICOM32_PGTABLE_H */
|
||||
|
|
|
@ -124,7 +124,12 @@ typedef struct {
|
|||
#define MINSIGSTKSZ 2048
|
||||
#define SIGSTKSZ 8192
|
||||
|
||||
#include <linux/version.h>
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32)
|
||||
#include <asm-generic/signal-defs.h>
|
||||
#else
|
||||
#include <asm-generic/signal.h>
|
||||
#endif
|
||||
|
||||
#ifdef __KERNEL__
|
||||
struct old_sigaction {
|
||||
|
|
|
@ -84,4 +84,7 @@
|
|||
#define SO_TIMESTAMPING 37
|
||||
#define SCM_TIMESTAMPING SO_TIMESTAMPING
|
||||
|
||||
#define SO_PROTOCOL 38
|
||||
#define SO_DOMAIN 39
|
||||
|
||||
#endif /* _ASM_UBICOM32_SOCKET_H */
|
||||
|
|
|
@ -34,12 +34,15 @@
|
|||
#include <linux/mqueue.h>
|
||||
#include <linux/uaccess.h>
|
||||
#include <asm/pgtable.h>
|
||||
#include <linux/version.h>
|
||||
|
||||
///static struct fs_struct init_fs = INIT_FS;
|
||||
static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
|
||||
static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,32)
|
||||
struct mm_struct init_mm = INIT_MM(init_mm);
|
||||
EXPORT_SYMBOL(init_mm);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Initial task structure.
|
||||
|
|
|
@ -169,7 +169,7 @@ static struct clocksource timer_device_clockbase = {
|
|||
* timer_device_alloc_event()
|
||||
* Allocate a timer device event.
|
||||
*/
|
||||
static int timer_device_alloc_event(const char *name, int cpuid, const cpumask_t *mask)
|
||||
static int timer_device_alloc_event(const char *name, int cpuid, const struct cpumask *cpumask)
|
||||
{
|
||||
struct clock_event_device *dev;
|
||||
struct irqaction *action;
|
||||
|
@ -208,10 +208,10 @@ static int timer_device_alloc_event(const char *name, int cpuid, const cpumask_t
|
|||
action->name = name;
|
||||
action->flags = IRQF_DISABLED | IRQF_TIMER;
|
||||
action->handler = timer_device_event;
|
||||
cpumask_copy(&action->mask, mask);
|
||||
//cpumask_copy(&action->mask, mask);
|
||||
action->dev_id = dev;
|
||||
setup_irq(dev->irq, action);
|
||||
irq_set_affinity(dev->irq, mask);
|
||||
irq_set_affinity(dev->irq, cpumask);
|
||||
ldsr_disable_vector(dev->irq);
|
||||
|
||||
/*
|
||||
|
@ -229,7 +229,7 @@ static int timer_device_alloc_event(const char *name, int cpuid, const cpumask_t
|
|||
dev->mult = div_sc(frequency, NSEC_PER_SEC, dev->shift);
|
||||
dev->max_delta_ns = clockevent_delta2ns(0xffffffff, dev);
|
||||
dev->min_delta_ns = clockevent_delta2ns(100, dev);
|
||||
dev->cpumask = mask;
|
||||
//dev->cpumask = mask;
|
||||
printk(KERN_NOTICE "timer[%d]: %s - created\n", dev->irq, dev->name);
|
||||
|
||||
/*
|
||||
|
@ -246,7 +246,7 @@ static int timer_device_alloc_event(const char *name, int cpuid, const cpumask_t
|
|||
*/
|
||||
int __cpuinit local_timer_setup(unsigned int cpu)
|
||||
{
|
||||
return timer_device_alloc_event("timer-cpu", cpu, cpumask_of(cpu));
|
||||
return timer_device_alloc_event("timer-cpu", cpu);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -283,19 +283,19 @@ void timer_device_init(void)
|
|||
/*
|
||||
* Always allocate a primary timer.
|
||||
*/
|
||||
timer_device_alloc_event("timer-primary", -1, CPU_MASK_ALL_PTR);
|
||||
timer_device_alloc_event("timer-primary", -1, cpu_all_mask);
|
||||
|
||||
#if defined(CONFIG_GENERIC_CLOCKEVENTS_BROADCAST)
|
||||
/*
|
||||
* If BROADCAST is selected we need to add a broadcast timer.
|
||||
*/
|
||||
timer_device_alloc_event("timer-broadcast", -1, CPU_MASK_ALL_PTR);
|
||||
timer_device_alloc_event("timer-broadcast", -1, cpu_all_mask);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Allocate extra timers that are requested.
|
||||
*/
|
||||
for (i = 0; i < CONFIG_TIMER_EXTRA_ALLOC; i++) {
|
||||
timer_device_alloc_event("timer-extra", -1, CPU_MASK_ALL_PTR);
|
||||
timer_device_alloc_event("timer-extra", -1, cpu_all_mask);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -634,6 +634,19 @@ void ubi32_eth_cleanup(void)
|
|||
}
|
||||
}
|
||||
|
||||
static const struct net_device_ops ubi32_netdev_ops = {
|
||||
.ndo_open = ubi32_eth_open,
|
||||
.ndo_stop = ubi32_eth_close,
|
||||
.ndo_start_xmit = ubi32_eth_start_xmit,
|
||||
.ndo_tx_timeout = ubi32_eth_tx_timeout,
|
||||
.ndo_do_ioctl = ubi32_eth_ioctl,
|
||||
.ndo_change_mtu = ubi32_eth_change_mtu,
|
||||
.ndo_set_config = ubi32_eth_set_config,
|
||||
.ndo_get_stats = ubi32_eth_get_stats,
|
||||
.ndo_validate_addr = eth_validate_addr,
|
||||
.ndo_set_mac_address = eth_mac_addr,
|
||||
};
|
||||
|
||||
int ubi32_eth_init_module(void)
|
||||
{
|
||||
struct ethtionode *eth_node;
|
||||
|
@ -706,16 +719,9 @@ int ubi32_eth_init_module(void)
|
|||
|
||||
spin_lock_init(&priv->lock);
|
||||
|
||||
dev->open = ubi32_eth_open;
|
||||
dev->stop = ubi32_eth_close;
|
||||
dev->hard_start_xmit = ubi32_eth_start_xmit;
|
||||
dev->tx_timeout = ubi32_eth_tx_timeout;
|
||||
dev->watchdog_timeo = UBI32_ETH_VP_TX_TIMEOUT;
|
||||
dev->netdev_ops = &ubi32_netdev_ops;
|
||||
|
||||
dev->set_config = ubi32_eth_set_config;
|
||||
dev->do_ioctl = ubi32_eth_ioctl;
|
||||
dev->get_stats = ubi32_eth_get_stats;
|
||||
dev->change_mtu = ubi32_eth_change_mtu;
|
||||
dev->watchdog_timeo = UBI32_ETH_VP_TX_TIMEOUT;
|
||||
#ifdef UBICOM32_USE_NAPI
|
||||
netif_napi_add(dev, &priv->napi, ubi32_eth_napi_poll, UBI32_ETH_NAPI_WEIGHT);
|
||||
#endif
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
#include <linux/tty.h>
|
||||
#include <linux/tty_flip.h>
|
||||
#include <linux/serial_core.h>
|
||||
#include <linux/version.h>
|
||||
|
||||
#include <asm/ip5000.h>
|
||||
|
||||
|
@ -259,8 +260,13 @@ static void ubi32_mailbox_enable_ms(struct uart_port *port)
|
|||
|
||||
static void ubi32_mailbox_rx_chars(struct ubi32_mailbox_port *uart)
|
||||
{
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32)
|
||||
struct uart_state *state = uart->port.state;
|
||||
struct tty_struct *tty = state->port.tty;
|
||||
#else
|
||||
struct uart_info *info = uart->port.info;
|
||||
struct tty_struct *tty = info->port.tty;
|
||||
#endif
|
||||
unsigned int status, ch, flg;
|
||||
|
||||
status = 0; // XXX? UART_GET_LSR(uart);
|
||||
|
@ -308,7 +314,11 @@ static void ubi32_mailbox_rx_chars(struct ubi32_mailbox_port *uart)
|
|||
|
||||
static void ubi32_mailbox_tx_chars(struct ubi32_mailbox_port *uart)
|
||||
{
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32)
|
||||
struct circ_buf *xmit = &uart->port.state->xmit;
|
||||
#else
|
||||
struct circ_buf *xmit = &uart->port.info->xmit;
|
||||
#endif
|
||||
|
||||
if (uart->port.x_char) {
|
||||
UART_PUT_CHAR(uart, uart->port.x_char);
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,150 @@
|
|||
--- a/arch/ubicom32/kernel/vmlinux.lds.S
|
||||
+++ b/arch/ubicom32/kernel/vmlinux.lds.S
|
||||
@@ -25,7 +25,6 @@
|
||||
* arch/blackfin
|
||||
* arch/parisc
|
||||
*/
|
||||
-#include <asm-generic/vmlinux.lds.h>
|
||||
#include <asm/ocm_size.h>
|
||||
#include <asm/memory_map.h>
|
||||
#include <asm/thread_info.h>
|
||||
@@ -201,94 +200,28 @@ SECTIONS {
|
||||
*(__ex_table)
|
||||
__stop___ex_table = .;
|
||||
|
||||
- *(.rodata) *(.rodata.*)
|
||||
- *(__vermagic) /* Kernel version magic */
|
||||
- *(__markers_strings)
|
||||
- *(.rodata1)
|
||||
- *(.rodata.str1.1)
|
||||
- *(__tracepoints_strings)
|
||||
-
|
||||
- /* PCI quirks */
|
||||
- __start_pci_fixups_early = . ;
|
||||
- *(.pci_fixup_early)
|
||||
- __end_pci_fixups_early = . ;
|
||||
- __start_pci_fixups_header = . ;
|
||||
- *(.pci_fixup_header)
|
||||
- __end_pci_fixups_header = . ;
|
||||
- __start_pci_fixups_final = . ;
|
||||
- *(.pci_fixup_final)
|
||||
- __end_pci_fixups_final = . ;
|
||||
- __start_pci_fixups_enable = . ;
|
||||
- *(.pci_fixup_enable)
|
||||
- __end_pci_fixups_enable = . ;
|
||||
- __start_pci_fixups_resume = . ;
|
||||
- *(.pci_fixup_resume)
|
||||
- __end_pci_fixups_resume = . ;
|
||||
- __start_pci_fixups_resume_early = . ;
|
||||
- *(.pci_fixup_resume_early)
|
||||
- __end_pci_fixups_resume_early = . ;
|
||||
- __start_pci_fixups_suspend = . ;
|
||||
- *(.pci_fixup_suspend)
|
||||
- __end_pci_fixups_suspend = . ;
|
||||
-
|
||||
- __start_builtin_fw = . ;
|
||||
- *(.builtin_fw)
|
||||
- __end_builtin_fw = . ;
|
||||
-
|
||||
-
|
||||
- /* Kernel symbol table: Normal symbols */
|
||||
- . = ALIGN(4);
|
||||
- __start___ksymtab = .;
|
||||
- *(__ksymtab)
|
||||
- __stop___ksymtab = .;
|
||||
-
|
||||
- /* Kernel symbol table: GPL-only symbols */
|
||||
- __start___ksymtab_gpl = .;
|
||||
- *(__ksymtab_gpl)
|
||||
- __stop___ksymtab_gpl = .;
|
||||
-
|
||||
- /* Kernel symbol table: Normal unused symbols */
|
||||
- __start___ksymtab_unused = .;
|
||||
- *(__ksymtab_unused)
|
||||
- __stop___ksymtab_unused = .;
|
||||
-
|
||||
- /* Kernel symbol table: GPL-only unused symbols */
|
||||
- __start___ksymtab_unused_gpl = .;
|
||||
- *(__ksymtab_unused_gpl)
|
||||
- __stop___ksymtab_unused_gpl = .;
|
||||
-
|
||||
- /* Kernel symbol table: GPL-future symbols */
|
||||
- __start___ksymtab_gpl_future = .;
|
||||
- *(__ksymtab_gpl_future)
|
||||
- __stop___ksymtab_gpl_future = .;
|
||||
-
|
||||
- /* Kernel symbol table: Normal symbols */
|
||||
- __start___kcrctab = .;
|
||||
- *(__kcrctab)
|
||||
- __stop___kcrctab = .;
|
||||
-
|
||||
- /* Kernel symbol table: GPL-only symbols */
|
||||
- __start___kcrctab_gpl = .;
|
||||
- *(__kcrctab_gpl)
|
||||
- __stop___kcrctab_gpl = .;
|
||||
-
|
||||
- /* Kernel symbol table: GPL-future symbols */
|
||||
- __start___kcrctab_gpl_future = .;
|
||||
- *(__kcrctab_gpl_future)
|
||||
- __stop___kcrctab_gpl_future = .;
|
||||
+ } > TEXT
|
||||
|
||||
- /* Kernel symbol table: strings */
|
||||
- *(__ksymtab_strings)
|
||||
+ RO_DATA(16)
|
||||
|
||||
- /* Built-in module parameters */
|
||||
- . = ALIGN(4) ;
|
||||
- __start___param = .;
|
||||
- *(__param)
|
||||
- __stop___param = .;
|
||||
+ .rodata : {} > TEXT
|
||||
+ .rodata1 : {} > TEXT
|
||||
+ .pci_fixup : {} > TEXT
|
||||
+ .builtin_fw : {} > TEXT
|
||||
+ .rio_route : {} > TEXT
|
||||
+ .tracedata : {} > TEXT
|
||||
+ __ksymtab : {} > TEXT
|
||||
+ __ksymtab_gpl : {} > TEXT
|
||||
+ __ksymtab_gpl_future : {} > TEXT
|
||||
+ __kcrctab_gpl : {} > TEXT
|
||||
+ __kcrctab_unused : {} > TEXT
|
||||
+ __kcrctab_unused_gpl : {} > TEXT
|
||||
+ __kcrctab_gpl_future : {} > TEXT
|
||||
+ __ksymtab_strings : {} > TEXT
|
||||
+ __init_rodata : {} > TEXT
|
||||
+ __param : {} > TEXT
|
||||
|
||||
- . = ALIGN(4) ;
|
||||
- _etext = . ;
|
||||
- } > TEXT
|
||||
+ _etext = .;
|
||||
|
||||
.data DATA_ADDR : {
|
||||
. = ALIGN(4);
|
||||
@@ -349,12 +282,6 @@ SECTIONS {
|
||||
PROVIDE (___eh_frame_end = .);
|
||||
} > INIT
|
||||
|
||||
- /DISCARD/ : {
|
||||
- EXIT_TEXT
|
||||
- EXIT_DATA
|
||||
- *(.exitcall.exit)
|
||||
- }
|
||||
-
|
||||
.bss : {
|
||||
. = ALIGN(4);
|
||||
_sbss = . ;
|
||||
@@ -365,6 +292,12 @@ SECTIONS {
|
||||
_end = . ;
|
||||
} > BSS
|
||||
|
||||
+ /DISCARD/ : {
|
||||
+ EXIT_TEXT
|
||||
+ EXIT_DATA
|
||||
+ *(.exitcall.exit)
|
||||
+ }
|
||||
+
|
||||
NOTES > BSS
|
||||
|
||||
}
|
|
@ -0,0 +1,419 @@
|
|||
--- a/arch/ubicom32/Makefile
|
||||
+++ b/arch/ubicom32/Makefile
|
||||
@@ -60,9 +60,6 @@ cflags-$(CONFIG_UBICOM32_V4) := -march=
|
||||
ldflags-$(CONFIG_LINKER_RELAXATION) := --relax
|
||||
LDFLAGS_vmlinux := $(ldflags-y)
|
||||
|
||||
-GCCLIBDIR := $(dir $(shell $(CC) $(cflags-y) -print-libgcc-file-name))
|
||||
-GCC_LIBS := $(GCCLIBDIR)/libgcc.a
|
||||
-
|
||||
KBUILD_CFLAGS += $(cflags-y) -ffunction-sections
|
||||
KBUILD_AFLAGS += $(cflags-y)
|
||||
|
||||
@@ -84,7 +81,6 @@ core-y += arch/$(ARCH)/kernel/ \
|
||||
drivers-$(CONFIG_OPROFILE) += arch/ubicom32/oprofile/
|
||||
|
||||
libs-y += arch/$(ARCH)/lib/
|
||||
-libs-y += $(GCC_LIBS)
|
||||
|
||||
archclean:
|
||||
|
||||
--- a/arch/ubicom32/lib/Makefile
|
||||
+++ b/arch/ubicom32/lib/Makefile
|
||||
@@ -30,3 +30,4 @@
|
||||
#
|
||||
|
||||
lib-y := checksum.o delay.o mem_ubicom32.o
|
||||
+lib-y += ashldi3.o ashrdi3.o divmod.o lshrdi3.o muldi3.o
|
||||
--- /dev/null
|
||||
+++ b/arch/ubicom32/lib/ashldi3.c
|
||||
@@ -0,0 +1,62 @@
|
||||
+/* ashrdi3.c extracted from gcc-2.95.2/libgcc2.c which is: */
|
||||
+/* Copyright (C) 1989, 92-98, 1999 Free Software Foundation, Inc.
|
||||
+
|
||||
+This file is part of GNU CC.
|
||||
+
|
||||
+GNU CC 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, or (at your option)
|
||||
+any later version.
|
||||
+
|
||||
+GNU CC is distributed in the hope that it will be useful,
|
||||
+but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+GNU General Public License for more details.
|
||||
+
|
||||
+You should have received a copy of the GNU General Public License
|
||||
+along with GNU CC; see the file COPYING. If not, write to
|
||||
+the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
+Boston, MA 02111-1307, USA. */
|
||||
+
|
||||
+#define BITS_PER_UNIT 8
|
||||
+
|
||||
+typedef int SItype __attribute__ ((mode (SI)));
|
||||
+typedef unsigned int USItype __attribute__ ((mode (SI)));
|
||||
+typedef int DItype __attribute__ ((mode (DI)));
|
||||
+typedef int word_type __attribute__ ((mode (__word__)));
|
||||
+
|
||||
+struct DIstruct {SItype high, low;};
|
||||
+
|
||||
+typedef union
|
||||
+{
|
||||
+ struct DIstruct s;
|
||||
+ DItype ll;
|
||||
+} DIunion;
|
||||
+
|
||||
+DItype
|
||||
+__ashldi3 (DItype u, word_type b)
|
||||
+{
|
||||
+ DIunion w;
|
||||
+ word_type bm;
|
||||
+ DIunion uu;
|
||||
+
|
||||
+ if (b == 0)
|
||||
+ return u;
|
||||
+
|
||||
+ uu.ll = u;
|
||||
+
|
||||
+ bm = (sizeof (SItype) * BITS_PER_UNIT) - b;
|
||||
+ if (bm <= 0)
|
||||
+ {
|
||||
+ w.s.low = 0;
|
||||
+ w.s.high = (USItype)uu.s.low << -bm;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ USItype carries = (USItype)uu.s.low >> bm;
|
||||
+ w.s.low = (USItype)uu.s.low << b;
|
||||
+ w.s.high = ((USItype)uu.s.high << b) | carries;
|
||||
+ }
|
||||
+
|
||||
+ return w.ll;
|
||||
+}
|
||||
--- /dev/null
|
||||
+++ b/arch/ubicom32/lib/ashrdi3.c
|
||||
@@ -0,0 +1,63 @@
|
||||
+/* ashrdi3.c extracted from gcc-2.7.2/libgcc2.c which is: */
|
||||
+/* Copyright (C) 1989, 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
|
||||
+
|
||||
+This file is part of GNU CC.
|
||||
+
|
||||
+GNU CC 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, or (at your option)
|
||||
+any later version.
|
||||
+
|
||||
+GNU CC is distributed in the hope that it will be useful,
|
||||
+but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+GNU General Public License for more details.
|
||||
+
|
||||
+You should have received a copy of the GNU General Public License
|
||||
+along with GNU CC; see the file COPYING. If not, write to
|
||||
+the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
+Boston, MA 02111-1307, USA. */
|
||||
+
|
||||
+#define BITS_PER_UNIT 8
|
||||
+
|
||||
+typedef int SItype __attribute__ ((mode (SI)));
|
||||
+typedef unsigned int USItype __attribute__ ((mode (SI)));
|
||||
+typedef int DItype __attribute__ ((mode (DI)));
|
||||
+typedef int word_type __attribute__ ((mode (__word__)));
|
||||
+
|
||||
+struct DIstruct {SItype high, low;};
|
||||
+
|
||||
+typedef union
|
||||
+{
|
||||
+ struct DIstruct s;
|
||||
+ DItype ll;
|
||||
+} DIunion;
|
||||
+
|
||||
+DItype
|
||||
+__ashrdi3 (DItype u, word_type b)
|
||||
+{
|
||||
+ DIunion w;
|
||||
+ word_type bm;
|
||||
+ DIunion uu;
|
||||
+
|
||||
+ if (b == 0)
|
||||
+ return u;
|
||||
+
|
||||
+ uu.ll = u;
|
||||
+
|
||||
+ bm = (sizeof (SItype) * BITS_PER_UNIT) - b;
|
||||
+ if (bm <= 0)
|
||||
+ {
|
||||
+ /* w.s.high = 1..1 or 0..0 */
|
||||
+ w.s.high = uu.s.high >> (sizeof (SItype) * BITS_PER_UNIT - 1);
|
||||
+ w.s.low = uu.s.high >> -bm;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ USItype carries = (USItype)uu.s.high << bm;
|
||||
+ w.s.high = uu.s.high >> b;
|
||||
+ w.s.low = ((USItype)uu.s.low >> b) | carries;
|
||||
+ }
|
||||
+
|
||||
+ return w.ll;
|
||||
+}
|
||||
--- /dev/null
|
||||
+++ b/arch/ubicom32/lib/divmod.c
|
||||
@@ -0,0 +1,85 @@
|
||||
+unsigned long
|
||||
+udivmodsi4(unsigned long num, unsigned long den, int modwanted)
|
||||
+{
|
||||
+ unsigned long bit = 1;
|
||||
+ unsigned long res = 0;
|
||||
+
|
||||
+ while (den < num && bit && !(den & (1L<<31)))
|
||||
+ {
|
||||
+ den <<=1;
|
||||
+ bit <<=1;
|
||||
+ }
|
||||
+ while (bit)
|
||||
+ {
|
||||
+ if (num >= den)
|
||||
+ {
|
||||
+ num -= den;
|
||||
+ res |= bit;
|
||||
+ }
|
||||
+ bit >>=1;
|
||||
+ den >>=1;
|
||||
+ }
|
||||
+ if (modwanted) return num;
|
||||
+ return res;
|
||||
+}
|
||||
+
|
||||
+long
|
||||
+__udivsi3 (long a, long b)
|
||||
+{
|
||||
+ return udivmodsi4 (a, b, 0);
|
||||
+}
|
||||
+
|
||||
+long
|
||||
+__umodsi3 (long a, long b)
|
||||
+{
|
||||
+ return udivmodsi4 (a, b, 1);
|
||||
+}
|
||||
+
|
||||
+long
|
||||
+__divsi3 (long a, long b)
|
||||
+{
|
||||
+ int neg = 0;
|
||||
+ long res;
|
||||
+
|
||||
+ if (a < 0)
|
||||
+ {
|
||||
+ a = -a;
|
||||
+ neg = !neg;
|
||||
+ }
|
||||
+
|
||||
+ if (b < 0)
|
||||
+ {
|
||||
+ b = -b;
|
||||
+ neg = !neg;
|
||||
+ }
|
||||
+
|
||||
+ res = udivmodsi4 (a, b, 0);
|
||||
+
|
||||
+ if (neg)
|
||||
+ res = -res;
|
||||
+
|
||||
+ return res;
|
||||
+}
|
||||
+
|
||||
+long
|
||||
+__modsi3 (long a, long b)
|
||||
+{
|
||||
+ int neg = 0;
|
||||
+ long res;
|
||||
+
|
||||
+ if (a < 0)
|
||||
+ {
|
||||
+ a = -a;
|
||||
+ neg = 1;
|
||||
+ }
|
||||
+
|
||||
+ if (b < 0)
|
||||
+ b = -b;
|
||||
+
|
||||
+ res = udivmodsi4 (a, b, 1);
|
||||
+
|
||||
+ if (neg)
|
||||
+ res = -res;
|
||||
+
|
||||
+ return res;
|
||||
+}
|
||||
--- /dev/null
|
||||
+++ b/arch/ubicom32/lib/lshrdi3.c
|
||||
@@ -0,0 +1,62 @@
|
||||
+/* lshrdi3.c extracted from gcc-2.7.2/libgcc2.c which is: */
|
||||
+/* Copyright (C) 1989, 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
|
||||
+
|
||||
+This file is part of GNU CC.
|
||||
+
|
||||
+GNU CC 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, or (at your option)
|
||||
+any later version.
|
||||
+
|
||||
+GNU CC is distributed in the hope that it will be useful,
|
||||
+but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+GNU General Public License for more details.
|
||||
+
|
||||
+You should have received a copy of the GNU General Public License
|
||||
+along with GNU CC; see the file COPYING. If not, write to
|
||||
+the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
+Boston, MA 02111-1307, USA. */
|
||||
+
|
||||
+#define BITS_PER_UNIT 8
|
||||
+
|
||||
+typedef int SItype __attribute__ ((mode (SI)));
|
||||
+typedef unsigned int USItype __attribute__ ((mode (SI)));
|
||||
+typedef int DItype __attribute__ ((mode (DI)));
|
||||
+typedef int word_type __attribute__ ((mode (__word__)));
|
||||
+
|
||||
+struct DIstruct {SItype high, low;};
|
||||
+
|
||||
+typedef union
|
||||
+{
|
||||
+ struct DIstruct s;
|
||||
+ DItype ll;
|
||||
+} DIunion;
|
||||
+
|
||||
+DItype
|
||||
+__lshrdi3 (DItype u, word_type b)
|
||||
+{
|
||||
+ DIunion w;
|
||||
+ word_type bm;
|
||||
+ DIunion uu;
|
||||
+
|
||||
+ if (b == 0)
|
||||
+ return u;
|
||||
+
|
||||
+ uu.ll = u;
|
||||
+
|
||||
+ bm = (sizeof (SItype) * BITS_PER_UNIT) - b;
|
||||
+ if (bm <= 0)
|
||||
+ {
|
||||
+ w.s.high = 0;
|
||||
+ w.s.low = (USItype)uu.s.high >> -bm;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ USItype carries = (USItype)uu.s.high << bm;
|
||||
+ w.s.high = (USItype)uu.s.high >> b;
|
||||
+ w.s.low = ((USItype)uu.s.low >> b) | carries;
|
||||
+ }
|
||||
+
|
||||
+ return w.ll;
|
||||
+}
|
||||
--- /dev/null
|
||||
+++ b/arch/ubicom32/lib/muldi3.c
|
||||
@@ -0,0 +1,87 @@
|
||||
+/* muldi3.c extracted from gcc-2.7.2.3/libgcc2.c and
|
||||
+ gcc-2.7.2.3/longlong.h which is: */
|
||||
+/* Copyright (C) 1989, 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
|
||||
+
|
||||
+This file is part of GNU CC.
|
||||
+
|
||||
+GNU CC 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, or (at your option)
|
||||
+any later version.
|
||||
+
|
||||
+GNU CC is distributed in the hope that it will be useful,
|
||||
+but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+GNU General Public License for more details.
|
||||
+
|
||||
+You should have received a copy of the GNU General Public License
|
||||
+along with GNU CC; see the file COPYING. If not, write to
|
||||
+the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
+Boston, MA 02111-1307, USA. */
|
||||
+
|
||||
+#define UWtype USItype
|
||||
+#define UHWtype USItype
|
||||
+#define W_TYPE_SIZE 32
|
||||
+#define __BITS4 (W_TYPE_SIZE / 4)
|
||||
+#define __ll_B ((UWtype) 1 << (W_TYPE_SIZE / 2))
|
||||
+#define __ll_lowpart(t) ((UWtype) (t) & (__ll_B - 1))
|
||||
+#define __ll_highpart(t) ((UWtype) (t) >> (W_TYPE_SIZE / 2))
|
||||
+
|
||||
+#define umul_ppmm(w1, w0, u, v) \
|
||||
+ do { \
|
||||
+ UWtype __x0, __x1, __x2, __x3; \
|
||||
+ UHWtype __ul, __vl, __uh, __vh; \
|
||||
+ \
|
||||
+ __ul = __ll_lowpart (u); \
|
||||
+ __uh = __ll_highpart (u); \
|
||||
+ __vl = __ll_lowpart (v); \
|
||||
+ __vh = __ll_highpart (v); \
|
||||
+ \
|
||||
+ __x0 = (UWtype) __ul * __vl; \
|
||||
+ __x1 = (UWtype) __ul * __vh; \
|
||||
+ __x2 = (UWtype) __uh * __vl; \
|
||||
+ __x3 = (UWtype) __uh * __vh; \
|
||||
+ \
|
||||
+ __x1 += __ll_highpart (__x0);/* this can't give carry */ \
|
||||
+ __x1 += __x2; /* but this indeed can */ \
|
||||
+ if (__x1 < __x2) /* did we get it? */ \
|
||||
+ __x3 += __ll_B; /* yes, add it in the proper pos. */ \
|
||||
+ \
|
||||
+ (w1) = __x3 + __ll_highpart (__x1); \
|
||||
+ (w0) = __ll_lowpart (__x1) * __ll_B + __ll_lowpart (__x0); \
|
||||
+ } while (0)
|
||||
+
|
||||
+
|
||||
+#define __umulsidi3(u, v) \
|
||||
+ ({DIunion __w; \
|
||||
+ umul_ppmm (__w.s.high, __w.s.low, u, v); \
|
||||
+ __w.ll; })
|
||||
+
|
||||
+typedef int SItype __attribute__ ((mode (SI)));
|
||||
+typedef unsigned int USItype __attribute__ ((mode (SI)));
|
||||
+typedef int DItype __attribute__ ((mode (DI)));
|
||||
+typedef int word_type __attribute__ ((mode (__word__)));
|
||||
+
|
||||
+struct DIstruct {SItype high, low;};
|
||||
+
|
||||
+typedef union
|
||||
+{
|
||||
+ struct DIstruct s;
|
||||
+ DItype ll;
|
||||
+} DIunion;
|
||||
+
|
||||
+DItype
|
||||
+__muldi3 (DItype u, DItype v)
|
||||
+{
|
||||
+ DIunion w;
|
||||
+ DIunion uu, vv;
|
||||
+
|
||||
+ uu.ll = u,
|
||||
+ vv.ll = v;
|
||||
+
|
||||
+ w.ll = __umulsidi3 (uu.s.low, vv.s.low);
|
||||
+ w.s.high += ((USItype) uu.s.low * (USItype) vv.s.high
|
||||
+ + (USItype) uu.s.high * (USItype) vv.s.low);
|
||||
+
|
||||
+ return w.ll;
|
||||
+}
|
||||
--- a/arch/ubicom32/kernel/ubicom32_ksyms.c
|
||||
+++ b/arch/ubicom32/kernel/ubicom32_ksyms.c
|
||||
@@ -72,7 +72,6 @@ EXPORT_SYMBOL(memmove);
|
||||
extern void __ashldi3(void);
|
||||
extern void __ashrdi3(void);
|
||||
extern void __divsi3(void);
|
||||
-extern void __divdi3(void);
|
||||
extern void __lshrdi3(void);
|
||||
extern void __modsi3(void);
|
||||
extern void __muldi3(void);
|
||||
@@ -83,7 +82,6 @@ extern void __umodsi3(void);
|
||||
EXPORT_SYMBOL(__ashldi3);
|
||||
EXPORT_SYMBOL(__ashrdi3);
|
||||
EXPORT_SYMBOL(__divsi3);
|
||||
-EXPORT_SYMBOL(__divdi3);
|
||||
EXPORT_SYMBOL(__lshrdi3);
|
||||
EXPORT_SYMBOL(__modsi3);
|
||||
EXPORT_SYMBOL(__muldi3);
|
|
@ -0,0 +1,13 @@
|
|||
--- a/drivers/mtd/devices/ubi32-m25p80.c
|
||||
+++ b/drivers/mtd/devices/ubi32-m25p80.c
|
||||
@@ -630,8 +630,8 @@ static int ubicom32_flash_driver_erase(s
|
||||
/* sanity checks */
|
||||
if (instr->addr + instr->len > flash->mtd.size)
|
||||
return -EINVAL;
|
||||
- if ((instr->addr % mtd->erasesize) != 0
|
||||
- || (instr->len % mtd->erasesize) != 0) {
|
||||
+ if (((u32) instr->addr % mtd->erasesize) != 0
|
||||
+ || ((u32) instr->len % mtd->erasesize) != 0) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
--- a/arch/ubicom32/Makefile
|
||||
+++ b/arch/ubicom32/Makefile
|
||||
@@ -54,8 +54,8 @@ CFLAGS_MODULE += -mno-fastcall
|
||||
#
|
||||
# Some CFLAG additions based on specific CPU type.
|
||||
#
|
||||
-cflags-$(CONFIG_UBICOM32_V3) := -march=ubicom32v3 -DIP5000
|
||||
-cflags-$(CONFIG_UBICOM32_V4) := -march=ubicom32v4 -DIP7000
|
||||
+cflags-$(CONFIG_UBICOM32_V3) := -march=ubicom32v3 -mno-fdpic -DIP5000
|
||||
+cflags-$(CONFIG_UBICOM32_V4) := -march=ubicom32v4 -mno-fdpic -DIP7000
|
||||
|
||||
ldflags-$(CONFIG_LINKER_RELAXATION) := --relax
|
||||
LDFLAGS_vmlinux := $(ldflags-y)
|
Loading…
Reference in New Issue