This series of patches (along with the patches from Thomas Chou) brings the 
nios2nommu arch up-to-date for the current kernel.
The 1st patch is rather large, but I hope its OK ...

Signed-off-by: Atle Nissestad <[EMAIL PROTECTED]>

diff --git a/linux-2.6.x/arch/nios2nommu/Kconfig 
b/linux-2.6.x/arch/nios2nommu/Kconfig
index 8e87a11..525c77b 100644
--- a/linux-2.6.x/arch/nios2nommu/Kconfig
+++ b/linux-2.6.x/arch/nios2nommu/Kconfig
@@ -12,6 +12,10 @@ config FPU
        bool
        default n
 
+config ZONE_DMA
+       bool
+       default y
+
 config UID16
        bool
        default y
@@ -339,6 +343,8 @@ source "drivers/Kconfig"
 
 source "fs/Kconfig"
 
+source "arch/nios2nommu/Kconfig.debug"
+
 menu "Kernel hacking"
 
 config FULLDEBUG
diff --git a/linux-2.6.x/arch/nios2nommu/drivers/Kconfig 
b/linux-2.6.x/arch/nios2nommu/drivers/Kconfig
index 2591cf4..2fde3a8 100644
--- a/linux-2.6.x/arch/nios2nommu/drivers/Kconfig
+++ b/linux-2.6.x/arch/nios2nommu/drivers/Kconfig
@@ -19,7 +19,7 @@ config SERIO_ALTPS2
        default N
        select SERIO
 
-config I2C_GPIO
+config I2C_NIOS2_GPIO
        tristate "GPIO-Based I2C Interface"
        default N
        select I2C
diff --git a/linux-2.6.x/arch/nios2nommu/drivers/Makefile 
b/linux-2.6.x/arch/nios2nommu/drivers/Makefile
index fdd26cf..f6a273e 100644
--- a/linux-2.6.x/arch/nios2nommu/drivers/Makefile
+++ b/linux-2.6.x/arch/nios2nommu/drivers/Makefile
@@ -5,6 +5,6 @@
 obj-$(CONFIG_PCI)              += pci/
 obj-$(CONFIG_FB_ALTERA)         += altfb.o
 obj-$(CONFIG_SERIO_ALTPS2)     += altps2.o
-obj-$(CONFIG_I2C_GPIO)         += i2c-gpio.o
+obj-$(CONFIG_I2C_NIOS2_GPIO)   += i2c-gpio.o
 obj-$(CONFIG_BLK_DEV_ALTCF)    += altcf.o
 obj-$(CONFIG_NIOS_SPI)         += spi.o
