diff options
author | Christian Weisgerber <naddy@cvs.openbsd.org> | 2016-03-02 15:14:45 +0000 |
---|---|---|
committer | Christian Weisgerber <naddy@cvs.openbsd.org> | 2016-03-02 15:14:45 +0000 |
commit | 292c73e93e88c799bb200b7e84fbb605f5f7b395 (patch) | |
tree | 0a2a9e208e2c550adf94b25f420401e3fe2fb9ec | |
parent | 825c9ecb5ab08b22c1a752104a3120bec7c1a272 (diff) |
Disentangle the Zaurus bootstrap from compat/linux and move the
syscall definitions directly into compat_linux.h.
For consistency, always use the termios defines without LINUX_
prefix.
ok visa@, help in getting this right from jsg@
-rw-r--r-- | sys/arch/zaurus/stand/zboot/compat_linux.h | 148 | ||||
-rw-r--r-- | sys/arch/zaurus/stand/zboot/termios.c | 12 |
2 files changed, 102 insertions, 58 deletions
diff --git a/sys/arch/zaurus/stand/zboot/compat_linux.h b/sys/arch/zaurus/stand/zboot/compat_linux.h index 084d07140e2..dc6c79cc93a 100644 --- a/sys/arch/zaurus/stand/zboot/compat_linux.h +++ b/sys/arch/zaurus/stand/zboot/compat_linux.h @@ -1,4 +1,4 @@ -/* $OpenBSD: compat_linux.h,v 1.9 2016/02/28 15:36:25 naddy Exp $ */ +/* $OpenBSD: compat_linux.h,v 1.10 2016/03/02 15:14:44 naddy Exp $ */ /* * Copyright (c) 2005 Uwe Stuehler <uwe@bsdx.de> @@ -20,12 +20,6 @@ #ifndef _LOCORE -#include <compat/linux/linux_types.h> -#include <compat/linux/linux_fcntl.h> -#include <compat/linux/linux_termios.h> -struct proc; -#include <compat/linux/linux_ioctl.h> - #define INT_LIMIT(x) (~((x)1 << (sizeof(x)*8 - 1))) #define OFFSET_MAX INT_LIMIT(long long) #define OFFT_OFFSET_MAX INT_LIMIT(long) @@ -36,43 +30,97 @@ struct proc; #undef SEEK_SET #undef SEEK_CUR -#define O_RDONLY LINUX_O_RDONLY -#define O_WRONLY LINUX_O_WRONLY -#define O_RDWR LINUX_O_RDWR +#define O_RDONLY 0x0000 +#define O_WRONLY 0x0001 +#define O_RDWR 0x0002 #define SEEK_SET 0 #define SEEK_CUR 1 #define LINUX_EOVERFLOW 75 -#define termios linux_termios - -#define IMAXBEL LINUX_IMAXBEL -#define IGNBRK LINUX_IGNBRK -#define BRKINT LINUX_BRKINT -#define PARMRK LINUX_PARMRK -#define ISTRIP LINUX_ISTRIP -#define INLCR LINUX_INLCR -#define IGNCR LINUX_IGNCR -#define ICRNL LINUX_ICRNL -#define IXON LINUX_IXON -#define OPOST LINUX_OPOST -#define ECHO LINUX_ECHO -#define ECHONL LINUX_ECHONL -#define ICANON LINUX_ICANON -#define ISIG LINUX_ISIG -#define IEXTEN LINUX_IEXTEN -#define CSIZE LINUX_CSIZE -#define PARENB LINUX_PARENB -#define CS8 LINUX_CS8 - -#define TIOCGETA LINUX_TCGETS -#define TIOCSETA LINUX_TCSETS -#define TIOCSETAW LINUX_TCSETSW -#define TIOCSETAF LINUX_TCSETSF - -#define TCSANOW LINUX_TCSANOW -#define TCSADRAIN LINUX_TCSADRAIN -#define TCSAFLUSH LINUX_TCSAFLUSH +struct linux_stat { + unsigned short lst_dev; + unsigned short pad1; + unsigned long lst_ino; + unsigned short lst_mode; + unsigned short lst_nlink; + unsigned short lst_uid; + unsigned short lst_gid; + unsigned short lst_rdev; + unsigned short pad2; + long lst_size; + unsigned long lst_blksize; + unsigned long lst_blocks; + long lst_atime; + unsigned long unused1; + long lst_mtime; + unsigned long unused2; + long lst_ctime; + unsigned long unused3; + unsigned long unused4; + unsigned long unused5; +}; + +struct termios { + unsigned long c_iflag; + unsigned long c_oflag; + unsigned long c_cflag; + unsigned long c_lflag; + unsigned char c_line; + unsigned char c_cc[19]; +}; + +#define IGNBRK 0x0000001 +#define BRKINT 0x0000002 +#define PARMRK 0x0000008 +#define ISTRIP 0x0000020 +#define INLCR 0x0000040 +#define IGNCR 0x0000080 +#define ICRNL 0x0000100 +#define IXON 0x0000400 +#define IMAXBEL 0x0002000 + +#define OPOST 0x0000001 + +#define ISIG 0x00000001 +#define ICANON 0x00000002 +#define ECHO 0x00000008 +#define ECHONL 0x00000040 +#define IEXTEN 0x00008000 + +#define CBAUD 0x0000100f +#define B0 0x00000000 +#define B50 0x00000001 +#define B75 0x00000002 +#define B110 0x00000003 +#define B134 0x00000004 +#define B150 0x00000005 +#define B200 0x00000006 +#define B300 0x00000007 +#define B600 0x00000008 +#define B1200 0x00000009 +#define B1800 0x0000000a +#define B2400 0x0000000b +#define B4800 0x0000000c +#define B9600 0x0000000d +#define B19200 0x0000000e +#define B38400 0x0000000f +#define B57600 0x00001001 +#define B115200 0x00001002 +#define B230400 0x00001003 + +#define CSIZE 0x00000030 +#define PARENB 0x00000100 +#define CS8 0x00000030 + +#define TIOCGETA (('T' << 8) | 1) +#define TIOCSETA (('T' << 8) | 2) +#define TIOCSETAW (('T' << 8) | 3) +#define TIOCSETAF (('T' << 8) | 4) + +#define TCSANOW 0 +#define TCSADRAIN 1 +#define TCSAFLUSH 2 typedef unsigned int speed_t; @@ -83,21 +131,19 @@ int tcsetattr(int, int, struct termios *); #endif /* !_LOCORE */ -#include <compat/linux/linux_syscall.h> - /* linux/asm/unistd.h */ #define __NR_SYSCALL_BASE 0x900000 -#define __NR_exit (__NR_SYSCALL_BASE+LINUX_SYS_exit) -#define __NR_read (__NR_SYSCALL_BASE+LINUX_SYS_read) -#define __NR_write (__NR_SYSCALL_BASE+LINUX_SYS_write) -#define __NR_open (__NR_SYSCALL_BASE+LINUX_SYS_open) -#define __NR_close (__NR_SYSCALL_BASE+LINUX_SYS_close) -#define __NR_time (__NR_SYSCALL_BASE+LINUX_SYS_time) -#define __NR_lseek32 (__NR_SYSCALL_BASE+LINUX_SYS_lseek) -#define __NR_ioctl (__NR_SYSCALL_BASE+LINUX_SYS_ioctl) -#define __NR_select (__NR_SYSCALL_BASE+LINUX_SYS_select) -#define __NR_stat (__NR_SYSCALL_BASE+LINUX_SYS_stat) +#define __NR_exit (__NR_SYSCALL_BASE+1) +#define __NR_read (__NR_SYSCALL_BASE+3) +#define __NR_write (__NR_SYSCALL_BASE+4) +#define __NR_open (__NR_SYSCALL_BASE+5) +#define __NR_close (__NR_SYSCALL_BASE+6) +#define __NR_time (__NR_SYSCALL_BASE+13) +#define __NR_lseek32 (__NR_SYSCALL_BASE+19) +#define __NR_ioctl (__NR_SYSCALL_BASE+54) +#define __NR_stat (__NR_SYSCALL_BASE+106) #define __NR_syscall (__NR_SYSCALL_BASE+113) +#define __NR_select (__NR_SYSCALL_BASE+142) #undef SYS_select #define SYS_select __NR_select diff --git a/sys/arch/zaurus/stand/zboot/termios.c b/sys/arch/zaurus/stand/zboot/termios.c index 87f86085673..e35d760be25 100644 --- a/sys/arch/zaurus/stand/zboot/termios.c +++ b/sys/arch/zaurus/stand/zboot/termios.c @@ -1,4 +1,4 @@ -/* $OpenBSD: termios.c,v 1.2 2005/05/24 20:38:20 uwe Exp $ */ +/* $OpenBSD: termios.c,v 1.3 2016/03/02 15:14:44 naddy Exp $ */ /*- * Copyright (c) 1989, 1993 @@ -39,10 +39,8 @@ static speed_t linux_speeds[] = { }; static const int linux_spmasks[] = { - LINUX_B0, LINUX_B50, LINUX_B75, LINUX_B110, LINUX_B134, LINUX_B150, - LINUX_B200, LINUX_B300, LINUX_B600, LINUX_B1200, LINUX_B1800, - LINUX_B2400, LINUX_B4800, LINUX_B9600, LINUX_B19200, LINUX_B38400, - LINUX_B57600, LINUX_B115200, LINUX_B230400 + B0, B50, B75, B110, B134, B150, B200, B300, B600, B1200, B1800, + B2400, B4800, B9600, B19200, B38400, B57600, B115200, B230400 }; int @@ -51,14 +49,14 @@ cfsetspeed(struct termios *t, speed_t speed) int mask; int i; - mask = LINUX_B9600; /* XXX default value should this be 0? */ + mask = B9600; /* XXX default value should this be 0? */ for (i = 0; i < sizeof (linux_speeds) / sizeof (speed_t); i++) { if (speed == linux_speeds[i]) { mask = linux_spmasks[i]; break; } } - t->c_cflag &= ~LINUX_CBAUD; + t->c_cflag &= ~CBAUD; t->c_cflag |= mask; return (0); |