summaryrefslogtreecommitdiff
path: root/sys/arch/zaurus
diff options
context:
space:
mode:
authorUwe Stuehler <uwe@cvs.openbsd.org>2005-04-13 04:33:48 +0000
committerUwe Stuehler <uwe@cvs.openbsd.org>2005-04-13 04:33:48 +0000
commitff33f430a373c5630d1d0829e64021f3d8b58251 (patch)
tree42b89ad78df044fc8258efda5fa16d481d777e4f /sys/arch/zaurus
parent9e22fe2b0b264f8998a850a93b533b01a5a09015 (diff)
boot when then timeout expires; prodded by drahn@ dlg@ and others
Diffstat (limited to 'sys/arch/zaurus')
-rw-r--r--sys/arch/zaurus/stand/zboot/compat_linux.h3
-rw-r--r--sys/arch/zaurus/stand/zboot/unixdev.c16
-rw-r--r--sys/arch/zaurus/stand/zboot/unixsys.S26
3 files changed, 35 insertions, 10 deletions
diff --git a/sys/arch/zaurus/stand/zboot/compat_linux.h b/sys/arch/zaurus/stand/zboot/compat_linux.h
index 77e50bdcd3f..d983d460997 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.4 2005/01/24 22:20:33 uwe Exp $ */
+/* $OpenBSD: compat_linux.h,v 1.5 2005/04/13 04:33:47 uwe Exp $ */
/*
* Copyright (c) 2005 Uwe Stuehler <uwe@bsdx.de>
@@ -48,6 +48,7 @@
#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__new_select (__NR_SYSCALL_BASE+142)
diff --git a/sys/arch/zaurus/stand/zboot/unixdev.c b/sys/arch/zaurus/stand/zboot/unixdev.c
index 400b6adc2dc..e4d713a8e6f 100644
--- a/sys/arch/zaurus/stand/zboot/unixdev.c
+++ b/sys/arch/zaurus/stand/zboot/unixdev.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: unixdev.c,v 1.3 2005/01/24 22:20:33 uwe Exp $ */
+/* $OpenBSD: unixdev.c,v 1.4 2005/04/13 04:33:47 uwe Exp $ */
/*
* Copyright (c) 1996-1998 Michael Shalayeff
@@ -38,6 +38,9 @@
#include "libsa.h"
#include <lib/libsa/unixdev.h>
+/* unixsys.S */
+int uselect(int, fd_set *, fd_set *, fd_set *, struct timeval *);
+
int
unixstrategy(void *devdata, int rw, daddr_t blk, size_t size, void *buf,
size_t *rsize)
@@ -170,11 +173,16 @@ unix_getc(dev_t dev)
int rc;
tv.tv_sec = 0;
- tv.tv_usec = 100000;
+ tv.tv_usec = 0;
FD_ZERO(&fdset);
FD_SET(0, &fdset);
- if ((rc = syscall(SYS_select, 1, &fdset, NULL, NULL, &tv)) <= 0)
+#if 0
+ rc = syscall(SYS_select, 1, &fdset, NULL, NULL, &tv);
+#else
+ rc = uselect(1, &fdset, NULL, NULL, &tv);
+#endif
+ if (rc <= 0)
return 0;
else
return 1;
@@ -188,7 +196,7 @@ unix_getc(dev_t dev)
time_t
getsecs(void)
{
- return 1;
+ return (time_t)syscall(__NR_time, NULL);
}
void
diff --git a/sys/arch/zaurus/stand/zboot/unixsys.S b/sys/arch/zaurus/stand/zboot/unixsys.S
index 22d5146dd9f..a956adc2240 100644
--- a/sys/arch/zaurus/stand/zboot/unixsys.S
+++ b/sys/arch/zaurus/stand/zboot/unixsys.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: unixsys.S,v 1.4 2005/01/24 22:20:33 uwe Exp $ */
+/* $OpenBSD: unixsys.S,v 1.5 2005/04/13 04:33:47 uwe Exp $ */
/*
* Copyright (c) 2005 Uwe Stuehler <uwe@bsdx.de>
@@ -39,20 +39,36 @@ RSYSCALL(exit)
cmn r0, #4096
movcc pc, lr
rsb r0, r0, #0
- ldr r1, Lerrno /* XXX clobbers arg1 */
+ ldr r1, .Lerrno /* XXX clobbers arg1 */
str r0, [r1]
mvn r0, #0
mov pc, lr
-Lerrno:
+.Lerrno:
.word errno
-ENTRY(__syscall)
+/* XXX only works for up to four arguments. */
ENTRY(syscall)
swi __NR_syscall
b 1b
- .data
+ENTRY(uselect)
+ str r4, [sp, #-4]!
+ ldr r4, [sp, #4]
+ swi __NR_select
+ ldr r4, [sp], #4
+ cmn r0, #4096
+ movcc pc, lr
+ rsb r0, r0, #0
+ str r1, [sp, #-4]!
+ ldr r1, .Lerrno
+ str r0, [r1]
+ ldr r1, [sp], #4
+ mvn r0, #0
+ mov pc, lr
+
+.data
+
.global errno
errno:
.word 0