mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-21 20:40:05 +00:00
arm: Remove ioperm/iopl/inb/inw/inl/outb/outw/outl support
Linux only supports the required ISA sysctls on StrongARM devices, which are armv4 and no longer tested during glibc development and probably bit-rotted by this point. (No reported test results, and the last discussion of armv4 support was in the glibc 2.19 release notes.)
This commit is contained in:
parent
0bb8f8c791
commit
6b33f373c7
10
ChangeLog
10
ChangeLog
@ -1,3 +1,13 @@
|
||||
2019-05-29 Florian Weimer <fweimer@redhat.com>
|
||||
|
||||
arm: Remove ioperm/iopl/inb/inw/inl/outb/outw/outl support.
|
||||
* sysdeps/unix/sysv/linux/arm/Makefile
|
||||
[$(subdir) == misc] (sysdep_headers): Remove sys/io.h.
|
||||
* sysdeps/unix/sysv/linux/arm/sys/io.h: Remove file.
|
||||
* sysdeps/unix/sysv/linux/arm/ioperm.c: Rewrite file.
|
||||
(ioperm, iopl, inb, inw, inl, outb, outw, outl): Turn into
|
||||
compatibility symbols.
|
||||
|
||||
2019-05-31 Florian Weimer <fweimer@redhat.com>
|
||||
|
||||
* sysdeps/unix/sysv/linux/syscall-names.list: Add oddly named
|
||||
|
3
NEWS
3
NEWS
@ -58,6 +58,9 @@ Deprecated and removed features, and other changes affecting compatibility:
|
||||
configurations) has been removed, following the deprecation of this
|
||||
subarchitecture in version 8 of GCC, and its removal in version 9.
|
||||
|
||||
* On 32-bit Arm, support for the port-based I/O emulation and the <sys/io.h>
|
||||
header have been removed.
|
||||
|
||||
Changes to build and runtime requirements:
|
||||
|
||||
* GCC 6.2 or later is required to build the GNU C Library.
|
||||
|
@ -5,7 +5,7 @@ endif
|
||||
|
||||
ifeq ($(subdir),misc)
|
||||
sysdep_routines += ioperm
|
||||
sysdep_headers += sys/elf.h sys/io.h
|
||||
sysdep_headers += sys/elf.h
|
||||
endif
|
||||
|
||||
ifeq ($(subdir),signal)
|
||||
|
@ -17,167 +17,71 @@
|
||||
License along with the GNU C Library. If not, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* I/O port access on the ARM is something of a fiction. What we do is to
|
||||
map an appropriate area of /dev/mem into user space so that a program
|
||||
can blast away at the hardware in such a way as to generate I/O cycles
|
||||
on the bus. To insulate user code from dependencies on particular
|
||||
hardware we don't allow calls to inb() and friends to be inlined, but
|
||||
force them to come through code in here every time. Performance-critical
|
||||
registers tend to be memory mapped these days so this should be no big
|
||||
problem. */
|
||||
#include <shlib-compat.h>
|
||||
|
||||
/* Once upon a time this file used mprotect to enable and disable
|
||||
access to particular areas of I/O space. Unfortunately the
|
||||
mprotect syscall also has the side effect of enabling caching for
|
||||
the area affected (this is a kernel limitation). So we now just
|
||||
enable all the ports all of the time. */
|
||||
#if SHLIB_COMPAT (libc, GLIBC_2_4, GLIBC_2_30)
|
||||
# include <errno.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/mman.h>
|
||||
|
||||
#include <sys/sysctl.h>
|
||||
|
||||
#define MAX_PORT 0x10000
|
||||
|
||||
static struct {
|
||||
unsigned long int base;
|
||||
unsigned long int io_base;
|
||||
unsigned int shift;
|
||||
unsigned int initdone; /* since all the above could be 0 */
|
||||
} io;
|
||||
|
||||
#define IO_ADDR(port) (io.base + ((port) << io.shift))
|
||||
|
||||
/*
|
||||
* Initialize I/O system. The io_bae and port_shift values are fetched
|
||||
* using sysctl (CTL_BUS, CTL_BUS_ISA, ISA_*).
|
||||
*/
|
||||
|
||||
static int
|
||||
init_iosys (void)
|
||||
int
|
||||
ioperm (unsigned long int from, unsigned long int num, int turn_on)
|
||||
{
|
||||
static int iobase_name[] = { CTL_BUS, CTL_BUS_ISA, BUS_ISA_PORT_BASE };
|
||||
static int ioshift_name[] = { CTL_BUS, CTL_BUS_ISA, BUS_ISA_PORT_SHIFT };
|
||||
size_t len = sizeof (io.base);
|
||||
|
||||
if (! __sysctl (iobase_name, 3, &io.io_base, &len, NULL, 0)
|
||||
&& ! __sysctl (ioshift_name, 3, &io.shift, &len, NULL, 0))
|
||||
{
|
||||
io.initdone = 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* sysctl has failed... */
|
||||
__set_errno (ENODEV);
|
||||
__set_errno (ENOSYS);
|
||||
return -1;
|
||||
}
|
||||
compat_symbol (libc, ioperm, ioperm, GLIBC_2_4);
|
||||
|
||||
int
|
||||
_ioperm (unsigned long int from, unsigned long int num, int turn_on)
|
||||
iopl (unsigned int level)
|
||||
{
|
||||
if (! io.initdone && init_iosys () < 0)
|
||||
return -1;
|
||||
__set_errno (ENOSYS);
|
||||
return -1;
|
||||
}
|
||||
compat_symbol (libc, iopl, iopl, GLIBC_2_4);
|
||||
|
||||
/* this test isn't as silly as it may look like; consider overflows! */
|
||||
if (from >= MAX_PORT || from + num > MAX_PORT)
|
||||
{
|
||||
__set_errno (EINVAL);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (turn_on)
|
||||
{
|
||||
if (! io.base)
|
||||
{
|
||||
int fd;
|
||||
/* The remaining functions do not have any way to indicate failure.
|
||||
However, it is only valid to call them after calling ioperm/iopl,
|
||||
which will have indicated failure. */
|
||||
|
||||
fd = __open ("/dev/mem", O_RDWR);
|
||||
if (fd < 0)
|
||||
return -1;
|
||||
void
|
||||
outb (unsigned char b, unsigned long int port)
|
||||
{
|
||||
}
|
||||
compat_symbol (libc, outb, outb, GLIBC_2_4);
|
||||
|
||||
io.base =
|
||||
(unsigned long int) __mmap (0, MAX_PORT << io.shift,
|
||||
PROT_READ | PROT_WRITE,
|
||||
MAP_SHARED, fd, io.io_base);
|
||||
__close (fd);
|
||||
if ((long) io.base == -1)
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
void
|
||||
outw (unsigned short b, unsigned long int port)
|
||||
{
|
||||
}
|
||||
compat_symbol (libc, outw, outw, GLIBC_2_4);
|
||||
|
||||
void
|
||||
outl (unsigned int b, unsigned long int port)
|
||||
{
|
||||
}
|
||||
compat_symbol (libc, outl, outl, GLIBC_2_4);
|
||||
|
||||
unsigned int
|
||||
inb (unsigned long int port)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
_iopl (unsigned int level)
|
||||
{
|
||||
if (level > 3)
|
||||
{
|
||||
__set_errno (EINVAL);
|
||||
return -1;
|
||||
}
|
||||
if (level)
|
||||
{
|
||||
return _ioperm (0, MAX_PORT, 1);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
_outb (unsigned char b, unsigned long int port)
|
||||
{
|
||||
*((volatile unsigned char *)(IO_ADDR (port))) = b;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
_outw (unsigned short b, unsigned long int port)
|
||||
{
|
||||
*((volatile unsigned short *)(IO_ADDR (port))) = b;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
_outl (unsigned int b, unsigned long int port)
|
||||
{
|
||||
*((volatile unsigned long *)(IO_ADDR (port))) = b;
|
||||
}
|
||||
compat_symbol (libc, inb, inb, GLIBC_2_4);
|
||||
|
||||
|
||||
unsigned int
|
||||
_inb (unsigned long int port)
|
||||
inw (unsigned long int port)
|
||||
{
|
||||
return *((volatile unsigned char *)(IO_ADDR (port)));
|
||||
return 0;
|
||||
}
|
||||
compat_symbol (libc, inw, inw, GLIBC_2_4);
|
||||
|
||||
|
||||
unsigned int
|
||||
_inw (unsigned long int port)
|
||||
inl (unsigned long int port)
|
||||
{
|
||||
return *((volatile unsigned short *)(IO_ADDR (port)));
|
||||
return 0;
|
||||
}
|
||||
compat_symbol (libc, inl, inl, GLIBC_2_4);
|
||||
|
||||
|
||||
unsigned int
|
||||
_inl (unsigned long int port)
|
||||
{
|
||||
return *((volatile unsigned long *)(IO_ADDR (port)));
|
||||
}
|
||||
|
||||
weak_alias (_ioperm, ioperm);
|
||||
weak_alias (_iopl, iopl);
|
||||
weak_alias (_inb, inb);
|
||||
weak_alias (_inw, inw);
|
||||
weak_alias (_inl, inl);
|
||||
weak_alias (_outb, outb);
|
||||
weak_alias (_outw, outw);
|
||||
weak_alias (_outl, outl);
|
||||
#endif /* SHLIB_COMAT */
|
||||
|
@ -1,47 +0,0 @@
|
||||
/* Copyright (C) 1996-2019 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library 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
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with the GNU C Library. If not, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef _SYS_IO_H
|
||||
|
||||
#define _SYS_IO_H 1
|
||||
#include <features.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
/* If TURN_ON is TRUE, request for permission to do direct i/o on the
|
||||
port numbers in the range [FROM,FROM+NUM-1]. Otherwise, turn I/O
|
||||
permission off for that range. This call requires root privileges. */
|
||||
extern int ioperm (unsigned long int __from, unsigned long int __num,
|
||||
int __turn_on) __THROW;
|
||||
|
||||
/* Set the I/O privilege level to LEVEL. If LEVEL is nonzero,
|
||||
permission to access any I/O port is granted. This call requires
|
||||
root privileges. */
|
||||
extern int iopl (int __level) __THROW;
|
||||
|
||||
/* The functions that actually perform reads and writes. */
|
||||
extern unsigned char inb (unsigned long int __port) __THROW;
|
||||
extern unsigned short int inw (unsigned long int __port) __THROW;
|
||||
extern unsigned long int inl (unsigned long int __port) __THROW;
|
||||
|
||||
extern void outb (unsigned char __value, unsigned long int __port) __THROW;
|
||||
extern void outw (unsigned short __value, unsigned long int __port) __THROW;
|
||||
extern void outl (unsigned long __value, unsigned long int __port) __THROW;
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* _SYS_IO_H */
|
Loading…
Reference in New Issue
Block a user