summaryrefslogtreecommitdiffstats
path: root/sys/i386
diff options
context:
space:
mode:
authordeischen <deischen@FreeBSD.org>2002-11-16 06:35:53 +0000
committerdeischen <deischen@FreeBSD.org>2002-11-16 06:35:53 +0000
commit31ea801074585bde84b74ea76bbedd715ad2f3a4 (patch)
tree7153d8e405a5cd14ef74512c9e674270132975b7 /sys/i386
parenta858c2cb5c0438dd0886b2672ecba35cc82bf1dc (diff)
downloadFreeBSD-src-31ea801074585bde84b74ea76bbedd715ad2f3a4.zip
FreeBSD-src-31ea801074585bde84b74ea76bbedd715ad2f3a4.tar.gz
Add getcontext, setcontext, and swapcontext as system calls.
Previously these were libc functions but were requested to be made into system calls for atomicity and to coalesce what might be two entrances into the kernel (signal mask setting and floating point trap) into one. A few style nits and comments from bde are also included. Tested on alpha by: gallatin
Diffstat (limited to 'sys/i386')
-rw-r--r--sys/i386/i386/machdep.c3
-rw-r--r--sys/i386/include/signal.h4
-rw-r--r--sys/i386/include/ucontext.h13
-rw-r--r--sys/i386/isa/npx.c4
4 files changed, 9 insertions, 15 deletions
diff --git a/sys/i386/i386/machdep.c b/sys/i386/i386/machdep.c
index 181463e..1aedc3d 100644
--- a/sys/i386/i386/machdep.c
+++ b/sys/i386/i386/machdep.c
@@ -2317,7 +2317,7 @@ set_fpregs(struct thread *td, struct fpreg *fpregs)
/*
* Get machine context.
*/
-void
+int
get_mcontext(struct thread *td, mcontext_t *mcp)
{
struct trapframe *tp;
@@ -2344,6 +2344,7 @@ get_mcontext(struct thread *td, mcontext_t *mcp)
mcp->mc_ss = tp->tf_ss;
mcp->mc_len = sizeof(*mcp);
get_fpcontext(td, mcp);
+ return (0);
}
/*
diff --git a/sys/i386/include/signal.h b/sys/i386/include/signal.h
index 29a9776..efc7ef0 100644
--- a/sys/i386/include/signal.h
+++ b/sys/i386/include/signal.h
@@ -119,7 +119,7 @@ struct sigcontext {
int sc_efl;
int sc_esp;
int sc_ss;
- int sc_len; /* sizeof(struct mcontext_t) */
+ int sc_len; /* sizeof(mcontext_t) */
/*
* XXX - See <machine/ucontext.h> and <machine/npx.h> for
* the following fields.
@@ -127,7 +127,7 @@ struct sigcontext {
int sc_fpformat;
int sc_ownedfp;
int sc_spare1[1];
- int sc_fpregs[128];
+ int sc_fpstate[128];
int sc_spare2[8];
};
diff --git a/sys/i386/include/ucontext.h b/sys/i386/include/ucontext.h
index af9b4fd..ea6f0b6 100644
--- a/sys/i386/include/ucontext.h
+++ b/sys/i386/include/ucontext.h
@@ -38,7 +38,7 @@ typedef struct __mcontext {
* and ucontext_t at the same time.
*/
int mc_onstack; /* XXX - sigcontext compat. */
- int mc_gs;
+ int mc_gs; /* machine state (trapframe) */
int mc_fs;
int mc_es;
int mc_ds;
@@ -55,7 +55,7 @@ typedef struct __mcontext {
int mc_eip;
int mc_cs;
int mc_eflags;
- int mc_esp; /* machine state */
+ int mc_esp;
int mc_ss;
int mc_len; /* sizeof(mcontext_t) */
@@ -72,8 +72,7 @@ typedef struct __mcontext {
int mc_spare2[8];
} mcontext_t;
-#ifdef _KERNEL
-#ifdef COMPAT_FREEBSD4
+#if defined(_KERNEL) && defined(COMPAT_FREEBSD4)
/* For 4.x binaries */
struct mcontext4 {
int mc_onstack; /* XXX - sigcontext compat. */
@@ -101,10 +100,4 @@ struct mcontext4 {
};
#endif
-struct thread;
-
-void get_mcontext(struct thread *td, mcontext_t *mcp);
-int set_mcontext(struct thread *td, const mcontext_t *mcp);
-#endif
-
#endif /* !_MACHINE_UCONTEXT_H_ */
diff --git a/sys/i386/isa/npx.c b/sys/i386/isa/npx.c
index 3395c99..661a698 100644
--- a/sys/i386/isa/npx.c
+++ b/sys/i386/isa/npx.c
@@ -161,14 +161,14 @@ void stop_emulating(void);
typedef u_char bool_t;
+static void fpusave(union savefpu *);
+static void fpurstor(union savefpu *);
static int npx_attach(device_t dev);
static void npx_identify(driver_t *driver, device_t parent);
#ifndef SMP
static void npx_intr(void *);
#endif
static int npx_probe(device_t dev);
-static void fpusave(union savefpu *);
-static void fpurstor(union savefpu *);
#ifdef I586_CPU_XXX
static long timezero(const char *funcname,
void (*func)(void *buf, size_t len));
OpenPOWER on IntegriCloud