diff options
author | msmith <msmith@FreeBSD.org> | 1999-08-30 22:13:28 +0000 |
---|---|---|
committer | msmith <msmith@FreeBSD.org> | 1999-08-30 22:13:28 +0000 |
commit | 56842578ac635aaac2ea2af6459b06fba2c3a3f1 (patch) | |
tree | 845b6d6e24ac8848d22e3d225ddf007778724087 /sys | |
parent | 628be0515eace470ecc5e0055dbc9cee71e2adb9 (diff) | |
download | FreeBSD-src-56842578ac635aaac2ea2af6459b06fba2c3a3f1.zip FreeBSD-src-56842578ac635aaac2ea2af6459b06fba2c3a3f1.tar.gz |
Check that there is memory range support before attempting to perform such
an operation, as a kernel client may not have previously checked the CPU
type (it may not be able to).
Also correct the function declaration style for the mem_range functions to
match the rest of this file (oops).
Submitted by: gibbs
Diffstat (limited to 'sys')
-rw-r--r-- | sys/amd64/amd64/mem.c | 16 | ||||
-rw-r--r-- | sys/i386/i386/mem.c | 16 |
2 files changed, 28 insertions, 4 deletions
diff --git a/sys/amd64/amd64/mem.c b/sys/amd64/amd64/mem.c index ab31e70..de134f1 100644 --- a/sys/amd64/amd64/mem.c +++ b/sys/amd64/amd64/mem.c @@ -461,8 +461,14 @@ mem_ioctl(dev, cmd, data, flags, p) * memory range attributes. */ void -mem_range_attr_get(struct mem_range_desc *mrd, int *arg) +mem_range_attr_get(mrd, arg) + struct mem_range_desc *mrd; + int *arg; { + /* can we handle this? */ + if (mem_range_softc.mr_op == NULL) + return(EOPNOTSUPP); + if (*arg == 0) { *arg = mem_range_softc.mr_ndesc; } else { @@ -471,8 +477,14 @@ mem_range_attr_get(struct mem_range_desc *mrd, int *arg) } int -mem_range_attr_set(struct mem_range_desc *mrd, int *arg) +mem_range_attr_set(mrd, arg) + struct mem_range_desc *mrd; + int *arg; { + /* can we handle this? */ + if (mem_range_softc.mr_op == NULL) + return(EOPNOTSUPP); + return(mem_range_softc.mr_op->set(&mem_range_softc, mrd, arg)); } diff --git a/sys/i386/i386/mem.c b/sys/i386/i386/mem.c index ab31e70..de134f1 100644 --- a/sys/i386/i386/mem.c +++ b/sys/i386/i386/mem.c @@ -461,8 +461,14 @@ mem_ioctl(dev, cmd, data, flags, p) * memory range attributes. */ void -mem_range_attr_get(struct mem_range_desc *mrd, int *arg) +mem_range_attr_get(mrd, arg) + struct mem_range_desc *mrd; + int *arg; { + /* can we handle this? */ + if (mem_range_softc.mr_op == NULL) + return(EOPNOTSUPP); + if (*arg == 0) { *arg = mem_range_softc.mr_ndesc; } else { @@ -471,8 +477,14 @@ mem_range_attr_get(struct mem_range_desc *mrd, int *arg) } int -mem_range_attr_set(struct mem_range_desc *mrd, int *arg) +mem_range_attr_set(mrd, arg) + struct mem_range_desc *mrd; + int *arg; { + /* can we handle this? */ + if (mem_range_softc.mr_op == NULL) + return(EOPNOTSUPP); + return(mem_range_softc.mr_op->set(&mem_range_softc, mrd, arg)); } |