summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Schwinge <thomas@schwinge.name>2011-10-10 12:19:20 +0200
committerThomas Schwinge <thomas@schwinge.name>2011-10-10 12:19:44 +0200
commit7497bcf50bbffcf2680437b9fe0decf0d1bdec7a (patch)
tree7829bce9a2335fac5425c82c0ae538bff9b716f0
parentaa60c6a6ab31c0e86243d82f4f67687c3f8ac86c (diff)
parent729f452a4ff186ae6990c6a3abd1705f42731343 (diff)
Merge commit '729f452a4ff186ae6990c6a3abd1705f42731343' into master-user_level_drivers
* Makefrag.am: Resolve conflict. * linux/dev/arch/i386/kernel/irq.c (install_user_intr_handler): Use EAGAIN instead of LINUX_EAGAIN, and ENOMEM instead of LINUX_ENOMEM.
-rw-r--r--.gitignore38
-rw-r--r--Makefile.am35
-rw-r--r--Makefrag.am8
-rw-r--r--Makerules.am10
-rw-r--r--Makerules.mig.am22
-rw-r--r--configure.ac6
-rw-r--r--device/cons.h11
-rw-r--r--device/dev_pager.c1
-rw-r--r--device/ds_routines.c3
-rw-r--r--device/ds_routines.h4
-rw-r--r--device/errno.h45
-rw-r--r--device/net_io.c3
-rw-r--r--i386/i386/db_interface.c5
-rw-r--r--i386/i386/fpu.c4
-rw-r--r--i386/i386/fpu.h1
-rw-r--r--i386/i386/hardclock.c8
-rw-r--r--i386/i386/i386asm.sym2
-rw-r--r--i386/i386/ipl.h1
-rw-r--r--i386/i386/locore.S87
-rw-r--r--i386/i386/locore.h6
-rw-r--r--i386/i386/pcb.c1
-rw-r--r--i386/i386/pic.h4
-rw-r--r--i386/i386/proc_reg.h2
-rw-r--r--i386/i386/trap.c1
-rw-r--r--i386/i386/vm_param.h5
-rw-r--r--i386/i386/xen.h3
-rw-r--r--i386/i386at/com.c19
-rw-r--r--i386/i386at/com.h6
-rw-r--r--i386/i386at/cons_conf.c6
-rw-r--r--i386/i386at/kd.c19
-rw-r--r--i386/i386at/kd.h7
-rw-r--r--i386/i386at/kd_event.c2
-rw-r--r--i386/i386at/kd_mouse.c6
-rw-r--r--i386/i386at/lpr.c8
-rw-r--r--i386/i386at/model_dep.c13
-rw-r--r--i386/i386at/pic_isa.c6
-rw-r--r--i386/i386at/rtc.c1
-rw-r--r--i386/intel/pmap.c8
-rw-r--r--i386/xen/xen.c4
-rw-r--r--i386/xen/xen_boothdr.S6
-rw-r--r--i386/xen/xen_locore.S2
-rw-r--r--include/mach/mach_types.defs10
-rw-r--r--include/mach/xen.h2
-rw-r--r--include/string.h2
-rw-r--r--kern/debug.h2
-rw-r--r--kern/mach_clock.h8
-rw-r--r--kern/printf.h1
-rw-r--r--linux/dev/arch/i386/kernel/irq.c27
-rw-r--r--linux/dev/drivers/block/floppy.c11
-rw-r--r--linux/dev/drivers/block/genhd.c5
-rw-r--r--linux/dev/glue/block.c40
-rw-r--r--linux/dev/glue/glue.h44
-rw-r--r--linux/dev/glue/kmem.c6
-rw-r--r--linux/dev/glue/misc.c35
-rw-r--r--linux/dev/glue/net.c7
-rw-r--r--linux/dev/include/asm-i386/errno.h266
-rw-r--r--linux/dev/include/linux/blk.h2
-rw-r--r--linux/dev/include/linux/kernel.h4
-rw-r--r--linux/dev/include/linux/notifier.h4
-rw-r--r--linux/dev/init/main.c27
-rw-r--r--linux/dev/kernel/dma.c4
-rw-r--r--linux/dev/kernel/printk.c1
-rw-r--r--linux/dev/kernel/resource.c2
-rw-r--r--linux/dev/kernel/sched.c27
-rw-r--r--linux/dev/kernel/softirq.c2
-rw-r--r--linux/dev/lib/vsprintf.c4
-rw-r--r--linux/pcmcia-cs/glue/wireless_glue.h9
-rw-r--r--linux/src/drivers/block/floppy.c4
-rw-r--r--linux/src/drivers/block/ide-cd.c64
-rw-r--r--linux/src/drivers/block/ide.c23
-rw-r--r--linux/src/drivers/block/ide.h2
-rw-r--r--linux/src/drivers/net/8390.c3
-rw-r--r--linux/src/drivers/net/at1700.c2
-rw-r--r--linux/src/drivers/net/de4x5.c20
-rw-r--r--linux/src/drivers/net/depca.c8
-rw-r--r--linux/src/drivers/scsi/FlashPoint.c15
-rw-r--r--linux/src/drivers/scsi/gdth.c5
-rw-r--r--linux/src/drivers/scsi/ppa.c5
-rw-r--r--linux/src/drivers/scsi/wd7000.c2
-rw-r--r--linux/src/include/asm-i386/string-486.h702
-rw-r--r--linux/src/include/linux/compiler-gcc.h106
-rw-r--r--linux/src/include/linux/compiler-gcc3.h23
-rw-r--r--linux/src/include/linux/compiler-gcc4.h57
-rw-r--r--linux/src/include/linux/compiler.h311
-rw-r--r--linux/src/include/linux/ctype.h70
-rw-r--r--linux/src/include/linux/init.h (renamed from linux/pcmcia-cs/include/linux/init.h)10
-rw-r--r--linux/src/include/linux/kcomp.h2
-rw-r--r--linux/src/include/linux/module.h3
-rw-r--r--linux/src/init/main.c3
-rw-r--r--linux/src/lib/ctype.c54
-rw-r--r--vm/memory_object_proxy.c2
-rw-r--r--vm/vm_map.c3
-rw-r--r--xen/block.c2
-rw-r--r--xen/block.h2
-rw-r--r--xen/console.c5
-rw-r--r--xen/console.h9
-rw-r--r--xen/evt.c2
-rw-r--r--xen/evt.h2
-rw-r--r--xen/grant.c2
-rw-r--r--xen/grant.h2
-rw-r--r--xen/net.c2
-rw-r--r--xen/net.h2
-rw-r--r--xen/ring.c2
-rw-r--r--xen/ring.h2
-rw-r--r--xen/store.c2
-rw-r--r--xen/store.h2
-rw-r--r--xen/time.c2
-rw-r--r--xen/time.h2
-rw-r--r--xen/xen.c9
-rw-r--r--xen/xen.h3
110 files changed, 1076 insertions, 1458 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 00000000..fe5d53a0
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,38 @@
+.deps
+.dirstamp
+.Tpo
+*.o
+*.a
+*.defs.*
+*.user.*
+*.server.*
+*.info
+*.info-*
+autom4te.cache/
+build-aux/
+mach/
+INSTALL
+Makefile
+Makefile.in
+aclocal.m4
+config.h*
+config.log
+config.status
+config.status.orig
+configure
+gnumach
+gnumach-undef
+gnumach-undef-bad
+gnumach.msgids
+stamp-h1
+stamp-vti
+version.c
+version.texi
+
+i386/i386/i386asm.h
+tests/test-mbchk
+
+# Ignore arch symlinks
+machine
+linux/src/include/asm
+linux/dev/include/asm
diff --git a/Makefile.am b/Makefile.am
index 04885ddb..56db9e9b 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,6 +1,6 @@
# Makefile for GNU Mach.
-# Copyright (C) 2006, 2007, 2008 Free Software Foundation, Inc.
+# Copyright (C) 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
@@ -51,6 +51,9 @@ AM_CPPFLAGS += \
-I$(top_srcdir)/$(systype)/include/mach/sa \
-I$(top_srcdir)/include
+AM_CFLAGS += \
+ -fno-builtin-log
+
# Yes, this makes the eyes hurt. But perhaps someone will finally take care of
# all that scruffy Mach code... Also see <http://savannah.gnu.org/task/?5726>.
AM_CFLAGS += \
@@ -68,6 +71,26 @@ AM_CFLAGS += \
endif
#
+# Silent build support.
+#
+
+AWK_V = $(AWK_V_$(V))
+AWK_V_ = $(AWK_V_$(AM_DEFAULT_VERBOSITY))
+AWK_V_0 = @echo " AWK $@";
+
+GZIP_V = $(GZIP_V_$(V))
+GZIP_V_ = $(GZIP_V_$(AM_DEFAULT_VERBOSITY))
+GZIP_V_0 = @echo " GZIP $@";
+
+NM_V = $(NM_V_$(V))
+NM_V_ = $(NM_V_$(AM_DEFAULT_VERBOSITY))
+NM_V_0 = @echo " NM $@";
+
+MIGCOM_V = $(MIGCOM_V_$(V))
+MIGCOM_V_ = $(MIGCOM_V_$(AM_DEFAULT_VERBOSITY))
+MIGCOM_V_0 = @echo " MIG $@";
+
+#
# MIG Setup.
#
@@ -133,22 +156,22 @@ noinst_PROGRAMS += \
gnumach.o
# This is the list of routines we decide is OK to steal from the C library.
-clib_routines := memcmp memcpy memmove memset bcopy bzero \
+clib_routines := memcmp memcpy memmove memset \
strchr strstr strsep strpbrk strtok \
htonl htons ntohl ntohs \
udivdi3 __udivdi3 \
__rel_iplt_start __rel_iplt_end \
_START _start etext _edata end _end # actually ld magic, not libc.
gnumach-undef: gnumach.$(OBJEXT)
- $(NM) -u $< | sed 's/ *U *//' | sort -u > $@
+ $(NM_V) $(NM) -u $< | sed 's/ *U *//' | sort -u > $@
MOSTLYCLEANFILES += gnumach-undef
gnumach-undef-bad: gnumach-undef Makefile
- sed '$(foreach r,$(clib_routines),/^$r$$/d;)' $< > $@
+ $(AM_V_GEN) sed '$(foreach r,$(clib_routines),/^$r$$/d;)' $< > $@
MOSTLYCLEANFILES += gnumach-undef-bad
clib-routines.o: gnumach-undef gnumach-undef-bad
- if test -s gnumach-undef-bad; \
+ $(AM_V_at) if test -s gnumach-undef-bad; \
then cat gnumach-undef-bad; exit 2; else true; fi
- $(CCLD) -nostdlib -nostartfiles -r -static \
+ $(AM_V_CCLD) $(CCLD) -nostdlib -nostartfiles -r -static \
-o $@ `sed 's/^/-Wl,-u,/' < $<` -x c /dev/null -lc -lgcc
gnumach_LINK = $(LD) $(LINKFLAGS) $(gnumach_LINKFLAGS) -o $@
diff --git a/Makefrag.am b/Makefrag.am
index e6ae390e..71ab1230 100644
--- a/Makefrag.am
+++ b/Makefrag.am
@@ -1,6 +1,7 @@
# Main Makefile fragment for GNU Mach.
-# Copyright (C) 1997, 1999, 2004, 2006, 2007 Free Software Foundation, Inc.
+# Copyright (C) 1997, 1999, 2004, 2006, 2007, 2009 Free Software
+# Foundation, Inc.
# Permission to use, copy, modify and distribute this software and its
# documentation is hereby granted, provided that both the copyright
@@ -280,7 +281,6 @@ libkernel_a_SOURCES += \
device/ds_routines.c \
device/ds_routines.h \
device/intr.c \
- device/errno.h \
device/if_ether.h \
device/if_hdr.h \
device/io_req.h \
@@ -503,8 +503,8 @@ nodist_libkernel_a_SOURCES += \
MOSTLYCLEANFILES += \
gnumach.msgids
gnumach.msgids: $(filter %.msgids,$(nodist_libkernel_a_SOURCES))
- cat $^ > $@.new
- mv $@.new $@
+ $(AM_V_at) cat $^ > $@.new
+ $(AM_V_GEN) mv $@.new $@
# `exec_' prefix, so that we don't try to build that file during when running
# `make install-data', as it may fail there, but isn't needed there either.
exec_msgidsdir = $(datadir)/msgids
diff --git a/Makerules.am b/Makerules.am
index 37d383ae..b1f17d12 100644
--- a/Makerules.am
+++ b/Makerules.am
@@ -1,6 +1,6 @@
# Makerules: how to do some things.
-# Copyright (C) 2006, 2007 Free Software Foundation, Inc.
+# Copyright (C) 2006, 2007, 2009 Free Software Foundation, Inc.
# Permission to use, copy, modify and distribute this software and its
# documentation is hereby granted, provided that both the copyright
@@ -20,11 +20,11 @@
EXTRA_DIST += \
gensym.awk
%.symc: %.sym gensym.awk
- $(AWK) -f $(word 2,$^) $< > $@
+ $(AWK_V) $(AWK) -f $(word 2,$^) $< > $@
%.symc.o: %.symc
- $(COMPILE) -S -x c -o $@ $<
+ $(AM_V_CC) $(COMPILE) -S -x c -o $@ $<
%.h: %.symc.o
- sed < $< > $@ \
+ $(AM_V_GEN) sed < $< > $@ \
-e 's/^[^*].*$$//' \
-e 's/^[*]/#define/' \
-e 's/mAgIc[^-0-9]*//'
@@ -37,7 +37,7 @@ include Makerules.mig.am
#
%.gz: %
- $(GZIP) -9 < $< > $@
+ $(GZIP_V) $(GZIP) -9 < $< > $@
#
# strip files.
diff --git a/Makerules.mig.am b/Makerules.mig.am
index b3f76da2..30609846 100644
--- a/Makerules.mig.am
+++ b/Makerules.mig.am
@@ -1,6 +1,6 @@
# Makerules.mig: how to do some MIG-related things.
-# Copyright (C) 2006, 2007 Free Software Foundation, Inc.
+# Copyright (C) 2006, 2007, 2009 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
@@ -72,20 +72,20 @@ lib_dep_tr_for_defs_a_CPPFLAGS = $(AM_CPPFLAGS) \
-E
%.server.defs.c: %.srv
- rm -f $@
- cp -p $< $@
+ $(AM_V_at) rm -f $@
+ $(AM_V_GEN) cp -p $< $@
%.user.defs.c: %.cli
- rm -f $@
- cp -p $< $@
+ $(AM_V_at) rm -f $@
+ $(AM_V_GEN) cp -p $< $@
%.server.h %.server.c %.server.msgids: lib_dep_tr_for_defs_a-%.server.defs.$(OBJEXT)
- $(MIGCOM) $(MIGCOMFLAGS) $(MIGCOMSFLAGS) \
- -sheader $*.server.h -server $*.server.c \
- -list $*.server.msgids \
+ $(MIGCOM_V) $(MIGCOM) $(MIGCOMFLAGS) $(MIGCOMSFLAGS) \
+ -sheader $*.server.h -server $*.server.c \
+ -list $*.server.msgids \
< $<
%.user.h %.user.c %.user.msgids: lib_dep_tr_for_defs_a-%.user.defs.$(OBJEXT)
- $(MIGCOM) $(MIGCOMFLAGS) $(MIGCOMUFLAGS) \
- -user $*.user.c -header $*.user.h \
- -list $*.user.msgids \
+ $(MIGCOM_V) $(MIGCOM) $(MIGCOMFLAGS) $(MIGCOMUFLAGS) \
+ -user $*.user.c -header $*.user.h \
+ -list $*.user.msgids \
< $<
# This is how it should be done, but this is not integrated into GNU Automake
diff --git a/configure.ac b/configure.ac
index 50ec6b40..3a7d3be6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -32,6 +32,9 @@ dnl Do not clutter the main build directory.
dnl We require GNU make.
[-Wall -Wno-portability]
)
+
+m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([no])],
+ [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
#
# Deduce the architecture we're building for.
@@ -149,7 +152,8 @@ m4_include([linux/configfrag.ac])
[ssp_possible=yes]
AC_MSG_CHECKING([whether the compiler accepts `-fstack-protector'])
# Is this a reliable test case?
-AC_LANG_CONFTEST([[void foo (void) { volatile char a[8]; a[3]; }]])
+AC_LANG_CONFTEST(
+ [AC_LANG_SOURCE([[void foo (void) { volatile char a[8]; a[3]; }]])])
[# `$CC -c -o ...' might not be portable. But, oh, well... Is calling
# `ac_compile' like this correct, after all?
if eval "$ac_compile -S -fstack-protector -o conftest.s" 2> /dev/null; then]
diff --git a/device/cons.h b/device/cons.h
index a6b04fff..c210f8c9 100644
--- a/device/cons.h
+++ b/device/cons.h
@@ -21,16 +21,18 @@
* Utah $Hdr: cons.h 1.10 94/12/14$
*/
+#ifndef _DEVICE_CONS_H
+#define _DEVICE_CONS_H
#include <sys/types.h>
struct consdev {
#ifdef MACH_KERNEL
char *cn_name; /* name of device in dev_name_list */
#endif
- int (*cn_probe)(); /* probe hardware and fill in consdev info */
- int (*cn_init)(); /* turn on as console */
- int (*cn_getc)(); /* kernel getchar interface */
- int (*cn_putc)(); /* kernel putchar interface */
+ int (*cn_probe)(struct consdev *cp); /* probe hardware and fill in consdev info */
+ int (*cn_init)(struct consdev *cp); /* turn on as console */
+ int (*cn_getc)(dev_t dev, int wait); /* kernel getchar interface */
+ int (*cn_putc)(dev_t dev, int c); /* kernel putchar interface */
dev_t cn_dev; /* major/minor of device */
short cn_pri; /* pecking order; the higher the better */
};
@@ -57,3 +59,4 @@ extern int cngetc(void);
extern int cnmaygetc(void);
extern void cnputc(char);
+#endif /* _DEVICE_CONS_H */
diff --git a/device/dev_pager.c b/device/dev_pager.c
index 224be850..447781ee 100644
--- a/device/dev_pager.c
+++ b/device/dev_pager.c
@@ -55,6 +55,7 @@
#include <device/ds_routines.h>
#include <device/dev_hdr.h>
#include <device/io_req.h>
+#include <device/memory_object_reply.user.h>
extern vm_offset_t block_io_mmap(); /* dummy routine to allow
mmap for block devices */
diff --git a/device/ds_routines.c b/device/ds_routines.c
index bd6b49b0..65ca5e1b 100644
--- a/device/ds_routines.c
+++ b/device/ds_routines.c
@@ -99,6 +99,7 @@
extern struct device_emulation_ops linux_block_emulation_ops;
#ifdef CONFIG_INET
extern struct device_emulation_ops linux_net_emulation_ops;
+extern void free_skbuffs ();
#ifdef CONFIG_PCMCIA
extern struct device_emulation_ops linux_pcmcia_emulation_ops;
#endif
@@ -129,6 +130,8 @@ static struct device_emulation_ops *emulation_list[] =
&mach_device_emulation_ops,
};
+vm_map_t device_io_map;
+
#define NUM_EMULATION (sizeof (emulation_list) / sizeof (emulation_list[0]))
io_return_t
diff --git a/device/ds_routines.h b/device/ds_routines.h
index c35c5ad9..9d635cfd 100644
--- a/device/ds_routines.h
+++ b/device/ds_routines.h
@@ -41,7 +41,9 @@
/*
* Map for device IO memory.
*/
-vm_map_t device_io_map;
+extern vm_map_t device_io_map;
+
+extern queue_head_t io_done_list;
kern_return_t device_read_alloc(io_req_t, vm_size_t);
kern_return_t device_write_get(io_req_t, boolean_t *);
diff --git a/device/errno.h b/device/errno.h
deleted file mode 100644
index e65aa984..00000000
--- a/device/errno.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Mach Operating System
- * Copyright (c) 1991 Carnegie Mellon University
- * All Rights Reserved.
- *
- * Permission to use, copy, modify and distribute this software and its
- * documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- *
- * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
- * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
- * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * Carnegie Mellon requests users of this software to return to
- *
- * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
- * School of Computer Science
- * Carnegie Mellon University
- * Pittsburgh PA 15213-3890
- *
- * any improvements or extensions that they make and grant Carnegie Mellon
- * the rights to redistribute these changes.
- */
-/*
- * Author: David B. Golub, Carnegie Mellon University
- * Date: 8/89
- *
- * Old names for new error codes, for compatibility.
- */
-
-#ifndef _ERRNO_
-#define _ERRNO_
-
-#include <device/device_types.h> /* the real error names */
-
-#define EIO D_IO_ERROR
-#define ENXIO D_NO_SUCH_DEVICE
-#define EINVAL D_INVALID_SIZE /* XXX */
-#define EBUSY D_ALREADY_OPEN
-#define ENOTTY D_INVALID_OPERATION
-#define ENOMEM D_NO_MEMORY
-
-#endif /* _ERRNO_ */
diff --git a/device/net_io.c b/device/net_io.c
index 1db9bca9..84463955 100644
--- a/device/net_io.c
+++ b/device/net_io.c
@@ -1655,10 +1655,9 @@ bpf_do_filter(infp, p, wirelen, header, hlen, hash_headpp, entpp)
buflen = NET_RCV_MAX;
*entpp = 0; /* default */
-#ifdef lint
A = 0;
X = 0;
-#endif
+
for (; pc < pc_end; ++pc) {
switch (pc->code) {
diff --git a/i386/i386/db_interface.c b/i386/i386/db_interface.c
index d149adc5..c07884de 100644
--- a/i386/i386/db_interface.c
+++ b/i386/i386/db_interface.c
@@ -39,6 +39,7 @@
#include <i386/setjmp.h>
#include <i386/pmap.h>
#include <i386/proc_reg.h>
+#include <i386/locore.h>
#include "gdt.h"
#include "trap.h"
@@ -390,6 +391,8 @@ db_write_bytes(
oldmap1 = *ptep1;
*ptep1 |= INTEL_PTE_WRITE;
}
+ if (CPU_HAS_FEATURE(CPU_FEATURE_PGE))
+ set_cr4(get_cr4() & ~CR4_PGE);
flush_tlb();
}
@@ -404,6 +407,8 @@ db_write_bytes(
*ptep1 = oldmap1;
}
flush_tlb();
+ if (CPU_HAS_FEATURE(CPU_FEATURE_PGE))
+ set_cr4(get_cr4() | CR4_PGE);
}
}
diff --git a/i386/i386/fpu.c b/i386/i386/fpu.c
index 2a4b9c09..2626a38f 100644
--- a/i386/i386/fpu.c
+++ b/i386/i386/fpu.c
@@ -52,12 +52,12 @@
#include <i386/thread.h>
#include <i386/fpu.h>
#include <i386/pio.h>
+#include <i386/pic.h>
#include <i386/locore.h>
#include "cpu_number.h"
#if 0
#include <i386/ipl.h>
-extern int curr_ipl;
#define ASSERT_IPL(L) \
{ \
if (curr_ipl != L) { \
@@ -865,7 +865,7 @@ fp_state_alloc()
* This comes in on line 5 of the slave PIC at SPL1.
*/
void
-fpintr()
+fpintr(int unit)
{
spl_t s;
thread_t thread = current_thread();
diff --git a/i386/i386/fpu.h b/i386/i386/fpu.h
index 1a1b61f6..21561875 100644
--- a/i386/i386/fpu.h
+++ b/i386/i386/fpu.h
@@ -124,5 +124,6 @@ extern void fpextovrflt(void);
extern void fpexterrflt(void);
extern void fpastintr(void);
extern void init_fpu(void);
+extern void fpintr(int unit);
#endif /* _I386_FPU_H_ */
diff --git a/i386/i386/hardclock.c b/i386/i386/hardclock.c
index a8846b95..66150332 100644
--- a/i386/i386/hardclock.c
+++ b/i386/i386/hardclock.c
@@ -39,13 +39,17 @@
#include <i386/ipl.h>
#endif
-extern void clock_interrupt();
+#ifdef LINUX_DEV
+#include <linux/dev/glue/glue.h>
+#endif
+
extern char return_to_iret[];
void
-hardclock(iunit, old_ipl, ret_addr, regs)
+hardclock(iunit, old_ipl, irq, ret_addr, regs)
int iunit; /* 'unit' number */
int old_ipl; /* old interrupt level */
+ int irq; /* irq number */
char * ret_addr; /* return address in interrupt handler */
struct i386_interrupt_state *regs;
/* saved registers */
diff --git a/i386/i386/i386asm.sym b/i386/i386/i386asm.sym
index b1670e8b..39dbcaf9 100644
--- a/i386/i386/i386asm.sym
+++ b/i386/i386/i386asm.sym
@@ -86,6 +86,8 @@ offset i386_interrupt_state i efl
offset i386_tss tss esp0
offset i386_tss tss ss0
+offset machine_slot sub_type cpu_type
+
expr I386_PGBYTES NBPG
expr VM_MIN_ADDRESS
expr VM_MAX_ADDRESS
diff --git a/i386/i386/ipl.h b/i386/i386/ipl.h
index 557cd8df..8f729e1d 100644
--- a/i386/i386/ipl.h
+++ b/i386/i386/ipl.h
@@ -73,5 +73,6 @@ WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
extern void (*ivect[])();
extern int iunit[];
extern int intpri[];
+extern spl_t curr_ipl;
#endif /* __ASSEMBLER__ */
#endif /* KERNEL */
diff --git a/i386/i386/locore.S b/i386/i386/locore.S
index 379b219f..440435bc 100644
--- a/i386/i386/locore.S
+++ b/i386/i386/locore.S
@@ -774,6 +774,7 @@ ast_from_interrupt:
* #ifndef MACH_XEN
* iunit
* saved SPL
+ * irq
* #endif
* return address == return_to_iret_i
* saved %edx
@@ -789,6 +790,7 @@ ast_from_interrupt:
* #ifndef MACH_XEN
* iunit
* saved SPL
+ * irq
* #endif
* return address == return_to_iret
* pointer to save area on old stack
@@ -1288,48 +1290,51 @@ Entry(copyoutmsg)
movl $USER_DS,%eax /* use user data segment for accesses */
mov %ax,%es
+#if !defined(MACH_HYP) && !PAE
+ cmpl $3,machine_slot+SUB_TYPE_CPU_TYPE
+ jbe copyout_retry /* Use slow version on i386 */
+#endif /* !defined(MACH_HYP) && !PAE */
+
+ movl %edx,%eax /* use count */
+ /*cld*/ /* count up: always this way in GCC code */
+ movl %eax,%ecx /* move by longwords first */
+ shrl $2,%ecx
+ RECOVER(copyout_fail)
+ rep
+ movsl
+ movl %eax,%ecx /* now move remaining bytes */
+ andl $3,%ecx
+ RECOVER(copyout_fail)
+ rep
+ movsb /* move */
+ xorl %eax,%eax /* return 0 for success */
+
+copyout_ret:
+ mov %ss,%di /* restore ES to kernel segment */
+ mov %di,%es
+
+ popl %edi /* restore registers */
+ popl %esi
+ ret /* and return */
+
+copyout_fail:
+ movl $1,%eax /* return 1 for failure */
+ jmp copyout_ret /* pop frame and return */
+
+#if !defined(MACH_HYP) && !PAE
/*
* Check whether user address space is writable
- * before writing to it - hardware is broken.
- * XXX only have to do this on 386's.
+ * before writing to it - i386 hardware is broken.
*/
copyout_retry:
-#ifdef MACH_HYP
- movl cr3,%ecx /* point to page directory */
-#else /* MACH_HYP */
movl %cr3,%ecx /* point to page directory */
-#endif /* MACH_HYP */
-#if PAE
- movl %edi,%eax /* get page directory pointer bits */
- shrl $(PDPSHIFT),%eax /* from user address */
- movl KERNELBASE(%ecx,%eax,PTE_SIZE),%ecx
- /* get page directory pointer */
-#ifdef MACH_PSEUDO_PHYS
- shrl $(PTESHIFT),%ecx
- movl pfn_list,%eax
- movl (%eax,%ecx,4),%ecx /* mfn_to_pfn */
- shll $(PTESHIFT),%ecx
-#else /* MACH_PSEUDO_PHYS */
- andl $(PTE_PFN),%ecx /* isolate page frame address */
-#endif /* MACH_PSEUDO_PHYS */
-#endif /* PAE */
movl %edi,%eax /* get page directory bits */
shrl $(PDESHIFT),%eax /* from user address */
-#if PAE
- andl $(PDEMASK),%eax
-#endif /* PAE */
movl KERNELBASE(%ecx,%eax,PTE_SIZE),%ecx
/* get page directory pointer */
testl $(PTE_V),%ecx /* present? */
jz 0f /* if not, fault is OK */
-#ifdef MACH_PSEUDO_PHYS
- shrl $(PTESHIFT),%ecx
- movl pfn_list,%eax
- movl (%eax,%ecx,4),%ecx /* mfn_to_pfn */
- shll $(PTESHIFT),%ecx
-#else /* MACH_PSEUDO_PHYS */
andl $(PTE_PFN),%ecx /* isolate page frame address */
-#endif /* MACH_PSEUDO_PHYS */
movl %edi,%eax /* get page table bits */
shrl $(PTESHIFT),%eax
andl $(PTEMASK),%eax /* from user address */
@@ -1343,17 +1348,9 @@ copyout_retry:
/*
* Not writable - must fake a fault. Turn off access to the page.
*/
-#ifdef MACH_HYP
- pushl %edx
- pushl %ecx
- call hyp_invalidate_pte
- popl %ecx
- popl %edx
-#else /* MACH_HYP */
andl $(PTE_INVALID),(%ecx) /* turn off valid bit */
movl %cr3,%eax /* invalidate TLB */
movl %eax,%cr3
-#endif /* MACH_HYP */
0:
/*
@@ -1384,18 +1381,8 @@ copyout_retry:
subl %eax,%edx /* decrement count */
jg copyout_retry /* restart on next page if not done */
xorl %eax,%eax /* return 0 for success */
-
-copyout_ret:
- mov %ss,%di /* restore ES to kernel segment */
- mov %di,%es
-
- popl %edi /* restore registers */
- popl %esi
- ret /* and return */
-
-copyout_fail:
- movl $1,%eax /* return 1 for failure */
- jmp copyout_ret /* pop frame and return */
+ jmp copyout_ret
+#endif /* !defined(MACH_HYP) && !PAE */
/*
* int inst_fetch(int eip, int cs);
diff --git a/i386/i386/locore.h b/i386/i386/locore.h
index 57014304..b6497267 100644
--- a/i386/i386/locore.h
+++ b/i386/i386/locore.h
@@ -32,8 +32,12 @@ extern int copyout (const void *kernelbuf, void *userbuf, size_t cn);
extern int copyoutmsg (const void *kernelbuf, void *userbuf, size_t cn);
+extern int inst_fetch (int eip, int cs);
+
extern int call_continuation (continuation_t continuation);
+extern void cpu_shutdown (void);
+
extern unsigned int cpu_features[1];
#define CPU_FEATURE_FPU 0
@@ -68,5 +72,7 @@ extern unsigned int cpu_features[1];
#define CPU_HAS_FEATURE(feature) (cpu_features[(feature) / 32] & (1 << ((feature) % 32)))
+extern int discover_x86_cpu_type (void);
+
#endif /* _MACHINE__LOCORE_H_ */
diff --git a/i386/i386/pcb.c b/i386/i386/pcb.c
index f687db14..7f2b3c88 100644
--- a/i386/i386/pcb.c
+++ b/i386/i386/pcb.c
@@ -96,6 +96,7 @@ void stack_attach(thread, stack, continuation)
STACK_IKS(stack)->k_eip = (int) Thread_continue;
STACK_IKS(stack)->k_ebx = (int) continuation;
STACK_IKS(stack)->k_esp = (int) STACK_IEL(stack);
+ STACK_IKS(stack)->k_ebp = (int) 0;
/*
* Point top of kernel stack to user`s registers.
diff --git a/i386/i386/pic.h b/i386/i386/pic.h
index 7a177d86..52f6ec16 100644
--- a/i386/i386/pic.h
+++ b/i386/i386/pic.h
@@ -179,6 +179,10 @@ WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#ifndef __ASSEMBLER__
extern void form_pic_mask (void);
extern void picinit (void);
+extern int curr_pic_mask;
+extern int pic_mask[];
+extern void prtnull(int unit);
+extern void intnull(int unit);
#endif
#endif /* _I386_PIC_H_ */
diff --git a/i386/i386/proc_reg.h b/i386/i386/proc_reg.h
index 64d8c43f..84e99310 100644
--- a/i386/i386/proc_reg.h
+++ b/i386/i386/proc_reg.h
@@ -144,7 +144,7 @@ extern unsigned long cr3;
#define set_cr3(value) \
({ \
register unsigned int _temp__ = (value); \
- asm volatile("mov %0, %%cr3" : : "r" (_temp__)); \
+ asm volatile("mov %0, %%cr3" : : "r" (_temp__) : "memory"); \
})
#endif /* MACH_HYP */
diff --git a/i386/i386/trap.c b/i386/i386/trap.c
index 22dd4914..90d4c31e 100644
--- a/i386/i386/trap.c
+++ b/i386/i386/trap.c
@@ -33,6 +33,7 @@
#include <mach/machine/eflags.h>
#include <i386/trap.h>
#include <i386/fpu.h>
+#include <i386/locore.h>
#include <i386/model_dep.h>
#include <intel/read_fault.h>
#include <machine/machspl.h> /* for spl_t */
diff --git a/i386/i386/vm_param.h b/i386/i386/vm_param.h
index 95df6044..b515a9ef 100644
--- a/i386/i386/vm_param.h
+++ b/i386/i386/vm_param.h
@@ -27,7 +27,7 @@
#include <mach/vm_param.h>
#include <xen/public/xen.h>
-/* The kernel address space is 1GB, starting at virtual address 0. */
+/* The kernel address space is usually 1GB, usually starting at virtual address 0. */
#ifdef MACH_XEN
#define VM_MIN_KERNEL_ADDRESS 0x20000000UL
#else /* MACH_XEN */
@@ -45,6 +45,9 @@
#define VM_MAX_KERNEL_ADDRESS (LINEAR_MAX_KERNEL_ADDRESS - LINEAR_MIN_KERNEL_ADDRESS + VM_MIN_KERNEL_ADDRESS)
#endif /* MACH_XEN */
+/* Reserve mapping room for kmem_suballoc calls. */
+#define VM_KERNEL_MAP_SIZE (192 * 1024 * 1024)
+
/* The kernel virtual address space is actually located
at high linear addresses.
This is the kernel address range in linear addresses. */
diff --git a/i386/i386/xen.h b/i386/i386/xen.h
index 731e5a2f..a8d919d2 100644
--- a/i386/i386/xen.h
+++ b/i386/i386/xen.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006, 2009, 2010, 2011 Samuel Thibault <samuel.thibault@ens-lyon.org>
+ * Copyright (C) 2006-2011 Free Software Foundation
*
* This program is free software ; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -25,6 +25,7 @@
#include <mach/machine/vm_types.h>
#include <mach/vm_param.h>
#include <mach/inline.h>
+#include <mach/xen.h>
#include <machine/vm_param.h>
#include <intel/pmap.h>
#include <kern/debug.h>
diff --git a/i386/i386at/com.c b/i386/i386at/com.c
index 325e0991..9ffe8747 100644
--- a/i386/i386at/com.c
+++ b/i386/i386at/com.c
@@ -35,7 +35,7 @@
#include <kern/mach_clock.h>
#include <sys/time.h>
#include <device/conf.h>
-#include <device/errno.h>
+#include <device/device_types.h>
#include <device/tty.h>
#include <device/io_req.h>
@@ -70,10 +70,6 @@ int comtimer_state[NCOM];
#define RCBAUD B9600
static int rcline = -1;
static struct bus_device *comcndev;
-int comcnprobe(struct consdev *cp);
-int comcninit(struct consdev *cp);
-int comcngetc(dev_t dev, int wait);
-int comcnputc(dev_t dev, int c);
/* XX */
extern char *kernel_cmdline;
@@ -215,6 +211,8 @@ comcnprobe(struct consdev *cp)
cp->cn_dev = makedev(maj, unit);
cp->cn_pri = pri;
+
+ return 0;
}
@@ -287,6 +285,7 @@ comcninit(struct consdev *cp)
}
}
+ return 0;
}
/*
@@ -336,13 +335,13 @@ io_return_t comopen(
io_return_t result;
if (unit >= NCOM)
- return ENXIO; /* no such device */
+ return D_NO_SUCH_DEVICE; /* no such device */
if ((isai = cominfo[unit]) == 0 || isai->alive == 0) {
/*
* Try to probe it again
*/
if (!com_reprobe(unit))
- return ENXIO;
+ return D_NO_SUCH_DEVICE;
}
tp = &com_tty[unit];
@@ -622,7 +621,9 @@ comstart(tp)
struct tty *tp;
{
char nch;
+#if 0
int i;
+#endif
if (tp->t_state & (TS_TIMEOUT|TS_TTSTOP|TS_BUSY)) {
comst_1++;
@@ -656,7 +657,7 @@ comst_4++;
#else
nch = getc(&tp->t_outq);
if ((nch & 0200) && ((tp->t_flags & LITOUT) == 0)) {
- timeout(ttrstrt, (char *)tp, (nch & 0x7f) + 6);
+ timeout((timer_func_t *)ttrstrt, (char *)tp, (nch & 0x7f) + 6);
tp->t_state |= TS_TIMEOUT;
comst_4++;
return;
@@ -884,6 +885,8 @@ comcnputc(dev_t dev, int c)
if (c == '\n')
comcnputc(dev, '\r');
outb(addr, c);
+
+ return 0;
}
int
diff --git a/i386/i386at/com.h b/i386/i386at/com.h
index e53e9482..49f23eec 100644
--- a/i386/i386at/com.h
+++ b/i386/i386at/com.h
@@ -27,6 +27,7 @@
#define _COM_H_
#include <mach/std_types.h>
+#include <device/cons.h>
/*
* Set receive modem state from modem status register.
@@ -42,4 +43,9 @@ extern void commodem_intr(int unit, int stat);
extern int comgetc(int unit);
+extern int comcnprobe(struct consdev *cp);
+extern int comcninit(struct consdev *cp);
+extern int comcngetc(dev_t dev, int wait);
+extern int comcnputc(dev_t dev, int c);
+
#endif /* _COM_H_ */
diff --git a/i386/i386at/cons_conf.c b/i386/i386at/cons_conf.c
index 8a4b37c5..cf42bb63 100644
--- a/i386/i386at/cons_conf.c
+++ b/i386/i386at/cons_conf.c
@@ -31,11 +31,11 @@
#include <device/cons.h>
#ifdef MACH_HYP
-extern int hypcnprobe(), hypcninit(), hypcngetc(), hypcnputc();
+#include <xen/console.h>
#else /* MACH_HYP */
-extern int kdcnprobe(), kdcninit(), kdcngetc(), kdcnputc();
+#include "kd.h"
#if NCOM > 0
-extern int comcnprobe(), comcninit(), comcngetc(), comcnputc();
+#include "com.h"
#endif
#endif /* MACH_HYP */
diff --git a/i386/i386at/kd.c b/i386/i386at/kd.c
index e4ac8325..4b70c5f6 100644
--- a/i386/i386at/kd.c
+++ b/i386/i386at/kd.c
@@ -85,6 +85,7 @@ WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <device/io_req.h>
#include <device/buf.h> /* for struct uio (!) */
#include <vm/vm_kern.h>
+#include <i386/locore.h>
#include <i386/loose_ends.h>
#include <i386/vm_param.h>
#include <i386/machspl.h>
@@ -112,10 +113,6 @@ static void charput(), charmvup(), charmvdown(), charclear(), charsetcursor();
static void kd_noopreset();
boolean_t kdcheckmagic();
-int kdcnprobe(struct consdev *cp);
-int kdcninit(struct consdev *cp);
-int kdcngetc(dev_t dev, int wait);
-void kdcnputc(dev_t dev, int c);
int do_modifier (int, Scancode, boolean_t);
/*
@@ -735,9 +732,8 @@ int flags; /* flags set for console */
*/
/*ARGSUSED*/
void
-kdintr(vec, regs)
+kdintr(vec)
int vec;
-int regs;
{
struct tty *tp;
unsigned char c;
@@ -802,7 +798,7 @@ int regs;
goto done;
} else if (kd_kbd_mouse && kd_kbd_magic(scancode)) {
goto done;
- } else if (kdcheckmagic(scancode, &regs)) {
+ } else if (kdcheckmagic(scancode)) {
goto done;
} else if (kb_mode == KB_EVENT) {
kd_enqsc(scancode);
@@ -988,9 +984,8 @@ boolean_t up;
* are still held down.
*/
boolean_t
-kdcheckmagic(scancode, regs)
+kdcheckmagic(scancode)
Scancode scancode;
-int *regs;
{
static int magic_state = KS_NORMAL; /* like kd_state */
boolean_t up = FALSE;
@@ -2969,16 +2964,18 @@ kdcngetc(dev_t dev, int wait)
return kdcnmaygetc();
}
-void
+int
kdcnputc(dev_t dev, int c)
{
if (!kd_initialized)
- return;
+ return -1;
/* Note that tab is handled in kd_putc */
if (c == '\n')
kd_putc('\r');
kd_putc(c);
+
+ return 0;
}
/*
diff --git a/i386/i386at/kd.h b/i386/i386at/kd.h
index 98c8bfee..1d53538b 100644
--- a/i386/i386at/kd.h
+++ b/i386/i386at/kd.h
@@ -75,6 +75,7 @@ WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <mach/boolean.h>
#include <sys/types.h>
#include <sys/time.h>
+#include <device/cons.h>
/*
@@ -729,10 +730,16 @@ extern void kd_handle_ack (void);
extern int kd_kbd_magic (int);
extern int kdstate2idx (int, boolean_t);
extern void kd_parserest (u_char *);
+extern int kdcnprobe(struct consdev *cp);
+extern int kdcninit(struct consdev *cp);
+extern int kdcngetc(dev_t dev, int wait);
extern int kdcnmaygetc (void);
+extern int kdcnputc(dev_t dev, int c);
extern void kd_slmwd (void *start, int count, int value);
extern void kd_slmscu (void *from, void *to, int count);
extern void kd_slmscd (void *from, void *to, int count);
+extern void kdintr(int vec);
+
#endif /* _KD_H_ */
diff --git a/i386/i386at/kd_event.c b/i386/i386at/kd_event.c
index 3983a118..8ea313bf 100644
--- a/i386/i386at/kd_event.c
+++ b/i386/i386at/kd_event.c
@@ -61,7 +61,7 @@ WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#ifdef MACH_KERNEL
#include <device/ds_routines.h>
-#include <device/errno.h>
+#include <device/device_types.h>
#include <device/io_req.h>
#else /* MACH_KERNEL */
#include <sys/file.h>
diff --git a/i386/i386at/kd_mouse.c b/i386/i386at/kd_mouse.c
index 640209c5..770a3fe3 100644
--- a/i386/i386at/kd_mouse.c
+++ b/i386/i386at/kd_mouse.c
@@ -69,7 +69,7 @@ WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <kern/printf.h>
#ifdef MACH_KERNEL
#include <device/ds_routines.h>
-#include <device/errno.h>
+#include <device/device_types.h>
#include <device/io_req.h>
#include <device/subrs.h>
#else /* MACH_KERNEL */
@@ -179,10 +179,10 @@ mouseopen(dev, flags)
#ifdef MACH_KERNEL
#else /* MACH_KERNEL */
if (flags & FWRITE)
- return(ENODEV);
+ return (D_NO_SUCH_DEVICE);
#endif /* MACH_KERNEL */
if (mouse_in_use)
- return(EBUSY);
+ return (D_ALREADY_OPEN);
mouse_in_use = TRUE; /* locking? */
kdq_reset(&mouse_queue);
lastbuttons = MOUSE_ALL_UP;
diff --git a/i386/i386at/lpr.c b/i386/i386at/lpr.c
index 57f6f857..cf76da23 100644
--- a/i386/i386at/lpr.c
+++ b/i386/i386at/lpr.c
@@ -37,7 +37,7 @@
#include <kern/mach_clock.h>
#include <sys/time.h>
#include <device/conf.h>
-#include <device/errno.h>
+#include <device/device_types.h>
#include <device/tty.h>
#include <device/io_req.h>
#else /* MACH_KERNEL */
@@ -140,11 +140,11 @@ struct tty *tp;
u_short addr;
if (unit >= NLPR || (isai = lprinfo[unit]) == 0 || isai->alive == 0)
- return(ENXIO);
+ return (D_NO_SUCH_DEVICE);
tp = &lpr_tty[unit];
#ifndef MACH_KERNEL
if (tp->t_state & TS_XCLUDE && u.u_uid != 0)
- return(EBUSY);
+ return (D_ALREADY_OPEN);
#endif /* MACH_KERNEL */
addr = (u_short) isai->address;
tp->t_dev = dev;
@@ -338,7 +338,7 @@ struct tty *tp;
#ifdef MACH_KERNEL
nch = getc(&tp->t_outq);
if ((tp->t_flags & LITOUT) == 0 && (nch & 0200)) {
- timeout(ttrstrt, (char *)tp, (nch & 0x7f) + 6);
+ timeout((timer_func_t *)ttrstrt, (char *)tp, (nch & 0x7f) + 6);
tp->t_state |= TS_TIMEOUT;
return;
}
diff --git a/i386/i386at/model_dep.c b/i386/i386at/model_dep.c
index 04b8228f..f6e797c1 100644
--- a/i386/i386at/model_dep.c
+++ b/i386/i386at/model_dep.c
@@ -128,8 +128,6 @@ extern void setup_main();
void halt_all_cpus (boolean_t reboot) __attribute__ ((noreturn));
void halt_cpu (void) __attribute__ ((noreturn));
-int discover_x86_cpu_type (void);
-
void inittodr(); /* forward */
int rebootflag = 0; /* exported to kdintr */
@@ -263,6 +261,8 @@ void db_reset_cpu(void)
void
mem_size_init(void)
{
+ vm_offset_t max_phys_size;
+
/* Physical memory on all PCs starts at physical address 0.
XX make it a constant. */
phys_first_addr = 0;
@@ -287,12 +287,13 @@ mem_size_init(void)
printf("AT386 boot: physical memory from 0x%x to 0x%x\n",
phys_first_addr, phys_last_addr);
- /* Reserve 1/6 of the memory address space for virtual mappings.
+ /* Reserve room for virtual mappings.
* Yes, this loses memory. Blame i386. */
- if (phys_last_addr > ((VM_MAX_KERNEL_ADDRESS - VM_MIN_KERNEL_ADDRESS) / 6) * 5) {
- phys_last_addr = ((VM_MAX_KERNEL_ADDRESS - VM_MIN_KERNEL_ADDRESS) / 6) * 5;
+ max_phys_size = VM_MAX_KERNEL_ADDRESS - VM_MIN_KERNEL_ADDRESS - VM_KERNEL_MAP_SIZE;
+ if (phys_last_addr - phys_first_addr > max_phys_size) {
+ phys_last_addr = phys_first_addr + max_phys_size;
printf("Truncating memory size to %dMiB\n", (phys_last_addr - phys_first_addr) / (1024 * 1024));
- /* TODO Xen: free lost memory */
+ /* TODO Xen: be nice, free lost memory */
}
phys_first_addr = round_page(phys_first_addr);
diff --git a/i386/i386at/pic_isa.c b/i386/i386at/pic_isa.c
index ef7d84c7..e48fb507 100644
--- a/i386/i386at/pic_isa.c
+++ b/i386/i386at/pic_isa.c
@@ -27,11 +27,11 @@
#include <sys/types.h>
#include <i386/ipl.h>
#include <i386/pic.h>
-
+#include <i386/fpu.h>
+#include <i386at/kd.h>
/* These interrupts are always present */
-extern void intnull(), fpintr(), hardclock(), kdintr();
-extern void prtnull();
+extern void hardclock();
void (*ivect[NINTR])() = {
/* 00 */ hardclock, /* always */
diff --git a/i386/i386at/rtc.c b/i386/i386at/rtc.c
index e0a03dee..77a83e8c 100644
--- a/i386/i386at/rtc.c
+++ b/i386/i386at/rtc.c
@@ -53,7 +53,6 @@ WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <i386/pio.h>
#include <i386at/rtc.h>
-static unsigned char rtc[RTC_NREG];
static int first_rtcopen_ever = 1;
void
diff --git a/i386/intel/pmap.c b/i386/intel/pmap.c
index 0b8ae903..9f34f2d7 100644
--- a/i386/intel/pmap.c
+++ b/i386/intel/pmap.c
@@ -155,9 +155,6 @@ boolean_t pmap_initialized = FALSE;
vm_offset_t kernel_virtual_start;
vm_offset_t kernel_virtual_end;
-/* XXX stupid fixed limit - get rid */
-vm_size_t morevm = 128 * 1024 * 1024; /* VM space for kernel map */
-
/*
* Index into pv_head table, its lock bits, and the modify/reference
* bits starting at phys_first_addr.
@@ -620,8 +617,7 @@ void pmap_bootstrap()
* and extends to a stupid arbitrary limit beyond that.
*/
kernel_virtual_start = phystokv(phys_last_addr);
- kernel_virtual_end = phystokv(phys_last_addr) + morevm
- + (phys_last_addr - phys_first_addr);
+ kernel_virtual_end = phystokv(phys_last_addr) + VM_KERNEL_MAP_SIZE;
if (kernel_virtual_end < kernel_virtual_start
|| kernel_virtual_end > VM_MAX_KERNEL_ADDRESS)
@@ -872,7 +868,7 @@ void pmap_clear_bootstrap_pagetable(pt_entry_t *base) {
#endif /* PAE */
for (i = 0; i < NPTES; i++) {
pt_entry_t pde = dir[i];
- unsigned long pfn = mfn_to_pfn(atop(pde));
+ unsigned long pfn = atop(pte_to_pa(pde));
void *pgt = (void*) phystokv(ptoa(pfn));
if (pde & INTEL_PTE_VALID)
hyp_free_page(pfn, pgt);
diff --git a/i386/xen/xen.c b/i386/xen/xen.c
index aa3c2cc8..a46ee2c6 100644
--- a/i386/xen/xen.c
+++ b/i386/xen/xen.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Samuel Thibault <samuel.thibault@ens-lyon.org>
+ * Copyright (C) 2006-2009 Free Software Foundation
*
* This program is free software ; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -18,6 +18,7 @@
#include <kern/printf.h>
#include <kern/debug.h>
+#include <kern/mach_clock.h>
#include <mach/machine/eflags.h>
#include <machine/thread.h>
@@ -43,7 +44,6 @@ void hyp_failsafe_c_callback(struct failsafe_callback_regs *regs) {
panic("failsafe");
}
-extern void clock_interrupt();
extern void return_to_iret;
void hypclock_machine_intr(int old_ipl, void *ret_addr, struct i386_interrupt_state *regs, unsigned64_t delta) {
diff --git a/i386/xen/xen_boothdr.S b/i386/xen/xen_boothdr.S
index 1b32efb8..152924dd 100644
--- a/i386/xen/xen_boothdr.S
+++ b/i386/xen/xen_boothdr.S
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006, 2009, 2010, 2011 Samuel Thibault <samuel.thibault@ens-lyon.org>
+ * Copyright (C) 2006-2011 Free Software Foundation
*
* This program is free software ; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -26,7 +26,7 @@
.ascii ",ELF_PADDR_OFFSET=0x20000000"
.ascii ",HYPERCALL_PAGE=0x2"
#if PAE
- .ascii ",PAE=yes"
+ .ascii ",PAE=yes[extended-cr3]"
#else
.ascii ",PAE=no"
#endif
@@ -59,7 +59,7 @@
ELFNOTE(Xen, XEN_ELFNOTE_ENTRY, .long, start)
ELFNOTE(Xen, XEN_ELFNOTE_HYPERCALL_PAGE, .long, hypcalls)
#if PAE
- ELFNOTE(Xen, XEN_ELFNOTE_PAE_MODE, .asciz, "yes")
+ ELFNOTE(Xen, XEN_ELFNOTE_PAE_MODE, .asciz, "yes[extended-cr3]")
#else
ELFNOTE(Xen, XEN_ELFNOTE_PAE_MODE, .asciz, "no")
#endif
diff --git a/i386/xen/xen_locore.S b/i386/xen/xen_locore.S
index 51f823f2..1468ef80 100644
--- a/i386/xen/xen_locore.S
+++ b/i386/xen/xen_locore.S
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Samuel Thibault <samuel.thibault@ens-lyon.org>
+ * Copyright (C) 2006-2009 Free Software Foundation
*
* This program is free software ; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/include/mach/mach_types.defs b/include/mach/mach_types.defs
index 4e448b81..5e31cdcf 100644
--- a/include/mach/mach_types.defs
+++ b/include/mach/mach_types.defs
@@ -121,11 +121,11 @@ type vm_statistics_data_t = struct[13] of integer_t;
type vm_machine_attribute_t = int;
type vm_machine_attribute_val_t = int;
-type thread_info_t = array[*:1024] of natural_t;
+type thread_info_t = array[*:1024] of integer_t;
type thread_basic_info_data_t = struct[11] of integer_t;
type thread_sched_info_data_t = struct[7] of integer_t;
-type task_info_t = array[*:1024] of natural_t;
+type task_info_t = array[*:1024] of integer_t;
type task_basic_info_data_t = struct[8] of integer_t;
type task_events_info = struct[7] of natural_t;
type task_thread_times_info_data_t = struct[4] of integer_t;
@@ -174,7 +174,7 @@ type host_priv_t = mach_port_t
#endif /* KERNEL_SERVER */
;
-type host_info_t = array[*:1024] of natural_t;
+type host_info_t = array[*:1024] of integer_t;
type host_basic_info_data_t = struct[5] of integer_t;
type host_sched_info_data_t = struct[2] of integer_t;
type host_load_info_data_t = struct[6] of integer_t;
@@ -189,7 +189,7 @@ type processor_t = mach_port_t
;
type processor_array_t = ^array[] of processor_t;
-type processor_info_t = array[*:1024] of natural_t;
+type processor_info_t = array[*:1024] of integer_t;
type processor_basic_info_data_t = struct[5] of integer_t;
@@ -215,7 +215,7 @@ type processor_set_name_t = mach_port_t
type processor_set_name_array_t = ^array[] of processor_set_name_t;
-type processor_set_info_t = array[*:1024] of natural_t;
+type processor_set_info_t = array[*:1024] of integer_t;
type processor_set_basic_info_data_t = struct[5] of integer_t;
type processor_set_sched_info_data_t = struct[2] of integer_t;
diff --git a/include/mach/xen.h b/include/mach/xen.h
index f1d9e418..3bb1d95d 100644
--- a/include/mach/xen.h
+++ b/include/mach/xen.h
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2006 Samuel Thibault <samuel.thibault@ens-lyon.org>
+ * Copyright (C) 2006-2009, 2011 Free Software Foundation
*
* This program is free software ; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/include/string.h b/include/string.h
index 8059bedb..c77d387b 100644
--- a/include/string.h
+++ b/include/string.h
@@ -32,7 +32,7 @@ extern void *memcpy (void *dest, const void *src, size_t n);
extern void *memmove (void *dest, const void *src, size_t n);
-extern int *memcmp (const void *s1, const void *s2, size_t n);
+extern int memcmp (const void *s1, const void *s2, size_t n);
extern void *memset (void *s, int c, size_t n);
diff --git a/kern/debug.h b/kern/debug.h
index f4e8200d..e429bdd1 100644
--- a/kern/debug.h
+++ b/kern/debug.h
@@ -57,6 +57,8 @@
#endif /* NDEBUG */
+extern void log (int level, const char *fmt, ...);
+
extern void panic_init(void);
extern void panic (const char *s, ...) __attribute__ ((noreturn));
diff --git a/kern/mach_clock.h b/kern/mach_clock.h
index 2009c709..4e4e8ff1 100644
--- a/kern/mach_clock.h
+++ b/kern/mach_clock.h
@@ -37,10 +37,12 @@ extern int hz; /* number of ticks per second */
extern int tick; /* number of usec per tick */
+typedef void timer_func_t(void *);
+
/* Time-out element. */
struct timer_elt {
queue_chain_t chain; /* chain in order of expiration */
- void (*fcn)(); /* function to call */
+ timer_func_t *fcn; /* function to call */
void * param; /* with this parameter */
unsigned long ticks; /* expiration time, in ticks */
int set; /* unset | set | allocated */
@@ -99,7 +101,7 @@ extern kern_return_t host_adjust_time(
extern void mapable_time_init (void);
/* For public timer elements. */
-extern void timeout(void (*fcn)(void *), void *param, int interval);
-extern boolean_t untimeout(void (*fcn)(void *), void *param);
+extern void timeout(timer_func_t *fcn, void *param, int interval);
+extern boolean_t untimeout(timer_func_t *fcn, void *param);
#endif /* _KERN_MACH_CLOCK_H_ */
diff --git a/kern/printf.h b/kern/printf.h
index c5effe5d..22681116 100644
--- a/kern/printf.h
+++ b/kern/printf.h
@@ -40,6 +40,7 @@ extern void printnum (unsigned long u, int base,
vm_offset_t putc_arg);
extern int sprintf (char *buf, const char *fmt, ...);
+extern int vsnprintf (char *buf, int size, const char *fmt, va_list args);
extern int printf (const char *fmt, ...);
diff --git a/linux/dev/arch/i386/kernel/irq.c b/linux/dev/arch/i386/kernel/irq.c
index e4276fbe..a4073393 100644
--- a/linux/dev/arch/i386/kernel/irq.c
+++ b/linux/dev/arch/i386/kernel/irq.c
@@ -47,10 +47,8 @@
#include <asm/io.h>
#include <asm/hardirq.h>
-extern void linux_timer_intr (void);
-extern spl_t splhigh (void);
-extern spl_t spl0 (void);
-extern void form_pic_mask (void);
+#include <linux/dev/glue/glue.h>
+#include <machine/machspl.h>
#if 0
/* XXX: This is the way it's done in linux 2.2. GNU Mach currently uses intr_count. It should be made using local_{bh/irq}_count instead (through hardirq_enter/exit) for SMP support. */
@@ -96,12 +94,6 @@ static struct linux_action *irq_action[16] =
NULL, NULL, NULL, NULL
};
-extern spl_t curr_ipl;
-extern int curr_pic_mask;
-extern int pic_mask[];
-
-extern void intnull (), prtnull ();
-
/*
* Generic interrupt handler for Linux devices.
* Set up a fake `struct pt_regs' then call the real handler.
@@ -255,15 +247,15 @@ setup_x86_irq (int irq, struct linux_action *new)
{
/* Can't share interrupts unless both agree to */
if (!(old->flags & new->flags & SA_SHIRQ))
- return (-LINUX_EBUSY);
+ return (-EBUSY);
/* Can't share interrupts unless both are same type */
if ((old->flags ^ new->flags) & SA_INTERRUPT)
- return (-LINUX_EBUSY);
+ return (-EBUSY);
/* Can't share at different levels */
if (intpri[irq] && linux_intr_pri != intpri[irq])
- return (-LINUX_EBUSY);
+ return (-EBUSY);
/* add new interrupt at end of irq queue */
do
@@ -309,7 +301,7 @@ install_user_intr_handler (unsigned int line, unsigned long flags,
if (old->delivery_port == dest)
{
printk ("The interrupt handler has been installed on line %d", irq);
- return linux_to_mach_error (-LINUX_EAGAIN);
+ return linux_to_mach_error (-EAGAIN);
}
old = old->next;
}
@@ -321,7 +313,7 @@ install_user_intr_handler (unsigned int line, unsigned long flags,
action = (struct linux_action *)
linux_kmalloc (sizeof (struct linux_action), GFP_KERNEL);
if (action == NULL)
- return linux_to_mach_error (-LINUX_ENOMEM);
+ return linux_to_mach_error (-ENOMEM);
action->handler = NULL;
action->next = NULL;
@@ -349,7 +341,7 @@ request_irq (unsigned int irq, void (*handler) (int, void *, struct pt_regs *),
assert (irq < 16);
if (!handler)
- return -LINUX_EINVAL;
+ return -EINVAL;
/*
* Hmm... Should I use `kalloc()' ?
@@ -358,7 +350,7 @@ request_irq (unsigned int irq, void (*handler) (int, void *, struct pt_regs *),
action = (struct linux_action *)
linux_kmalloc (sizeof (struct linux_action), GFP_KERNEL);
if (action == NULL)
- return -LINUX_ENOMEM;
+ return -ENOMEM;
action->handler = handler;
action->next = NULL;
@@ -525,7 +517,6 @@ static void show(char * str)
int i;
unsigned long *stack;
int cpu = smp_processor_id();
- extern char *get_options(char *str, int *ints);
printk("\n%s, CPU %d:\n", str, cpu);
printk("irq: %d [%d %d]\n",
diff --git a/linux/dev/drivers/block/floppy.c b/linux/dev/drivers/block/floppy.c
index d3fcd6af..83943ee1 100644
--- a/linux/dev/drivers/block/floppy.c
+++ b/linux/dev/drivers/block/floppy.c
@@ -177,6 +177,8 @@ static inline int __get_order(unsigned long size);
#include <linux/blk.h>
#include <linux/cdrom.h> /* for the compatibility eject ioctl */
+#include <linux/dev/glue/glue.h>
+
#ifndef FLOPPY_MOTOR_MASK
#define FLOPPY_MOTOR_MASK 0xf0
@@ -437,7 +439,6 @@ static int probing = 0;
static volatile int command_status = FD_COMMAND_NONE, fdc_busy = 0;
static struct wait_queue *fdc_wait = NULL, *command_done = NULL;
#ifdef MACH
-extern int issig (void);
#define NO_SIGNAL (! issig () || ! interruptible)
#else
#define NO_SIGNAL (!(current->signal & ~current->blocked) || !interruptible)
@@ -1412,7 +1413,7 @@ static int interpret_errors(void)
*/
static void setup_rw_floppy(void)
{
- int i,ready_date,r, flags,dflags;
+ int i, ready_date, r, flags;
timeout_fn function;
flags = raw_cmd->flags;
@@ -1435,7 +1436,6 @@ static void setup_rw_floppy(void)
if (wait_for_completion(ready_date,function))
return;
}
- dflags = DRS->flags;
if ((flags & FD_RAW_READ) || (flags & FD_RAW_WRITE))
setup_DMA();
@@ -4172,8 +4172,6 @@ static void floppy_release_irq_and_dma(void)
#ifdef MODULE
-extern char *get_options(char *str, int *ints);
-
char *floppy=NULL;
static void parse_floppy_cfg_string(char *cfg)
@@ -4277,11 +4275,10 @@ void cleanup_module(void)
* resource contention. */
void floppy_eject(void)
{
- int dummy;
if(floppy_grab_irq_and_dma()==0)
{
lock_fdc(MAXTIMEOUT,0);
- dummy=fd_eject(0);
+ fd_eject(0);
process_fd_request();
floppy_release_irq_and_dma();
}
diff --git a/linux/dev/drivers/block/genhd.c b/linux/dev/drivers/block/genhd.c
index 3946b39c..84b3792c 100644
--- a/linux/dev/drivers/block/genhd.c
+++ b/linux/dev/drivers/block/genhd.c
@@ -39,6 +39,7 @@
#ifdef MACH
#include <machine/spl.h>
+#include <linux/dev/glue/glue.h>
#endif
#define SYS_IND(p) get_unaligned(&p->sys_ind)
@@ -289,7 +290,7 @@ read_mbr:
printk(" unable to read partition table\n");
return -1;
}
- data = bh->b_data;
+ data = (unsigned char *)bh->b_data;
/* In some cases we modify the geometry */
/* of the drive (below), so ensure that */
/* nobody else tries to re-use this data. */
@@ -770,8 +771,6 @@ void device_setup(void)
struct gendisk *p;
int nr=0;
#ifdef MACH
- extern int linux_intr_pri;
-
linux_intr_pri = SPL5;
#endif
diff --git a/linux/dev/glue/block.c b/linux/dev/glue/block.c
index b920fb62..dfd2ee98 100644
--- a/linux/dev/glue/block.c
+++ b/linux/dev/glue/block.c
@@ -61,6 +61,7 @@
#include <device/disk_status.h>
#include <device/device_reply.user.h>
#include <device/device_emul.h>
+#include <device/ds_routines.h>
/* TODO. This should be fixed to not be i386 specific. */
#include <i386at/disk.h>
@@ -78,9 +79,7 @@
#include <linux/hdreg.h>
#include <asm/io.h>
-extern int linux_auto_config;
-extern int linux_intr_pri;
-extern int linux_to_mach_error (int);
+#include <linux/dev/glue/glue.h>
/* This task queue is not used in Mach: just for fixing undefined symbols. */
DECLARE_TASK_QUEUE (tq_disk);
@@ -193,9 +192,6 @@ int read_ahead[MAX_BLKDEV] = {0, };
This is unused in Mach. It is here to make drivers compile. */
struct wait_queue *wait_for_request = NULL;
-/* Map for allocating device memory. */
-extern vm_map_t device_io_map;
-
/* Initialize block drivers. */
int
blk_dev_init ()
@@ -230,19 +226,17 @@ int
register_blkdev (unsigned major, const char *name,
struct file_operations *fops)
{
- int err = 0;
-
if (major == 0)
{
for (major = MAX_BLKDEV - 1; major > 0; major--)
if (blkdevs[major].fops == NULL)
goto out;
- return -LINUX_EBUSY;
+ return -EBUSY;
}
if (major >= MAX_BLKDEV)
- return -LINUX_EINVAL;
+ return -EINVAL;
if (blkdevs[major].fops && blkdevs[major].fops != fops)
- return -LINUX_EBUSY;
+ return -EBUSY;
out:
blkdevs[major].name = name;
@@ -260,12 +254,10 @@ out:
int
unregister_blkdev (unsigned major, const char *name)
{
- int err;
-
if (major >= MAX_BLKDEV)
- return -LINUX_EINVAL;
+ return -EINVAL;
if (! blkdevs[major].fops || strcmp (blkdevs[major].name, name))
- return -LINUX_EINVAL;
+ return -EINVAL;
blkdevs[major].fops = NULL;
if (blkdevs[major].labels)
{
@@ -280,8 +272,6 @@ unregister_blkdev (unsigned major, const char *name)
void
set_blocksize (kdev_t dev, int size)
{
- extern int *blksize_size[];
-
if (! blksize_size[MAJOR (dev)])
return;
@@ -324,7 +314,6 @@ alloc_buffer (int size)
static void
free_buffer (void *p, int size)
{
- int i;
struct temp_data *d;
vm_page_t m;
@@ -388,7 +377,6 @@ __brelse (struct buffer_head *bh)
struct buffer_head *
bread (kdev_t dev, int block, int size)
{
- int err;
struct buffer_head *bh;
bh = getblk (dev, block, size);
@@ -537,7 +525,7 @@ rdwr_partial (int rw, kdev_t dev, loff_t *off,
}
bh->b_data = alloc_buffer (bh->b_size);
if (! bh->b_data)
- return -LINUX_ENOMEM;
+ return -ENOMEM;
ll_rw_block (READ, 1, &bh);
wait_on_buffer (bh);
if (buffer_uptodate (bh))
@@ -556,7 +544,7 @@ rdwr_partial (int rw, kdev_t dev, loff_t *off,
wait_on_buffer (bh);
if (! buffer_uptodate (bh))
{
- err = -LINUX_EIO;
+ err = -EIO;
goto out;
}
}
@@ -565,7 +553,7 @@ rdwr_partial (int rw, kdev_t dev, loff_t *off,
*off += c;
}
else
- err = -LINUX_EIO;
+ err = -EIO;
out:
free_buffer (bh->b_data, bh->b_size);
return err;
@@ -618,7 +606,7 @@ rdwr_full (int rw, kdev_t dev, loff_t *off, char **buf, int *resid, int bshift)
bh->b_data = alloc_buffer (cc);
if (! bh->b_data)
{
- err = -LINUX_ENOMEM;
+ err = -ENOMEM;
break;
}
if (rw == WRITE)
@@ -642,7 +630,7 @@ rdwr_full (int rw, kdev_t dev, loff_t *off, char **buf, int *resid, int bshift)
&& rw == READ && test_bit (BH_Bounce, &bh->b_state))
memcpy (*buf + cc, bh->b_data, bh->b_size);
else if (! err && ! buffer_uptodate (bh))
- err = -LINUX_EIO;
+ err = -EIO;
if (test_bit (BH_Bounce, &bh->b_state))
free_buffer (bh->b_data, bh->b_size);
}
@@ -922,7 +910,7 @@ static kern_return_t
init_partition (struct name_map *np, kdev_t *dev,
struct device_struct *ds, int slice, int *part)
{
- int err, i, j;
+ int i, j;
struct disklabel *lp;
struct gendisk *gd = ds->gd;
struct partition *p;
@@ -1674,7 +1662,7 @@ device_get_status (void *d, dev_flavor_t flavor, dev_status_t status,
INIT_DATA();
if ((*bd->ds->fops->ioctl) (&td.inode, &td.file,
- HDIO_GETGEO, &hg))
+ HDIO_GETGEO, (unsigned long)&hg))
return D_INVALID_OPERATION;
dp->dp_type = DPT_WINI; /* XXX: It may be a floppy... */
diff --git a/linux/dev/glue/glue.h b/linux/dev/glue/glue.h
new file mode 100644
index 00000000..5d4f6d88
--- /dev/null
+++ b/linux/dev/glue/glue.h
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2011 Free Software Foundation
+ *
+ * This program is free software ; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation ; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 the program ; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#ifndef LINUX_DEV_GLUE_GLUE_H
+#define LINUX_DEV_GLUE_GLUE_H
+
+#include <vm/vm_types.h>
+#include <mach/machine/vm_types.h>
+
+extern int linux_auto_config;
+extern int linux_intr_pri;
+
+extern void *alloc_contig_mem (unsigned, unsigned, unsigned, vm_page_t *);
+extern void free_contig_mem (vm_page_t);
+extern void init_IRQ (void);
+extern void restore_IRQ (void);
+extern void linux_kmem_init (void);
+extern void linux_net_emulation_init (void);
+extern void device_setup (void);
+extern void linux_timer_intr (void);
+extern void linux_bad_intr (int);
+extern void linux_sched_init (void);
+extern void pcmcia_init (void);
+extern void linux_soft_intr (void);
+extern int issig (void);
+extern int linux_to_mach_error (int);
+extern char *get_options(char *str, int *ints);
+
+#endif /* LINUX_DEV_GLUE_GLUE_H */
diff --git a/linux/dev/glue/kmem.c b/linux/dev/glue/kmem.c
index 8c21ce7d..367895bd 100644
--- a/linux/dev/glue/kmem.c
+++ b/linux/dev/glue/kmem.c
@@ -29,6 +29,7 @@
#include <kern/assert.h>
#include <kern/kalloc.h>
+#include <kern/printf.h>
#include <vm/vm_page.h>
#include <vm/vm_kern.h>
@@ -40,8 +41,7 @@
#include <asm/system.h>
-extern void *alloc_contig_mem (unsigned, unsigned, unsigned, vm_page_t *);
-extern int printf (const char *, ...);
+#include <linux/dev/glue/glue.h>
/* Amount of memory to reserve for Linux memory allocator.
We reserve 64K chunks to stay within DMA limits.
@@ -554,7 +554,7 @@ vfree (void *addr)
if (!p)
panic ("vmalloc_list_lookup failure");
- kmem_free (kernel_map, addr, p->size);
+ kmem_free (kernel_map, (vm_offset_t) addr, p->size);
vmalloc_list_remove (p);
}
diff --git a/linux/dev/glue/misc.c b/linux/dev/glue/misc.c
index d8ca3c24..f25d501b 100644
--- a/linux/dev/glue/misc.c
+++ b/linux/dev/glue/misc.c
@@ -53,6 +53,7 @@
#include <sys/types.h>
#include <mach/vm_param.h>
#include <kern/thread.h>
+#include <kern/printf.h>
#include <vm/vm_map.h>
#include <vm/vm_page.h>
#include <device/device_types.h>
@@ -66,10 +67,7 @@
#include <linux/blk.h>
#include <linux/proc_fs.h>
#include <linux/kernel_stat.h>
-
-extern boolean_t vm_map_lookup_entry (register vm_map_t, register vm_offset_t,
- vm_map_entry_t *);
-extern int printf (const char *, ...);
+#include <linux/dev/glue/glue.h>
int (*dispatch_scsi_info_ptr) (int ino, char *buffer, char **start,
off_t offset, int length, int inout) = 0;
@@ -84,34 +82,34 @@ linux_to_mach_error (int err)
case 0:
return D_SUCCESS;
- case -LINUX_EPERM:
+ case -EPERM:
return D_INVALID_OPERATION;
- case -LINUX_EIO:
+ case -EIO:
return D_IO_ERROR;
- case -LINUX_ENXIO:
+ case -ENXIO:
return D_NO_SUCH_DEVICE;
- case -LINUX_EACCES:
+ case -EACCES:
return D_INVALID_OPERATION;
- case -LINUX_EFAULT:
+ case -EFAULT:
return D_INVALID_SIZE;
- case -LINUX_EBUSY:
+ case -EBUSY:
return D_ALREADY_OPEN;
- case -LINUX_EINVAL:
+ case -EINVAL:
return D_INVALID_SIZE;
- case -LINUX_EROFS:
+ case -EROFS:
return D_READ_ONLY;
- case -LINUX_EWOULDBLOCK:
+ case -EWOULDBLOCK:
return D_WOULD_BLOCK;
- case -LINUX_ENOMEM:
+ case -ENOMEM:
return D_NO_MEMORY;
default:
@@ -148,7 +146,7 @@ verify_area (int rw, const void *p, unsigned long size)
|| (entry->protection & prot) != prot)
{
vm_map_unlock_read (current_map ());
- return -LINUX_EFAULT;
+ return -EFAULT;
}
if (entry->vme_end - entry->vme_start >= len)
break;
@@ -229,7 +227,12 @@ add_blkdev_randomness (int major)
void
do_gettimeofday (struct timeval *tv)
{
- host_get_time (1, tv);
+ /*
+ * XXX: The first argument should be mach_host_self (), but that's too
+ * expensive, and the host argument is not used by host_get_time (),
+ * only checked not to be HOST_NULL.
+ */
+ host_get_time ((host_t) 1, (time_value_t *) tv);
}
int
diff --git a/linux/dev/glue/net.c b/linux/dev/glue/net.c
index 095428d3..91ebf969 100644
--- a/linux/dev/glue/net.c
+++ b/linux/dev/glue/net.c
@@ -69,6 +69,8 @@
#include <mach/vm_param.h>
#include <mach/notify.h>
+#include <kern/printf.h>
+
#include <ipc/ipc_port.h>
#include <ipc/ipc_space.h>
@@ -84,6 +86,7 @@
#include <device/net_io.h>
#include <device/device_reply.user.h>
#include <device/device_emul.h>
+#include <device/ds_routines.h>
#define MACH_INCLUDE
#include <linux/kernel.h>
@@ -97,7 +100,7 @@
#include <linux/etherdevice.h>
#include <linux/wireless.h>
-extern int linux_intr_pri;
+#include <linux/dev/glue/glue.h>
/* One of these is associated with each instance of a device. */
struct net_data
@@ -248,7 +251,6 @@ void
dev_kfree_skb (struct sk_buff *skb, int mode)
{
unsigned flags;
- extern void *io_done_list;
/* Queue sk_buff on done list if there is a
page list attached or we need to send a reply.
@@ -425,7 +427,6 @@ device_write (void *d, ipc_port_t reply_port,
{
unsigned char *p;
int i, amt, skblen, s;
- io_return_t err = 0;
vm_map_copy_t copy = (vm_map_copy_t) data;
struct net_data *nd = d;
struct linux_device *dev = nd->dev;
diff --git a/linux/dev/include/asm-i386/errno.h b/linux/dev/include/asm-i386/errno.h
deleted file mode 100644
index 1683367a..00000000
--- a/linux/dev/include/asm-i386/errno.h
+++ /dev/null
@@ -1,266 +0,0 @@
-#ifndef _I386_ERRNO_H
-#define _I386_ERRNO_H
-
-#ifdef MACH_INCLUDE
-
-#define LINUX_EPERM 1 /* Operation not permitted */
-#define LINUX_ENOENT 2 /* No such file or directory */
-#define LINUX_ESRCH 3 /* No such process */
-#define LINUX_EINTR 4 /* Interrupted system call */
-#define LINUX_EIO 5 /* I/O error */
-#define LINUX_ENXIO 6 /* No such device or address */
-#define LINUX_E2BIG 7 /* Arg list too long */
-#define LINUX_ENOEXEC 8 /* Exec format error */
-#define LINUX_EBADF 9 /* Bad file number */
-#define LINUX_ECHILD 10 /* No child processes */
-#define LINUX_EAGAIN 11 /* Try again */
-#define LINUX_ENOMEM 12 /* Out of memory */
-#define LINUX_EACCES 13 /* Permission denied */
-#define LINUX_EFAULT 14 /* Bad address */
-#define LINUX_ENOTBLK 15 /* Block device required */
-#define LINUX_EBUSY 16 /* Device or resource busy */
-#define LINUX_EEXIST 17 /* File exists */
-#define LINUX_EXDEV 18 /* Cross-device link */
-#define LINUX_ENODEV 19 /* No such device */
-#define LINUX_ENOTDIR 20 /* Not a directory */
-#define LINUX_EISDIR 21 /* Is a directory */
-#define LINUX_EINVAL 22 /* Invalid argument */
-#define LINUX_ENFILE 23 /* File table overflow */
-#define LINUX_EMFILE 24 /* Too many open files */
-#define LINUX_ENOTTY 25 /* Not a typewriter */
-#define LINUX_ETXTBSY 26 /* Text file busy */
-#define LINUX_EFBIG 27 /* File too large */
-#define LINUX_ENOSPC 28 /* No space left on device */
-#define LINUX_ESPIPE 29 /* Illegal seek */
-#define LINUX_EROFS 30 /* Read-only file system */
-#define LINUX_EMLINK 31 /* Too many links */
-#define LINUX_EPIPE 32 /* Broken pipe */
-#define LINUX_EDOM 33 /* Math argument out of domain of func */
-#define LINUX_ERANGE 34 /* Math result not representable */
-#define LINUX_EDEADLK 35 /* Resource deadlock would occur */
-#define LINUX_ENAMETOOLONG 36 /* File name too long */
-#define LINUX_ENOLCK 37 /* No record locks available */
-#define LINUX_ENOSYS 38 /* Function not implemented */
-#define LINUX_ENOTEMPTY 39 /* Directory not empty */
-#define LINUX_ELOOP 40 /* Too many symbolic links encountered */
-#define LINUX_EWOULDBLOCK LINUX_EAGAIN /* Operation would block */
-#define LINUX_ENOMSG 42 /* No message of desired type */
-#define LINUX_EIDRM 43 /* Identifier removed */
-#define LINUX_ECHRNG 44 /* Channel number out of range */
-#define LINUX_EL2NSYNC 45 /* Level 2 not synchronized */
-#define LINUX_EL3HLT 46 /* Level 3 halted */
-#define LINUX_EL3RST 47 /* Level 3 reset */
-#define LINUX_ELNRNG 48 /* Link number out of range */
-#define LINUX_EUNATCH 49 /* Protocol driver not attached */
-#define LINUX_ENOCSI 50 /* No CSI structure available */
-#define LINUX_EL2HLT 51 /* Level 2 halted */
-#define LINUX_EBADE 52 /* Invalid exchange */
-#define LINUX_EBADR 53 /* Invalid request descriptor */
-#define LINUX_EXFULL 54 /* Exchange full */
-#define LINUX_ENOANO 55 /* No anode */
-#define LINUX_EBADRQC 56 /* Invalid request code */
-#define LINUX_EBADSLT 57 /* Invalid slot */
-
-#define LINUX_EDEADLOCK LINUX_EDEADLK
-
-#define LINUX_EBFONT 59 /* Bad font file format */
-#define LINUX_ENOSTR 60 /* Device not a stream */
-#define LINUX_ENODATA 61 /* No data available */
-#define LINUX_ETIME 62 /* Timer expired */
-#define LINUX_ENOSR 63 /* Out of streams resources */
-#define LINUX_ENONET 64 /* Machine is not on the network */
-#define LINUX_ENOPKG 65 /* Package not installed */
-#define LINUX_EREMOTE 66 /* Object is remote */
-#define LINUX_ENOLINK 67 /* Link has been severed */
-#define LINUX_EADV 68 /* Advertise error */
-#define LINUX_ESRMNT 69 /* Srmount error */
-#define LINUX_ECOMM 70 /* Communication error on send */
-#define LINUX_EPROTO 71 /* Protocol error */
-#define LINUX_EMULTIHOP 72 /* Multihop attempted */
-#define LINUX_EDOTDOT 73 /* RFS specific error */
-#define LINUX_EBADMSG 74 /* Not a data message */
-#define LINUX_EOVERFLOW 75 /* Value too large for defined data type */
-#define LINUX_ENOTUNIQ 76 /* Name not unique on network */
-#define LINUX_EBADFD 77 /* File descriptor in bad state */
-#define LINUX_EREMCHG 78 /* Remote address changed */
-#define LINUX_ELIBACC 79 /* Can not access a needed shared library */
-#define LINUX_ELIBBAD 80 /* Accessing a corrupted shared library */
-#define LINUX_ELIBSCN 81 /* .lib section in a.out corrupted */
-#define LINUX_ELIBMAX 82 /* Attempting to link in too many shared libraries */
-#define LINUX_ELIBEXEC 83 /* Cannot exec a shared library directly */
-#define LINUX_EILSEQ 84 /* Illegal byte sequence */
-#define LINUX_ERESTART 85 /* Interrupted system call should be restarted */
-#define LINUX_ESTRPIPE 86 /* Streams pipe error */
-#define LINUX_EUSERS 87 /* Too many users */
-#define LINUX_ENOTSOCK 88 /* Socket operation on non-socket */
-#define LINUX_EDESTADDRREQ 89 /* Destination address required */
-#define LINUX_EMSGSIZE 90 /* Message too long */
-#define LINUX_EPROTOTYPE 91 /* Protocol wrong type for socket */
-#define LINUX_ENOPROTOOPT 92 /* Protocol not available */
-#define LINUX_EPROTONOSUPPORT 93 /* Protocol not supported */
-#define LINUX_ESOCKTNOSUPPORT 94 /* Socket type not supported */
-#define LINUX_EOPNOTSUPP 95 /* Operation not supported on transport endpoint */
-#define LINUX_EPFNOSUPPORT 96 /* Protocol family not supported */
-#define LINUX_EAFNOSUPPORT 97 /* Address family not supported by protocol */
-#define LINUX_EADDRINUSE 98 /* Address already in use */
-#define LINUX_EADDRNOTAVAIL 99 /* Cannot assign requested address */
-#define LINUX_ENETDOWN 100 /* Network is down */
-#define LINUX_ENETUNREACH 101 /* Network is unreachable */
-#define LINUX_ENETRESET 102 /* Network dropped connection because of reset */
-#define LINUX_ECONNABORTED 103 /* Software caused connection abort */
-#define LINUX_ECONNRESET 104 /* Connection reset by peer */
-#define LINUX_ENOBUFS 105 /* No buffer space available */
-#define LINUX_EISCONN 106 /* Transport endpoint is already connected */
-#define LINUX_ENOTCONN 107 /* Transport endpoint is not connected */
-#define LINUX_ESHUTDOWN 108 /* Cannot send after transport endpoint shutdown */
-#define LINUX_ETOOMANYREFS 109 /* Too many references: cannot splice */
-#define LINUX_ETIMEDOUT 110 /* Connection timed out */
-#define LINUX_ECONNREFUSED 111 /* Connection refused */
-#define LINUX_EHOSTDOWN 112 /* Host is down */
-#define LINUX_EHOSTUNREACH 113 /* No route to host */
-#define LINUX_EALREADY 114 /* Operation already in progress */
-#define LINUX_EINPROGRESS 115 /* Operation now in progress */
-#define LINUX_ESTALE 116 /* Stale NFS file handle */
-#define LINUX_EUCLEAN 117 /* Structure needs cleaning */
-#define LINUX_ENOTNAM 118 /* Not a XENIX named type file */
-#define LINUX_ENAVAIL 119 /* No XENIX semaphores available */
-#define LINUX_EISNAM 120 /* Is a named type file */
-#define LINUX_EREMOTEIO 121 /* Remote I/O error */
-#define LINUX_EDQUOT 122 /* Quota exceeded */
-
-#define LINUX_ENOMEDIUM 123 /* No medium found */
-#define LINUX_EMEDIUMTYPE 124 /* Wrong medium type */
-
-#else /* !MACH_INCLUDE */
-
-#define EPERM 1 /* Operation not permitted */
-#define ENOENT 2 /* No such file or directory */
-#define ESRCH 3 /* No such process */
-#define EINTR 4 /* Interrupted system call */
-#define EIO 5 /* I/O error */
-#define ENXIO 6 /* No such device or address */
-#define E2BIG 7 /* Arg list too long */
-#define ENOEXEC 8 /* Exec format error */
-#define EBADF 9 /* Bad file number */
-#define ECHILD 10 /* No child processes */
-#define EAGAIN 11 /* Try again */
-#define ENOMEM 12 /* Out of memory */
-#define EACCES 13 /* Permission denied */
-#define EFAULT 14 /* Bad address */
-#define ENOTBLK 15 /* Block device required */
-#define EBUSY 16 /* Device or resource busy */
-#define EEXIST 17 /* File exists */
-#define EXDEV 18 /* Cross-device link */
-#define ENODEV 19 /* No such device */
-#define ENOTDIR 20 /* Not a directory */
-#define EISDIR 21 /* Is a directory */
-#define EINVAL 22 /* Invalid argument */
-#define ENFILE 23 /* File table overflow */
-#define EMFILE 24 /* Too many open files */
-#define ENOTTY 25 /* Not a typewriter */
-#define ETXTBSY 26 /* Text file busy */
-#define EFBIG 27 /* File too large */
-#define ENOSPC 28 /* No space left on device */
-#define ESPIPE 29 /* Illegal seek */
-#define EROFS 30 /* Read-only file system */
-#define EMLINK 31 /* Too many links */
-#define EPIPE 32 /* Broken pipe */
-#define EDOM 33 /* Math argument out of domain of func */
-#define ERANGE 34 /* Math result not representable */
-#define EDEADLK 35 /* Resource deadlock would occur */
-#define ENAMETOOLONG 36 /* File name too long */
-#define ENOLCK 37 /* No record locks available */
-#define ENOSYS 38 /* Function not implemented */
-#define ENOTEMPTY 39 /* Directory not empty */
-#define ELOOP 40 /* Too many symbolic links encountered */
-#define EWOULDBLOCK EAGAIN /* Operation would block */
-#define ENOMSG 42 /* No message of desired type */
-#define EIDRM 43 /* Identifier removed */
-#define ECHRNG 44 /* Channel number out of range */
-#define EL2NSYNC 45 /* Level 2 not synchronized */
-#define EL3HLT 46 /* Level 3 halted */
-#define EL3RST 47 /* Level 3 reset */
-#define ELNRNG 48 /* Link number out of range */
-#define EUNATCH 49 /* Protocol driver not attached */
-#define ENOCSI 50 /* No CSI structure available */
-#define EL2HLT 51 /* Level 2 halted */
-#define EBADE 52 /* Invalid exchange */
-#define EBADR 53 /* Invalid request descriptor */
-#define EXFULL 54 /* Exchange full */
-#define ENOANO 55 /* No anode */
-#define EBADRQC 56 /* Invalid request code */
-#define EBADSLT 57 /* Invalid slot */
-
-#define EDEADLOCK EDEADLK
-
-#define EBFONT 59 /* Bad font file format */
-#define ENOSTR 60 /* Device not a stream */
-#define ENODATA 61 /* No data available */
-#define ETIME 62 /* Timer expired */
-#define ENOSR 63 /* Out of streams resources */
-#define ENONET 64 /* Machine is not on the network */
-#define ENOPKG 65 /* Package not installed */
-#define EREMOTE 66 /* Object is remote */
-#define ENOLINK 67 /* Link has been severed */
-#define EADV 68 /* Advertise error */
-#define ESRMNT 69 /* Srmount error */
-#define ECOMM 70 /* Communication error on send */
-#define EPROTO 71 /* Protocol error */
-#define EMULTIHOP 72 /* Multihop attempted */
-#define EDOTDOT 73 /* RFS specific error */
-#define EBADMSG 74 /* Not a data message */
-#define EOVERFLOW 75 /* Value too large for defined data type */
-#define ENOTUNIQ 76 /* Name not unique on network */
-#define EBADFD 77 /* File descriptor in bad state */
-#define EREMCHG 78 /* Remote address changed */
-#define ELIBACC 79 /* Can not access a needed shared library */
-#define ELIBBAD 80 /* Accessing a corrupted shared library */
-#define ELIBSCN 81 /* .lib section in a.out corrupted */
-#define ELIBMAX 82 /* Attempting to link in too many shared libraries */
-#define ELIBEXEC 83 /* Cannot exec a shared library directly */
-#define EILSEQ 84 /* Illegal byte sequence */
-#define ERESTART 85 /* Interrupted system call should be restarted */
-#define ESTRPIPE 86 /* Streams pipe error */
-#define EUSERS 87 /* Too many users */
-#define ENOTSOCK 88 /* Socket operation on non-socket */
-#define EDESTADDRREQ 89 /* Destination address required */
-#define EMSGSIZE 90 /* Message too long */
-#define EPROTOTYPE 91 /* Protocol wrong type for socket */
-#define ENOPROTOOPT 92 /* Protocol not available */
-#define EPROTONOSUPPORT 93 /* Protocol not supported */
-#define ESOCKTNOSUPPORT 94 /* Socket type not supported */
-#define EOPNOTSUPP 95 /* Operation not supported on transport endpoint */
-#define EPFNOSUPPORT 96 /* Protocol family not supported */
-#define EAFNOSUPPORT 97 /* Address family not supported by protocol */
-#define EADDRINUSE 98 /* Address already in use */
-#define EADDRNOTAVAIL 99 /* Cannot assign requested address */
-#define ENETDOWN 100 /* Network is down */
-#define ENETUNREACH 101 /* Network is unreachable */
-#define ENETRESET 102 /* Network dropped connection because of reset */
-#define ECONNABORTED 103 /* Software caused connection abort */
-#define ECONNRESET 104 /* Connection reset by peer */
-#define ENOBUFS 105 /* No buffer space available */
-#define EISCONN 106 /* Transport endpoint is already connected */
-#define ENOTCONN 107 /* Transport endpoint is not connected */
-#define ESHUTDOWN 108 /* Cannot send after transport endpoint shutdown */
-#define ETOOMANYREFS 109 /* Too many references: cannot splice */
-#define ETIMEDOUT 110 /* Connection timed out */
-#define ECONNREFUSED 111 /* Connection refused */
-#define EHOSTDOWN 112 /* Host is down */
-#define EHOSTUNREACH 113 /* No route to host */
-#define EALREADY 114 /* Operation already in progress */
-#define EINPROGRESS 115 /* Operation now in progress */
-#define ESTALE 116 /* Stale NFS file handle */
-#define EUCLEAN 117 /* Structure needs cleaning */
-#define ENOTNAM 118 /* Not a XENIX named type file */
-#define ENAVAIL 119 /* No XENIX semaphores available */
-#define EISNAM 120 /* Is a named type file */
-#define EREMOTEIO 121 /* Remote I/O error */
-#define EDQUOT 122 /* Quota exceeded */
-
-#define ENOMEDIUM 123 /* No medium found */
-#define EMEDIUMTYPE 124 /* Wrong medium type */
-
-#endif /* !MACH_INCLUDE */
-
-#endif
diff --git a/linux/dev/include/linux/blk.h b/linux/dev/include/linux/blk.h
index 852853c5..412b8641 100644
--- a/linux/dev/include/linux/blk.h
+++ b/linux/dev/include/linux/blk.h
@@ -385,7 +385,9 @@ static void end_request(int uptodate) {
struct request *req = CURRENT;
#endif /* IDE_DRIVER */
struct buffer_head * bh;
+#ifndef MACH
int nsect;
+#endif
req->errors = 0;
if (!uptodate) {
diff --git a/linux/dev/include/linux/kernel.h b/linux/dev/include/linux/kernel.h
index aef73ac3..4db76acc 100644
--- a/linux/dev/include/linux/kernel.h
+++ b/linux/dev/include/linux/kernel.h
@@ -9,9 +9,7 @@
#include <stdarg.h>
#include <linux/linkage.h>
-
-/* Optimization barrier */
-#define barrier() __asm__("": : :"memory")
+#include <linux/compiler.h>
#define INT_MAX ((int)(~0U>>1))
#define UINT_MAX (~0U)
diff --git a/linux/dev/include/linux/notifier.h b/linux/dev/include/linux/notifier.h
index eede20f0..b3c9ccf6 100644
--- a/linux/dev/include/linux/notifier.h
+++ b/linux/dev/include/linux/notifier.h
@@ -55,11 +55,7 @@ extern __inline__ int notifier_chain_unregister(struct notifier_block **nl, stru
}
nl=&((*nl)->next);
}
-#ifdef MACH_INCLUDE
- return -LINUX_ENOENT;
-#else
return -ENOENT;
-#endif
}
/*
diff --git a/linux/dev/init/main.c b/linux/dev/init/main.c
index 9ed35d3d..f5c4832f 100644
--- a/linux/dev/init/main.c
+++ b/linux/dev/init/main.c
@@ -39,6 +39,7 @@
#include <machine/spl.h>
#include <machine/pmap.h>
#include <machine/vm_param.h>
+#include <machine/model_dep.h>
#define MACH_INCLUDE
#include <linux/sched.h>
@@ -47,6 +48,8 @@
#include <linux/delay.h>
#include <linux/ioport.h>
#include <linux/string.h>
+#include <linux/pci.h>
+#include <linux/dev/glue/glue.h>
#include <asm/system.h>
#include <asm/io.h>
@@ -83,30 +86,6 @@ struct drive_info_struct
*/
static void calibrate_delay (void);
-extern vm_offset_t phys_last_addr;
-
-extern void *alloc_contig_mem (unsigned, unsigned, unsigned, vm_page_t *);
-extern void free_contig_mem (vm_page_t);
-extern void init_IRQ (void);
-extern void restore_IRQ (void);
-extern void startrtclock (void);
-extern void linux_version_init (void);
-extern void linux_kmem_init (void);
-extern unsigned long pci_init (unsigned long, unsigned long);
-extern void linux_net_emulation_init (void);
-extern void device_setup (void);
-extern void linux_printk (char *,...);
-extern int linux_timer_intr (void);
-extern spl_t spl0 (void);
-extern spl_t splhigh (void);
-extern void form_pic_mask (void);
-extern int linux_bad_intr (int);
-extern int prtnull ();
-extern int intnull ();
-extern void linux_sched_init (void);
-extern void pcmcia_init (void);
-
-
/*
* Amount of contiguous memory to allocate for initialization.
*/
diff --git a/linux/dev/kernel/dma.c b/linux/dev/kernel/dma.c
index 4b569780..bbda4bbf 100644
--- a/linux/dev/kernel/dma.c
+++ b/linux/dev/kernel/dma.c
@@ -80,10 +80,10 @@ int
request_dma (unsigned int dmanr, const char *device_id)
{
if (dmanr >= MAX_DMA_CHANNELS)
- return -LINUX_EINVAL;
+ return -EINVAL;
if (xchg (&dma_chan_busy[dmanr].lock, 1) != 0)
- return -LINUX_EBUSY;
+ return -EBUSY;
dma_chan_busy[dmanr].device_id = device_id;
diff --git a/linux/dev/kernel/printk.c b/linux/dev/kernel/printk.c
index 1c45b245..8bed0d2a 100644
--- a/linux/dev/kernel/printk.c
+++ b/linux/dev/kernel/printk.c
@@ -27,6 +27,7 @@
#include <stdarg.h>
#include <asm/system.h>
#include <kern/assert.h>
+#include <kern/printf.h>
#include <device/cons.h>
static char buf[2048];
diff --git a/linux/dev/kernel/resource.c b/linux/dev/kernel/resource.c
index 7a187552..ba107e8e 100644
--- a/linux/dev/kernel/resource.c
+++ b/linux/dev/kernel/resource.c
@@ -131,7 +131,7 @@ release_region (unsigned int from, unsigned int num)
int
check_region (unsigned int from, unsigned int num)
{
- return (find_gap (&iolist, from, num) == NULL) ? -LINUX_EBUSY : 0;
+ return (find_gap (&iolist, from, num) == NULL) ? -EBUSY : 0;
}
/* Called from init/main.c to reserve IO ports. */
diff --git a/linux/dev/kernel/sched.c b/linux/dev/kernel/sched.c
index 792c2dae..87906a45 100644
--- a/linux/dev/kernel/sched.c
+++ b/linux/dev/kernel/sched.c
@@ -34,6 +34,9 @@
#include <kern/thread.h>
#include <kern/sched_prim.h>
+#include <kern/printf.h>
+
+#include <machine/machspl.h>
#define MACH_INCLUDE
#include <linux/sched.h>
@@ -41,21 +44,13 @@
#include <linux/fs.h>
#include <linux/blkdev.h>
#include <linux/interrupt.h>
+#include <linux/dev/glue/glue.h>
#include <asm/system.h>
#include <asm/atomic.h>
int securelevel = 0;
-extern void *alloc_contig_mem (unsigned, unsigned, unsigned, vm_page_t *);
-extern void free_contig_mem (vm_page_t);
-extern spl_t splhigh (void);
-extern spl_t splx (spl_t);
-extern void linux_soft_intr (void);
-extern int issig (void);
-extern int printf (const char *, ...);
-extern int linux_auto_config;
-
static void timer_bh (void);
DECLARE_TASK_QUEUE (tq_timer);
@@ -165,7 +160,7 @@ __do_down (struct semaphore *sem, int task_state)
if (task_state == TASK_INTERRUPTIBLE && issig ())
{
- ret = -LINUX_EINTR;
+ ret = -EINTR;
atomic_inc (&sem->count);
break;
}
@@ -185,7 +180,7 @@ __do_down (struct semaphore *sem, int task_state)
{
if (task_state == TASK_INTERRUPTIBLE && issig ())
{
- ret = -LINUX_EINTR;
+ ret = -EINTR;
atomic_inc (&sem->count);
break;
}
@@ -326,16 +321,6 @@ schedule (void)
}
void
-cdrom_sleep (int t)
-{
- int xxx;
-
- assert_wait ((event_t) &xxx, TRUE);
- thread_set_timeout (t);
- schedule ();
-}
-
-void
linux_sched_init (void)
{
/*
diff --git a/linux/dev/kernel/softirq.c b/linux/dev/kernel/softirq.c
index 96102a7a..65a0962f 100644
--- a/linux/dev/kernel/softirq.c
+++ b/linux/dev/kernel/softirq.c
@@ -13,6 +13,8 @@
#include <linux/interrupt.h>
#include <asm/system.h>
+#include <linux/dev/glue/glue.h>
+
int bh_mask_count[32];
unsigned long bh_active = 0;
unsigned long bh_mask = 0;
diff --git a/linux/dev/lib/vsprintf.c b/linux/dev/lib/vsprintf.c
index 0beb7471..541ec650 100644
--- a/linux/dev/lib/vsprintf.c
+++ b/linux/dev/lib/vsprintf.c
@@ -328,9 +328,9 @@ linux_vsprintf (char *buf, const char *fmt, va_list args)
num = va_arg (args, unsigned long);
else if (qualifier == 'h')
if (flags & SIGN)
- num = va_arg (args, short);
+ num = (short) va_arg (args, int);
else
- num = va_arg (args, unsigned short);
+ num = (unsigned short) va_arg (args, unsigned int);
else if (flags & SIGN)
num = va_arg (args, int);
else
diff --git a/linux/pcmcia-cs/glue/wireless_glue.h b/linux/pcmcia-cs/glue/wireless_glue.h
index 05eef4ba..61006b4a 100644
--- a/linux/pcmcia-cs/glue/wireless_glue.h
+++ b/linux/pcmcia-cs/glue/wireless_glue.h
@@ -48,14 +48,7 @@
#endif
-/*
- * We compile everything directly into the GNU Mach kernel, there are no
- * modules.
- */
-#define SET_MODULE_OWNER(a) do{ } while(0)
-#define EXPORT_SYMBOL(a)
-
-
+#include <kern/debug.h>
/*
* We need some `schedule_task' replacement. This is defined in
diff --git a/linux/src/drivers/block/floppy.c b/linux/src/drivers/block/floppy.c
index 0314a0b7..1b96c44f 100644
--- a/linux/src/drivers/block/floppy.c
+++ b/linux/src/drivers/block/floppy.c
@@ -177,6 +177,8 @@ static inline int __get_order(unsigned long size);
#include <linux/blk.h>
#include <linux/cdrom.h> /* for the compatibility eject ioctl */
+#include <linux/dev/glue/glue.h>
+
#ifndef FLOPPY_MOTOR_MASK
#define FLOPPY_MOTOR_MASK 0xf0
@@ -4167,8 +4169,6 @@ static void floppy_release_irq_and_dma(void)
#ifdef MODULE
-extern char *get_options(char *str, int *ints);
-
char *floppy=NULL;
static void parse_floppy_cfg_string(char *cfg)
diff --git a/linux/src/drivers/block/ide-cd.c b/linux/src/drivers/block/ide-cd.c
index 17f60b94..e4548f54 100644
--- a/linux/src/drivers/block/ide-cd.c
+++ b/linux/src/drivers/block/ide-cd.c
@@ -153,6 +153,10 @@
/***************************************************************************/
+#ifdef MACH
+#include <kern/sched_prim.h>
+#endif
+
#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/delay.h>
@@ -626,7 +630,7 @@ static void cdrom_queue_request_sense (ide_drive_t *drive,
pc->c[0] = REQUEST_SENSE;
pc->c[4] = len;
- pc->buffer = (char *)reqbuf;
+ pc->buffer = (unsigned char *)reqbuf;
pc->buflen = len;
pc->sense_data = (struct atapi_request_sense *)failed_command;
@@ -844,7 +848,7 @@ static int cdrom_start_packet_command (ide_drive_t *drive, int xferlen,
HANDLER is the interrupt handler to call when the command completes
or there's data ready. */
static int cdrom_transfer_packet_command (ide_drive_t *drive,
- char *cmd_buf, int cmd_len,
+ unsigned char *cmd_buf, int cmd_len,
ide_handler_t *handler)
{
if (CDROM_CONFIG_FLAGS (drive)->drq_interrupt) {
@@ -1379,10 +1383,19 @@ static void cdrom_do_packet_command (ide_drive_t *drive)
cdrom_start_packet_command (drive, len, cdrom_do_pc_continuation);
}
-
-#ifndef MACH
/* Sleep for TIME jiffies.
Not to be called from an interrupt handler. */
+#ifdef MACH
+static
+void cdrom_sleep (int time)
+{
+ int xxx;
+
+ assert_wait ((event_t) &xxx, TRUE);
+ thread_set_timeout (time);
+ schedule ();
+}
+#else
static
void cdrom_sleep (int time)
{
@@ -1660,7 +1673,7 @@ cdrom_read_capacity (ide_drive_t *drive, unsigned *capacity,
pc.sense_data = reqbuf;
pc.c[0] = READ_CAPACITY;
- pc.buffer = (char *)&capbuf;
+ pc.buffer = (unsigned char *)&capbuf;
pc.buflen = sizeof (capbuf);
stat = cdrom_queue_packet_command (drive, &pc);
@@ -1681,7 +1694,7 @@ cdrom_read_tocentry (ide_drive_t *drive, int trackno, int msf_flag,
memset (&pc, 0, sizeof (pc));
pc.sense_data = reqbuf;
- pc.buffer = buf;
+ pc.buffer = (unsigned char *)buf;
pc.buflen = buflen;
pc.c[0] = SCMD_READ_TOC;
pc.c[6] = trackno;
@@ -1813,7 +1826,7 @@ cdrom_read_subchannel (ide_drive_t *drive, int format,
memset (&pc, 0, sizeof (pc));
pc.sense_data = reqbuf;
- pc.buffer = buf;
+ pc.buffer = (unsigned char *) buf;
pc.buflen = buflen;
pc.c[0] = SCMD_READ_SUBCHANNEL;
pc.c[1] = 2; /* MSF addressing */
@@ -1836,7 +1849,7 @@ cdrom_mode_sense (ide_drive_t *drive, int pageno, int modeflag,
memset (&pc, 0, sizeof (pc));
pc.sense_data = reqbuf;
- pc.buffer = buf;
+ pc.buffer = (unsigned char *)buf;
pc.buflen = buflen;
pc.c[0] = MODE_SENSE_10;
pc.c[2] = pageno | (modeflag << 6);
@@ -1855,7 +1868,7 @@ cdrom_mode_select (ide_drive_t *drive, int pageno, char *buf, int buflen,
memset (&pc, 0, sizeof (pc));
pc.sense_data = reqbuf;
- pc.buffer = buf;
+ pc.buffer = (unsigned char *)buf;
pc.buflen = - buflen;
pc.c[0] = MODE_SELECT_10;
pc.c[1] = 0x10;
@@ -1971,7 +1984,7 @@ cdrom_read_block (ide_drive_t *drive, int format, int lba, int nblocks,
memset (&pc, 0, sizeof (pc));
pc.sense_data = reqbuf;
- pc.buffer = buf;
+ pc.buffer = (unsigned char *)buf;
pc.buflen = buflen;
#if ! STANDARD_ATAPI
@@ -2698,9 +2711,12 @@ void ide_cdrom_setup (ide_drive_t *drive)
CDROM_CONFIG_FLAGS (drive)->subchan_as_bcd = 0;
if (drive->id != NULL) {
- if (strcmp (drive->id->model, "V003S0DS") == 0 &&
- drive->id->fw_rev[4] == '1' &&
- drive->id->fw_rev[6] <= '2') {
+ const char *model = (const char *)drive->id->model;
+ const char *fw_rev = (const char *)drive->id->fw_rev;
+
+ if (strcmp (model, "V003S0DS") == 0 &&
+ fw_rev[4] == '1' &&
+ fw_rev[6] <= '2') {
/* Vertos 300.
Some versions of this drive like to talk BCD. */
CDROM_CONFIG_FLAGS (drive)->toctracks_as_bcd = 1;
@@ -2709,27 +2725,27 @@ void ide_cdrom_setup (ide_drive_t *drive)
CDROM_CONFIG_FLAGS (drive)->subchan_as_bcd = 1;
}
- else if (strcmp (drive->id->model, "V006E0DS") == 0 &&
- drive->id->fw_rev[4] == '1' &&
- drive->id->fw_rev[6] <= '2') {
+ else if (strcmp (model, "V006E0DS") == 0 &&
+ fw_rev[4] == '1' &&
+ fw_rev[6] <= '2') {
/* Vertos 600 ESD. */
CDROM_CONFIG_FLAGS (drive)->toctracks_as_bcd = 1;
}
- else if (strcmp (drive->id->model, "GCD-R580B") == 0)
+ else if (strcmp (model, "GCD-R580B") == 0)
drive->cdrom_info.max_sectors = 124;
- else if (strcmp (drive->id->model,
+ else if (strcmp (model,
"NEC CD-ROM DRIVE:260") == 0 &&
- strcmp (drive->id->fw_rev, "1.01") == 0) {
+ strcmp (fw_rev, "1.01") == 0) {
/* Old NEC260 (not R). */
CDROM_CONFIG_FLAGS (drive)->tocaddr_as_bcd = 1;
CDROM_CONFIG_FLAGS (drive)->playmsf_as_bcd = 1;
CDROM_CONFIG_FLAGS (drive)->subchan_as_bcd = 1;
}
- else if (strcmp (drive->id->model, "WEARNES CDD-120") == 0 &&
- strcmp (drive->id->fw_rev, "A1.1") == 0) {
+ else if (strcmp (model, "WEARNES CDD-120") == 0 &&
+ strcmp (fw_rev, "A1.1") == 0) {
/* Wearnes */
CDROM_CONFIG_FLAGS (drive)->playmsf_as_bcd = 1;
CDROM_CONFIG_FLAGS (drive)->subchan_as_bcd = 1;
@@ -2737,9 +2753,9 @@ void ide_cdrom_setup (ide_drive_t *drive)
/* Sanyo 3 CD changer uses a non-standard command
for CD changing */
- else if ((strcmp(drive->id->model, "CD-ROM CDR-C3 G") == 0) ||
- (strcmp(drive->id->model, "CD-ROM CDR-C3G") == 0) ||
- (strcmp(drive->id->model, "CD-ROM CDR_C36") == 0)) {
+ else if ((strcmp(model, "CD-ROM CDR-C3 G") == 0) ||
+ (strcmp(model, "CD-ROM CDR-C3G") == 0) ||
+ (strcmp(model, "CD-ROM CDR_C36") == 0)) {
/* uses CD in slot 0 when value is set to 3 */
CDROM_STATE_FLAGS (drive)->sanyo_slot = 3;
}
diff --git a/linux/src/drivers/block/ide.c b/linux/src/drivers/block/ide.c
index 18f2e763..d9e3fbaf 100644
--- a/linux/src/drivers/block/ide.c
+++ b/linux/src/drivers/block/ide.c
@@ -1525,7 +1525,7 @@ static inline void do_rw_disk (ide_drive_t *drive, struct request *rq, unsigned
*/
static void execute_drive_cmd (ide_drive_t *drive, struct request *rq)
{
- byte *args = rq->buffer;
+ byte *args = (byte *)rq->buffer;
if (args) {
#ifdef DEBUG
printk("%s: DRIVE_CMD cmd=0x%02x sc=0x%02x fr=0x%02x xx=0x%02x\n",
@@ -2020,7 +2020,7 @@ static int ide_open(struct inode * inode, struct file * filp)
struct request rq;
check_disk_change(inode->i_rdev);
ide_init_drive_cmd (&rq);
- rq.buffer = door_lock;
+ rq.buffer = (char *)door_lock;
/*
* Ignore the return code from door_lock,
* since the open() has already succeeded,
@@ -2071,7 +2071,7 @@ static void ide_release(struct inode * inode, struct file * file)
struct request rq;
invalidate_buffers(inode->i_rdev);
ide_init_drive_cmd (&rq);
- rq.buffer = door_unlock;
+ rq.buffer = (char *)door_unlock;
(void) ide_do_drive_cmd(drive, &rq, ide_wait);
}
}
@@ -2321,7 +2321,7 @@ static int ide_ioctl (struct inode *inode, struct file *file,
argbuf[3] = args[3];
}
if (!(err = verify_area(VERIFY_WRITE,(void *)arg, argsize))) {
- rq.buffer = argbuf;
+ rq.buffer = (char *)argbuf;
err = ide_do_drive_cmd(drive, &rq, ide_wait);
memcpy_tofs((void *)arg, argbuf, argsize);
}
@@ -2455,7 +2455,7 @@ static inline void do_identify (ide_drive_t *drive, byte cmd)
ide_fixstring (id->fw_rev, sizeof(id->fw_rev), bswap);
ide_fixstring (id->serial_no, sizeof(id->serial_no), bswap);
- if (strstr(id->model, "E X A B Y T E N E S T"))
+ if (strstr((char *)id->model, "E X A B Y T E N E S T"))
return;
#ifdef CONFIG_BLK_DEV_IDEATAPI
@@ -2474,9 +2474,12 @@ static inline void do_identify (ide_drive_t *drive, byte cmd)
#endif /* CONFIG_BLK_DEV_PROMISE */
if (!drive->ide_scsi) switch (type) {
case 0:
- if (!strstr(id->model, "oppy") && !strstr(id->model, "poyp") && !strstr(id->model, "ZIP"))
+ if (!strstr((char *)id->model, "oppy") &&
+ !strstr((char *)id->model, "poyp") &&
+ !strstr((char *)id->model, "ZIP"))
printk("cdrom or floppy?, assuming ");
- if (drive->media != ide_cdrom && !strstr(id->model, "CD-ROM")) {
+ if (drive->media != ide_cdrom &&
+ !strstr((char *)id->model, "CD-ROM")) {
#ifdef CONFIG_BLK_DEV_IDEFLOPPY
printk("FLOPPY drive\n");
drive->media = ide_floppy;
@@ -2616,8 +2619,8 @@ static inline void do_identify (ide_drive_t *drive, byte cmd)
drive->bios_cyl = capacity/cylsize;
}
- if (!strncmp(id->model, "BMI ", 4) &&
- strstr(id->model, " ENHANCED IDE ") &&
+ if (!strncmp((char *)id->model, "BMI ", 4) &&
+ strstr((char *)id->model, " ENHANCED IDE ") &&
drive->select.b.lba)
drive->no_geom = 1;
@@ -2856,7 +2859,7 @@ static inline byte probe_for_drive (ide_drive_t *drive)
(void) do_probe(drive, WIN_PIDENTIFY); /* look for ATAPI device */
#endif /* CONFIG_BLK_DEV_IDEATAPI */
}
- if (drive->id && strstr(drive->id->model, "E X A B Y T E N E S T"))
+ if (drive->id && strstr((char *)drive->id->model, "E X A B Y T E N E S T"))
enable_nest(drive);
if (!drive->present)
return 0; /* drive not found */
diff --git a/linux/src/drivers/block/ide.h b/linux/src/drivers/block/ide.h
index 44331607..9b8904e0 100644
--- a/linux/src/drivers/block/ide.h
+++ b/linux/src/drivers/block/ide.h
@@ -198,7 +198,7 @@ struct atapi_request_sense {
};
struct packet_command {
- char *buffer;
+ unsigned char *buffer;
int buflen;
int stat;
struct atapi_request_sense *sense_data;
diff --git a/linux/src/drivers/net/8390.c b/linux/src/drivers/net/8390.c
index 9864106b..93c485d6 100644
--- a/linux/src/drivers/net/8390.c
+++ b/linux/src/drivers/net/8390.c
@@ -706,13 +706,10 @@ int ethdev_init(struct device *dev)
printk(version);
if (dev->priv == NULL) {
- struct ei_device *ei_local;
-
dev->priv = kmalloc(sizeof(struct ei_device), GFP_KERNEL);
if (dev->priv == NULL)
return -ENOMEM;
memset(dev->priv, 0, sizeof(struct ei_device));
- ei_local = (struct ei_device *)dev->priv;
}
dev->hard_start_xmit = &ei_start_xmit;
diff --git a/linux/src/drivers/net/at1700.c b/linux/src/drivers/net/at1700.c
index 953c1889..9e42ab48 100644
--- a/linux/src/drivers/net/at1700.c
+++ b/linux/src/drivers/net/at1700.c
@@ -595,7 +595,9 @@ net_rx(struct device *dev)
/* The inverse routine to net_open(). */
static int net_close(struct device *dev)
{
+#if 0
struct net_local *lp = (struct net_local *)dev->priv;
+#endif
int ioaddr = dev->base_addr;
dev->tbusy = 1;
diff --git a/linux/src/drivers/net/de4x5.c b/linux/src/drivers/net/de4x5.c
index 114f6a74..a66f0564 100644
--- a/linux/src/drivers/net/de4x5.c
+++ b/linux/src/drivers/net/de4x5.c
@@ -1493,7 +1493,7 @@ de4x5_sw_reset(struct device *dev)
status = -EIO;
}
- lp->tx_new = (++lp->tx_new) % lp->txRingSize;
+ lp->tx_new = (lp->tx_new + 1) % lp->txRingSize;
lp->tx_old = lp->tx_new;
return status;
@@ -1553,7 +1553,7 @@ de4x5_queue_pkt(struct sk_buff *skb, struct device *dev)
#endif
outl(POLL_DEMAND, DE4X5_TPD);/* Start the TX */
- lp->tx_new = (++lp->tx_new) % lp->txRingSize;
+ lp->tx_new = (lp->tx_new + 1) % lp->txRingSize;
dev->trans_start = jiffies;
if (TX_BUFFS_AVAIL) {
@@ -1708,7 +1708,7 @@ de4x5_rx(struct device *dev)
}
/* Change buffer ownership for this frame, back to the adapter */
- for (;lp->rx_old!=entry;lp->rx_old=(++lp->rx_old)%lp->rxRingSize) {
+ for (;lp->rx_old!=entry;lp->rx_old=(lp->rx_old+1)%lp->rxRingSize) {
lp->rx_ring[lp->rx_old].status = cpu_to_le32(R_OWN);
barrier();
}
@@ -1719,7 +1719,7 @@ de4x5_rx(struct device *dev)
/*
** Update entry information
*/
- lp->rx_new = (++lp->rx_new) % lp->rxRingSize;
+ lp->rx_new = (lp->rx_new + 1) % lp->rxRingSize;
}
return 0;
@@ -1768,7 +1768,7 @@ de4x5_tx(struct device *dev)
}
/* Update all the pointers */
- lp->tx_old = (++lp->tx_old) % lp->txRingSize;
+ lp->tx_old = (lp->tx_old + 1) % lp->txRingSize;
}
if (TX_BUFFS_AVAIL && dev->tbusy) { /* Any resources available? */
@@ -1838,7 +1838,7 @@ de4x5_rx_ovfc(struct device *dev)
for (; (s32)le32_to_cpu(lp->rx_ring[lp->rx_new].status)>=0;) {
lp->rx_ring[lp->rx_new].status = cpu_to_le32(R_OWN);
- lp->rx_new = (++lp->rx_new % lp->rxRingSize);
+ lp->rx_new = (lp->rx_new + 1) % lp->rxRingSize;
}
outl(omr, DE4X5_OMR);
@@ -1963,7 +1963,7 @@ set_multicast_list(struct device *dev)
load_packet(dev, lp->setup_frame, TD_IC | PERFECT_F | TD_SET |
SETUP_FRAME_LEN, NULL);
- lp->tx_new = (++lp->tx_new) % lp->txRingSize;
+ lp->tx_new = (lp->tx_new + 1) % lp->txRingSize;
outl(POLL_DEMAND, DE4X5_TPD); /* Start the TX */
dev->trans_start = jiffies;
}
@@ -3576,7 +3576,7 @@ ping_media(struct device *dev, int msec)
lp->tmp = lp->tx_new; /* Remember the ring position */
load_packet(dev, lp->frame, TD_LS | TD_FS | sizeof(lp->frame), NULL);
- lp->tx_new = (++lp->tx_new) % lp->txRingSize;
+ lp->tx_new = (lp->tx_new + 1) % lp->txRingSize;
outl(POLL_DEMAND, DE4X5_TPD);
}
@@ -5111,7 +5111,7 @@ mii_get_phy(struct device *dev)
lp->useMII = TRUE;
/* Search the MII address space for possible PHY devices */
- for (n=0, lp->mii_cnt=0, i=1; !((i==1) && (n==1)); i=(++i)%DE4X5_MAX_MII) {
+ for (n=0, lp->mii_cnt=0, i=1; !((i==1) && (n==1)); i=(i+1)%DE4X5_MAX_MII) {
lp->phy[lp->active].addr = i;
if (i==0) n++; /* Count cycles */
while (de4x5_reset_phy(dev)<0) udelay(100);/* Wait for reset */
@@ -5607,7 +5607,7 @@ de4x5_ioctl(struct device *dev, struct ifreq *rq, int cmd)
while (test_and_set_bit(0, (void *)&dev->tbusy) != 0);
load_packet(dev, lp->setup_frame, TD_IC | PERFECT_F | TD_SET |
SETUP_FRAME_LEN, NULL);
- lp->tx_new = (++lp->tx_new) % lp->txRingSize;
+ lp->tx_new = (lp->tx_new + 1) % lp->txRingSize;
outl(POLL_DEMAND, DE4X5_TPD); /* Start the TX */
dev->tbusy = 0; /* Unlock the TX ring */
diff --git a/linux/src/drivers/net/depca.c b/linux/src/drivers/net/depca.c
index 8cf6fc80..e1b03429 100644
--- a/linux/src/drivers/net/depca.c
+++ b/linux/src/drivers/net/depca.c
@@ -966,7 +966,7 @@ depca_rx(struct device *dev)
}
}
/* Change buffer ownership for this last frame, back to the adapter */
- for (; lp->rx_old!=entry; lp->rx_old=(++lp->rx_old)&lp->rxRingMask) {
+ for (; lp->rx_old!=entry; lp->rx_old=(lp->rx_old+1)&lp->rxRingMask) {
writel(readl(&lp->rx_ring[lp->rx_old].base) | R_OWN,
&lp->rx_ring[lp->rx_old].base);
}
@@ -976,7 +976,7 @@ depca_rx(struct device *dev)
/*
** Update entry information
*/
- lp->rx_new = (++lp->rx_new) & lp->rxRingMask;
+ lp->rx_new = (lp->rx_new + 1) & lp->rxRingMask;
}
return 0;
@@ -1017,7 +1017,7 @@ depca_tx(struct device *dev)
}
/* Update all the pointers */
- lp->tx_old = (++lp->tx_old) & lp->txRingMask;
+ lp->tx_old = (lp->tx_old + 1) & lp->txRingMask;
}
return 0;
@@ -1540,7 +1540,7 @@ static int load_packet(struct device *dev, struct sk_buff *skb)
/* set up the buffer descriptors */
len = (skb->len < ETH_ZLEN) ? ETH_ZLEN : skb->len;
- for (i = entry; i != end; i = (++i) & lp->txRingMask) {
+ for (i = entry; i != end; i = (i + 1) & lp->txRingMask) {
/* clean out flags */
writel(readl(&lp->tx_ring[i].base) & ~T_FLAGS, &lp->tx_ring[i].base);
writew(0x0000, &lp->tx_ring[i].misc); /* clears other error flags */
diff --git a/linux/src/drivers/scsi/FlashPoint.c b/linux/src/drivers/scsi/FlashPoint.c
index a74c3c5f..aae35c03 100644
--- a/linux/src/drivers/scsi/FlashPoint.c
+++ b/linux/src/drivers/scsi/FlashPoint.c
@@ -2326,7 +2326,6 @@ void Debug_Load(UCHAR p_card, UCHAR p_bug_data);
extern unsigned int SccbGlobalFlags;
-#ident "$Id: FlashPoint.c,v 1.1 1999/04/26 05:53:56 tb Exp $"
/*----------------------------------------------------------------------
*
*
@@ -5352,7 +5351,7 @@ void Debug_Load(UCHAR p_card, UCHAR p_bug_data)
}
#endif
-#ident "$Id: FlashPoint.c,v 1.1 1999/04/26 05:53:56 tb Exp $"
+
/*----------------------------------------------------------------------
*
*
@@ -5424,7 +5423,7 @@ UCHAR debug_int[MAX_CARDS][debug_size] = { 0 };
UCHAR debug_index[MAX_CARDS] = { 0 };
UCHAR reserved_1[3] = { 0 };
#endif
-#ident "$Id: FlashPoint.c,v 1.1 1999/04/26 05:53:56 tb Exp $"
+
/*----------------------------------------------------------------------
*
*
@@ -7518,7 +7517,6 @@ void sinits(PSCCB p_sccb, UCHAR p_card)
}
-#ident "$Id: FlashPoint.c,v 1.1 1999/04/26 05:53:56 tb Exp $"
/*----------------------------------------------------------------------
*
*
@@ -8267,7 +8265,6 @@ void phaseBusFree(ULONG port, UCHAR p_card)
-#ident "$Id: FlashPoint.c,v 1.1 1999/04/26 05:53:56 tb Exp $"
/*----------------------------------------------------------------------
*
*
@@ -8659,7 +8656,7 @@ void autoCmdCmplt(ULONG p_port, UCHAR p_card)
queueCmdComplete(&BL_Card[p_card], currSCCB, p_card);
}
-#ident "$Id: FlashPoint.c,v 1.1 1999/04/26 05:53:56 tb Exp $"
+
/*----------------------------------------------------------------------
*
*
@@ -9351,7 +9348,7 @@ void hostDataXferRestart(PSCCB currSCCB)
currSCCB->Sccb_XferCnt = currSCCB->DataLength - currSCCB->Sccb_ATC;
}
}
-#ident "$Id: FlashPoint.c,v 1.1 1999/04/26 05:53:56 tb Exp $"
+
/*----------------------------------------------------------------------
*
*
@@ -10581,7 +10578,7 @@ void scsavdi(UCHAR p_card, ULONG p_port)
utilEEWrite(p_port, sum_data, EEPROM_CHECK_SUM/2);
utilEEWriteOnOff(p_port,0); /* Turn off write access */
}
-#ident "$Id: FlashPoint.c,v 1.1 1999/04/26 05:53:56 tb Exp $"
+
/*----------------------------------------------------------------------
*
*
@@ -11026,7 +11023,7 @@ void DiagEEPROM(ULONG p_port)
}
-#ident "$Id: FlashPoint.c,v 1.1 1999/04/26 05:53:56 tb Exp $"
+
/*----------------------------------------------------------------------
*
*
diff --git a/linux/src/drivers/scsi/gdth.c b/linux/src/drivers/scsi/gdth.c
index 6cc2b780..0a4bef89 100644
--- a/linux/src/drivers/scsi/gdth.c
+++ b/linux/src/drivers/scsi/gdth.c
@@ -2851,8 +2851,9 @@ __initfunc (int gdth_detect(Scsi_Host_Template *shtp))
ushort eisa_slot,device_id,index;
gdth_pci_str pcistr;
int i,j,hanum;
+#if LINUX_VERSION_CODE < 0x020000
unchar b;
-
+#endif
#ifdef DEBUG_GDTH
printk("GDT: This driver contains debugging information !! Trace level = %d\n",
@@ -2878,7 +2879,7 @@ __initfunc (int gdth_detect(Scsi_Host_Template *shtp))
}
/* initializations */
- gdth_polling = TRUE; b = 0;
+ gdth_polling = TRUE;
for (i=0; i<GDTH_MAXCMDS; ++i)
for (j=0; j<MAXHA; ++j)
gdth_cmd_tab[i][j].cmnd = UNUSED_CMND;
diff --git a/linux/src/drivers/scsi/ppa.c b/linux/src/drivers/scsi/ppa.c
index 5063a677..fd224f9e 100644
--- a/linux/src/drivers/scsi/ppa.c
+++ b/linux/src/drivers/scsi/ppa.c
@@ -259,7 +259,6 @@ int ppa_detect(Scsi_Host_Template * host)
struct Scsi_Host *hreg;
int ports;
int i, nhosts;
- unsigned short ppb;
printk("ppa: Version %s\n", PPA_VERSION);
nhosts = 0;
@@ -267,7 +266,7 @@ int ppa_detect(Scsi_Host_Template * host)
for (i = 0; i < parbus_no; i++) {
if (parbus_base[i] == 0x0000)
continue;
- ppb = ppa_hosts[i].base = parbus_base[i];
+ ppa_hosts[i].base = parbus_base[i];
/* sanity checks */
if (check_region(parbus_base[i],
@@ -518,7 +517,7 @@ static inline int ppa_byte_in(unsigned short base, char *buffer, int len)
" shrb $4,%%al\n" \
" orb %%al," #reg "\n"
-static inline int ppa_nibble_in(unsigned short str_p, char *buffer, int len)
+static inline int ppa_nibble_in(unsigned short base, char *buffer, int len)
{
for (; len; len--) {
unsigned char h;
diff --git a/linux/src/drivers/scsi/wd7000.c b/linux/src/drivers/scsi/wd7000.c
index d910e27b..08d3ac3c 100644
--- a/linux/src/drivers/scsi/wd7000.c
+++ b/linux/src/drivers/scsi/wd7000.c
@@ -573,7 +573,7 @@ static int mail_out (Adapter *host, Scb *scbptr)
break;
}
else
- ogmb = (++ogmb) % OGMB_CNT;
+ ogmb = (ogmb + 1) % OGMB_CNT;
}
restore_flags (flags);
diff --git a/linux/src/include/asm-i386/string-486.h b/linux/src/include/asm-i386/string-486.h
deleted file mode 100644
index 1a337ba7..00000000
--- a/linux/src/include/asm-i386/string-486.h
+++ /dev/null
@@ -1,702 +0,0 @@
-#ifndef _I386_STRING_I486_H_
-#define _I386_STRING_I486_H_
-
-/*
- * This string-include defines all string functions as inline
- * functions. Use gcc. It also assumes ds=es=data space, this should be
- * normal. Most of the string-functions are rather heavily hand-optimized,
- * see especially strtok,strstr,str[c]spn. They should work, but are not
- * very easy to understand. Everything is done entirely within the register
- * set, making the functions fast and clean.
- *
- * Copyright (C) 1991, 1992 Linus Torvalds
- * Revised and optimized for i486/pentium
- * 1994/03/15 by Alberto Vignani/Davide Parodi @crf.it
- *
- * Split into 2 CPU specific files by Alan Cox to keep #ifdef noise down.
- */
-
-#define __HAVE_ARCH_STRCPY
-extern inline char * strcpy(char * dest,const char *src)
-{
-register char *tmp= (char *)dest;
-register char dummy;
-__asm__ __volatile__(
- "\n1:\t"
- "movb (%0),%b2\n\t"
- "incl %0\n\t"
- "movb %b2,(%1)\n\t"
- "incl %1\n\t"
- "testb %b2,%b2\n\t"
- "jne 1b"
- :"=r" (src), "=r" (tmp), "=q" (dummy)
- :"0" (src), "1" (tmp)
- :"memory");
-return dest;
-}
-
-#define __HAVE_ARCH_STRNCPY
-extern inline char * strncpy(char * dest,const char *src,size_t count)
-{
-register char *tmp= (char *)dest;
-register char dummy;
-if (count) {
-__asm__ __volatile__(
- "\n1:\t"
- "movb (%0),%b2\n\t"
- "incl %0\n\t"
- "movb %b2,(%1)\n\t"
- "incl %1\n\t"
- "decl %3\n\t"
- "je 3f\n\t"
- "testb %b2,%b2\n\t"
- "jne 1b\n\t"
- "2:\tmovb %b2,(%1)\n\t"
- "incl %1\n\t"
- "decl %3\n\t"
- "jne 2b\n\t"
- "3:"
- :"=r" (src), "=r" (tmp), "=q" (dummy), "=r" (count)
- :"0" (src), "1" (tmp), "3" (count)
- :"memory");
- } /* if (count) */
-return dest;
-}
-
-#define __HAVE_ARCH_STRCAT
-extern inline char * strcat(char * dest,const char * src)
-{
-register char *tmp = (char *)(dest-1);
-register char dummy;
-__asm__ __volatile__(
- "\n1:\tincl %1\n\t"
- "cmpb $0,(%1)\n\t"
- "jne 1b\n"
- "2:\tmovb (%2),%b0\n\t"
- "incl %2\n\t"
- "movb %b0,(%1)\n\t"
- "incl %1\n\t"
- "testb %b0,%b0\n\t"
- "jne 2b\n"
- :"=q" (dummy), "=r" (tmp), "=r" (src)
- :"1" (tmp), "2" (src)
- :"memory");
-return dest;
-}
-
-#define __HAVE_ARCH_STRNCAT
-extern inline char * strncat(char * dest,const char * src,size_t count)
-{
-register char *tmp = (char *)(dest-1);
-register char dummy;
-__asm__ __volatile__(
- "\n1:\tincl %1\n\t"
- "cmpb $0,(%1)\n\t"
- "jne 1b\n"
- "2:\tdecl %3\n\t"
- "js 3f\n\t"
- "movb (%2),%b0\n\t"
- "incl %2\n\t"
- "movb %b0,(%1)\n\t"
- "incl %1\n\t"
- "testb %b0,%b0\n\t"
- "jne 2b\n"
- "3:\txorb %b0,%b0\n\t"
- "movb %b0,(%1)\n\t"
- :"=q" (dummy), "=r" (tmp), "=r" (src), "=r" (count)
- :"1" (tmp), "2" (src), "3" (count)
- :"memory");
-return dest;
-}
-
-#define __HAVE_ARCH_STRCMP
-extern inline int strcmp(const char * cs,const char * ct)
-{
-register int __res;
-__asm__ __volatile__(
- "\n1:\tmovb (%1),%b0\n\t"
- "incl %1\n\t"
- "cmpb %b0,(%2)\n\t"
- "jne 2f\n\t"
- "incl %2\n\t"
- "testb %b0,%b0\n\t"
- "jne 1b\n\t"
- "xorl %k0,%k0\n\t"
- "jmp 3f\n"
- "2:\tmovl $1,%k0\n\t"
- "jb 3f\n\t"
- "negl %k0\n"
- "3:"
- :"=q" (__res), "=r" (cs), "=r" (ct)
- :"1" (cs), "2" (ct)
- : "memory" );
-return __res;
-}
-
-#define __HAVE_ARCH_STRNCMP
-extern inline int strncmp(const char * cs,const char * ct,size_t count)
-{
-register int __res;
-__asm__ __volatile__(
- "\n1:\tdecl %3\n\t"
- "js 2f\n\t"
- "movb (%1),%b0\n\t"
- "incl %1\n\t"
- "cmpb %b0,(%2)\n\t"
- "jne 3f\n\t"
- "incl %2\n\t"
- "testb %b0,%b0\n\t"
- "jne 1b\n"
- "2:\txorl %k0,%k0\n\t"
- "jmp 4f\n"
- "3:\tmovl $1,%k0\n\t"
- "jb 4f\n\t"
- "negl %k0\n"
- "4:"
- :"=q" (__res), "=r" (cs), "=r" (ct), "=r" (count)
- :"1" (cs), "2" (ct), "3" (count));
-return __res;
-}
-
-#define __HAVE_ARCH_STRCHR
-extern inline char * strchr(const char * s, int c)
-{
-register char * __res;
-__asm__ __volatile__(
- "movb %%al,%%ah\n"
- "1:\tmovb (%1),%%al\n\t"
- "cmpb %%ah,%%al\n\t"
- "je 2f\n\t"
- "incl %1\n\t"
- "testb %%al,%%al\n\t"
- "jne 1b\n\t"
- "xorl %1,%1\n"
- "2:\tmovl %1,%0\n\t"
- :"=a" (__res), "=r" (s)
- :"0" (c), "1" (s));
-return __res;
-}
-
-#define __HAVE_ARCH_STRRCHR
-extern inline char * strrchr(const char * s, int c)
-{
-register char * __res;
-__asm__ __volatile__(
- "cld\n\t"
- "movb %%al,%%ah\n"
- "1:\tlodsb\n\t"
- "cmpb %%ah,%%al\n\t"
- "jne 2f\n\t"
- "leal -1(%%esi),%0\n"
- "2:\ttestb %%al,%%al\n\t"
- "jne 1b"
- :"=d" (__res):"0" (0),"S" (s),"a" (c):"ax","si");
-return __res;
-}
-
-#define __HAVE_ARCH_STRSPN
-extern inline size_t strspn(const char * cs, const char * ct)
-{
-register char * __res;
-__asm__ __volatile__(
- "cld\n\t"
- "movl %4,%%edi\n\t"
- "repne\n\t"
- "scasb\n\t"
- "notl %%ecx\n\t"
- "decl %%ecx\n\t"
- "movl %%ecx,%%edx\n"
- "1:\tlodsb\n\t"
- "testb %%al,%%al\n\t"
- "je 2f\n\t"
- "movl %4,%%edi\n\t"
- "movl %%edx,%%ecx\n\t"
- "repne\n\t"
- "scasb\n\t"
- "je 1b\n"
- "2:\tdecl %0"
- :"=S" (__res):"a" (0),"c" (0xffffffff),"0" (cs),"g" (ct)
- :"ax","cx","dx","di");
-return __res-cs;
-}
-
-#define __HAVE_ARCH_STRCSPN
-extern inline size_t strcspn(const char * cs, const char * ct)
-{
-register char * __res;
-__asm__ __volatile__(
- "cld\n\t"
- "movl %4,%%edi\n\t"
- "repne\n\t"
- "scasb\n\t"
- "notl %%ecx\n\t"
- "decl %%ecx\n\t"
- "movl %%ecx,%%edx\n"
- "1:\tlodsb\n\t"
- "testb %%al,%%al\n\t"
- "je 2f\n\t"
- "movl %4,%%edi\n\t"
- "movl %%edx,%%ecx\n\t"
- "repne\n\t"
- "scasb\n\t"
- "jne 1b\n"
- "2:\tdecl %0"
- :"=S" (__res):"a" (0),"c" (0xffffffff),"0" (cs),"g" (ct)
- :"ax","cx","dx","di");
-return __res-cs;
-}
-
-#define __HAVE_ARCH_STRPBRK
-extern inline char * strpbrk(const char * cs,const char * ct)
-{
-register char * __res;
-__asm__ __volatile__(
- "cld\n\t"
- "movl %4,%%edi\n\t"
- "repne\n\t"
- "scasb\n\t"
- "notl %%ecx\n\t"
- "decl %%ecx\n\t"
- "movl %%ecx,%%edx\n"
- "1:\tlodsb\n\t"
- "testb %%al,%%al\n\t"
- "je 2f\n\t"
- "movl %4,%%edi\n\t"
- "movl %%edx,%%ecx\n\t"
- "repne\n\t"
- "scasb\n\t"
- "jne 1b\n\t"
- "decl %0\n\t"
- "jmp 3f\n"
- "2:\txorl %0,%0\n"
- "3:"
- :"=S" (__res):"a" (0),"c" (0xffffffff),"0" (cs),"g" (ct)
- :"ax","cx","dx","di");
-return __res;
-}
-
-#define __HAVE_ARCH_STRSTR
-extern inline char * strstr(const char * cs,const char * ct)
-{
-register char * __res;
-__asm__ __volatile__(
- "cld\n\t" \
- "movl %4,%%edi\n\t"
- "repne\n\t"
- "scasb\n\t"
- "notl %%ecx\n\t"
- "decl %%ecx\n\t" /* NOTE! This also sets Z if searchstring='' */
- "movl %%ecx,%%edx\n"
- "1:\tmovl %4,%%edi\n\t"
- "movl %%esi,%%eax\n\t"
- "movl %%edx,%%ecx\n\t"
- "repe\n\t"
- "cmpsb\n\t"
- "je 2f\n\t" /* also works for empty string, see above */
- "xchgl %%eax,%%esi\n\t"
- "incl %%esi\n\t"
- "cmpb $0,-1(%%eax)\n\t"
- "jne 1b\n\t"
- "xorl %%eax,%%eax\n\t"
- "2:"
- :"=a" (__res):"0" (0),"c" (0xffffffff),"S" (cs),"g" (ct)
- :"cx","dx","di","si");
-return __res;
-}
-
-#define __HAVE_ARCH_STRLEN
-extern inline size_t strlen(const char * s)
-{
-/*
- * slightly slower on a 486, but with better chances of
- * register allocation
- */
-register char dummy, *tmp= (char *)s;
-__asm__ __volatile__(
- "\n1:\t"
- "movb\t(%0),%1\n\t"
- "incl\t%0\n\t"
- "testb\t%1,%1\n\t"
- "jne\t1b"
- :"=r" (tmp),"=q" (dummy)
- :"0" (s)
- : "memory" );
-return (tmp-s-1);
-}
-
-/* Added by Gertjan van Wingerde to make minix and sysv module work */
-#define __HAVE_ARCH_STRNLEN
-extern inline size_t strnlen(const char * s, size_t count)
-{
-register int __res;
-__asm__ __volatile__(
- "movl %1,%0\n\t"
- "jmp 2f\n"
- "1:\tcmpb $0,(%0)\n\t"
- "je 3f\n\t"
- "incl %0\n"
- "2:\tdecl %2\n\t"
- "cmpl $-1,%2\n\t"
- "jne 1b\n"
- "3:\tsubl %1,%0"
- :"=a" (__res)
- :"c" (s),"d" (count)
- :"dx");
-return __res;
-}
-/* end of additional stuff */
-
-#define __HAVE_ARCH_STRTOK
-extern inline char * strtok(char * s,const char * ct)
-{
-register char * __res;
-__asm__ __volatile__(
- "testl %1,%1\n\t"
- "jne 1f\n\t"
- "testl %0,%0\n\t"
- "je 8f\n\t"
- "movl %0,%1\n"
- "1:\txorl %0,%0\n\t"
- "movl $-1,%%ecx\n\t"
- "xorl %%eax,%%eax\n\t"
- "cld\n\t"
- "movl %4,%%edi\n\t"
- "repne\n\t"
- "scasb\n\t"
- "notl %%ecx\n\t"
- "decl %%ecx\n\t"
- "je 7f\n\t" /* empty delimiter-string */
- "movl %%ecx,%%edx\n"
- "2:\tlodsb\n\t"
- "testb %%al,%%al\n\t"
- "je 7f\n\t"
- "movl %4,%%edi\n\t"
- "movl %%edx,%%ecx\n\t"
- "repne\n\t"
- "scasb\n\t"
- "je 2b\n\t"
- "decl %1\n\t"
- "cmpb $0,(%1)\n\t"
- "je 7f\n\t"
- "movl %1,%0\n"
- "3:\tlodsb\n\t"
- "testb %%al,%%al\n\t"
- "je 5f\n\t"
- "movl %4,%%edi\n\t"
- "movl %%edx,%%ecx\n\t"
- "repne\n\t"
- "scasb\n\t"
- "jne 3b\n\t"
- "decl %1\n\t"
- "cmpb $0,(%1)\n\t"
- "je 5f\n\t"
- "movb $0,(%1)\n\t"
- "incl %1\n\t"
- "jmp 6f\n"
- "5:\txorl %1,%1\n"
- "6:\tcmpb $0,(%0)\n\t"
- "jne 7f\n\t"
- "xorl %0,%0\n"
- "7:\ttestl %0,%0\n\t"
- "jne 8f\n\t"
- "movl %0,%1\n"
- "8:"
- :"=b" (__res),"=S" (___strtok)
- :"0" (___strtok),"1" (s),"g" (ct)
- :"ax","cx","dx","di","memory");
-return __res;
-}
-
-#define __memcpy_c(d,s,count) \
-((count%4==0) ? \
- __memcpy_by4((d),(s),(count)) : \
- ((count%2==0) ? \
- __memcpy_by2((d),(s),(count)) : \
- __memcpy_g((d),(s),(count))))
-
-#define __HAVE_ARCH_MEMCPY
-#define memcpy(d,s,count) \
-(count == 0 \
- ? d \
- : __builtin_constant_p(count) \
- ? __memcpy_c((d),(s),(count)) \
- : __memcpy_g((d),(s),(count)))
-
-/*
- * These ought to get tweaked to do some cache priming.
- */
-
-extern inline void * __memcpy_by4(void * to, const void * from, size_t n)
-{
-register void *tmp = (void *)to;
-register int dummy1,dummy2;
-__asm__ __volatile__ (
- "\n1:\tmovl (%2),%0\n\t"
- "addl $4,%2\n\t"
- "movl %0,(%1)\n\t"
- "addl $4,%1\n\t"
- "decl %3\n\t"
- "jnz 1b"
- :"=r" (dummy1), "=r" (tmp), "=r" (from), "=r" (dummy2)
- :"1" (tmp), "2" (from), "3" (n/4)
- :"memory");
-return to;
-}
-
-extern inline void * __memcpy_by2(void * to, const void * from, size_t n)
-{
-register void *tmp = (void *)to;
-register int dummy1,dummy2;
-__asm__ __volatile__ (
- "shrl $1,%3\n\t"
- "jz 2f\n" /* only a word */
- "1:\tmovl (%2),%0\n\t"
- "addl $4,%2\n\t"
- "movl %0,(%1)\n\t"
- "addl $4,%1\n\t"
- "decl %3\n\t"
- "jnz 1b\n"
- "2:\tmovw (%2),%w0\n\t"
- "movw %w0,(%1)"
- :"=r" (dummy1), "=r" (tmp), "=r" (from), "=r" (dummy2)
- :"1" (tmp), "2" (from), "3" (n/2)
- :"memory");
-return to;
-}
-
-extern inline void * __memcpy_g(void * to, const void * from, size_t n)
-{
-register void *tmp = (void *)to;
-__asm__ __volatile__ (
- "cld\n\t"
- "shrl $1,%%ecx\n\t"
- "jnc 1f\n\t"
- "movsb\n"
- "1:\tshrl $1,%%ecx\n\t"
- "jnc 2f\n\t"
- "movsw\n"
- "2:\trep\n\t"
- "movsl"
- : /* no output */
- :"c" (n),"D" ((long) tmp),"S" ((long) from)
- :"cx","di","si","memory");
-return to;
-}
-
-
-#define __HAVE_ARCH_MEMMOVE
-extern inline void * memmove(void * dest,const void * src, size_t n)
-{
-register void *tmp = (void *)dest;
-if (dest<src)
-__asm__ __volatile__ (
- "cld\n\t"
- "rep\n\t"
- "movsb"
- : /* no output */
- :"c" (n),"S" (src),"D" (tmp)
- :"cx","si","di");
-else
-__asm__ __volatile__ (
- "std\n\t"
- "rep\n\t"
- "movsb\n\t"
- "cld\n\t"
- : /* no output */
- :"c" (n), "S" (n-1+(const char *)src), "D" (n-1+(char *)tmp)
- :"cx","si","di","memory");
-return dest;
-}
-
-extern inline int memcmp(const void * cs,const void * ct,size_t count)
-{
-register int __res;
-__asm__ __volatile__(
- "cld\n\t"
- "repe\n\t"
- "cmpsb\n\t"
- "je 1f\n\t"
- "sbbl %0,%0\n\t"
- "orb $1,%b0\n"
- "1:"
- :"=abd" (__res):"0" (0),"S" (cs),"D" (ct),"c" (count)
- :"si","di","cx");
-return __res;
-}
-
-#define __HAVE_ARCH_MEMCHR
-extern inline void * memchr(const void * cs,int c,size_t count)
-{
-register void * __res;
-if (!count)
- return NULL;
-__asm__ __volatile__(
- "cld\n\t"
- "repne\n\t"
- "scasb\n\t"
- "je 1f\n\t"
- "movl $1,%0\n"
- "1:\tdecl %0"
- :"=D" (__res):"a" (c),"D" (cs),"c" (count)
- :"cx");
-return __res;
-}
-
-#define __memset_cc(s,c,count) \
-((count%4==0) ? \
- __memset_cc_by4((s),(c),(count)) : \
- ((count%2==0) ? \
- __memset_cc_by2((s),(c),(count)) : \
- __memset_cg((s),(c),(count))))
-
-#define __memset_gc(s,c,count) \
-((count%4==0) ? \
- __memset_gc_by4((s),(c),(count)) : \
- ((count%2==0) ? \
- __memset_gc_by2((s),(c),(count)) : \
- __memset_gg((s),(c),(count))))
-
-#define __HAVE_ARCH_MEMSET
-#define memset(s,c,count) \
-(count == 0 \
- ? s \
- : __builtin_constant_p(c) \
- ? __builtin_constant_p(count) \
- ? __memset_cc((s),(c),(count)) \
- : __memset_cg((s),(c),(count)) \
- : __builtin_constant_p(count) \
- ? __memset_gc((s),(c),(count)) \
- : __memset_gg((s),(c),(count)))
-
-extern inline void * __memset_cc_by4(void * s, char c, size_t count)
-{
-/*
- * register char *tmp = s;
- */
-register char *tmp = (char *)s;
-register int dummy;
-__asm__ __volatile__ (
- "\n1:\tmovl %2,(%0)\n\t"
- "addl $4,%0\n\t"
- "decl %1\n\t"
- "jnz 1b"
- :"=r" (tmp), "=r" (dummy)
- :"r" (0x01010101UL * (unsigned char) c), "0" (tmp), "1" (count/4)
- :"memory");
-return s;
-}
-
-extern inline void * __memset_cc_by2(void * s, char c, size_t count)
-{
-register void *tmp = (void *)s;
-register int dummy;
-__asm__ __volatile__ (
- "shrl $1,%1\n\t" /* may be divisible also by 4 */
- "jz 2f\n"
- "\n1:\tmovl %2,(%0)\n\t"
- "addl $4,%0\n\t"
- "decl %1\n\t"
- "jnz 1b\n"
- "2:\tmovw %w2,(%0)"
- :"=r" (tmp), "=r" (dummy)
- :"r" (0x01010101UL * (unsigned char) c), "0" (tmp), "1" (count/2)
- :"memory");
-return s;
-}
-
-extern inline void * __memset_gc_by4(void * s, char c, size_t count)
-{
-register void *tmp = (void *)s;
-register int dummy;
-__asm__ __volatile__ (
- "movb %b0,%h0\n"
- "pushw %w0\n\t"
- "shll $16,%k0\n\t"
- "popw %w0\n"
- "1:\tmovl %k0,(%1)\n\t"
- "addl $4,%1\n\t"
- "decl %2\n\t"
- "jnz 1b\n"
- :"=q" (c), "=r" (tmp), "=r" (dummy)
- :"0" ((unsigned) c), "1" (tmp), "2" (count/4)
- :"memory");
-return s;
-}
-
-extern inline void * __memset_gc_by2(void * s, char c, size_t count)
-{
-register void *tmp = (void *)s;
-register int dummy1,dummy2;
-__asm__ __volatile__ (
- "movb %b0,%h0\n\t"
- "shrl $1,%2\n\t" /* may be divisible also by 4 */
- "jz 2f\n\t"
- "pushw %w0\n\t"
- "shll $16,%k0\n\t"
- "popw %w0\n"
- "1:\tmovl %k0,(%1)\n\t"
- "addl $4,%1\n\t"
- "decl %2\n\t"
- "jnz 1b\n"
- "2:\tmovw %w0,(%1)"
- :"=q" (dummy1), "=r" (tmp), "=r" (dummy2)
- :"0" ((unsigned) c), "1" (tmp), "2" (count/2)
- :"memory");
-return s;
-}
-
-extern inline void * __memset_cg(void * s, char c, size_t count)
-{
-register void *tmp = (void *)s;
-__asm__ __volatile__ (
- "shrl $1,%%ecx\n\t"
- "cld\n\t"
- "rep\n\t"
- "stosw\n\t"
- "jnc 1f\n\t"
- "movb %%al,(%%edi)\n"
- "1:"
- : /* no output */
- :"c" (count),"D" (tmp), "a" (0x0101U * (unsigned char) c)
- :"cx","di","memory");
-return s;
-}
-
-extern inline void * __memset_gg(void * s,char c,size_t count)
-{
-register void *tmp = (void *)s;
-__asm__ __volatile__ (
- "movb %%al,%%ah\n\t"
- "shrl $1,%%ecx\n\t"
- "cld\n\t"
- "rep\n\t"
- "stosw\n\t"
- "jnc 1f\n\t"
- "movb %%al,(%%edi)\n"
- "1:"
- : /* no output */
- :"c" (count),"D" (tmp), "a" (c)
- :"cx","di","memory");
-return s;
-}
-
-
-/*
- * find the first occurrence of byte 'c', or 1 past the area if none
- */
-#define __HAVE_ARCH_MEMSCAN
-extern inline void * memscan(void * addr, int c, size_t size)
-{
- if (!size)
- return addr;
- __asm__("cld
- repnz; scasb
- jnz 1f
- dec %%edi
-1: "
- : "=D" (addr), "=c" (size)
- : "0" (addr), "1" (size), "a" (c));
- return addr;
-}
-
-#endif
diff --git a/linux/src/include/linux/compiler-gcc.h b/linux/src/include/linux/compiler-gcc.h
new file mode 100644
index 00000000..59e4028e
--- /dev/null
+++ b/linux/src/include/linux/compiler-gcc.h
@@ -0,0 +1,106 @@
+#ifndef __LINUX_COMPILER_H
+#error "Please don't include <linux/compiler-gcc.h> directly, include <linux/compiler.h> instead."
+#endif
+
+/*
+ * Common definitions for all gcc versions go here.
+ */
+
+
+/* Optimization barrier */
+/* The "volatile" is due to gcc bugs */
+#define barrier() __asm__ __volatile__("": : :"memory")
+
+/*
+ * This macro obfuscates arithmetic on a variable address so that gcc
+ * shouldn't recognize the original var, and make assumptions about it.
+ *
+ * This is needed because the C standard makes it undefined to do
+ * pointer arithmetic on "objects" outside their boundaries and the
+ * gcc optimizers assume this is the case. In particular they
+ * assume such arithmetic does not wrap.
+ *
+ * A miscompilation has been observed because of this on PPC.
+ * To work around it we hide the relationship of the pointer and the object
+ * using this macro.
+ *
+ * Versions of the ppc64 compiler before 4.1 had a bug where use of
+ * RELOC_HIDE could trash r30. The bug can be worked around by changing
+ * the inline assembly constraint from =g to =r, in this particular
+ * case either is valid.
+ */
+#define RELOC_HIDE(ptr, off) \
+ ({ unsigned long __ptr; \
+ __asm__ ("" : "=r"(__ptr) : "0"(ptr)); \
+ (typeof(ptr)) (__ptr + (off)); })
+
+#ifdef __CHECKER__
+#define __must_be_array(arr) 0
+#else
+/* &a[0] degrades to a pointer: a different type from an array */
+#define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))
+#endif
+
+/*
+ * Force always-inline if the user requests it so via the .config,
+ * or if gcc is too old:
+ */
+#if !defined(CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING) || \
+ !defined(CONFIG_OPTIMIZE_INLINING) || (__GNUC__ < 4)
+# define inline inline __attribute__((always_inline))
+# define __inline__ __inline__ __attribute__((always_inline))
+# define __inline __inline __attribute__((always_inline))
+#endif
+
+#define __deprecated __attribute__((deprecated))
+#define __packed __attribute__((packed))
+#define __weak __attribute__((weak))
+
+/*
+ * it doesn't make sense on ARM (currently the only user of __naked) to trace
+ * naked functions because then mcount is called without stack and frame pointer
+ * being set up and there is no chance to restore the lr register to the value
+ * before mcount was called.
+ *
+ * The asm() bodies of naked functions often depend on standard calling conventions,
+ * therefore they must be noinline and noclone. GCC 4.[56] currently fail to enforce
+ * this, so we must do so ourselves. See GCC PR44290.
+ */
+#define __naked __attribute__((naked)) noinline __noclone notrace
+
+#define __noreturn __attribute__((noreturn))
+
+/*
+ * From the GCC manual:
+ *
+ * Many functions have no effects except the return value and their
+ * return value depends only on the parameters and/or global
+ * variables. Such a function can be subject to common subexpression
+ * elimination and loop optimization just as an arithmetic operator
+ * would be.
+ * [...]
+ */
+#define __pure __attribute__((pure))
+#define __aligned(x) __attribute__((aligned(x)))
+#define __printf(a,b) __attribute__((format(printf,a,b)))
+#define noinline __attribute__((noinline))
+#define __attribute_const__ __attribute__((__const__))
+#define __maybe_unused __attribute__((unused))
+#define __always_unused __attribute__((unused))
+
+#define __gcc_header(x) #x
+#define _gcc_header(x) __gcc_header(linux/compiler-gcc##x.h)
+#define gcc_header(x) _gcc_header(x)
+#include gcc_header(__GNUC__)
+
+#if !defined(__noclone)
+#define __noclone /* not needed */
+#endif
+
+/*
+ * A trick to suppress uninitialized variable warning without generating any
+ * code
+ */
+#define uninitialized_var(x) x = x
+
+#define __always_inline inline __attribute__((always_inline))
diff --git a/linux/src/include/linux/compiler-gcc3.h b/linux/src/include/linux/compiler-gcc3.h
new file mode 100644
index 00000000..37d41243
--- /dev/null
+++ b/linux/src/include/linux/compiler-gcc3.h
@@ -0,0 +1,23 @@
+#ifndef __LINUX_COMPILER_H
+#error "Please don't include <linux/compiler-gcc3.h> directly, include <linux/compiler.h> instead."
+#endif
+
+#if __GNUC_MINOR__ < 2
+# error Sorry, your compiler is too old - please upgrade it.
+#endif
+
+#if __GNUC_MINOR__ >= 3
+# define __used __attribute__((__used__))
+#else
+# define __used __attribute__((__unused__))
+#endif
+
+#if __GNUC_MINOR__ >= 4
+#define __must_check __attribute__((warn_unused_result))
+#endif
+
+#ifdef CONFIG_GCOV_KERNEL
+# if __GNUC_MINOR__ < 4
+# error "GCOV profiling support for gcc versions below 3.4 not included"
+# endif /* __GNUC_MINOR__ */
+#endif /* CONFIG_GCOV_KERNEL */
diff --git a/linux/src/include/linux/compiler-gcc4.h b/linux/src/include/linux/compiler-gcc4.h
new file mode 100644
index 00000000..dfadc96e
--- /dev/null
+++ b/linux/src/include/linux/compiler-gcc4.h
@@ -0,0 +1,57 @@
+#ifndef __LINUX_COMPILER_H
+#error "Please don't include <linux/compiler-gcc4.h> directly, include <linux/compiler.h> instead."
+#endif
+
+/* GCC 4.1.[01] miscompiles __weak */
+#ifdef __KERNEL__
+# if __GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL__ <= 1
+# error Your version of gcc miscompiles the __weak directive
+# endif
+#endif
+
+#define __used __attribute__((__used__))
+#define __must_check __attribute__((warn_unused_result))
+#define __compiler_offsetof(a,b) __builtin_offsetof(a,b)
+
+#if __GNUC_MINOR__ >= 3
+/* Mark functions as cold. gcc will assume any path leading to a call
+ to them will be unlikely. This means a lot of manual unlikely()s
+ are unnecessary now for any paths leading to the usual suspects
+ like BUG(), printk(), panic() etc. [but let's keep them for now for
+ older compilers]
+
+ Early snapshots of gcc 4.3 don't support this and we can't detect this
+ in the preprocessor, but we can live with this because they're unreleased.
+ Maketime probing would be overkill here.
+
+ gcc also has a __attribute__((__hot__)) to move hot functions into
+ a special section, but I don't see any sense in this right now in
+ the kernel context */
+#define __cold __attribute__((__cold__))
+
+
+#if __GNUC_MINOR__ >= 5
+/*
+ * Mark a position in code as unreachable. This can be used to
+ * suppress control flow warnings after asm blocks that transfer
+ * control elsewhere.
+ *
+ * Early snapshots of gcc 4.5 don't support this and we can't detect
+ * this in the preprocessor, but we can live with this because they're
+ * unreleased. Really, we need to have autoconf for the kernel.
+ */
+#define unreachable() __builtin_unreachable()
+
+/* Mark a function definition as prohibited from being cloned. */
+#define __noclone __attribute__((__noclone__))
+
+#endif
+#endif
+
+#if __GNUC_MINOR__ > 0
+#define __compiletime_object_size(obj) __builtin_object_size(obj, 0)
+#endif
+#if __GNUC_MINOR__ >= 4 && !defined(__CHECKER__)
+#define __compiletime_warning(message) __attribute__((warning(message)))
+#define __compiletime_error(message) __attribute__((error(message)))
+#endif
diff --git a/linux/src/include/linux/compiler.h b/linux/src/include/linux/compiler.h
new file mode 100644
index 00000000..320d6c94
--- /dev/null
+++ b/linux/src/include/linux/compiler.h
@@ -0,0 +1,311 @@
+#ifndef __LINUX_COMPILER_H
+#define __LINUX_COMPILER_H
+
+#ifndef __ASSEMBLY__
+
+#ifdef __CHECKER__
+# define __user __attribute__((noderef, address_space(1)))
+# define __kernel __attribute__((address_space(0)))
+# define __safe __attribute__((safe))
+# define __force __attribute__((force))
+# define __nocast __attribute__((nocast))
+# define __iomem __attribute__((noderef, address_space(2)))
+# define __acquires(x) __attribute__((context(x,0,1)))
+# define __releases(x) __attribute__((context(x,1,0)))
+# define __acquire(x) __context__(x,1)
+# define __release(x) __context__(x,-1)
+# define __cond_lock(x,c) ((c) ? ({ __acquire(x); 1; }) : 0)
+# define __percpu __attribute__((noderef, address_space(3)))
+#ifdef CONFIG_SPARSE_RCU_POINTER
+# define __rcu __attribute__((noderef, address_space(4)))
+#else
+# define __rcu
+#endif
+extern void __chk_user_ptr(const volatile void __user *);
+extern void __chk_io_ptr(const volatile void __iomem *);
+#else
+# define __user
+# define __kernel
+# define __safe
+# define __force
+# define __nocast
+# define __iomem
+# define __chk_user_ptr(x) (void)0
+# define __chk_io_ptr(x) (void)0
+# define __builtin_warning(x, y...) (1)
+# define __acquires(x)
+# define __releases(x)
+# define __acquire(x) (void)0
+# define __release(x) (void)0
+# define __cond_lock(x,c) (c)
+# define __percpu
+# define __rcu
+#endif
+
+#ifdef __KERNEL__
+
+#ifdef __GNUC__
+#include <linux/compiler-gcc.h>
+#endif
+
+#define notrace __attribute__((no_instrument_function))
+
+/* Intel compiler defines __GNUC__. So we will overwrite implementations
+ * coming from above header files here
+ */
+#ifdef __INTEL_COMPILER
+# include <linux/compiler-intel.h>
+#endif
+
+/*
+ * Generic compiler-dependent macros required for kernel
+ * build go below this comment. Actual compiler/compiler version
+ * specific implementations come from the above header files
+ */
+
+struct ftrace_branch_data {
+ const char *func;
+ const char *file;
+ unsigned line;
+ union {
+ struct {
+ unsigned long correct;
+ unsigned long incorrect;
+ };
+ struct {
+ unsigned long miss;
+ unsigned long hit;
+ };
+ unsigned long miss_hit[2];
+ };
+};
+
+/*
+ * Note: DISABLE_BRANCH_PROFILING can be used by special lowlevel code
+ * to disable branch tracing on a per file basis.
+ */
+#if defined(CONFIG_TRACE_BRANCH_PROFILING) \
+ && !defined(DISABLE_BRANCH_PROFILING) && !defined(__CHECKER__)
+void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect);
+
+#define likely_notrace(x) __builtin_expect(!!(x), 1)
+#define unlikely_notrace(x) __builtin_expect(!!(x), 0)
+
+#define __branch_check__(x, expect) ({ \
+ int ______r; \
+ static struct ftrace_branch_data \
+ __attribute__((__aligned__(4))) \
+ __attribute__((section("_ftrace_annotated_branch"))) \
+ ______f = { \
+ .func = __func__, \
+ .file = __FILE__, \
+ .line = __LINE__, \
+ }; \
+ ______r = likely_notrace(x); \
+ ftrace_likely_update(&______f, ______r, expect); \
+ ______r; \
+ })
+
+/*
+ * Using __builtin_constant_p(x) to ignore cases where the return
+ * value is always the same. This idea is taken from a similar patch
+ * written by Daniel Walker.
+ */
+# ifndef likely
+# define likely(x) (__builtin_constant_p(x) ? !!(x) : __branch_check__(x, 1))
+# endif
+# ifndef unlikely
+# define unlikely(x) (__builtin_constant_p(x) ? !!(x) : __branch_check__(x, 0))
+# endif
+
+#ifdef CONFIG_PROFILE_ALL_BRANCHES
+/*
+ * "Define 'is'", Bill Clinton
+ * "Define 'if'", Steven Rostedt
+ */
+#define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
+#define __trace_if(cond) \
+ if (__builtin_constant_p((cond)) ? !!(cond) : \
+ ({ \
+ int ______r; \
+ static struct ftrace_branch_data \
+ __attribute__((__aligned__(4))) \
+ __attribute__((section("_ftrace_branch"))) \
+ ______f = { \
+ .func = __func__, \
+ .file = __FILE__, \
+ .line = __LINE__, \
+ }; \
+ ______r = !!(cond); \
+ ______f.miss_hit[______r]++; \
+ ______r; \
+ }))
+#endif /* CONFIG_PROFILE_ALL_BRANCHES */
+
+#else
+# define likely(x) __builtin_expect(!!(x), 1)
+# define unlikely(x) __builtin_expect(!!(x), 0)
+#endif
+
+/* Optimization barrier */
+#ifndef barrier
+# define barrier() __memory_barrier()
+#endif
+
+/* Unreachable code */
+#ifndef unreachable
+# define unreachable() do { } while (1)
+#endif
+
+#ifndef RELOC_HIDE
+# define RELOC_HIDE(ptr, off) \
+ ({ unsigned long __ptr; \
+ __ptr = (unsigned long) (ptr); \
+ (typeof(ptr)) (__ptr + (off)); })
+#endif
+
+#endif /* __KERNEL__ */
+
+#endif /* __ASSEMBLY__ */
+
+#ifdef __KERNEL__
+/*
+ * Allow us to mark functions as 'deprecated' and have gcc emit a nice
+ * warning for each use, in hopes of speeding the functions removal.
+ * Usage is:
+ * int __deprecated foo(void)
+ */
+#ifndef __deprecated
+# define __deprecated /* unimplemented */
+#endif
+
+#ifdef MODULE
+#define __deprecated_for_modules __deprecated
+#else
+#define __deprecated_for_modules
+#endif
+
+#ifndef __must_check
+#define __must_check
+#endif
+
+#ifndef CONFIG_ENABLE_MUST_CHECK
+#undef __must_check
+#define __must_check
+#endif
+#ifndef CONFIG_ENABLE_WARN_DEPRECATED
+#undef __deprecated
+#undef __deprecated_for_modules
+#define __deprecated
+#define __deprecated_for_modules
+#endif
+
+/*
+ * Allow us to avoid 'defined but not used' warnings on functions and data,
+ * as well as force them to be emitted to the assembly file.
+ *
+ * As of gcc 3.4, static functions that are not marked with attribute((used))
+ * may be elided from the assembly file. As of gcc 3.4, static data not so
+ * marked will not be elided, but this may change in a future gcc version.
+ *
+ * NOTE: Because distributions shipped with a backported unit-at-a-time
+ * compiler in gcc 3.3, we must define __used to be __attribute__((used))
+ * for gcc >=3.3 instead of 3.4.
+ *
+ * In prior versions of gcc, such functions and data would be emitted, but
+ * would be warned about except with attribute((unused)).
+ *
+ * Mark functions that are referenced only in inline assembly as __used so
+ * the code is emitted even though it appears to be unreferenced.
+ */
+#ifndef __used
+# define __used /* unimplemented */
+#endif
+
+#ifndef __maybe_unused
+# define __maybe_unused /* unimplemented */
+#endif
+
+#ifndef __always_unused
+# define __always_unused /* unimplemented */
+#endif
+
+#ifndef noinline
+#define noinline
+#endif
+
+/*
+ * Rather then using noinline to prevent stack consumption, use
+ * noinline_for_stack instead. For documentaiton reasons.
+ */
+#define noinline_for_stack noinline
+
+#ifndef __always_inline
+#define __always_inline inline
+#endif
+
+#endif /* __KERNEL__ */
+
+/*
+ * From the GCC manual:
+ *
+ * Many functions do not examine any values except their arguments,
+ * and have no effects except the return value. Basically this is
+ * just slightly more strict class than the `pure' attribute above,
+ * since function is not allowed to read global memory.
+ *
+ * Note that a function that has pointer arguments and examines the
+ * data pointed to must _not_ be declared `const'. Likewise, a
+ * function that calls a non-`const' function usually must not be
+ * `const'. It does not make sense for a `const' function to return
+ * `void'.
+ */
+#ifndef __attribute_const__
+# define __attribute_const__ /* unimplemented */
+#endif
+
+/*
+ * Tell gcc if a function is cold. The compiler will assume any path
+ * directly leading to the call is unlikely.
+ */
+
+#ifndef __cold
+#define __cold
+#endif
+
+/* Simple shorthand for a section definition */
+#ifndef __section
+# define __section(S) __attribute__ ((__section__(#S)))
+#endif
+
+/* Are two types/vars the same type (ignoring qualifiers)? */
+#ifndef __same_type
+# define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b))
+#endif
+
+/* Compile time object size, -1 for unknown */
+#ifndef __compiletime_object_size
+# define __compiletime_object_size(obj) -1
+#endif
+#ifndef __compiletime_warning
+# define __compiletime_warning(message)
+#endif
+#ifndef __compiletime_error
+# define __compiletime_error(message)
+#endif
+
+/*
+ * Prevent the compiler from merging or refetching accesses. The compiler
+ * is also forbidden from reordering successive instances of ACCESS_ONCE(),
+ * but only when the compiler is aware of some particular ordering. One way
+ * to make the compiler aware of ordering is to put the two invocations of
+ * ACCESS_ONCE() in different C statements.
+ *
+ * This macro does absolutely -nothing- to prevent the CPU from reordering,
+ * merging, or refetching absolutely anything at any time. Its main intended
+ * use is to mediate communication between process-level code and irq/NMI
+ * handlers, all running on the same CPU.
+ */
+#define ACCESS_ONCE(x) (*(volatile typeof(x) *)&(x))
+
+#endif /* __LINUX_COMPILER_H */
diff --git a/linux/src/include/linux/ctype.h b/linux/src/include/linux/ctype.h
index 838ef933..8acfe312 100644
--- a/linux/src/include/linux/ctype.h
+++ b/linux/src/include/linux/ctype.h
@@ -1,6 +1,11 @@
#ifndef _LINUX_CTYPE_H
#define _LINUX_CTYPE_H
+/*
+ * NOTE! This ctype does not handle EOF like the standard C
+ * library is required to.
+ */
+
#define _U 0x01 /* upper */
#define _L 0x02 /* lower */
#define _D 0x04 /* digit */
@@ -10,25 +15,50 @@
#define _X 0x40 /* hex digit */
#define _SP 0x80 /* hard space (0x20) */
-extern unsigned char _ctype[];
-extern char _ctmp;
-
-#define isalnum(c) ((_ctype+1)[c]&(_U|_L|_D))
-#define isalpha(c) ((_ctype+1)[c]&(_U|_L))
-#define iscntrl(c) ((_ctype+1)[c]&(_C))
-#define isdigit(c) ((_ctype+1)[c]&(_D))
-#define isgraph(c) ((_ctype+1)[c]&(_P|_U|_L|_D))
-#define islower(c) ((_ctype+1)[c]&(_L))
-#define isprint(c) ((_ctype+1)[c]&(_P|_U|_L|_D|_SP))
-#define ispunct(c) ((_ctype+1)[c]&(_P))
-#define isspace(c) ((_ctype+1)[c]&(_S))
-#define isupper(c) ((_ctype+1)[c]&(_U))
-#define isxdigit(c) ((_ctype+1)[c]&(_D|_X))
-
-#define isascii(c) (((unsigned) c)<=0x7f)
-#define toascii(c) (((unsigned) c)&0x7f)
-
-#define tolower(c) (_ctmp=c,isupper(_ctmp)?_ctmp-('A'-'a'):_ctmp)
-#define toupper(c) (_ctmp=c,islower(_ctmp)?_ctmp-('a'-'A'):_ctmp)
+extern const unsigned char _ctype[];
+
+#define __ismask(x) (_ctype[(int)(unsigned char)(x)])
+
+#define isalnum(c) ((__ismask(c)&(_U|_L|_D)) != 0)
+#define isalpha(c) ((__ismask(c)&(_U|_L)) != 0)
+#define iscntrl(c) ((__ismask(c)&(_C)) != 0)
+#define isdigit(c) ((__ismask(c)&(_D)) != 0)
+#define isgraph(c) ((__ismask(c)&(_P|_U|_L|_D)) != 0)
+#define islower(c) ((__ismask(c)&(_L)) != 0)
+#define isprint(c) ((__ismask(c)&(_P|_U|_L|_D|_SP)) != 0)
+#define ispunct(c) ((__ismask(c)&(_P)) != 0)
+/* Note: isspace() must return false for %NUL-terminator */
+#define isspace(c) ((__ismask(c)&(_S)) != 0)
+#define isupper(c) ((__ismask(c)&(_U)) != 0)
+#define isxdigit(c) ((__ismask(c)&(_D|_X)) != 0)
+
+#define isascii(c) (((unsigned char)(c))<=0x7f)
+#define toascii(c) (((unsigned char)(c))&0x7f)
+
+static inline unsigned char __tolower(unsigned char c)
+{
+ if (isupper(c))
+ c -= 'A'-'a';
+ return c;
+}
+
+static inline unsigned char __toupper(unsigned char c)
+{
+ if (islower(c))
+ c -= 'a'-'A';
+ return c;
+}
+
+#define tolower(c) __tolower(c)
+#define toupper(c) __toupper(c)
+
+/*
+ * Fast implementation of tolower() for internal usage. Do not use in your
+ * code.
+ */
+static inline char _tolower(const char c)
+{
+ return c | 0x20;
+}
#endif
diff --git a/linux/pcmcia-cs/include/linux/init.h b/linux/src/include/linux/init.h
index 06da72d0..d4798b25 100644
--- a/linux/pcmcia-cs/include/linux/init.h
+++ b/linux/src/include/linux/init.h
@@ -1,9 +1,17 @@
#ifndef _COMPAT_INIT_H
#define _COMPAT_INIT_H
+#include <linux/compiler.h>
+
+#ifdef MODULE
+#define __exitused
+#else
+#define __exitused __used
+#endif
+
#define __init
#define __initdata
-#define __exit
+#define __exit __exitused __cold notrace
#define __exitdata
#define __devinit
#define __devinitdata
diff --git a/linux/src/include/linux/kcomp.h b/linux/src/include/linux/kcomp.h
index 1f7344a6..5e06d7e7 100644
--- a/linux/src/include/linux/kcomp.h
+++ b/linux/src/include/linux/kcomp.h
@@ -7,8 +7,6 @@
#include <linux/netdevice.h>
#include <linux/pagemap.h>
-#define __exit
-
#define pci_enable_device(x) 0
#define page_address(x) (x | PAGE_OFFSET)
diff --git a/linux/src/include/linux/module.h b/linux/src/include/linux/module.h
index bc364f79..acc25403 100644
--- a/linux/src/include/linux/module.h
+++ b/linux/src/include/linux/module.h
@@ -101,9 +101,12 @@ int Using_Versions; /* gcc will handle this global (used as a flag) correctly */
#else
+#define EXPORT_SYMBOL(sym)
+
#define MOD_INC_USE_COUNT do { } while (0)
#define MOD_DEC_USE_COUNT do { } while (0)
#define MOD_IN_USE 1
+#define SET_MODULE_OWNER(dev) do{ } while(0)
#endif
diff --git a/linux/src/init/main.c b/linux/src/init/main.c
index d41ec60c..1aa15b97 100644
--- a/linux/src/init/main.c
+++ b/linux/src/init/main.c
@@ -42,6 +42,8 @@
#include <asm/bugs.h>
+#include <linux/dev/glue/glue.h>
+
/*
* Versions of gcc older than that listed below may actually compile
* and link okay, but the end product can have subtle run time bugs.
@@ -64,7 +66,6 @@ extern int bdflush(void *);
extern int kswapd(void *);
extern void kswapd_setup(void);
-extern void init_IRQ(void);
extern void init_modules(void);
extern long console_init(long, long);
extern long kmalloc_init(long,long);
diff --git a/linux/src/lib/ctype.c b/linux/src/lib/ctype.c
index c5be2641..26baa620 100644
--- a/linux/src/lib/ctype.c
+++ b/linux/src/lib/ctype.c
@@ -5,32 +5,32 @@
*/
#include <linux/ctype.h>
+#include <linux/module.h>
-char _ctmp;
-unsigned char _ctype[] = {0x00, /* EOF */
-_C,_C,_C,_C,_C,_C,_C,_C, /* 0-7 */
-_C,_C|_S,_C|_S,_C|_S,_C|_S,_C|_S,_C,_C, /* 8-15 */
-_C,_C,_C,_C,_C,_C,_C,_C, /* 16-23 */
-_C,_C,_C,_C,_C,_C,_C,_C, /* 24-31 */
-_S|_SP,_P,_P,_P,_P,_P,_P,_P, /* 32-39 */
-_P,_P,_P,_P,_P,_P,_P,_P, /* 40-47 */
-_D,_D,_D,_D,_D,_D,_D,_D, /* 48-55 */
-_D,_D,_P,_P,_P,_P,_P,_P, /* 56-63 */
-_P,_U|_X,_U|_X,_U|_X,_U|_X,_U|_X,_U|_X,_U, /* 64-71 */
-_U,_U,_U,_U,_U,_U,_U,_U, /* 72-79 */
-_U,_U,_U,_U,_U,_U,_U,_U, /* 80-87 */
-_U,_U,_U,_P,_P,_P,_P,_P, /* 88-95 */
-_P,_L|_X,_L|_X,_L|_X,_L|_X,_L|_X,_L|_X,_L, /* 96-103 */
-_L,_L,_L,_L,_L,_L,_L,_L, /* 104-111 */
-_L,_L,_L,_L,_L,_L,_L,_L, /* 112-119 */
-_L,_L,_L,_P,_P,_P,_P,_C, /* 120-127 */
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 128-143 */
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 144-159 */
-_S|_SP,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P, /* 160-175 */
-_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P, /* 176-191 */
-_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U, /* 192-207 */
-_U,_U,_U,_U,_U,_U,_U,_P,_U,_U,_U,_U,_U,_U,_U,_L, /* 208-223 */
-_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L, /* 224-239 */
-_L,_L,_L,_L,_L,_L,_L,_P,_L,_L,_L,_L,_L,_L,_L,_L}; /* 240-255 */
-
+const unsigned char _ctype[] = {
+_C,_C,_C,_C,_C,_C,_C,_C, /* 0-7 */
+_C,_C|_S,_C|_S,_C|_S,_C|_S,_C|_S,_C,_C, /* 8-15 */
+_C,_C,_C,_C,_C,_C,_C,_C, /* 16-23 */
+_C,_C,_C,_C,_C,_C,_C,_C, /* 24-31 */
+_S|_SP,_P,_P,_P,_P,_P,_P,_P, /* 32-39 */
+_P,_P,_P,_P,_P,_P,_P,_P, /* 40-47 */
+_D,_D,_D,_D,_D,_D,_D,_D, /* 48-55 */
+_D,_D,_P,_P,_P,_P,_P,_P, /* 56-63 */
+_P,_U|_X,_U|_X,_U|_X,_U|_X,_U|_X,_U|_X,_U, /* 64-71 */
+_U,_U,_U,_U,_U,_U,_U,_U, /* 72-79 */
+_U,_U,_U,_U,_U,_U,_U,_U, /* 80-87 */
+_U,_U,_U,_P,_P,_P,_P,_P, /* 88-95 */
+_P,_L|_X,_L|_X,_L|_X,_L|_X,_L|_X,_L|_X,_L, /* 96-103 */
+_L,_L,_L,_L,_L,_L,_L,_L, /* 104-111 */
+_L,_L,_L,_L,_L,_L,_L,_L, /* 112-119 */
+_L,_L,_L,_P,_P,_P,_P,_C, /* 120-127 */
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 128-143 */
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 144-159 */
+_S|_SP,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P, /* 160-175 */
+_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P, /* 176-191 */
+_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U, /* 192-207 */
+_U,_U,_U,_U,_U,_U,_U,_P,_U,_U,_U,_U,_U,_U,_U,_L, /* 208-223 */
+_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L, /* 224-239 */
+_L,_L,_L,_L,_L,_L,_L,_P,_L,_L,_L,_L,_L,_L,_L,_L}; /* 240-255 */
+EXPORT_SYMBOL(_ctype);
diff --git a/vm/memory_object_proxy.c b/vm/memory_object_proxy.c
index 4d81a687..72042567 100644
--- a/vm/memory_object_proxy.c
+++ b/vm/memory_object_proxy.c
@@ -40,6 +40,7 @@
#include <mach/kern_return.h>
#include <mach/notify.h>
#include <mach/vm_prot.h>
+#include <kern/printf.h>
#include <kern/zalloc.h>
#include <kern/mach_param.h>
#include <ipc/ipc_port.h>
@@ -125,7 +126,6 @@ memory_object_create_proxy (ipc_space_t space, vm_prot_t max_protection,
vm_offset_t *len, natural_t len_count,
ipc_port_t *port)
{
- kern_return_t kr;
memory_object_proxy_t proxy;
ipc_port_t notify;
diff --git a/vm/vm_map.c b/vm/vm_map.c
index 751e0314..ce834032 100644
--- a/vm/vm_map.c
+++ b/vm/vm_map.c
@@ -4157,6 +4157,8 @@ vm_map_t vm_map_fork(old_map)
object->ref_count++;
vm_object_unlock(object);
+ new_entry = vm_map_entry_create(new_map);
+
if (old_entry->projected_on != 0) {
/*
* If entry is projected buffer, clone the
@@ -4171,7 +4173,6 @@ vm_map_t vm_map_fork(old_map)
* Mark both entries as shared.
*/
- new_entry = vm_map_entry_create(new_map);
vm_map_entry_copy(new_entry, old_entry);
old_entry->is_shared = TRUE;
new_entry->is_shared = TRUE;
diff --git a/xen/block.c b/xen/block.c
index 4718891d..10befcc6 100644
--- a/xen/block.c
+++ b/xen/block.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006-2009, 2011 Samuel Thibault <samuel.thibault@ens-lyon.org>
+ * Copyright (C) 2006-2009, 2011 Free Software Foundation
*
* This program is free software ; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/xen/block.h b/xen/block.h
index 5955968a..82488855 100644
--- a/xen/block.h
+++ b/xen/block.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Samuel Thibault <samuel.thibault@ens-lyon.org>
+ * Copyright (C) 2006-2009 Free Software Foundation
*
* This program is free software ; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/xen/console.c b/xen/console.c
index 9798ec0a..ed72d1ab 100644
--- a/xen/console.c
+++ b/xen/console.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Samuel Thibault <samuel.thibault@ens-lyon.org>
+ * Copyright (C) 2006-2011 Free Software Foundation
*
* This program is free software ; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -216,9 +216,6 @@ int hypcnclose(int dev, int flag)
int hypcnprobe(struct consdev *cp)
{
- struct xencons_interface *my_console;
- my_console = (void*) mfn_to_kv(boot_info.console_mfn);
-
cp->cn_dev = makedev(0, 0);
cp->cn_pri = CN_INTERNAL;
return 0;
diff --git a/xen/console.h b/xen/console.h
index fa13dc0f..ad171a47 100644
--- a/xen/console.h
+++ b/xen/console.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Samuel Thibault <samuel.thibault@ens-lyon.org>
+ * Copyright (C) 2006-2009, 2011 Free Software Foundation
*
* This program is free software ; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -21,6 +21,8 @@
#include <machine/xen.h>
#include <string.h>
+#include <device/cons.h>
+
#define hyp_console_write(str, len) hyp_console_io (CONSOLEIO_write, (len), kvtolin(str))
#define hyp_console_put(str) ({ \
@@ -30,4 +32,9 @@
extern void hyp_console_init(void);
+extern int hypcnputc(dev_t dev, int c);
+extern int hypcngetc(dev_t dev, int wait);
+extern int hypcnprobe(struct consdev *cp);
+extern int hypcninit(struct consdev *cp);
+
#endif /* XEN_CONSOLE_H */
diff --git a/xen/evt.c b/xen/evt.c
index 345e1d06..6346baa0 100644
--- a/xen/evt.c
+++ b/xen/evt.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2007 Samuel Thibault <samuel.thibault@ens-lyon.org>
+ * Copyright (C) 2007-2009 Free Software Foundation
*
* This program is free software ; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/xen/evt.h b/xen/evt.h
index a5839776..e4dbad1b 100644
--- a/xen/evt.h
+++ b/xen/evt.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Samuel Thibault <samuel.thibault@ens-lyon.org>
+ * Copyright (C) 2006-2009 Free Software Foundation
*
* This program is free software ; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/xen/grant.c b/xen/grant.c
index 505d2026..3d5c3fe7 100644
--- a/xen/grant.c
+++ b/xen/grant.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Samuel Thibault <samuel.thibault@ens-lyon.org>
+ * Copyright (C) 2006-2009 Free Software Foundation
*
* This program is free software ; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/xen/grant.h b/xen/grant.h
index ff8617d4..30ce344d 100644
--- a/xen/grant.h
+++ b/xen/grant.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Samuel Thibault <samuel.thibault@ens-lyon.org>
+ * Copyright (C) 2006-2009 Free Software Foundation
*
* This program is free software ; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/xen/net.c b/xen/net.c
index dd903eda..5c1194c6 100644
--- a/xen/net.c
+++ b/xen/net.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006-2009, 2011 Samuel Thibault <samuel.thibault@ens-lyon.org>
+ * Copyright (C) 2006-2009, 2011 Free Software Foundation
*
* This program is free software ; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/xen/net.h b/xen/net.h
index 66838700..836e75f2 100644
--- a/xen/net.h
+++ b/xen/net.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Samuel Thibault <samuel.thibault@ens-lyon.org>
+ * Copyright (C) 2006-2009 Free Software Foundation
*
* This program is free software ; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/xen/ring.c b/xen/ring.c
index 8644059e..91ce3ff1 100644
--- a/xen/ring.c
+++ b/xen/ring.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Samuel Thibault <samuel.thibault@ens-lyon.org>
+ * Copyright (C) 2006-2009 Free Software Foundation
*
* This program is free software ; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/xen/ring.h b/xen/ring.h
index 6ed00acd..c5c2fe39 100644
--- a/xen/ring.h
+++ b/xen/ring.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Samuel Thibault <samuel.thibault@ens-lyon.org>
+ * Copyright (C) 2006-2009 Free Software Foundation
*
* This program is free software ; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/xen/store.c b/xen/store.c
index 3c6baebf..94d0ae45 100644
--- a/xen/store.c
+++ b/xen/store.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Samuel Thibault <samuel.thibault@ens-lyon.org>
+ * Copyright (C) 2006-2009 Free Software Foundation
*
* This program is free software ; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/xen/store.h b/xen/store.h
index 4b3ee187..ae236eb6 100644
--- a/xen/store.h
+++ b/xen/store.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Samuel Thibault <samuel.thibault@ens-lyon.org>
+ * Copyright (C) 2006-2009 Free Software Foundation
*
* This program is free software ; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/xen/time.c b/xen/time.c
index 4c5cc351..5cddd8fa 100644
--- a/xen/time.c
+++ b/xen/time.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Samuel Thibault <samuel.thibault@ens-lyon.org>
+ * Copyright (C) 2006-2009 Free Software Foundation
*
* This program is free software ; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/xen/time.h b/xen/time.h
index f8755884..8c8bc53e 100644
--- a/xen/time.h
+++ b/xen/time.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Samuel Thibault <samuel.thibault@ens-lyon.org>
+ * Copyright (C) 2006-2009 Free Software Foundation
*
* This program is free software ; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/xen/xen.c b/xen/xen.c
index f8f964eb..28953512 100644
--- a/xen/xen.c
+++ b/xen/xen.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2007-2011 Samuel Thibault <samuel.thibault@ens-lyon.org>
+ * Copyright (C) 2007-2011 Free Software Foundation
*
* This program is free software ; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -30,13 +30,6 @@
#include "xen.h"
#include "evt.h"
-void hyp_invalidate_pte(pt_entry_t *pte)
-{
- if (!hyp_mmu_update_pte(kv_to_ma(pte), (*pte) & ~INTEL_PTE_VALID))
- panic("%s:%d could not set pte %p(%p) to %p(%p)\n",__FILE__,__LINE__,pte,(vm_offset_t) kv_to_ma(pte),*pte,ma_to_pa(*pte));
- hyp_mmuext_op_void(MMUEXT_TLB_FLUSH_LOCAL);
-}
-
void hyp_debug()
{
panic("debug");
diff --git a/xen/xen.h b/xen/xen.h
index 6eeb350e..f0a3abb9 100644
--- a/xen/xen.h
+++ b/xen/xen.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006-2010, 2011 Samuel Thibault <samuel.thibault@ens-lyon.org>
+ * Copyright (C) 2006-2009, 2011 Free Software Foundation
*
* This program is free software ; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -21,7 +21,6 @@
void hyp_init(void);
void hyp_dev_init(void);
-void hyp_invalidate_pte(pt_entry_t *pte);
void hyp_idle(void);
void hyp_p2m_init(void);