aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlavio Cruz <flaviocruz@gmail.com>2022-12-20 20:01:02 -0500
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2022-12-21 12:55:46 +0100
commit448889a4f0c32ba8ea61f870d4edcb0e0d58af85 (patch)
treecad56c7263667bb09096cc05c707130d3809544a
parent28ac48ba2371ad6f76f263e56dcf0090fe0d6087 (diff)
downloadgnumach-448889a4f0c32ba8ea61f870d4edcb0e0d58af85.tar.gz
gnumach-448889a4f0c32ba8ea61f870d4edcb0e0d58af85.tar.bz2
gnumach-448889a4f0c32ba8ea61f870d4edcb0e0d58af85.zip
Use -Wstrict-prototypes and fix warnings
Most of the changes include defining and using proper function type declarations (with argument types declared) and avoiding using the K&R style of function declarations. Message-Id: <Y6Jazsuis1QA0lXI@mars>
-rw-r--r--Makefile.am2
-rw-r--r--chips/busses.h6
-rw-r--r--device/blkio.c44
-rw-r--r--device/buf.h6
-rw-r--r--device/conf.h12
-rw-r--r--device/dev_hdr.h4
-rw-r--r--device/dev_lookup.c12
-rw-r--r--device/dev_name.c9
-rw-r--r--device/net_io.c2
-rw-r--r--device/net_io.h4
-rw-r--r--gensym.awk2
-rw-r--r--i386/i386/ipl.h4
-rw-r--r--i386/i386/pcb.c2
-rw-r--r--i386/i386/pcb.h2
-rw-r--r--i386/i386at/com.c2
-rw-r--r--i386/i386at/conf.c48
-rw-r--r--i386/i386at/ioapic.c6
-rw-r--r--i386/i386at/kd.c41
-rw-r--r--i386/i386at/kd_mouse.c2
-rw-r--r--i386/i386at/kdsoft.h13
-rw-r--r--include/mach/error.h2
-rw-r--r--include/mach/mig_errors.h2
-rw-r--r--ipc/ipc_mqueue.c4
-rw-r--r--ipc/ipc_mqueue.h2
-rw-r--r--ipc/mach_msg.c10
-rw-r--r--kern/exception.c5
-rw-r--r--kern/ipc_mig.c5
-rw-r--r--kern/syscall_sw.h8
-rw-r--r--vm/memory_object.c6
-rw-r--r--vm/vm_debug.c6
-rw-r--r--vm/vm_fault.c18
-rw-r--r--vm/vm_fault.h7
-rw-r--r--vm/vm_kern.c2
-rw-r--r--vm/vm_map.c14
-rw-r--r--vm/vm_map.h14
-rw-r--r--vm/vm_user.c11
36 files changed, 144 insertions, 195 deletions
diff --git a/Makefile.am b/Makefile.am
index 8870c7ac..7abe37b5 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -61,7 +61,7 @@ AM_CCASFLAGS += \
# 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 += \
- -Wall
+ -Wall -Wstrict-prototypes
# We need the GNU-style inline
AM_CFLAGS += \
diff --git a/chips/busses.h b/chips/busses.h
index f728add0..90eebc67 100644
--- a/chips/busses.h
+++ b/chips/busses.h
@@ -73,7 +73,7 @@ struct bus_ctlr {
struct bus_driver *driver; /* myself, as a device */
char *name; /* readability */
int unit; /* index in driver */
- void (*intr)(); /* interrupt handler(s) */
+ void (*intr)(int); /* interrupt handler(s) */
vm_offset_t address; /* device virtual address */
int am; /* address modifier */
vm_offset_t phys_address;/* device phys address */
@@ -93,7 +93,7 @@ struct bus_device {
struct bus_driver *driver; /* autoconf info */
char *name; /* my name */
int unit;
- void (*intr)();
+ void (*intr)(int);
vm_offset_t address; /* device address */
int am; /* address modifier */
vm_offset_t phys_address;/* device phys address */
@@ -131,7 +131,7 @@ struct bus_driver {
vm_offset_t);
void (*attach)( /* setup driver after probe */
struct bus_device *);
- int (*dgo)(); /* start transfer */
+ int (*dgo)(struct bus_device *); /* start transfer */
vm_offset_t *addr; /* device csr addresses */
char *dname; /* name of a device */
struct bus_device **dinfo; /* backpointers to init structs */
diff --git a/device/blkio.c b/device/blkio.c
index 7ec1f2cf..62fc6295 100644
--- a/device/blkio.c
+++ b/device/blkio.c
@@ -37,50 +37,6 @@
#include <device/ds_routines.h>
-
-io_return_t block_io(
- void (*strat)(),
- void (*max_count)(),
- io_req_t ior)
-{
- kern_return_t rc;
- boolean_t wait = FALSE;
-
- /*
- * Make sure the size is not too large by letting max_count
- * change io_count. If we are doing a write, then io_alloc_size
- * preserves the original io_count.
- */
- (*max_count)(ior);
-
- /*
- * If reading, allocate memory. If writing, wire
- * down the incoming memory.
- */
- if (ior->io_op & IO_READ)
- rc = device_read_alloc(ior, (vm_size_t)ior->io_count);
- else
- rc = device_write_get(ior, &wait);
-
- if (rc != KERN_SUCCESS)
- return (rc);
-
- /*
- * Queue the operation for the device.
- */
- (*strat)(ior);
-
- /*
- * The io is now queued. Wait for it if needed.
- */
- if (wait) {
- iowait(ior);
- return(D_SUCCESS);
- }
-
- return (D_IO_QUEUED);
-}
-
/*
* 'standard' max_count routine. VM continuations mean that this
* code can cope with arbitrarily-sized write operations (they won't be
diff --git a/device/buf.h b/device/buf.h
index a79ed8e4..7c8a4362 100644
--- a/device/buf.h
+++ b/device/buf.h
@@ -83,12 +83,6 @@
#define B_MD1 IO_SPARE_START
/*
- * Redefine physio routine
- */
-#define physio(strat, xbuf, dev, ops, minphys, ior) \
- block_io(strat, minphys, ior)
-
-/*
* Export standard minphys routine.
*/
extern void minphys(io_req_t);
diff --git a/device/conf.h b/device/conf.h
index 1af00285..8177966b 100644
--- a/device/conf.h
+++ b/device/conf.h
@@ -36,6 +36,7 @@
#include <mach/port.h>
#include <mach/vm_prot.h>
#include <device/device_types.h>
+#include <device/net_status.h>
struct io_req;
typedef struct io_req *io_req_t;
@@ -54,20 +55,20 @@ struct dev_ops {
int (*d_getstat)(dev_t, dev_flavor_t, dev_status_t, mach_msg_type_number_t *); /* get status/control */
int (*d_setstat)(dev_t, dev_flavor_t, dev_status_t, mach_msg_type_number_t); /* set status/control */
vm_offset_t (*d_mmap)(dev_t, vm_offset_t, vm_prot_t); /* map memory */
- int (*d_async_in)(); /* asynchronous input setup */
- int (*d_reset)(); /* reset device */
+ int (*d_async_in)(dev_t, const ipc_port_t, int, filter_t*, unsigned int); /* asynchronous input setup */
+ int (*d_reset)(dev_t); /* reset device */
int (*d_port_death)(dev_t, mach_port_t);
/* clean up reply ports */
int d_subdev; /* number of sub-devices per
unit */
- int (*d_dev_info)(); /* driver info for kernel */
+ int (*d_dev_info)(dev_t, int, int*); /* driver info for kernel */
};
typedef struct dev_ops *dev_ops_t;
/*
* Routines for null entries.
*/
-extern int nulldev(void); /* no operation - OK */
+extern int nulldev_reset(dev_t dev);
extern int nulldev_open(dev_t dev, int flag, io_req_t ior);
extern void nulldev_close(dev_t dev, int flags);
extern int nulldev_read(dev_t dev, io_req_t ior);
@@ -75,7 +76,8 @@ extern int nulldev_write(dev_t dev, io_req_t ior);
extern io_return_t nulldev_getstat(dev_t dev, dev_flavor_t flavor, dev_status_t data, mach_msg_type_number_t *count);
extern io_return_t nulldev_setstat(dev_t dev, dev_flavor_t flavor, dev_status_t data, mach_msg_type_number_t count);
extern io_return_t nulldev_portdeath(dev_t dev, mach_port_t port);
-extern int nodev(void); /* no operation - error */
+extern int nodev_async_in(dev_t, const ipc_port_t, int, filter_t*, unsigned int); /* no operation - error */
+extern int nodev_info(dev_t, int, int*); /* no operation - error */
extern vm_offset_t nomap(dev_t dev, vm_offset_t off, int prot); /* no operation - error */
/*
diff --git a/device/dev_hdr.h b/device/dev_hdr.h
index 4bd12c1c..56e0d825 100644
--- a/device/dev_hdr.h
+++ b/device/dev_hdr.h
@@ -119,10 +119,12 @@ device_t dev_port_lookup(ipc_port_t);
void dev_port_enter(mach_device_t);
void dev_port_remove(mach_device_t);
+typedef boolean_t (*dev_map_fn)(mach_device_t, mach_port_t);
+
/*
* To call a routine on each device
*/
-boolean_t dev_map(boolean_t (*)(), mach_port_t);
+boolean_t dev_map(dev_map_fn, mach_port_t);
/*
* To lock and unlock state and open-count
diff --git a/device/dev_lookup.c b/device/dev_lookup.c
index 9af7508c..e9d38925 100644
--- a/device/dev_lookup.c
+++ b/device/dev_lookup.c
@@ -70,8 +70,7 @@ struct kmem_cache dev_hdr_cache;
* The number table lock must be held.
*/
void
-dev_number_enter(device)
- const mach_device_t device;
+dev_number_enter(const mach_device_t device)
{
queue_t q;
@@ -84,8 +83,7 @@ dev_number_enter(device)
* The device-number table lock must be held.
*/
void
-dev_number_remove(device)
- const mach_device_t device;
+dev_number_remove(const mach_device_t device)
{
queue_t q;
@@ -98,9 +96,7 @@ dev_number_remove(device)
* The number table lock must be held.
*/
mach_device_t
-dev_number_lookup(ops, devnum)
- const dev_ops_t ops;
- int devnum;
+dev_number_lookup(const dev_ops_t ops, int devnum)
{
queue_t q;
mach_device_t device;
@@ -316,7 +312,7 @@ convert_device_to_port(device)
*/
boolean_t
dev_map(
- boolean_t (*routine)(),
+ dev_map_fn routine,
mach_port_t port)
{
int i;
diff --git a/device/dev_name.c b/device/dev_name.c
index 59ea961b..13ff6dc9 100644
--- a/device/dev_name.c
+++ b/device/dev_name.c
@@ -39,7 +39,7 @@
/*
* Routines placed in empty entries in the device tables
*/
-int nulldev(void)
+int nulldev_reset(dev_t)
{
return (D_SUCCESS);
}
@@ -78,7 +78,12 @@ int nulldev_portdeath(dev_t dev, mach_port_t port)
return (D_SUCCESS);
}
-int nodev(void)
+int nodev_async_in(dev_t, const ipc_port_t, int, filter_t*, unsigned int)
+{
+ return (D_INVALID_OPERATION);
+}
+
+int nodev_info(dev_t, int, int*)
{
return (D_INVALID_OPERATION);
}
diff --git a/device/net_io.c b/device/net_io.c
index 72b040a0..338b433c 100644
--- a/device/net_io.c
+++ b/device/net_io.c
@@ -1437,7 +1437,7 @@ printf ("net_getstat: count: %d, addr_int_count: %d\n",
io_return_t
net_write(
struct ifnet *ifp,
- int (*start)(),
+ net_write_start_device_fn start,
io_req_t ior)
{
spl_t s;
diff --git a/device/net_io.h b/device/net_io.h
index 9468e34b..c9af85ee 100644
--- a/device/net_io.h
+++ b/device/net_io.h
@@ -79,7 +79,9 @@ extern void net_packet(struct ifnet *, ipc_kmsg_t, unsigned int, boolean_t);
extern void net_filter(ipc_kmsg_t, ipc_kmsg_queue_t);
extern io_return_t net_getstat(struct ifnet *, dev_flavor_t, dev_status_t,
mach_msg_type_number_t *);
-extern io_return_t net_write(struct ifnet *, int (*)(), io_req_t);
+
+typedef int (*net_write_start_device_fn)(short);
+extern io_return_t net_write(struct ifnet *, net_write_start_device_fn, io_req_t);
/*
* Non-interrupt code may allocate and free net_kmsgs with these functions.
diff --git a/gensym.awk b/gensym.awk
index f5eabae5..63c2f440 100644
--- a/gensym.awk
+++ b/gensym.awk
@@ -27,7 +27,7 @@ BEGIN {
/^[a-z]/ {
if (bogus_printed == "no")
{
- print "void bogus() {";
+ print "void bogus(void) {";
bogus_printed = "yes";
}
}
diff --git a/i386/i386/ipl.h b/i386/i386/ipl.h
index fb939789..20e7428b 100644
--- a/i386/i386/ipl.h
+++ b/i386/i386/ipl.h
@@ -72,7 +72,9 @@ WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#ifdef KERNEL
#ifndef __ASSEMBLER__
#include <machine/machspl.h>
-extern void (*ivect[])();
+/* Note that interrupts have varying signatures */
+typedef void (*interrupt_handler_fn)(int);
+extern interrupt_handler_fn ivect[];
extern int iunit[];
extern spl_t curr_ipl;
#endif /* __ASSEMBLER__ */
diff --git a/i386/i386/pcb.c b/i386/i386/pcb.c
index 5ac487b7..ef300537 100644
--- a/i386/i386/pcb.c
+++ b/i386/i386/pcb.c
@@ -332,7 +332,7 @@ void load_context(thread_t new)
*/
thread_t switch_context(
thread_t old,
- void (*continuation)(),
+ continuation_t continuation,
thread_t new)
{
/*
diff --git a/i386/i386/pcb.h b/i386/i386/pcb.h
index 5bc78066..4d48b9f7 100644
--- a/i386/i386/pcb.h
+++ b/i386/i386/pcb.h
@@ -77,7 +77,7 @@ extern void update_ktss_iopb (unsigned char *new_iopb, io_port_t size);
extern thread_t Load_context (thread_t new);
-extern thread_t Switch_context (thread_t old, void (*continuation)(), thread_t new);
+extern thread_t Switch_context (thread_t old, continuation_t continuation, thread_t new);
extern void switch_to_shutdown_context(thread_t thread,
void (*routine)(processor_t),
diff --git a/i386/i386at/com.c b/i386/i386at/com.c
index 8bd80206..c63c30a4 100644
--- a/i386/i386at/com.c
+++ b/i386/i386at/com.c
@@ -49,7 +49,7 @@
#include <device/cons.h>
-static void comparam();
+static void comparam(int);
static vm_offset_t com_std[NCOM] = { 0 };
struct bus_device *cominfo[NCOM];
diff --git a/i386/i386at/conf.c b/i386/i386at/conf.c
index ca5d0dfb..ecbf1e45 100644
--- a/i386/i386at/conf.c
+++ b/i386/i386at/conf.c
@@ -86,76 +86,76 @@ struct dev_ops dev_name_list[] =
indirect list */
{ "cn", nulldev_open, nulldev_close, nulldev_read,
nulldev_write, nulldev_getstat, nulldev_setstat, nomap,
- nodev, nulldev, nulldev_portdeath, 0,
- nodev },
+ nodev_async_in, nulldev_reset, nulldev_portdeath, 0,
+ nodev_info},
#ifndef MACH_HYP
#if ENABLE_IMMEDIATE_CONSOLE
{ "immc", nulldev_open, nulldev_close, nulldev_read,
nulldev_write, nulldev_getstat, nulldev_setstat,
- nomap, nodev, nulldev, nulldev_portdeath, 0,
- nodev },
+ nomap, nodev_async_in, nulldev_reset, nulldev_portdeath, 0,
+ nodev_info },
#endif /* ENABLE_IMMEDIATE_CONSOLE */
{ kdname, kdopen, kdclose, kdread,
kdwrite, kdgetstat, kdsetstat, kdmmap,
- nodev, nulldev, kdportdeath, 0,
- nodev },
+ nodev_async_in, nulldev_reset, kdportdeath, 0,
+ nodev_info },
#endif /* MACH_HYP */
{ timename, timeopen, timeclose, nulldev_read,
nulldev_write, nulldev_getstat, nulldev_setstat, timemmap,
- nodev, nulldev, nulldev_portdeath, 0,
- nodev },
+ nodev_async_in, nulldev_reset, nulldev_portdeath, 0,
+ nodev_info },
#ifndef MACH_HYP
#if NCOM > 0
{ comname, comopen, comclose, comread,
comwrite, comgetstat, comsetstat, nomap,
- nodev, nulldev, comportdeath, 0,
- nodev },
+ nodev_async_in, nulldev_reset, comportdeath, 0,
+ nodev_info },
#endif
#ifdef MACH_LPR
{ lprname, lpropen, lprclose, lprread,
lprwrite, lprgetstat, lprsetstat, nomap,
- nodev, nulldev, lprportdeath, 0,
- nodev },
+ nodev_async_in, nulldev_reset, lprportdeath, 0,
+ nodev_info },
#endif
{ mousename, mouseopen, mouseclose, mouseread,
nulldev_write, mousegetstat, nulldev_setstat, nomap,
- nodev, nulldev, nulldev_portdeath, 0,
- nodev },
+ nodev_async_in, nulldev_reset, nulldev_portdeath, 0,
+ nodev_info },
{ kbdname, kbdopen, kbdclose, kbdread,
nulldev_write, kbdgetstat, kbdsetstat, nomap,
- nodev, nulldev, nulldev_portdeath, 0,
- nodev },
+ nodev_async_in, nulldev_reset, nulldev_portdeath, 0,
+ nodev_info },
{ memname, nulldev_open, nulldev_close, nulldev_read,
nulldev_write, nulldev_getstat, nulldev_setstat, memmmap,
- nodev, nulldev, nulldev_portdeath, 0,
- nodev },
+ nodev_async_in, nulldev_reset, nulldev_portdeath, 0,
+ nodev_info },
#endif /* MACH_HYP */
#ifdef MACH_KMSG
{ kmsgname, kmsgopen, kmsgclose, kmsgread,
nulldev_write, kmsggetstat, nulldev_setstat, nomap,
- nodev, nulldev, nulldev_portdeath, 0,
- nodev },
+ nodev_async_in, nulldev_reset, nulldev_portdeath, 0,
+ nodev_info },
#endif
#ifdef MACH_HYP
{ hypcnname, hypcnopen, hypcnclose, hypcnread,
hypcnwrite, hypcngetstat, hypcnsetstat, nomap,
- nodev, nulldev, hypcnportdeath, 0,
- nodev },
+ nodev_async_in, nulldev_reset, hypcnportdeath, 0,
+ nodev_info },
#endif /* MACH_HYP */
{ irqname, nulldev_open, nulldev_close, nulldev_read,
nulldev_write,nulldev_getstat,nulldev_setstat, nomap,
- nodev, nulldev, nulldev_portdeath,0,
- nodev },
+ nodev_async_in, nulldev_reset, nulldev_portdeath,0,
+ nodev_info },
};
int dev_name_count = sizeof(dev_name_list)/sizeof(dev_name_list[0]);
diff --git a/i386/i386at/ioapic.c b/i386/i386at/ioapic.c
index e5523488..3373aa71 100644
--- a/i386/i386at/ioapic.c
+++ b/i386/i386at/ioapic.c
@@ -43,7 +43,7 @@ spl_t curr_ipl;
int iunit[NINTR] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 18, 19, 20, 21, 22, 23};
-void (*ivect[NINTR])() = {
+interrupt_handler_fn ivect[NINTR] = {
/* 00 */ intnull, /* install timer later */
/* 01 */ kdintr, /* kdintr, ... */
/* 02 */ intnull,
@@ -402,8 +402,8 @@ ioapic_configure(void)
/* Install clock interrupt handler on both remapped timer pin and pin 0
* since nobody knows how all x86 timers are wired up */
- ivect[0] = hardclock;
- ivect[timer_pin] = hardclock;
+ ivect[0] = (interrupt_handler_fn)hardclock;
+ ivect[timer_pin] = (interrupt_handler_fn)hardclock;
printf("IOAPIC 0 configured\n");
}
diff --git a/i386/i386at/kd.c b/i386/i386at/kd.c
index b5501873..5b932889 100644
--- a/i386/i386at/kd.c
+++ b/i386/i386at/kd.c
@@ -107,20 +107,24 @@ WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
struct tty kd_tty;
extern boolean_t rebootflag;
-static void charput(), charmvup(), charmvdown(), charclear(), charsetcursor();
+static void charput(csrpos_t pos, char ch, char chattr);
+static void charmvup(csrpos_t from, csrpos_t to, int count);
+static void charmvdown(csrpos_t from, csrpos_t to, int count);
+static void charclear(csrpos_t to, int count, char chattr);
+static void charsetcursor(csrpos_t newpos);
static void kd_noopreset(void);
/*
* These routines define the interface to the device-specific layer.
* See kdsoft.h for a more complete description of what each routine does.
*/
-void (*kd_dput)() = charput; /* put attributed char */
-void (*kd_dmvup)() = charmvup; /* block move up */
-void (*kd_dmvdown)() = charmvdown; /* block move down */
-void (*kd_dclear)() = charclear; /* block clear */
-void (*kd_dsetcursor)() = charsetcursor;
+void (*kd_dput)(csrpos_t, char, char) = charput; /* put attributed char */
+void (*kd_dmvup)(csrpos_t, csrpos_t, int) = charmvup; /* block move up */
+void (*kd_dmvdown)(csrpos_t, csrpos_t, int) = charmvdown; /* block move down */
+void (*kd_dclear)(csrpos_t, int, char) = charclear; /* block clear */
+void (*kd_dsetcursor)(csrpos_t) = charsetcursor;
/* set cursor position on displayed page */
-void (*kd_dreset)() = kd_noopreset; /* prepare for reboot */
+void (*kd_dreset)(void) = kd_noopreset; /* prepare for reboot */
/*
* Globals used for both character-based controllers and bitmap-based
@@ -2488,7 +2492,7 @@ int new_button = 0;
void
kd_xga_init(void)
{
- csrpos_t xga_getpos();
+ csrpos_t xga_getpos(void);
unsigned char start, stop;
#if 0
@@ -2610,10 +2614,7 @@ xga_getpos(void)
* Put attributed character for EGA/CGA/etc.
*/
static void
-charput(pos, ch, chattr)
-csrpos_t pos; /* where to put it */
-char ch; /* the character */
-char chattr; /* its attribute */
+charput(csrpos_t pos, char ch, char chattr)
{
*(vid_start + pos) = ch;
*(vid_start + pos + 1) = chattr;
@@ -2626,8 +2627,7 @@ char chattr; /* its attribute */
* Set hardware cursor position for EGA/CGA/etc.
*/
static void
-charsetcursor(newpos)
-csrpos_t newpos;
+charsetcursor(csrpos_t newpos)
{
short curpos; /* position, not scaled for attribute byte */
@@ -2647,9 +2647,7 @@ csrpos_t newpos;
* Block move up for EGA/CGA/etc.
*/
static void
-charmvup(from, to, count)
-csrpos_t from, to;
-int count;
+charmvup(csrpos_t from, csrpos_t to, int count)
{
kd_slmscu(vid_start+from, vid_start+to, count);
}
@@ -2661,9 +2659,7 @@ int count;
* Block move down for EGA/CGA/etc.
*/
static void
-charmvdown(from, to, count)
-csrpos_t from, to;
-int count;
+charmvdown(csrpos_t from, csrpos_t to, int count)
{
kd_slmscd(vid_start+from, vid_start+to, count);
}
@@ -2675,10 +2671,7 @@ int count;
* Fast clear for CGA/EGA/etc.
*/
static void
-charclear(to, count, chattr)
-csrpos_t to;
-int count;
-char chattr;
+charclear(csrpos_t to, int count, char chattr)
{
kd_slmwd(vid_start+to, count, ((unsigned short)chattr<<8)+K_SPACE);
}
diff --git a/i386/i386at/kd_mouse.c b/i386/i386at/kd_mouse.c
index 7dd1c272..3af21273 100644
--- a/i386/i386at/kd_mouse.c
+++ b/i386/i386at/kd_mouse.c
@@ -82,7 +82,7 @@ WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include "kd_mouse.h"
-static void (*oldvect)(); /* old interrupt vector */
+static interrupt_handler_fn oldvect; /* old interrupt vector */
static int oldunit;
extern struct bus_device *cominfo[];
diff --git a/i386/i386at/kdsoft.h b/i386/i386at/kdsoft.h
index 1dfd2b2c..79bfdb06 100644
--- a/i386/i386at/kdsoft.h
+++ b/i386/i386at/kdsoft.h
@@ -145,13 +145,12 @@ extern void bmpmvdown(csrpos_t, csrpos_t, int);
extern void bmpclear(csrpos_t, int, char);
extern void bmpsetcursor(csrpos_t);
-extern void (*kd_dput)(); /* put attributed char */
-extern void (*kd_dmvup)(); /* block move up */
-extern void (*kd_dmvdown)(); /* block move down */
-extern void (*kd_dclear)(); /* block clear */
-extern void (*kd_dsetcursor)();
- /* set cursor position on displayed page */
-extern void (*kd_dreset)(); /* prepare for reboot */
+extern void (*kd_dput)(csrpos_t, char, char); /* put attributed char */
+extern void (*kd_dmvup)(csrpos_t, csrpos_t, int); /* block move up */
+extern void (*kd_dmvdown)(csrpos_t, csrpos_t, int); /* block move down */
+extern void (*kd_dclear)(csrpos_t, int, char); /* block clear */
+extern void (*kd_dsetcursor)(csrpos_t); /* set cursor position on displayed page */
+extern void (*kd_dreset)(void); /* prepare for reboot */
/*
diff --git a/include/mach/error.h b/include/mach/error.h
index 72a2d79c..035dcf83 100644
--- a/include/mach/error.h
+++ b/include/mach/error.h
@@ -44,7 +44,6 @@
#define err_none (mach_error_t)0
#define ERR_SUCCESS (mach_error_t)0
-#define ERR_ROUTINE_NIL (mach_error_fn_t)0
#define err_system(x) (((x)&0x3f)<<26)
@@ -89,7 +88,6 @@
#ifndef __ASSEMBLER__
typedef kern_return_t mach_error_t;
-typedef mach_error_t (* mach_error_fn_t)();
#endif /* __ASSEMBLER__ */
#endif /* _MACH_ERROR_H_ */
diff --git a/include/mach/mig_errors.h b/include/mach/mig_errors.h
index 5758ccf3..389ce778 100644
--- a/include/mach/mig_errors.h
+++ b/include/mach/mig_errors.h
@@ -68,7 +68,7 @@ typedef struct mig_symtab {
#else
int
#endif
- (*ms_routine)();
+ (*ms_routine)(void);
} mig_symtab_t;
/*
diff --git a/ipc/ipc_mqueue.c b/ipc/ipc_mqueue.c
index a371a625..ac6bed51 100644
--- a/ipc/ipc_mqueue.c
+++ b/ipc/ipc_mqueue.c
@@ -259,7 +259,7 @@ ipc_mqueue_send(
ip_unlock(port);
counter(c_ipc_mqueue_send_block++);
- thread_block((void (*)(void)) 0);
+ thread_block(thread_no_continuation);
ip_lock(port);
/* why did we wake up? */
@@ -520,7 +520,7 @@ ipc_mqueue_receive(
mach_msg_size_t max_size,
mach_msg_timeout_t time_out,
boolean_t resume,
- void (*continuation)(void),
+ continuation_t continuation,
ipc_kmsg_t *kmsgp,
mach_port_seqno_t *seqnop)
{
diff --git a/ipc/ipc_mqueue.h b/ipc/ipc_mqueue.h
index efca6817..dfac7456 100644
--- a/ipc/ipc_mqueue.h
+++ b/ipc/ipc_mqueue.h
@@ -75,7 +75,7 @@ ipc_mqueue_copyin(ipc_space_t, mach_port_name_t, ipc_mqueue_t *, ipc_object_t *)
extern mach_msg_return_t
ipc_mqueue_receive(ipc_mqueue_t, mach_msg_option_t,
mach_msg_size_t, mach_msg_timeout_t,
- boolean_t, void (*)(),
+ boolean_t, continuation_t,
ipc_kmsg_t *, mach_port_seqno_t *);
/*
diff --git a/ipc/mach_msg.c b/ipc/mach_msg.c
index aa8cdb5b..420e2a26 100644
--- a/ipc/mach_msg.c
+++ b/ipc/mach_msg.c
@@ -789,7 +789,7 @@ mach_msg_trap(
self->ith_object = rcv_object;
self->ith_mqueue = rcv_mqueue;
- if ((receiver->swap_func == (void (*)()) mach_msg_continue) &&
+ if ((receiver->swap_func == mach_msg_continue) &&
thread_handoff(self, mach_msg_continue, receiver)) {
assert(current_thread() == receiver);
@@ -798,7 +798,7 @@ mach_msg_trap(
* because the receiver is using no options.
*/
} else if ((receiver->swap_func ==
- (void (*)()) exception_raise_continue) &&
+ exception_raise_continue) &&
thread_handoff(self, mach_msg_continue, receiver)) {
counter(c_mach_msg_trap_block_exc++);
assert(current_thread() == receiver);
@@ -830,7 +830,7 @@ mach_msg_trap(
assert(current_thread() == receiver);
if ((receiver->swap_func ==
- (void (*)()) mach_msg_receive_continue) &&
+ mach_msg_receive_continue) &&
((receiver->ith_option & MACH_RCV_NOTIFY) == 0)) {
/*
* We can still use the optimized code.
@@ -1669,8 +1669,8 @@ mach_msg_interrupt(thread_t thread)
{
ipc_mqueue_t mqueue;
- assert((thread->swap_func == (void (*)()) mach_msg_continue) ||
- (thread->swap_func == (void (*)()) mach_msg_receive_continue));
+ assert((thread->swap_func == mach_msg_continue) ||
+ (thread->swap_func == mach_msg_receive_continue));
mqueue = thread->ith_mqueue;
imq_lock(mqueue);
diff --git a/kern/exception.c b/kern/exception.c
index 2ff122f2..0d8191a7 100644
--- a/kern/exception.c
+++ b/kern/exception.c
@@ -449,9 +449,8 @@ exception_raise(
receiver = ipc_thread_queue_first(&dest_mqueue->imq_threads);
if ((receiver == ITH_NULL) ||
- !((receiver->swap_func == (void (*)()) mach_msg_continue) ||
- ((receiver->swap_func ==
- (void (*)()) mach_msg_receive_continue) &&
+ !((receiver->swap_func == mach_msg_continue) ||
+ ((receiver->swap_func == mach_msg_receive_continue) &&
(sizeof(struct mach_exception) <= receiver->ith_msize) &&
((receiver->ith_option & MACH_RCV_NOTIFY) == 0))) ||
!thread_handoff(self, exception_raise_continue, receiver)) {
diff --git a/kern/ipc_mig.c b/kern/ipc_mig.c
index 7ed12faa..f353009e 100644
--- a/kern/ipc_mig.c
+++ b/kern/ipc_mig.c
@@ -285,10 +285,7 @@ mig_put_reply_port(
* len - Length of destination buffer.
*/
vm_size_t
-mig_strncpy(dest, src, len)
- char *dest;
- const char *src;
- int len;
+mig_strncpy(char *dest, const char *src, int len)
{
char *dest_ = dest;
int i;
diff --git a/kern/syscall_sw.h b/kern/syscall_sw.h
index 80b1810b..34eaf90b 100644
--- a/kern/syscall_sw.h
+++ b/kern/syscall_sw.h
@@ -35,9 +35,11 @@
* Note: this is indexed manually by locore.S!
*/
+typedef void (*generic_trap_function)(void);
+
typedef struct {
int mach_trap_arg_count;
- int (*mach_trap_function)();
+ generic_trap_function mach_trap_function;
boolean_t mach_trap_stack;
const char *mach_trap_name;
} mach_trap_t;
@@ -46,8 +48,8 @@ extern mach_trap_t mach_trap_table[];
extern int mach_trap_count;
#define MACH_TRAP(name, arg_count) \
- { (arg_count), (int (*)()) (name), FALSE, #name }
+ { (arg_count), (generic_trap_function) (name), FALSE, #name }
#define MACH_TRAP_STACK(name, arg_count) \
- { (arg_count), (int (*)()) (name), TRUE, #name }
+ { (arg_count), (generic_trap_function) (name), TRUE, #name }
#endif /* _KERN_SYSCALL_SW_H_ */
diff --git a/vm/memory_object.c b/vm/memory_object.c
index ad93f87c..464a036e 100644
--- a/vm/memory_object.c
+++ b/vm/memory_object.c
@@ -976,9 +976,9 @@ kern_return_t memory_object_get_attributes(
/*
* If successful, consumes the supplied naked send right.
*/
-kern_return_t vm_set_default_memory_manager(host, default_manager)
- const host_t host;
- ipc_port_t *default_manager;
+kern_return_t vm_set_default_memory_manager(
+ const host_t host,
+ ipc_port_t *default_manager)
{
ipc_port_t current_manager;
ipc_port_t new_manager;
diff --git a/vm/vm_debug.c b/vm/vm_debug.c
index 4b5c1521..3339d0c8 100644
--- a/vm/vm_debug.c
+++ b/vm/vm_debug.c
@@ -433,10 +433,8 @@ mach_vm_object_pages(
*/
kern_return_t
-host_virtual_physical_table_info(host, infop, countp)
- const host_t host;
- hash_info_bucket_array_t *infop;
- natural_t *countp;
+host_virtual_physical_table_info(const host_t host,
+ hash_info_bucket_array_t *infop, natural_t *countp)
{
vm_offset_t addr;
vm_size_t size = 0;/* '=0' to quiet gcc warnings */
diff --git a/vm/vm_fault.c b/vm/vm_fault.c
index e1dfb06e..44801911 100644
--- a/vm/vm_fault.c
+++ b/vm/vm_fault.c
@@ -70,7 +70,7 @@ typedef struct vm_fault_state {
vm_offset_t vmf_vaddr;
vm_prot_t vmf_fault_type;
boolean_t vmf_change_wiring;
- void (*vmf_continuation)();
+ vm_fault_continuation_t vmf_continuation;
vm_map_version_t vmf_version;
boolean_t vmf_wired;
struct vm_object *vmf_object;
@@ -218,7 +218,7 @@ vm_fault_return_t vm_fault_page(
*/
/* More arguments: */
boolean_t resume, /* We are restarting. */
- void (*continuation)()) /* Continuation for blocking. */
+ continuation_t continuation) /* Continuation for blocking. */
{
vm_page_t m;
vm_object_t object;
@@ -347,7 +347,7 @@ vm_fault_return_t vm_fault_page(
PAGE_ASSERT_WAIT(m, interruptible);
vm_object_unlock(object);
- if (continuation != (void (*)()) 0) {
+ if (continuation != thread_no_continuation) {
vm_fault_state_t *state =
(vm_fault_state_t *) current_thread()->ith_other;
@@ -1082,7 +1082,7 @@ vm_fault_return_t vm_fault_page(
block_and_backoff:
vm_fault_cleanup(object, first_m);
- if (continuation != (void (*)()) 0) {
+ if (continuation != thread_no_continuation) {
vm_fault_state_t *state =
(vm_fault_state_t *) current_thread()->ith_other;
@@ -1149,7 +1149,7 @@ kern_return_t vm_fault(
vm_prot_t fault_type,
boolean_t change_wiring,
boolean_t resume,
- void (*continuation)())
+ vm_fault_continuation_t continuation)
{
vm_map_version_t version; /* Map version for verificiation */
boolean_t wired; /* Should mapping be wired down? */
@@ -1187,7 +1187,7 @@ kern_return_t vm_fault(
goto after_vm_fault_page;
}
- if (continuation != (void (*)()) 0) {
+ if (continuation != vm_fault_no_continuation) {
/*
* We will probably need to save state.
*/
@@ -1239,7 +1239,7 @@ kern_return_t vm_fault(
object->ref_count++;
vm_object_paging_begin(object);
- if (continuation != (void (*)()) 0) {
+ if (continuation != vm_fault_no_continuation) {
vm_fault_state_t *state =
(vm_fault_state_t *) current_thread()->ith_other;
@@ -1293,7 +1293,7 @@ kern_return_t vm_fault(
kr = KERN_SUCCESS;
goto done;
case VM_FAULT_MEMORY_SHORTAGE:
- if (continuation != (void (*)()) 0) {
+ if (continuation != vm_fault_no_continuation) {
vm_fault_state_t *state =
(vm_fault_state_t *) current_thread()->ith_other;
@@ -1476,7 +1476,7 @@ kern_return_t vm_fault(
#undef RELEASE_PAGE
done:
- if (continuation != (void (*)()) 0) {
+ if (continuation != vm_fault_no_continuation) {
vm_fault_state_t *state =
(vm_fault_state_t *) current_thread()->ith_other;
diff --git a/vm/vm_fault.h b/vm/vm_fault.h
index 7fdbc417..ae692b11 100644
--- a/vm/vm_fault.h
+++ b/vm/vm_fault.h
@@ -49,11 +49,14 @@ typedef kern_return_t vm_fault_return_t;
#define VM_FAULT_FICTITIOUS_SHORTAGE 4
#define VM_FAULT_MEMORY_ERROR 5
+typedef void (*vm_fault_continuation_t)(kern_return_t);
+#define vm_fault_no_continuation ((vm_fault_continuation_t)0)
+
extern void vm_fault_init(void);
extern vm_fault_return_t vm_fault_page(vm_object_t, vm_offset_t, vm_prot_t,
boolean_t, boolean_t, vm_prot_t *,
vm_page_t *, vm_page_t *, boolean_t,
- void (*)());
+ continuation_t);
extern void vm_fault_cleanup(vm_object_t, vm_page_t);
/*
@@ -61,7 +64,7 @@ extern void vm_fault_cleanup(vm_object_t, vm_page_t);
*/
extern kern_return_t vm_fault(vm_map_t, vm_offset_t, vm_prot_t, boolean_t,
- boolean_t, void (*)());
+ boolean_t, vm_fault_continuation_t);
extern void vm_fault_wire(vm_map_t, vm_map_entry_t);
extern void vm_fault_unwire(vm_map_t, vm_map_entry_t);
diff --git a/vm/vm_kern.c b/vm/vm_kern.c
index c624a875..51223d98 100644
--- a/vm/vm_kern.c
+++ b/vm/vm_kern.c
@@ -1014,7 +1014,7 @@ kmem_io_map_copyout(
return(ret);
}
copy->cpy_cont = vm_map_copy_discard_cont;
- copy->cpy_cont_args = (char *) new_copy;
+ copy->cpy_cont_args = (vm_map_copyin_args_t)new_copy;
copy = new_copy;
page_list = &copy->cpy_page_list[0];
}
diff --git a/vm/vm_map.c b/vm/vm_map.c
index 4200a239..963aa507 100644
--- a/vm/vm_map.c
+++ b/vm/vm_map.c
@@ -280,8 +280,7 @@ void vm_map_unlock(struct vm_map *map)
#define vm_map_copy_entry_create(copy) \
_vm_map_entry_create(&(copy)->cpy_hdr)
-vm_map_entry_t _vm_map_entry_create(map_header)
- const struct vm_map_header *map_header;
+vm_map_entry_t _vm_map_entry_create(const struct vm_map_header *map_header)
{
vm_map_entry_t entry;
@@ -303,9 +302,8 @@ vm_map_entry_t _vm_map_entry_create(map_header)
#define vm_map_copy_entry_dispose(map, entry) \
_vm_map_entry_dispose(&(copy)->cpy_hdr, (entry))
-void _vm_map_entry_dispose(map_header, entry)
- const struct vm_map_header *map_header;
- vm_map_entry_t entry;
+void _vm_map_entry_dispose(const struct vm_map_header *map_header,
+ vm_map_entry_t entry)
{
(void)map_header;
@@ -3810,7 +3808,7 @@ kern_return_t vm_map_copyin_page_list(
copy->offset = src_addr;
copy->size = len;
copy->cpy_cont = ((kern_return_t (*)()) 0);
- copy->cpy_cont_args = (char *) VM_MAP_COPYIN_ARGS_NULL;
+ copy->cpy_cont_args = VM_MAP_COPYIN_ARGS_NULL;
/*
* Find the beginning of the region.
@@ -3900,7 +3898,7 @@ make_continuation:
}
cont_args->steal_pages = steal_pages;
- copy->cpy_cont_args = (char *) cont_args;
+ copy->cpy_cont_args = cont_args;
copy->cpy_cont = vm_map_copyin_page_list_cont;
src_end = src_start;
@@ -4239,7 +4237,7 @@ retry:
cont_args->destroy_len = src_end - src_start;
cont_args->steal_pages = FALSE;
- copy->cpy_cont_args = (char *) cont_args;
+ copy->cpy_cont_args = cont_args;
copy->cpy_cont = vm_map_copyin_page_list_cont;
}
diff --git a/vm/vm_map.h b/vm/vm_map.h
index 57bdf651..3d1c9428 100644
--- a/vm/vm_map.h
+++ b/vm/vm_map.h
@@ -255,6 +255,10 @@ typedef struct vm_map_version {
#define VM_MAP_COPY_PAGE_LIST_MAX 64
+struct vm_map_copy;
+struct vm_map_copyin_args_data;
+typedef kern_return_t (*vm_map_copy_cont_fn)(struct vm_map_copyin_args_data*, struct vm_map_copy**);
+
typedef struct vm_map_copy {
int type;
#define VM_MAP_COPY_ENTRY_LIST 1
@@ -270,8 +274,8 @@ typedef struct vm_map_copy {
struct { /* PAGE_LIST */
vm_page_t page_list[VM_MAP_COPY_PAGE_LIST_MAX];
int npages;
- kern_return_t (*cont)();
- char *cont_args;
+ vm_map_copy_cont_fn cont;
+ struct vm_map_copyin_args_data* cont_args;
} c_p;
} c_u;
} *vm_map_copy_t;
@@ -323,7 +327,7 @@ MACRO_BEGIN \
(*((old_copy)->cpy_cont))((old_copy)->cpy_cont_args, \
(vm_map_copy_t *) 0); \
(old_copy)->cpy_cont = (kern_return_t (*)()) 0; \
- (old_copy)->cpy_cont_args = (char *) 0; \
+ (old_copy)->cpy_cont_args = VM_MAP_COPYIN_ARGS_NULL; \
MACRO_END
#define vm_map_copy_has_cont(copy) \
@@ -333,14 +337,14 @@ MACRO_END
* Continuation structures for vm_map_copyin_page_list.
*/
-typedef struct {
+typedef struct vm_map_copyin_args_data {
vm_map_t map;
vm_offset_t src_addr;
vm_size_t src_len;
vm_offset_t destroy_addr;
vm_size_t destroy_len;
boolean_t steal_pages;
-} vm_map_copyin_args_data_t, *vm_map_copyin_args_t;
+} vm_map_copyin_args_data_t, *vm_map_copyin_args_t;
#define VM_MAP_COPYIN_ARGS_NULL ((vm_map_copyin_args_t) 0)
diff --git a/vm/vm_user.c b/vm/vm_user.c
index 9e789eba..b3887ad1 100644
--- a/vm/vm_user.c
+++ b/vm/vm_user.c
@@ -430,12 +430,11 @@ kern_return_t vm_map(
*
* [ To unwire the pages, specify VM_PROT_NONE. ]
*/
-kern_return_t vm_wire(port, map, start, size, access)
- const ipc_port_t port;
- vm_map_t map;
- vm_offset_t start;
- vm_size_t size;
- vm_prot_t access;
+kern_return_t vm_wire(const ipc_port_t port,
+ vm_map_t map,
+ vm_offset_t start,
+ vm_size_t size,
+ vm_prot_t access)
{
boolean_t priv;