diff --git a/linux-2.6.x/arch/nios2nommu/drivers/altcf.c 
b/linux-2.6.x/arch/nios2nommu/drivers/altcf.c
index 724d483..80275c6 100644
--- a/linux-2.6.x/arch/nios2nommu/drivers/altcf.c
+++ b/linux-2.6.x/arch/nios2nommu/drivers/altcf.c
@@ -51,7 +51,7 @@ struct cf_dev {
        int ide_irq;
        int configured;
        ide_hwif_t *hwif;
-       struct work_struct wcf;
+       struct delayed_work wcf;
 };
 
 static struct cf_dev cf_devices[MAX_HWIFS] = {
@@ -123,7 +123,7 @@ static int cf_config(struct cf_dev* dev)
                    hw.irq = dev->ide_irq;
                    hw.chipset = ide_generic;
                    outl(IDECTL_IIDE, dev->base + REG_IDECTL);
-                   index = ide_register_hw(&hw, &hwif);
+                   index = ide_register_hw(&hw, 1, &hwif);
                    if (index >=0) {
                            dev->configured = 1;
                            dev->hwif = hwif;
@@ -157,13 +157,13 @@ static irqreturn_t cf_intr(int irq, void *dev_id)
        if ((cfctl & CFCTL_DET))
                schedule_delayed_work(&dev->wcf, HZ/2);
        else
-               schedule_work(&dev->wcf);
+               schedule_work(&dev->wcf.work);
        return IRQ_HANDLED;
 }
 
-static void cf_event(void      *dev_id)
+static void cf_event(struct work_struct *work)
 {
-       struct cf_dev* dev = (struct cf_dev *)dev_id;
+       struct cf_dev* dev = container_of(work, struct cf_dev, wcf.work);
 
        if (dev) {
                unsigned int cfctl;
@@ -219,7 +219,7 @@ int __init altcf_init(void)
                                cf_init_hwif_ports(&hw, cf_devices[i].ide_base, 
0, NULL);
                                hw.chipset = ide_generic;
                                hw.irq = cf_devices[i].ide_irq;
-                               if (ide_register_hw(&hw, &hwif)>=0) {
+                               if (ide_register_hw(&hw, 1, &hwif)>=0) {
                                        cf_devices[i].configured = 1;
                                        cf_devices[i].hwif = hwif;
                                }
@@ -230,11 +230,11 @@ int __init altcf_init(void)
                }
 
                /* register the detection interrupt */
-               if (request_irq(cf_devices[i].irq, cf_intr, SA_INTERRUPT, "cf", 
&cf_devices[i])) {
+               if (request_irq(cf_devices[i].irq, cf_intr, IRQF_DISABLED, 
"cf", &cf_devices[i])) {
                        PDEBUG("CF: unable to get interrupt %d for detecting 
inf %d\n",
                                        cf_devices[i].irq, i );
                } else {
-                       INIT_WORK(&cf_devices[i].wcf, cf_event);
+                       INIT_DELAYED_WORK(&cf_devices[i].wcf, cf_event);
                        /* enable the detection interrupt */
                        cfctl=inl(cf_devices[i].base + REG_CFCTL);
                        outl(cfctl | CFCTL_IDET, cf_devices[i].base + 
REG_CFCTL);
diff --git a/linux-2.6.x/arch/nios2nommu/drivers/pci/pci.c 
b/linux-2.6.x/arch/nios2nommu/drivers/pci/pci.c
index 58454c2..83436df 100644
--- a/linux-2.6.x/arch/nios2nommu/drivers/pci/pci.c
+++ b/linux-2.6.x/arch/nios2nommu/drivers/pci/pci.c
@@ -1,5 +1,5 @@
 /* arch/sh/kernel/pci.c
- * $Id: pci.c,v 1.3 2007/05/15 01:48:54 gerg Exp $
+ * $Id: pci.c,v 1.2 2007/01/25 01:26:48 gerg Exp $
  *
  * Copyright (c) 2002 M. R. Brown  <[EMAIL PROTECTED]>
  * 
diff --git a/linux-2.6.x/arch/nios2nommu/kernel/asm-offsets.c 
b/linux-2.6.x/arch/nios2nommu/kernel/asm-offsets.c
index dd93a81..4877eba 100644
--- a/linux-2.6.x/arch/nios2nommu/kernel/asm-offsets.c
+++ b/linux-2.6.x/arch/nios2nommu/kernel/asm-offsets.c
@@ -31,7 +31,7 @@ int main(void)
        DEFINE(TASK_PTRACE, offsetof(struct task_struct, ptrace));
        DEFINE(TASK_BLOCKED, offsetof(struct task_struct, blocked));
        DEFINE(TASK_THREAD, offsetof(struct task_struct, thread));
-       DEFINE(TASK_THREAD_INFO, offsetof(struct task_struct, thread_info));
+       DEFINE(TASK_THREAD_INFO, offsetof(struct task_struct, stack));
        DEFINE(TASK_MM, offsetof(struct task_struct, mm));
        DEFINE(TASK_ACTIVE_MM, offsetof(struct task_struct, active_mm));
 
diff --git a/linux-2.6.x/arch/nios2nommu/kernel/nios2_ksyms.c 
b/linux-2.6.x/arch/nios2nommu/kernel/nios2_ksyms.c
index 1602b67..720f007 100644
--- a/linux-2.6.x/arch/nios2nommu/kernel/nios2_ksyms.c
+++ b/linux-2.6.x/arch/nios2nommu/kernel/nios2_ksyms.c
@@ -51,15 +51,6 @@ EXPORT_SYMBOL(__ioremap);
 EXPORT_SYMBOL(iounmap);
 EXPORT_SYMBOL(dump_fpu);
 EXPORT_SYMBOL(dump_thread);
-EXPORT_SYMBOL(strnlen);
-EXPORT_SYMBOL(strrchr);
-EXPORT_SYMBOL(strstr);
-EXPORT_SYMBOL(strchr);
-EXPORT_SYMBOL(strcat);
-EXPORT_SYMBOL(strlen);
-EXPORT_SYMBOL(strcmp);
-EXPORT_SYMBOL(strncmp);
-EXPORT_SYMBOL(strcpy);
 
 EXPORT_SYMBOL(kernel_thread);
 
@@ -68,8 +59,6 @@ EXPORT_SYMBOL(csum_partial_copy);
 
 EXPORT_SYMBOL(memcpy);
 EXPORT_SYMBOL(memset);
-EXPORT_SYMBOL(memcmp);
-EXPORT_SYMBOL(memscan);
 EXPORT_SYMBOL(memmove);
 
 EXPORT_SYMBOL(__down);
diff --git a/linux-2.6.x/arch/nios2nommu/kernel/process.c 
b/linux-2.6.x/arch/nios2nommu/kernel/process.c
index 7561052..a40621d 100644
--- a/linux-2.6.x/arch/nios2nommu/kernel/process.c
+++ b/linux-2.6.x/arch/nios2nommu/kernel/process.c
@@ -317,7 +317,7 @@ int copy_thread(int nr, unsigned long clone_flags,
        unsigned long stack_offset, *retp;
 
        stack_offset = THREAD_SIZE - sizeof(struct pt_regs);
-       childregs = (struct pt_regs *) ((unsigned long) p->thread_info + 
stack_offset);
+       childregs = (struct pt_regs *) ((unsigned long) p->stack + 
stack_offset);
        p->thread.kregs = childregs;
 
        *childregs = *regs;
diff --git a/linux-2.6.x/arch/nios2nommu/kernel/setup.c 
b/linux-2.6.x/arch/nios2nommu/kernel/setup.c
index ea3ef08..1f1627b 100644
--- a/linux-2.6.x/arch/nios2nommu/kernel/setup.c
+++ b/linux-2.6.x/arch/nios2nommu/kernel/setup.c
@@ -56,11 +56,11 @@
 
 #include <asm/irq.h>
 #include <asm/byteorder.h>
-//#include <asm/niosconf.h>
 #include <asm/asm-offsets.h>
+#include <asm/pgtable.h>
 
 #ifdef CONFIG_BLK_DEV_INITRD
-#include <asm/pgtable.h>
+#include <linux/blk.h>
 #endif
 
 #ifdef CONFIG_NIOS_SPI
@@ -90,7 +90,7 @@ EXPORT_SYMBOL(memory_end);
 #ifndef CONFIG_PASS_CMDLINE
 static char default_command_line[] = CONFIG_CMDLINE;
 #endif
-static char command_line[COMMAND_LINE_SIZE] = { 0, };
+static char __initdata command_line[COMMAND_LINE_SIZE] = { 0, };
 
 
 /*                                r1  r2  r3  r4  r5  r6  r7  r8  r9 r10 r11*/
@@ -146,7 +146,7 @@ inline void exit_se_flash(int base)
        *(unsigned short*)base=0;
 }
 
-void setup_arch(char **cmdline_p)
+void __init setup_arch(char **cmdline_p)
 {
        int bootmap_size;
        extern int _stext, _etext;
@@ -635,7 +635,7 @@ static int __init altps2_device_init(void)
 arch_initcall(altps2_device_init);
 #endif // CONFIG_SERIO_ALTPS2
 
-#if defined(CONFIG_I2C_GPIO) && defined(na_gpio_0)
+#if defined(CONFIG_I2C_NIOS2_GPIO) && defined(na_gpio_0)
 #include <asm/gpio.h>
 
 static struct gpio_i2c_pins i2c_gpio_0_pins = {
@@ -660,4 +660,4 @@ static int __init i2c_gpio_device_init(void)
 }
 arch_initcall(i2c_gpio_device_init);
 
-#endif // CONFIG_I2C_GPIO
+#endif // CONFIG_I2C_NIOS2_GPIO
diff --git a/linux-2.6.x/arch/nios2nommu/kernel/syscalltable.S 
b/linux-2.6.x/arch/nios2nommu/kernel/syscalltable.S
index a9c96a2..3507e24 100644
--- a/linux-2.6.x/arch/nios2nommu/kernel/syscalltable.S
+++ b/linux-2.6.x/arch/nios2nommu/kernel/syscalltable.S
@@ -315,8 +315,48 @@ ENTRY(sys_call_table)
        .long sys_ni_syscall    /* sys_add_key */
        .long sys_ni_syscall    /* 280 */ /* sys_request_key */
        .long sys_ni_syscall    /* sys_keyctl */
+       .long sys_ioprio_set
+       .long sys_ioprio_get
+       .long sys_inotify_init
+       .long sys_inotify_add_watch     /* 285 */
+       .long sys_inotify_rm_watch
+       .long sys_migrate_pages
+       .long sys_openat
+       .long sys_mkdirat
+       .long sys_mknodat               /* 290 */
+       .long sys_fchownat
+       .long sys_futimesat
+       .long sys_fstatat64
+       .long sys_unlinkat
+       .long sys_renameat              /* 295 */
+       .long sys_linkat
+       .long sys_symlinkat
+       .long sys_readlinkat
+       .long sys_fchmodat
+       .long sys_faccessat             /* 300 */
+       .long sys_ni_syscall            /* Reserved for pselect6 */
+       .long sys_ni_syscall            /* Reserved for ppoll */
+       .long sys_unshare
+       .long sys_set_robust_list
+       .long sys_get_robust_list       /* 305 */
+       .long sys_splice
+       .long sys_sync_file_range
+       .long sys_tee
+       .long sys_vmsplice
+       .long sys_move_pages            /* 310 */
+       .long sys_sched_setaffinity
+       .long sys_sched_getaffinity
+       .long sys_kexec_load
+       .long sys_getcpu
+       .long sys_epoll_pwait           /* 315 */
+       .long sys_utimensat
+       .long sys_signalfd
+       .long sys_timerfd
+       .long sys_eventfd
+       .long sys_pread64
+       .long sys_pwrite64              /* 321 */
 
-       .rept NR_syscalls - 282
+       .rept NR_syscalls - 322
                .long sys_ni_syscall
        .endr
 
diff --git a/linux-2.6.x/arch/nios2nommu/kernel/time.c 
b/linux-2.6.x/arch/nios2nommu/kernel/time.c
index 8f2fb58..3b536fe 100644
--- a/linux-2.6.x/arch/nios2nommu/kernel/time.c
+++ b/linux-2.6.x/arch/nios2nommu/kernel/time.c
@@ -30,36 +30,68 @@
 
 
 #include <linux/errno.h>
-#include <linux/module.h>
 #include <linux/sched.h>
 #include <linux/kernel.h>
 #include <linux/param.h>
 #include <linux/string.h>
 #include <linux/mm.h>
 #include <linux/interrupt.h>
-#include <linux/profile.h>
 #include <linux/time.h>
 #include <linux/timex.h>
+#include <linux/profile.h>
+#include <linux/module.h>
 #include <linux/irq.h>
 
 #include <asm/segment.h>
 #include <asm/io.h>
 #include <asm/nios.h>
 
-
 #define        TICK_SIZE (tick_nsec / 1000)
 
 unsigned long cpu_khz;
 static inline int set_rtc_mmss(unsigned long nowtime)
 {
-  return -1;
+  return 0;
+}
+
+/* Timer timeout status */
+#define nios2_timer_TO (inw(&na_timer0->np_timerstatus) & 
np_timerstatus_to_mask)
+
+/* Timer snapshot */
+static inline unsigned long nios2_read_timercount(void)
+{
+       unsigned long count;
+
+       outw(0, &na_timer0->np_timersnapl);
+       count = inw(&na_timer0->np_timersnaph) << 16 | 
inw(&na_timer0->np_timersnapl);
+
+       return count;
+}
+
+/*
+ * Should return useconds since last timer tick
+ */
+static unsigned long gettimeoffset(void)
+{
+       unsigned long offset;
+       unsigned long count;
+
+       count = nios2_read_timercount();
+       offset = ((nasys_clock_freq/HZ)-1 - nios2_read_timercount()) \
+                / (nasys_clock_freq / USEC_PER_SEC);
+
+       /* Check if we just wrapped the counters and maybe missed a tick */
+       if (nios2_timer_TO  && (offset < (100000 / HZ / 2)))
+               offset += (USEC_PER_SEC / HZ);
+
+       return offset;
 }
 
 /*
  * timer_interrupt() needs to keep up the real-time clock,
  * as well as call the "do_timer()" routine every clocktick
  */
-static irqreturn_t timer_interrupt(int irq, void *dummy)
+irqreturn_t timer_interrupt(int irq, void *dummy)
 {
        /* last time the cmos clock got updated */
        static long last_rtc_update=0;
@@ -77,7 +109,8 @@ static irqreturn_t timer_interrupt(int irq, void *dummy)
         * CMOS clock accordingly every ~11 minutes. Set_rtc_mmss() has to be
         * called as close as possible to 500 ms before the new second starts.
         */
-       if (ntp_synced() && xtime.tv_sec > last_rtc_update + 660 &&
+       if (ntp_synced() &&
+           xtime.tv_sec > last_rtc_update + 660 &&
            (xtime.tv_nsec / 1000) >= 500000 - ((unsigned) TICK_SIZE) / 2 &&
            (xtime.tv_nsec  / 1000) <= 500000 + ((unsigned) TICK_SIZE) / 2) {
          if (set_rtc_mmss(xtime.tv_sec) == 0)
@@ -90,9 +123,10 @@ static irqreturn_t timer_interrupt(int irq, void *dummy)
        return(IRQ_HANDLED);
 }
 
-void time_init(void)
+void __init time_init(void)
 {
        unsigned int year, mon, day, hour, min, sec;
+       int err;
 
        extern void arch_gettod(int *year, int *mon, int *day, int *hour,
                                int *min, int *sec);
@@ -106,8 +140,9 @@ void time_init(void)
        xtime.tv_nsec = 0;
        wall_to_monotonic.tv_sec = -xtime.tv_sec;
 
-       request_irq(na_timer0_irq, timer_interrupt, IRQ_FLG_LOCK, "timer", 
NULL);
-
+       err = request_irq(na_timer0_irq, timer_interrupt, IRQ_FLG_LOCK, 
"timer", NULL);
+       if(err)
+               printk(KERN_ERR "%s() failed - errno = %d\n", __FUNCTION__, 
-err);
        na_timer0->np_timerperiodl = (nasys_clock_freq/HZ)-1;
        na_timer0->np_timerperiodh = ((nasys_clock_freq/HZ)-1) >> 16;
 
@@ -128,8 +163,7 @@ void do_gettimeofday(struct timeval *tv)
 
        do {
                seq = read_seqbegin_irqsave(&xtime_lock, flags);
-               usec = 0; // For now use timeoffset 0
-//             usec = mach_gettimeoffset ? mach_gettimeoffset() : 0;
+               usec = gettimeoffset();
                sec = xtime.tv_sec;
                usec += (xtime.tv_nsec / 1000);
        } while (read_seqretry_irqrestore(&xtime_lock, seq, flags));
@@ -142,7 +176,7 @@ void do_gettimeofday(struct timeval *tv)
        tv->tv_sec = sec;
        tv->tv_usec = usec;
 }
-
+EXPORT_SYMBOL(do_gettimeofday);
 
 int do_settimeofday(struct timespec *tv)
 {
@@ -155,13 +189,11 @@ int do_settimeofday(struct timespec *tv)
        write_seqlock_irq(&xtime_lock);
        /*
         * This is revolting. We need to set "xtime" correctly. However, the
-        * value in this location is the value at the most recent update of
-        * wall time.  Discover what correction gettimeofday() would have
+        * value in this location is the value at the last tick.
+        * Discover what correction gettimeofday() would have
         * made, and then undo it!
-        * FIXME On m68knommu this is if (mach_gettimeoffset) nsec -= 
(mach_gettimeoffset() * 1000);
         */
-//     nsec -= cur_timer->get_offset() * NSEC_PER_USEC;
-//     nsec -= (jiffies - wall_jiffies) * TICK_NSEC;
+       nsec -= gettimeoffset() * NSEC_PER_USEC;
 
        wtm_sec  = wall_to_monotonic.tv_sec + (xtime.tv_sec - sec);
        wtm_nsec = wall_to_monotonic.tv_nsec + (xtime.tv_nsec - nsec);
@@ -169,15 +201,14 @@ int do_settimeofday(struct timespec *tv)
        set_normalized_timespec(&xtime, sec, nsec);
        set_normalized_timespec(&wall_to_monotonic, wtm_sec, wtm_nsec);
 
-       time_adjust = 0;                /* stop active adjtime() */
-       time_status |= STA_UNSYNC;
-       time_maxerror = NTP_PHASE_LIMIT;
-       time_esterror = NTP_PHASE_LIMIT;
+       ntp_clear();
+
        write_sequnlock_irq(&xtime_lock);
        clock_was_set();
+
        return 0;
 }
-
+EXPORT_SYMBOL(do_settimeofday);
 
 /*
  * Scheduler clock - returns current time in nanosec units.
@@ -186,6 +217,3 @@ unsigned long long sched_clock(void)
 {
        return (unsigned long long)jiffies * (1000000000 / HZ);
 }
-
-EXPORT_SYMBOL(do_gettimeofday);
-EXPORT_SYMBOL(do_settimeofday);
diff --git a/linux-2.6.x/arch/nios2nommu/kernel/vmlinux.lds.S 
b/linux-2.6.x/arch/nios2nommu/kernel/vmlinux.lds.S
index 99bbf9f..491901c 100644
--- a/linux-2.6.x/arch/nios2nommu/kernel/vmlinux.lds.S
+++ b/linux-2.6.x/arch/nios2nommu/kernel/vmlinux.lds.S
@@ -15,7 +15,7 @@ SECTIONS
   _stext = . ;
   _text = .;                   /* Text and read-only data */
   .text : {
-    *(.text)
+    TEXT_TEXT
     SCHED_TEXT
     LOCK_TEXT
     *(.fixup)
diff --git a/linux-2.6.x/drivers/ide/ide.c b/linux-2.6.x/drivers/ide/ide.c
index 5e88a06..1383432 100644
--- a/linux-2.6.x/drivers/ide/ide.c
+++ b/linux-2.6.x/drivers/ide/ide.c
@@ -1750,6 +1750,9 @@ static int __init ide_init(void)
        if (probe_qd65xx)
                (void)qd65xx_init();
 #endif
+#ifdef CONFIG_BLK_DEV_ALTCF
+       (void) altcf_init();
+#endif
 
        /* Probe for special PCI and other "known" interface chipsets. */
        probe_for_hwifs();
diff --git a/linux-2.6.x/drivers/net/Space.c b/linux-2.6.x/drivers/net/Space.c
index 3b79c6c..ac9b789 100644
--- a/linux-2.6.x/drivers/net/Space.c
+++ b/linux-2.6.x/drivers/net/Space.c
@@ -71,6 +71,7 @@ extern struct net_device *sonic_probe(int unit);
 extern struct net_device *SK_init(int unit);
 extern struct net_device *seeq8005_probe(int unit);
 extern struct net_device *smc_init(int unit);
+extern struct net_device *dm9ks_probe(int unit);
 extern struct net_device *atarilance_probe(int unit);
 extern struct net_device *sun3lance_probe(int unit);
 extern struct net_device *sun3_82586_probe(int unit);
@@ -191,6 +192,15 @@ static struct devprobe2 isa_probes[] __initdata = {
 #ifdef CONFIG_SMC9194
        {smc_init, 0},
 #endif
+#if defined(CONFIG_OPEN_ETH)
+       {oeth_init, 0},
+#endif
+#if defined(CONFIG_MTIP1000_ETH)
+       {mtip1000_init, 0},
+#endif
+#if defined(CONFIG_DM9KS)
+       {dm9ks_probe, 0},
+#endif
 #ifdef CONFIG_SEEQ8005
        {seeq8005_probe, 0},
 #endif
diff --git a/linux-2.6.x/drivers/net/dm9000.c b/linux-2.6.x/drivers/net/dm9000.c
index 738aa59..4a91e0b 100644
--- a/linux-2.6.x/drivers/net/dm9000.c
+++ b/linux-2.6.x/drivers/net/dm9000.c
@@ -577,6 +577,12 @@ dm9000_probe(struct platform_device *pdev)
        db->mii.mdio_read    = dm9000_phy_read;
        db->mii.mdio_write   = dm9000_phy_write;
 
+#ifdef CONFIG_EXCALIBUR
+       {
+               extern unsigned char *excalibur_enet_hwaddr;
+               memcpy(ndev->dev_addr, excalibur_enet_hwaddr, 6);
+       }
+#else
        /* Read SROM content */
        for (i = 0; i < 64; i++)
                ((u16 *) db->srom)[i] = read_srom_word(db, i);
diff --git a/linux-2.6.x/drivers/net/smc911x.c 
b/linux-2.6.x/drivers/net/smc911x.c
index db43e42..69638ee 100644
--- a/linux-2.6.x/drivers/net/smc911x.c
+++ b/linux-2.6.x/drivers/net/smc911x.c
@@ -2017,6 +2017,12 @@ static int __init smc911x_probe(struct net_device *dev, 
unsigned long ioaddr)
 
        /* Get the MAC address */
        SMC_GET_MAC_ADDR(dev->dev_addr);
+#ifdef CONFIG_EXCALIBUR
+       {
+               extern unsigned char *excalibur_enet_hwaddr;
+               memcpy(dev->dev_addr, excalibur_enet_hwaddr, 6);
+       }
+#endif
 
        /* now, reset the chip, and put it into a known state */
        smc911x_reset(dev);
diff --git a/linux-2.6.x/drivers/net/smc91x.c b/linux-2.6.x/drivers/net/smc91x.c
index 01cc3c7..a10c5f8 100644
--- a/linux-2.6.x/drivers/net/smc91x.c
+++ b/linux-2.6.x/drivers/net/smc91x.c
@@ -1918,6 +1918,12 @@ static int __init smc_probe(struct net_device *dev, void 
__iomem *ioaddr)
        /* Get the MAC address */
        SMC_SELECT_BANK(1);
        SMC_GET_MAC_ADDR(dev->dev_addr);
+#ifdef CONFIG_EXCALIBUR
+       {
+               extern unsigned char *excalibur_enet_hwaddr;
+               memcpy(dev->dev_addr, excalibur_enet_hwaddr, 6);
+       }
+#endif
 
        /* now, reset the chip, and put it into a known state */
        smc_reset(dev);
diff --git a/linux-2.6.x/drivers/serial/NIOSserial.c 
b/linux-2.6.x/drivers/serial/NIOSserial.c
index 5b3df6a..9c14748 100644
--- a/linux-2.6.x/drivers/serial/NIOSserial.c
+++ b/linux-2.6.x/drivers/serial/NIOSserial.c
@@ -351,9 +351,9 @@ irqreturn_t rs_interrupt(int irq, void *dev_id)
        return IRQ_HANDLED;
 }
 
-static void do_softint(void *private)
+static void do_softint(struct work_struct *work)
 {
-       struct NIOS_serial      *info = (struct NIOS_serial *) private;
+       struct NIOS_serial      *info = container_of(work,struct NIOS_serial, 
tqueue);
        struct tty_struct       *tty;
 
        tty = info->tty;
@@ -371,9 +371,9 @@ static void do_softint(void *private)
  *     do_serial_hangup() -> tty->hangup() -> rs_hangup()
  *
  */
-static void do_serial_hangup(void *private_)
+static void do_serial_hangup(struct work_struct *work_)
 {
-       struct NIOS_serial      *info = (struct NIOS_serial *) private_;
+       struct NIOS_serial      *info = container_of(work_,struct NIOS_serial, 
tqueue_hangup);
        struct tty_struct       *tty;
 
        tty = info->tty;
diff --git a/linux-2.6.x/drivers/serial/altera_juart.c 
b/linux-2.6.x/drivers/serial/altera_juart.c
index d59273c..5bffc9b 100644
--- a/linux-2.6.x/drivers/serial/altera_juart.c
+++ b/linux-2.6.x/drivers/serial/altera_juart.c
@@ -474,7 +474,7 @@ static int __init jtaguart_init(void)
 {
        int ret;
 
-       printk(KERN_INFO "Serial: JTAG UART driver $Revision: 1.4 $\n");
+       printk(KERN_INFO "Serial: JTAG UART driver $Revision: 1.3 $\n");
 
        ret = uart_register_driver(&juart_reg);
        if (ret == 0) {
diff --git a/linux-2.6.x/include/asm-nios2nommu/Kbuild 
b/linux-2.6.x/include/asm-nios2nommu/Kbuild
new file mode 100644
index 0000000..abf0368
--- /dev/null
+++ b/linux-2.6.x/include/asm-nios2nommu/Kbuild
@@ -0,0 +1,4 @@
+include include/asm-generic/Kbuild.asm
+
+header-y += traps.h
+header-y += io.h
diff --git a/linux-2.6.x/include/asm-nios2nommu/dma-mapping.h 
b/linux-2.6.x/include/asm-nios2nommu/dma-mapping.h
index 4328863..6289370 100644
--- a/linux-2.6.x/include/asm-nios2nommu/dma-mapping.h
+++ b/linux-2.6.x/include/asm-nios2nommu/dma-mapping.h
@@ -68,12 +68,12 @@ extern int dma_is_consistent(dma_addr_t dma_addr);
 extern void dma_cache_sync(void *vaddr, size_t size,
               enum dma_data_direction direction);
 
-#define ARCH_HAS_DMA_DECLARE_COHERENT_MEMORY
-
-extern int dma_declare_coherent_memory(struct device *dev, dma_addr_t bus_addr,
-       dma_addr_t device_addr, size_t size, int flags);
-extern void dma_release_declared_memory(struct device *dev);
-extern void * dma_mark_declared_memory_occupied(struct device *dev,
-       dma_addr_t device_addr, size_t size);
+// #define ARCH_HAS_DMA_DECLARE_COHERENT_MEMORY
+// 
+// extern int dma_declare_coherent_memory(struct device *dev, dma_addr_t 
bus_addr,
+//     dma_addr_t device_addr, size_t size, int flags);
+// extern void dma_release_declared_memory(struct device *dev);
+// extern void * dma_mark_declared_memory_occupied(struct device *dev,
+//     dma_addr_t device_addr, size_t size);
 
 #endif /* _ASM_DMA_MAPPING_H */
diff --git a/linux-2.6.x/include/asm-nios2nommu/io.h 
b/linux-2.6.x/include/asm-nios2nommu/io.h
index 73a5c17..d0e3741 100644
--- a/linux-2.6.x/include/asm-nios2nommu/io.h
+++ b/linux-2.6.x/include/asm-nios2nommu/io.h
@@ -46,6 +46,9 @@ extern void outsl(unsigned long port, void *src, unsigned 
long count);
 #define irq_canonicalize(i)    (i)
 #endif
 
+#endif /* __KERNEL__ */
+/* IO macros are needed by userspace programs */
+
 /*
  * readX/writeX() are used to access memory mapped devices. On some
  * architectures the memory mapped IO stuff needs to be accessed
@@ -138,7 +141,8 @@ extern void outsl(unsigned long port, void *src, unsigned 
long count);
 #define outw_p(x,addr) outw(x,addr)
 #define outl_p(x,addr) outl(x,addr)
 
-
+/* IO macros are needed by userspace programs */
+#ifdef __KERNEL__
 
 extern inline void insb(unsigned long port, void *dst, unsigned long count)
 {
@@ -243,6 +247,9 @@ extern void iounmap(void *addr);
 #define virt_to_bus virt_to_phys
 #define bus_to_virt phys_to_virt
 
+#define ioport_map(port, nr)   ioremap(port, nr)
+#define ioport_unmap(port)     iounmap(port)
+
 /*
  * Convert a physical pointer to a virtual kernel pointer for /dev/mem
  * access
@@ -254,6 +261,16 @@ extern void iounmap(void *addr);
  */
 #define xlate_dev_kmem_ptr(p)  p
 
+#define readsb(p,d,l)          insb(p,d,l)
+#define readsw(p,d,l)          insw(p,d,l)
+#define readsl(p,d,l)          insl(p,d,l)
+#define writesb(p,d,l)         outsb(p,d,l)
+#define writesw(p,d,l)         outsw(p,d,l)
+#define writesl(p,d,l)         outsl(p,d,l)
+#ifndef irq_canonicalize
+#define irq_canonicalize(i)    (i)
+#endif
+
 #endif /* __KERNEL__ */
 
 #endif /* !(__NIOS2_IO_H) */
diff --git a/linux-2.6.x/include/asm-nios2nommu/kdebug.h 
b/linux-2.6.x/include/asm-nios2nommu/kdebug.h
new file mode 100644
index 0000000..6ece1b0
--- /dev/null
+++ b/linux-2.6.x/include/asm-nios2nommu/kdebug.h
@@ -0,0 +1 @@
+#include <asm-generic/kdebug.h>
diff --git a/linux-2.6.x/include/asm-nios2nommu/page.h 
b/linux-2.6.x/include/asm-nios2nommu/page.h
index f784beb..764e73c 100644
--- a/linux-2.6.x/include/asm-nios2nommu/page.h
+++ b/linux-2.6.x/include/asm-nios2nommu/page.h
@@ -90,7 +90,8 @@ extern unsigned long memory_end;
 #define virt_to_pfn(kaddr)     (__pa(kaddr) >> PAGE_SHIFT)
 #define pfn_to_virt(pfn)       __va((pfn) << PAGE_SHIFT)
 
-#define virt_to_page(addr)     (mem_map + (((unsigned long)(addr)-PAGE_OFFSET) 
>> PAGE_SHIFT))
+#define virt_to_page(addr)     ((void*) addr < (void*) memory_end ? mem_map + \
+                               (((unsigned long)(addr)-PAGE_OFFSET) >> 
PAGE_SHIFT) : 0UL)
 #define page_to_virt(page)     ((((page) - mem_map) << PAGE_SHIFT) + 
PAGE_OFFSET)
 #define VALID_PAGE(page)       (((page) - mem_map) < max_mapnr)
 
diff --git a/linux-2.6.x/include/asm-nios2nommu/pgtable.h 
b/linux-2.6.x/include/asm-nios2nommu/pgtable.h
index 9c2f068..4124a33 100644
--- a/linux-2.6.x/include/asm-nios2nommu/pgtable.h
+++ b/linux-2.6.x/include/asm-nios2nommu/pgtable.h
@@ -29,6 +29,7 @@
 //vic - this bit copied from m68knommu version
 #include <asm/setup.h>
 #include <asm/io.h>
+#include <linux/sched.h>
 
 typedef pte_t *pte_addr_t;
 
@@ -101,4 +102,11 @@ extern inline void flush_pages_to_ram (unsigned long 
address, int n)
 #define        VMALLOC_START   0
 #define        VMALLOC_END     0xffffffff
 
+#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 /* _NIOS_PGTABLE_H */
diff --git a/linux-2.6.x/include/asm-nios2nommu/ptrace.h 
b/linux-2.6.x/include/asm-nios2nommu/ptrace.h
index c4e20c3..d669e08 100644
--- a/linux-2.6.x/include/asm-nios2nommu/ptrace.h
+++ b/linux-2.6.x/include/asm-nios2nommu/ptrace.h
@@ -114,6 +114,7 @@ struct switch_stack {
        unsigned long  ra;
 };
 
+#ifdef __KERNEL__
 /* Arbitrarily choose the same ptrace numbers as used by the Sparc code. */
 #define PTRACE_GETREGS            12
 #define PTRACE_SETREGS            13
@@ -122,8 +123,6 @@ struct switch_stack {
 #define PTRACE_SETFPREGS          15
 #endif
 
-#ifdef __KERNEL__
-
 #ifndef PS_S
 #define PS_S  (0x00000001)
 #endif
diff --git a/linux-2.6.x/include/asm-nios2nommu/socket.h 
b/linux-2.6.x/include/asm-nios2nommu/socket.h
index ca77fbe..5452e2b 100644
--- a/linux-2.6.x/include/asm-nios2nommu/socket.h
+++ b/linux-2.6.x/include/asm-nios2nommu/socket.h
@@ -73,5 +73,7 @@
 
 #define SO_PEERSEC             31      /* ;dgt2;tmp;                   */
 #define SO_PASSSEC             34
+#define SO_TIMESTAMPNS         35
+#define SCM_TIMESTAMPNS                SO_TIMESTAMPNS
 
 #endif /* _ASM_SOCKET_H */
diff --git a/linux-2.6.x/include/asm-nios2nommu/sockios.h 
b/linux-2.6.x/include/asm-nios2nommu/sockios.h
index d9c181b..c604aa7 100644
--- a/linux-2.6.x/include/asm-nios2nommu/sockios.h
+++ b/linux-2.6.x/include/asm-nios2nommu/sockios.h
@@ -32,7 +32,8 @@
 #define FIOGETOWN      0x8903
 #define SIOCGPGRP      0x8904
 #define SIOCATMARK     0x8905
-#define SIOCGSTAMP     0x8906          /* Get stamp */
+#define SIOCGSTAMP     0x8906  /* Get stamp */
+#define SIOCGSTAMPNS   0x8907  /* Get stamp (timespec) */
 
 #endif /* !(_ASM_NIOS_SOCKIOS_H) */
 
diff --git a/linux-2.6.x/include/asm-nios2nommu/system.h 
b/linux-2.6.x/include/asm-nios2nommu/system.h
index a6ea4c8..7c35af0 100644
--- a/linux-2.6.x/include/asm-nios2nommu/system.h
+++ b/linux-2.6.x/include/asm-nios2nommu/system.h
@@ -26,6 +26,7 @@
 #define _NIOS2NOMMU_SYSTEM_H
 
 #include <linux/linkage.h>
+#include <linux/compiler.h>
 #include <asm/segment.h>
 #include <asm/entry.h>
 #include <asm/nios.h>
diff --git a/linux-2.6.x/include/asm-nios2nommu/uaccess.h 
b/linux-2.6.x/include/asm-nios2nommu/uaccess.h
index 0ef6734..e7ea20a 100644
--- a/linux-2.6.x/include/asm-nios2nommu/uaccess.h
+++ b/linux-2.6.x/include/asm-nios2nommu/uaccess.h
@@ -173,11 +173,12 @@ static inline long strnlen_user(const char *src, long n)
  * Zero Userspace
  */
 
-static inline unsigned long
-clear_user(void *to, unsigned long n)
+static inline unsigned long __clear_user(void *to, unsigned long n)
 {
        memset(to, 0, n);
-    return(0);
+       return(0);
 }
 
+#define clear_user(to, n) __clear_user(to, n)
+
 #endif /* _NIOS2NOMMU_UACCESS_H */
diff --git a/linux-2.6.x/include/asm-nios2nommu/unistd.h 
b/linux-2.6.x/include/asm-nios2nommu/unistd.h
index 248ce0a..1a00d92 100644
--- a/linux-2.6.x/include/asm-nios2nommu/unistd.h
+++ b/linux-2.6.x/include/asm-nios2nommu/unistd.h
@@ -213,8 +213,8 @@
 #define __NR_rt_sigtimedwait   177
 #define __NR_rt_sigqueueinfo   178
 #define __NR_rt_sigsuspend     179
-#define __NR_pread64           180
-#define __NR_pwrite64          181
+#define __NR_pread             180
+#define __NR_pwrite            181
 #define __NR_lchown            182
 #define __NR_getcwd            183
 #define __NR_capget            184
@@ -251,375 +251,114 @@
 #define __NR_setfsuid32                215
 #define __NR_setfsgid32                216
 #define __NR_pivot_root                217
+/* 218 unused */
+/* 219 unused */
 #define __NR_getdents64                220
-#define __NR_fcntl64           221
-#define __NR_security          223
-#define __NR_gettid            224
-#define __NR_readahead         225
-#define __NR_setxattr          226
-#define __NR_lsetxattr         227
-#define __NR_fsetxattr         228
-#define __NR_getxattr          229
-#define __NR_lgetxattr         230
-#define __NR_fgetxattr         231
-#define __NR_listxattr         232
-#define __NR_llistxattr                233
-#define __NR_flistxattr                234
-#define __NR_removexattr       235
-#define __NR_lremovexattr      236
-#define __NR_fremovexattr      237
-#define __NR_tkill             238
-#define __NR_sendfile64                239
-#define __NR_futex             240
-#define __NR_sched_setaffinity 241
-#define __NR_sched_getaffinity 242
-#define __NR_set_thread_area   243
-#define __NR_get_thread_area   244
-#define __NR_io_setup          245
-#define __NR_io_destroy                246
-#define __NR_io_getevents      247
-#define __NR_io_submit         248
-#define __NR_io_cancel         249
-#define __NR_alloc_hugepages   250
-#define __NR_free_hugepages    251
-#define __NR_exit_group                252
-#define __NR_lookup_dcookie    253
-#define __NR_sys_epoll_create  254
-#define __NR_sys_epoll_ctl     255
-#define __NR_sys_epoll_wait    256
-#define __NR_remap_file_pages  257
-#define __NR_set_tid_address   258
-#define __NR_timer_create      259
-#define __NR_timer_settime     (__NR_timer_create+1)
-#define __NR_timer_gettime     (__NR_timer_create+2)
-#define __NR_timer_getoverrun  (__NR_timer_create+3)
-#define __NR_timer_delete      (__NR_timer_create+4)
-#define __NR_clock_settime     (__NR_timer_create+5)
-#define __NR_clock_gettime     (__NR_timer_create+6)
-#define __NR_clock_getres      (__NR_timer_create+7)
-#define __NR_clock_nanosleep   (__NR_timer_create+8)
-#define __NR_statfs64          268
-#define __NR_fstatfs64         269
-#define __NR_tgkill            270
-#define __NR_utimes            271
-#define __NR_fadvise64_64      272
-#define __NR_vserver           273
-#define __NR_mbind             274
-#define __NR_get_mempolicy     275
-#define __NR_set_mempolicy     276
-#define __NR_mq_open           277
-#define __NR_mq_unlink         (__NR_mq_open+1)
-#define __NR_mq_timedsend      (__NR_mq_open+2)
-#define __NR_mq_timedreceive   (__NR_mq_open+3)
-#define __NR_mq_notify         (__NR_mq_open+4)
-#define __NR_mq_getsetattr     (__NR_mq_open+5)
-#define __NR_sys_kexec_load    283
-#define __NR_waitid            284
-/* #define __NR_sys_setaltroot 285 */
-#define __NR_add_key           286
-#define __NR_request_key       287
-#define __NR_keyctl            288
-
-#define NR_syscalls 289
-
-
-/* user-visible error numbers are in the range -1 - -122: see
-   <asm-nios2nommu/errno.h> */
-
-#define __syscall_return(type, res) \
-do { \
-       if ((unsigned long)(res) >= (unsigned long)(-125)) { \
-                                                                        \
-                /* avoid using res which is declared to be in           \
-                    register r2; errno might expand to a function       \
-                    call and clobber it.                          */    \
-                                                                        \
-               int __err = -(res); \
-               errno = __err; \
-               res = -1; \
-       } \
-       return (type) (res); \
-} while (0)
-
-#define _syscall0(type,name) \
-type name(void) \
-{ \
-    long __res;                                             \
-                                                            \
-    __asm__ __volatile__ (                                  \
-                                                            \
-        "    \n\t"                                          \
-                                                            \
-        "    movi    r2,    %2\n\t"   /* TRAP_ID_SYSCALL */ \
-        "    movi    r3,    %1\n\t"   /* __NR_##name     */ \
-                                                            \
-        "    trap\n\t"                                      \
-        "    mov     %0,    r2\n\t"   /* syscall rtn     */ \
-                                                            \
-        "    \n\t"                                          \
-                                                            \
-        :   "=r" (__res)              /* %0              */ \
-                                                            \
-        :   "i" (__NR_##name)         /* %1              */ \
-          , "i" (TRAP_ID_SYSCALL)     /* %2              */ \
-                                                            \
-        :   "r2"                      /* Clobbered       */ \
-          , "r3"                      /* Clobbered       */ \
-        );                                                  \
-                                                            \
-__syscall_return(type,__res); \
-}
-
-//;dgt2;tmp;can we RELY on syscall1 arg a
-//;dgt2;tmp; already being in r4 ?
-#define _syscall1(type,name,atype,a) \
-type name(atype a) \
-{ \
-    long __res;                                             \
-                                                            \
-    __asm__ __volatile__ (                                  \
-                                                            \
-        "    \n\t"                                          \
-                                                            \
-        "    movi    r2,    %2\n\t"   /* TRAP_ID_SYSCALL */ \
-        "    movi    r3,    %1\n\t"   /* __NR_##name     */ \
-        "    mov     r4,    %3\n\t"   /* (long) a        */ \
-                                                            \
-        "    trap\n\t"                                      \
-        "    mov     %0,    r2\n\t"   /* syscall rtn     */ \
-                                                            \
-        "    \n\t"                                          \
-                                                            \
-        :   "=r" (__res)              /* %0              */ \
-                                                            \
-        :   "i" (__NR_##name)         /* %1              */ \
-          , "i" (TRAP_ID_SYSCALL)     /* %2              */ \
-          , "r" ((long) a)            /* %3              */ \
-                                                            \
-        :   "r2"                      /* Clobbered       */ \
-          , "r3"                      /* Clobbered       */ \
-          , "r4"                      /* Clobbered       */ \
-        );                                                  \
-                                                            \
-__syscall_return(type,__res); \
-}
-
-//;dgt2;tmp;can we RELY on syscall2 args a,b
-//;dgt2;tmp; already being in r4,r5 ?
-#define _syscall2(type,name,atype,a,btype,b) \
-type name(atype a,btype b) \
-{ \
-    long __res;                                             \
-                                                            \
-    __asm__ __volatile__ (                                  \
-                                                            \
-        "    \n\t"                                          \
-                                                            \
-        "    movi    r2,    %2\n\t"   /* TRAP_ID_SYSCALL */ \
-        "    movi    r3,    %1\n\t"   /* __NR_##name     */ \
-        "    mov     r4,    %3\n\t"   /* (long) a        */ \
-        "    mov     r5,    %4\n\t"   /* (long) b        */ \
-                                                            \
-        "    trap\n\t"                                      \
-        "    mov     %0,    r2\n\t"   /* syscall rtn     */ \
-                                                            \
-        "    \n\t"                                          \
-                                                            \
-        :   "=r" (__res)              /* %0              */ \
-                                                            \
-        :   "i" (__NR_##name)         /* %1              */ \
-          , "i" (TRAP_ID_SYSCALL)     /* %2              */ \
-          , "r" ((long) a)            /* %3              */ \
-          , "r" ((long) b)            /* %4              */ \
-                                                            \
-        :   "r2"                      /* Clobbered       */ \
-          , "r3"                      /* Clobbered       */ \
-          , "r4"                      /* Clobbered       */ \
-          , "r5"                      /* Clobbered       */ \
-        );                                                  \
-                                                            \
-__syscall_return(type,__res); \
-}
-
-//;dgt2;tmp;can we RELY on syscall3 args a,b,c
-//;dgt2;tmp; already being in r4,r5,r6 ?
-#define _syscall3(type,name,atype,a,btype,b,ctype,c) \
-type name(atype a,btype b,ctype c) \
-{ \
-    long __res;                                             \
-                                                            \
-    __asm__ __volatile__ (                                  \
-                                                            \
-        "    \n\t"                                          \
-                                                            \
-        "    movi    r2,    %2\n\t"   /* TRAP_ID_SYSCALL */ \
-        "    movi    r3,    %1\n\t"   /* __NR_##name     */ \
-        "    mov     r4,    %3\n\t"   /* (long) a        */ \
-        "    mov     r5,    %4\n\t"   /* (long) b        */ \
-        "    mov     r6,    %5\n\t"   /* (long) c        */ \
-                                                            \
-        "    trap\n\t"                                      \
-        "    mov     %0,    r2\n\t"   /* syscall rtn     */ \
-                                                            \
-        "    \n\t"                                          \
-                                                            \
-        :   "=r" (__res)              /* %0              */ \
-                                                            \
-        :   "i" (__NR_##name)         /* %1              */ \
-          , "i" (TRAP_ID_SYSCALL)     /* %2              */ \
-          , "r" ((long) a)            /* %3              */ \
-          , "r" ((long) b)            /* %4              */ \
-          , "r" ((long) c)            /* %5              */ \
-                                                            \
-        :   "r2"                      /* Clobbered       */ \
-          , "r3"                      /* Clobbered       */ \
-          , "r4"                      /* Clobbered       */ \
-          , "r5"                      /* Clobbered       */ \
-          , "r6"                      /* Clobbered       */ \
-        );                                                  \
-                                                            \
-__syscall_return(type,__res); \
-}
-
-//;dgt2;tmp;can we RELY on syscall4 args a,b,c,d
-//;dgt2;tmp; already being in r4,r5,r6,r7 ?
-#define _syscall4(type,name,atype,a,btype,b,ctype,c,dtype,d) \
-type name (atype a, btype b, ctype c, dtype d) \
-{ \
-    long __res;                                             \
-                                                            \
-    __asm__ __volatile__ (                                  \
-                                                            \
-        "    \n\t"                                          \
-                                                            \
-        "    movi    r2,    %2\n\t"   /* TRAP_ID_SYSCALL */ \
-        "    movi    r3,    %1\n\t"   /* __NR_##name     */ \
-        "    mov     r4,    %3\n\t"   /* (long) a        */ \
-        "    mov     r5,    %4\n\t"   /* (long) b        */ \
-        "    mov     r6,    %5\n\t"   /* (long) c        */ \
-        "    mov     r7,    %6\n\t"   /* (long) d        */ \
-                                                            \
-        "    trap\n\t"                                      \
-        "    mov     %0,    r2\n\t"   /* syscall rtn     */ \
-                                                            \
-        "    \n\t"                                          \
-                                                            \
-        :   "=r" (__res)              /* %0              */ \
-                                                            \
-        :   "i" (__NR_##name)         /* %1              */ \
-          , "i" (TRAP_ID_SYSCALL)     /* %2              */ \
-          , "r" ((long) a)            /* %3              */ \
-          , "r" ((long) b)            /* %4              */ \
-          , "r" ((long) c)            /* %5              */ \
-          , "r" ((long) d)            /* %6              */ \
-                                                            \
-        :   "r2"                      /* Clobbered       */ \
-          , "r3"                      /* Clobbered       */ \
-          , "r4"                      /* Clobbered       */ \
-          , "r5"                      /* Clobbered       */ \
-          , "r6"                      /* Clobbered       */ \
-          , "r7"                      /* Clobbered       */ \
-        );                                                  \
-                                                            \
-__syscall_return(type,__res); \
-}
-
-//;dgt2;tmp;can we RELY on syscall5 args a,b,c,d
-//;dgt2;tmp; already being in r4,r5,r6,r7 ?
-#define _syscall5(type,name,atype,a,btype,b,ctype,c,dtype,d,etype,e) \
-type name (atype a,btype b,ctype c,dtype d,etype e) \
-{ \
-    long __res;                                             \
-                                                            \
-    __asm__ __volatile__ (                                  \
-                                                            \
-        "    \n\t"                                          \
-                                                            \
-        "    movi    r2,    %2\n\t"   /* TRAP_ID_SYSCALL */ \
-        "    movi    r3,    %1\n\t"   /* __NR_##name     */ \
-        "    mov     r4,    %3\n\t"   /* (long) a        */ \
-        "    mov     r5,    %4\n\t"   /* (long) b        */ \
-        "    mov     r6,    %5\n\t"   /* (long) c        */ \
-        "    mov     r7,    %6\n\t"   /* (long) c        */ \
-        "    mov     r8,    %7\n\t"   /* (long) e        */ \
-                                                            \
-        "    trap\n\t"                                      \
-        "    mov     %0,    r2\n\t"   /* syscall rtn     */ \
-                                                            \
-        "    \n\t"                                          \
-                                                            \
-        :   "=r" (__res)              /* %0              */ \
-                                                            \
-        :   "i" (__NR_##name)         /* %1              */ \
-          , "i" (TRAP_ID_SYSCALL)     /* %2              */ \
-          , "r" ((long) a)            /* %3              */ \
-          , "r" ((long) b)            /* %4              */ \
-          , "r" ((long) c)            /* %5              */ \
-          , "r" ((long) d)            /* %6              */ \
-          , "r" ((long) e)            /* %7              */ \
-                                                            \
-        :   "r2"                      /* Clobbered       */ \
-          , "r3"                      /* Clobbered       */ \
-          , "r4"                      /* Clobbered       */ \
-          , "r5"                      /* Clobbered       */ \
-          , "r6"                      /* Clobbered       */ \
-          , "r7"                      /* Clobbered       */ \
-          , "r8"                      /* Clobbered       */ \
-        );                                                  \
-                                                            \
-__syscall_return(type,__res); \
-}
-
-//;dgt2;tmp;can we RELY on syscall6 args a,b,c,d
-//;dgt2;tmp; already being in r4,r5,r6,r7 ?
-#define _syscall6(type,name,atype,a,btype,b,ctype,c,dtype,d,etype,e,ftype,f) \
-type name (atype a,btype b,ctype c,dtype d,etype e,ftype f) \
-{ \
-    long __res;                                             \
-                                                            \
-    __asm__ __volatile__ (                                  \
-                                                            \
-        "    \n\t"                                          \
-                                                            \
-        "    movi    r2,    %2\n\t"   /* TRAP_ID_SYSCALL */ \
-        "    movi    r3,    %1\n\t"   /* __NR_##name     */ \
-        "    mov     r4,    %3\n\t"   /* (long) a        */ \
-        "    mov     r5,    %4\n\t"   /* (long) b        */ \
-        "    mov     r6,    %5\n\t"   /* (long) c        */ \
-        "    mov     r7,    %6\n\t"   /* (long) c        */ \
-        "    mov     r8,    %7\n\t"   /* (long) e        */ \
-        "    mov     r9,    %8\n\t"   /* (long) f        */ \
-                                                            \
-        "    trap\n\t"                                      \
-        "    mov     %0,    r2\n\t"   /* syscall rtn     */ \
-                                                            \
-        "    \n\t"                                          \
-                                                            \
-        :   "=r" (__res)              /* %0              */ \
-                                                            \
-        :   "i" (__NR_##name)         /* %1              */ \
-          , "i" (TRAP_ID_SYSCALL)     /* %2              */ \
-          , "r" ((long) a)            /* %3              */ \
-          , "r" ((long) b)            /* %4              */ \
-          , "r" ((long) c)            /* %5              */ \
-          , "r" ((long) d)            /* %6              */ \
-          , "r" ((long) e)            /* %7              */ \
-          , "r" ((long) f)            /* %8              */ \
-                                                            \
-        :   "r2"                      /* Clobbered       */ \
-          , "r3"                      /* Clobbered       */ \
-          , "r4"                      /* Clobbered       */ \
-          , "r5"                      /* Clobbered       */ \
-          , "r6"                      /* Clobbered       */ \
-          , "r7"                      /* Clobbered       */ \
-          , "r8"                      /* Clobbered       */ \
-          , "r9"                      /* Clobbered       */ \
-        );                                                  \
-                                                            \
-__syscall_return(type,__res); \
-}
+#define __NR_gettid            221
+#define __NR_tkill             222
+#define __NR_setxattr          223
+#define __NR_lsetxattr         224
+#define __NR_fsetxattr         225
+#define __NR_getxattr          226
+#define __NR_lgetxattr         227
+#define __NR_fgetxattr         228
+#define __NR_listxattr         229
+#define __NR_llistxattr                230
+#define __NR_flistxattr                231
+#define __NR_removexattr       232
+#define __NR_lremovexattr      233
+#define __NR_fremovexattr      234
+#define __NR_futex             235
+#define __NR_sendfile64                236
+#define __NR_mincore           237
+#define __NR_madvise           238
+#define __NR_fcntl64           239
+#define __NR_readahead         240
+#define __NR_io_setup          241
+#define __NR_io_destroy                242
+#define __NR_io_getevents      243
+#define __NR_io_submit         244
+#define __NR_io_cancel         245
+#define __NR_fadvise64         246
+#define __NR_exit_group                247
+#define __NR_lookup_dcookie    248
+#define __NR_epoll_create      249
+#define __NR_epoll_ctl         250
+#define __NR_epoll_wait                251
+#define __NR_remap_file_pages  252
+#define __NR_set_tid_address   253
+#define __NR_timer_create      254
+#define __NR_timer_settime     255
+#define __NR_timer_gettime     256
+#define __NR_timer_getoverrun  257
+#define __NR_timer_delete      258
+#define __NR_clock_settime     259
+#define __NR_clock_gettime     260
+#define __NR_clock_getres      261
+#define __NR_clock_nanosleep   262
+#define __NR_statfs64          263
+#define __NR_fstatfs64         264
+#define __NR_tgkill            265
+#define __NR_utimes            266
+#define __NR_fadvise64_64      267
+#define __NR_mbind             268
+#define __NR_get_mempolicy     269
+#define __NR_set_mempolicy     270
+#define __NR_mq_open           271
+#define __NR_mq_unlink         272
+#define __NR_mq_timedsend      273
+#define __NR_mq_timedreceive   274
+#define __NR_mq_notify         275
+#define __NR_mq_getsetattr     276
+#define __NR_waitid            277
+#define __NR_sys_setaltroot    278
+#define __NR_add_key           279
+#define __NR_request_key       280
+#define __NR_keyctl            281
+#define __NR_ioprio_set                282
+#define __NR_ioprio_get                283
+#define __NR_inotify_init      284
+#define __NR_inotify_add_watch 285
+#define __NR_inotify_rm_watch  286
+#define __NR_migrate_pages     287
+#define __NR_openat            288
+#define __NR_mkdirat           289
+#define __NR_mknodat           290
+#define __NR_fchownat          291
+#define __NR_futimesat         292
+#define __NR_fstatat64         293
+#define __NR_unlinkat          294
+#define __NR_renameat          295
+#define __NR_linkat            296
+#define __NR_symlinkat         297
+#define __NR_readlinkat                298
+#define __NR_fchmodat          299
+#define __NR_faccessat         300
+#define __NR_pselect6          301
+#define __NR_ppoll             302
+#define __NR_unshare           303
+#define __NR_set_robust_list   304
+#define __NR_get_robust_list   305
+#define __NR_splice            306
+#define __NR_sync_file_range   307
+#define __NR_tee               308
+#define __NR_vmsplice          309
+#define __NR_move_pages                310
+#define __NR_sched_setaffinity 311
+#define __NR_sched_getaffinity 312
+#define __NR_kexec_load                313
+#define __NR_getcpu            314
+#define __NR_epoll_pwait       315
+#define __NR_utimensat         316
+#define __NR_signalfd          317
+#define __NR_timerfd           318
+#define __NR_eventfd           319
+#define __NR_pread64           320
+#define __NR_pwrite64          321
 
 #ifdef __KERNEL__
+#define NR_syscalls            322
+
 #define __ARCH_WANT_IPC_PARSE_VERSION
 #define __ARCH_WANT_OLD_READDIR
 #define __ARCH_WANT_OLD_STAT
@@ -642,46 +381,6 @@ __syscall_return(type,__res); \
 #define __ARCH_WANT_SYS_SIGPENDING
 #define __ARCH_WANT_SYS_SIGPROCMASK
 #define __ARCH_WANT_SYS_RT_SIGACTION
-#endif
-
-#ifdef __KERNEL_SYSCALLS__
-
-#include <linux/compiler.h>
-#include <linux/types.h>
-
-/*
- * we need this inline - forking from kernel space will result
- * in NO COPY ON WRITE (!!!), until an execve is executed. This
- * is no problem, but for the stack. This is handled by not letting
- * main() use the stack at all after fork(). Thus, no function
- * calls - which means inline code for fork too, as otherwise we
- * would use the stack upon exit from 'fork()'.
- *
- * Actually only pause and fork are needed inline, so that there
- * won't be any messing with the stack from main(), but we define
- * some others too.
- */
-#define __NR__exit __NR_exit
-static inline _syscall0(int,pause)
-static inline _syscall0(int,sync)
-static inline _syscall0(pid_t,setsid)
-static inline _syscall3(int,write,int,fd,const char *,buf,off_t,count)
-static inline _syscall3(int,read,int,fd,char *,buf,off_t,count)
-static inline _syscall3(off_t,lseek,int,fd,off_t,offset,int,count)
-static inline _syscall1(int,dup,int,fd)
-static inline _syscall3(int,execve,const char *,file,char **,argv,char **,envp)
-static inline _syscall3(int,open,const char *,file,int,flag,int,mode)
-static inline _syscall1(int,close,int,fd)
-static inline _syscall1(int,_exit,int,exitcode)
-static inline _syscall3(pid_t,waitpid,pid_t,pid,int *,wait_stat,int,options)
-static inline _syscall1(int,delete_module,const char *,name)
-
-static inline pid_t wait(int * wait_stat)
-{
-       return waitpid(-1,wait_stat,0);
-}
-
-#endif
 
 /*
  * "Conditional" syscalls
@@ -691,4 +390,6 @@ static inline pid_t wait(int * wait_stat)
  */
 #define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall");
 
+#endif /* __KERNEL__ */
+
 #endif /* _ASM_NIOS_UNISTD_H_ */
-- 
1.5.3.2

_______________________________________________
uClinux-dev mailing list
[email protected]
http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
This message was resent by [email protected]
To unsubscribe see:
http://mailman.uclinux.org/mailman/options/uclinux-dev

Reply via email to