summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2020-03-09 21:46:19 +0100
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2020-03-09 21:46:19 +0100
commit987a93875577af05b2c8c6f16a1f479ba193d0d9 (patch)
tree04ef441348caa44c3e9ceb35ee485456619c2e0c
parent28f3f7153bc72b18d08edcbdd9ef2051396192b1 (diff)
parenteae1961fc21a7c7ebaf2925472631ac404045ab7 (diff)
Merge branch 'master-user_level_drivers' into master-user_level_drivers-debian
-rw-r--r--Makefile.am2
-rw-r--r--Makefrag.am4
-rw-r--r--device/intr.c8
-rw-r--r--device/intr.h (renamed from include/device/intr.h)11
-rw-r--r--doc/mach.texi2
-rw-r--r--i386/i386/fpu.c8
-rw-r--r--include/device/notify.h34
-rw-r--r--include/sys/types.h2
-rw-r--r--kern/startup.c7
9 files changed, 57 insertions, 21 deletions
diff --git a/Makefile.am b/Makefile.am
index 11312a1e..d1968b85 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -170,7 +170,7 @@ noinst_PROGRAMS += \
# This is the list of routines we decide is OK to steal from the C library.
clib_routines := htonl htons ntohl ntohs \
udivdi3 __udivdi3 __udivmoddi4 __umoddi3 \
- __divdi3 \
+ __divdi3 __moddi3 \
__rel_iplt_start __rel_iplt_end \
__ffsdi2 ffs \
_START _start etext _edata end _end # actually ld magic, not libc.
diff --git a/Makefrag.am b/Makefrag.am
index fee77894..6aacbf8d 100644
--- a/Makefrag.am
+++ b/Makefrag.am
@@ -313,6 +313,7 @@ libkernel_a_SOURCES += \
device/ds_routines.c \
device/ds_routines.h \
device/intr.c \
+ device/intr.h \
device/if_ether.h \
device/if_hdr.h \
device/io_req.h \
@@ -359,9 +360,10 @@ include_device_HEADERS = \
include/device/device_reply.defs \
include/device/device_request.defs \
include/device/device_types.defs \
+ include/device/notify.defs \
+ include/device/notify.h \
include/device/device_types.h \
include/device/disk_status.h \
- include/device/intr.h \
include/device/net_status.h \
include/device/tape_status.h \
include/device/tty_status.h
diff --git a/device/intr.c b/device/intr.c
index eb37ecf5..1e9ab898 100644
--- a/device/intr.c
+++ b/device/intr.c
@@ -253,7 +253,7 @@ static boolean_t
deliver_intr (int line, ipc_port_t dest_port)
{
ipc_kmsg_t kmsg;
- mach_intr_notification_t *n;
+ device_intr_notification_t *n;
mach_port_t dest = (mach_port_t) dest_port;
if (dest == MACH_PORT_NULL)
@@ -264,17 +264,17 @@ deliver_intr (int line, ipc_port_t dest_port)
return FALSE;
ikm_init(kmsg, sizeof *n);
- n = (mach_intr_notification_t *) &kmsg->ikm_header;
+ n = (device_intr_notification_t *) &kmsg->ikm_header;
mach_msg_header_t *m = &n->intr_header;
mach_msg_type_t *t = &n->intr_type;
m->msgh_bits = MACH_MSGH_BITS(MACH_MSG_TYPE_PORT_SEND, 0);
m->msgh_size = sizeof *n;
- m->msgh_seqno = INTR_NOTIFY_MSGH_SEQNO;
+ m->msgh_seqno = DEVICE_NOTIFY_MSGH_SEQNO;
m->msgh_local_port = MACH_PORT_NULL;
m->msgh_remote_port = MACH_PORT_NULL;
- m->msgh_id = MACH_INTR_NOTIFY;
+ m->msgh_id = DEVICE_INTR_NOTIFY;
t->msgt_name = MACH_MSG_TYPE_INTEGER_32;
t->msgt_size = 32;
diff --git a/include/device/intr.h b/device/intr.h
index 6da21035..48843cf0 100644
--- a/include/device/intr.h
+++ b/device/intr.h
@@ -4,13 +4,7 @@
#include <device/device_types.h>
#include <kern/queue.h>
-
-typedef struct
-{
- mach_msg_header_t intr_header;
- mach_msg_type_t intr_type;
- int line;
-} mach_intr_notification_t;
+#include <device/notify.h>
typedef struct intr_entry
{
@@ -21,8 +15,7 @@ typedef struct intr_entry
int unacked_interrupts; /* Number of times irqs were disabled for this */
} user_intr_t;
-#define INTR_NOTIFY_MSGH_SEQNO 0
-#define MACH_INTR_NOTIFY 424242
+#define DEVICE_NOTIFY_MSGH_SEQNO 0
int install_user_intr_handler (unsigned int line,
unsigned long flags,
diff --git a/doc/mach.texi b/doc/mach.texi
index 2bd085b2..dd1e5edd 100644
--- a/doc/mach.texi
+++ b/doc/mach.texi
@@ -5648,7 +5648,9 @@ mapped-time interface:
do
@{
secs = mtime->seconds;
+ __sync_synchronize();
usecs = mtime->microseconds;
+ __sync_synchronize();
@}
while (secs != mtime->check_seconds);
@end example
diff --git a/i386/i386/fpu.c b/i386/i386/fpu.c
index 6ee20150..0887a32c 100644
--- a/i386/i386/fpu.c
+++ b/i386/i386/fpu.c
@@ -492,7 +492,7 @@ ASSERT_IPL(SPL0);
* divide by zero
* overflow
*
- * Use 53-bit precision.
+ * Use 64-bit precision.
*/
static void fpinit(thread_t thread)
{
@@ -508,7 +508,7 @@ ASSERT_IPL(SPL0);
{
fnstcw(&control);
control &= ~(FPC_PC|FPC_RC); /* Clear precision & rounding control */
- control |= (FPC_PC_53 | /* Set precision */
+ control |= (FPC_PC_64 | /* Set precision */
FPC_RC_RN | /* round-to-nearest */
FPC_ZE | /* Suppress zero-divide */
FPC_OE | /* and overflow */
@@ -860,7 +860,7 @@ fp_state_alloc(void)
if (fp_kind == FP_387X) {
ifps->xfp_save_state.fp_control = (0x037f
& ~(FPC_IM|FPC_ZM|FPC_OM|FPC_PC))
- | (FPC_PC_53|FPC_IC_AFF);
+ | (FPC_PC_64|FPC_IC_AFF);
ifps->xfp_save_state.fp_status = 0;
ifps->xfp_save_state.fp_tag = 0xffff; /* all empty */
if (CPU_HAS_FEATURE(CPU_FEATURE_SSE))
@@ -868,7 +868,7 @@ fp_state_alloc(void)
} else {
ifps->fp_save_state.fp_control = (0x037f
& ~(FPC_IM|FPC_ZM|FPC_OM|FPC_PC))
- | (FPC_PC_53|FPC_IC_AFF);
+ | (FPC_PC_64|FPC_IC_AFF);
ifps->fp_save_state.fp_status = 0;
ifps->fp_save_state.fp_tag = 0xffff; /* all empty */
}
diff --git a/include/device/notify.h b/include/device/notify.h
new file mode 100644
index 00000000..91d518ca
--- /dev/null
+++ b/include/device/notify.h
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2010 Free Software Foundation, Inc.
+ *
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ *
+ * THE FREE SOFTWARE FOUNDATIONALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION. THE FREE SOFTWARE FOUNDATION DISCLAIMS ANY LIABILITY OF ANY KIND
+ * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ */
+
+/*
+ * Device notification definitions.
+ */
+
+#ifndef _MACH_DEVICE_NOTIFY_H_
+#define _MACH_DEVICE_NOTIFY_H_
+
+#include <mach/port.h>
+#include <mach/message.h>
+
+typedef struct
+{
+ mach_msg_header_t intr_header;
+ mach_msg_type_t intr_type;
+ int line;
+} device_intr_notification_t;
+
+#define DEVICE_INTR_NOTIFY 424242
+
+#endif /* _MACH_DEVICE_NOTIFY_H_ */
diff --git a/include/sys/types.h b/include/sys/types.h
index d576cc2a..8d5af37a 100644
--- a/include/sys/types.h
+++ b/include/sys/types.h
@@ -54,7 +54,7 @@ typedef char * caddr_t; /* address of a (signed) char */
#ifndef _TIME_T
#define _TIME_T
-typedef unsigned int time_t;
+typedef unsigned long long time_t;
#endif
#define RAND_MAX 0x7fffffff
diff --git a/kern/startup.c b/kern/startup.c
index 5077a0b8..1f873192 100644
--- a/kern/startup.c
+++ b/kern/startup.c
@@ -90,6 +90,7 @@ extern char *kernel_cmdline;
void setup_main(void)
{
thread_t startup_thread;
+ phys_addr_t memsize;
#if MACH_KDB
/*
@@ -137,7 +138,11 @@ void setup_main(void)
mapable_time_init();
machine_info.max_cpus = NCPUS;
- machine_info.memory_size = vm_page_mem_size(); /* XXX phys_addr_t -> vm_size_t */
+ memsize = vm_page_mem_size();
+ machine_info.memory_size = memsize;
+ if (machine_info.memory_size < memsize)
+ /* Overflow, report at least 4GB */
+ machine_info.memory_size = ~0;
machine_info.avail_cpus = 0;
machine_info.major_version = KERNEL_MAJOR_VERSION;
machine_info.minor_version = KERNEL_MINOR_VERSION;