On Sun, Feb 28, 2016 at 05:25:06PM +0100, Christian Weisgerber wrote:
> This disentangles the zaurus bootstrap from compat/linux.
>
> We only need a small subset of syscall numbers and constants, so
> this moves the definitions directly into zboot/compat_linux.h.
> Compared to compat/linux/*.h, I skipped various intermediate typedefs
> and defines.
>
> It's silly to have half of the termios defines prefixed by LINUX_
> and the other half not, so I've unified the usage without the prefix.
>
> THIS DIFF SHOULD NOT CAUSE ANY BINARY CHANGES.
>
> (I don't have access to an arm machine. I compiled the .c files
> on a different platform, and there were no code changes, although
> in two instances a local bss symbol changed its name suffix.)
>
> This could use some double checking and verification that unixsys.o
> doesn't change.
After changing the Makefile to make it build on armv7, it looks like the
diff causes the checksums on the following to change:
(MD5) diskprobe.o: FAILED
(MD5) exit.o: FAILED
(MD5) unixsys.o: FAILED
(MD5) zboot: FAILED
In the case of unixsys.o the diff in the .s looks like:
@@ -53,7 +50,7 @@
.text; .align 0; .globl uselect; .type uselect,#function; uselect:;
str r4, [sp, #-4]!
ldr r4, [sp, #4]
- swi (0x900000 +142)
+ swi (0x900000 +82)
ldr r4, [sp], #4
cmn r0, #4096
movcc pc, lr
You've used the wrong number for select, should be:
linux/linux_syscall.h:#define LINUX_SYS_select 142
diskprobe diff:
@@ -344,7 +344,7 @@ bios_getdiskinfo:
.L66:
.align 2
.L65:
- .word path.2502
+ .word path.2337
.word .LC3
.word .LC0
.size bios_getdiskinfo, .-bios_getdiskinfo
@@ -387,8 +387,8 @@ diskprobe:
strb r2, [r5, #2]
strb r2, [r5, #3]
strb r5, [r5, #4]
- mov r9, r2
str r2, [fp, #-52]
+ mov r9, r2
mov r7, r2
.L68:
mov r0, #452
@@ -551,7 +551,7 @@ diskprobe:
.L86:
.align 2
.L85:
- .word C.0.2450
+ .word C.0.2285
.word disklist
.word .LC4
.word -1610612224
@@ -565,13 +565,13 @@ diskprobe:
.size timeout, 4
timeout:
.word 10
- .local path.2502
- .comm path.2502,1024,1
+ .local path.2337
+ .comm path.2337,1024,1
.section .rodata
.align 2
- .type C.0.2450, %object
- .size C.0.2450, 8
-C.0.2450:
+ .type C.0.2285, %object
+ .size C.0.2285, 8
+C.0.2285:
.word 128
.word 130
.comm disklist,8,1
exit diff:
@@ -67,8 +67,8 @@ panic:
.L15:
.align 2
.L14:
- .word paniced.1926
+ .word paniced.1761
.word .LC0
.size panic, .-panic
- .local paniced.1926
- .comm paniced.1926,4,4
+ .local paniced.1761
+ .comm paniced.1761,4,4
>
>
> Index: compat_linux.h
> ===================================================================
> RCS file: /cvs/src/sys/arch/zaurus/stand/zboot/compat_linux.h,v
> retrieving revision 1.9
> diff -u -p -r1.9 compat_linux.h
> --- compat_linux.h 28 Feb 2016 15:36:25 -0000 1.9
> +++ compat_linux.h 28 Feb 2016 16:11:39 -0000
> @@ -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,20 +131,18 @@ 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_select (__NR_SYSCALL_BASE+82)
> +#define __NR_stat (__NR_SYSCALL_BASE+106)
> #define __NR_syscall (__NR_SYSCALL_BASE+113)
>
> #undef SYS_select
> Index: termios.c
> ===================================================================
> RCS file: /cvs/src/sys/arch/zaurus/stand/zboot/termios.c,v
> retrieving revision 1.2
> diff -u -p -r1.2 termios.c
> --- termios.c 24 May 2005 20:38:20 -0000 1.2
> +++ termios.c 27 Feb 2016 18:37:33 -0000
> @@ -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 sp
> 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);
> --
> Christian "naddy" Weisgerber [email protected]
>