Added mach_thread_set_state
This commit is contained in:
parent
a2bed85761
commit
b6b7d129a1
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: mach_machdep.c,v 1.16 2003/11/11 17:31:59 manu Exp $ */
|
||||
/* $NetBSD: mach_machdep.c,v 1.17 2003/11/11 18:12:40 manu Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2002 The NetBSD Foundation, Inc.
|
||||
|
@ -37,7 +37,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: mach_machdep.c,v 1.16 2003/11/11 17:31:59 manu Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: mach_machdep.c,v 1.17 2003/11/11 18:12:40 manu Exp $");
|
||||
|
||||
#include "opt_ppcarch.h"
|
||||
#include <sys/param.h>
|
||||
|
@ -141,7 +141,7 @@ mach_create_thread_child(void *arg)
|
|||
}
|
||||
|
||||
int
|
||||
mach_thread_state(l, flavor, state, size)
|
||||
mach_thread_get_state_machdep(l, flavor, state, size)
|
||||
struct lwp *l;
|
||||
int flavor;
|
||||
void *state;
|
||||
|
@ -158,7 +158,7 @@ mach_thread_state(l, flavor, state, size)
|
|||
mpts = (struct mach_ppc_thread_state *)state;
|
||||
mpts->srr0 = tf->srr0;
|
||||
mpts->srr1 = tf->srr1;
|
||||
memcpy(mpts, &tf->fixreg[0], sizeof(mpts->gpreg));
|
||||
memcpy(mpts->gpreg, tf->fixreg, 32 * sizeof(register_t));
|
||||
mpts->cr = tf->cr;
|
||||
mpts->xer = tf->xer;
|
||||
mpts->lr = tf->lr;
|
||||
|
@ -185,3 +185,44 @@ mach_thread_state(l, flavor, state, size)
|
|||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
mach_thread_set_state_machdep(l, flavor, state)
|
||||
struct lwp *l;
|
||||
int flavor;
|
||||
void *state;
|
||||
{
|
||||
struct trapframe *tf;
|
||||
|
||||
tf = trapframe(l);
|
||||
|
||||
switch (flavor) {
|
||||
case MACH_PPC_THREAD_STATE: {
|
||||
struct mach_ppc_thread_state *mpts;
|
||||
|
||||
mpts = (struct mach_ppc_thread_state *)state;
|
||||
tf->srr0 = mpts->srr0;
|
||||
tf->srr1 = mpts->srr1;
|
||||
memcpy(tf->fixreg, mpts->gpreg, 32 * sizeof(register_t));
|
||||
tf->cr = mpts->cr;
|
||||
tf->xer = mpts->xer;
|
||||
tf->lr = mpts->lr;
|
||||
tf->ctr = mpts->ctr;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case MACH_THREAD_STATE_NONE:
|
||||
break;
|
||||
|
||||
case MACH_PPC_FLOAT_STATE:
|
||||
case MACH_PPC_EXCEPTION_STATE:
|
||||
case MACH_PPC_VECTOR_STATE:
|
||||
default:
|
||||
printf("Unimplemented thread state flavor %d\n", flavor);
|
||||
return EINVAL;
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: mach_namemap.c,v 1.34 2003/11/11 17:31:59 manu Exp $ */
|
||||
/* $NetBSD: mach_namemap.c,v 1.35 2003/11/11 18:12:40 manu Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2002-2003 The NetBSD Foundation, Inc.
|
||||
|
@ -37,7 +37,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: mach_namemap.c,v 1.34 2003/11/11 17:31:59 manu Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: mach_namemap.c,v 1.35 2003/11/11 18:12:40 manu Exp $");
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
|
@ -134,6 +134,7 @@ struct mach_subsystem_namemap mach_namemap[] = {
|
|||
{ 3418, mach_semaphore_create, "semaphore_create" },
|
||||
{ 3419, mach_semaphore_destroy, "semaphore_destroy" },
|
||||
{ 3603, mach_thread_get_state, "thread_get_state" },
|
||||
{ 3604, mach_thread_set_state, "thread_set_state" },
|
||||
{ 3612, mach_thread_info, "thread_info" },
|
||||
{ 3616, mach_thread_policy, "thread_policy" },
|
||||
{ 3800, mach_vm_region, "vm_region" },
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: mach_thread.c,v 1.22 2003/11/11 17:31:59 manu Exp $ */
|
||||
/* $NetBSD: mach_thread.c,v 1.23 2003/11/11 18:12:40 manu Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2002-2003 The NetBSD Foundation, Inc.
|
||||
|
@ -37,7 +37,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: mach_thread.c,v 1.22 2003/11/11 17:31:59 manu Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: mach_thread.c,v 1.23 2003/11/11 18:12:40 manu Exp $");
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
|
@ -298,16 +298,15 @@ mach_thread_get_state(args)
|
|||
int error;
|
||||
int size;
|
||||
|
||||
if ((error = mach_thread_get_state_machdep(l,
|
||||
req->req_flavor, &rep->rep_state, &size)) != 0)
|
||||
return mach_msg_error(args, error);
|
||||
|
||||
rep->rep_msgh.msgh_bits =
|
||||
MACH_MSGH_REPLY_LOCAL_BITS(MACH_MSG_TYPE_MOVE_SEND_ONCE);
|
||||
rep->rep_msgh.msgh_size = sizeof(*rep) - sizeof(rep->rep_trailer);
|
||||
rep->rep_msgh.msgh_local_port = req->req_msgh.msgh_local_port;
|
||||
rep->rep_msgh.msgh_id = req->req_msgh.msgh_id + 100;
|
||||
|
||||
error = mach_thread_state(l, req->req_flavor, &rep->rep_state, &size);
|
||||
if (error != 0)
|
||||
return mach_msg_error(args, error);
|
||||
|
||||
rep->rep_count = size / sizeof(int);
|
||||
rep->rep_state[rep->rep_count + 1] = 8; /* This is the trailer */
|
||||
|
||||
|
@ -316,3 +315,29 @@ mach_thread_get_state(args)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
mach_thread_set_state(args)
|
||||
struct mach_trap_args *args;
|
||||
{
|
||||
mach_thread_set_state_request_t *req = args->smsg;
|
||||
mach_thread_set_state_reply_t *rep = args->rmsg;
|
||||
size_t *msglen = args->rsize;
|
||||
struct lwp *l = args->l;
|
||||
int error;
|
||||
|
||||
if ((error = mach_thread_set_state_machdep(l,
|
||||
req->req_flavor, &req->req_state)) != 0)
|
||||
return mach_msg_error(args, error);
|
||||
|
||||
rep->rep_msgh.msgh_bits =
|
||||
MACH_MSGH_REPLY_LOCAL_BITS(MACH_MSG_TYPE_MOVE_SEND_ONCE);
|
||||
rep->rep_msgh.msgh_size = sizeof(*rep) - sizeof(rep->rep_trailer);
|
||||
rep->rep_msgh.msgh_local_port = req->req_msgh.msgh_local_port;
|
||||
rep->rep_msgh.msgh_id = req->req_msgh.msgh_id + 100;
|
||||
rep->rep_trailer.msgh_trailer_size = 8;
|
||||
|
||||
*msglen = sizeof(*rep);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: mach_thread.h,v 1.11 2003/11/11 17:31:59 manu Exp $ */
|
||||
/* $NetBSD: mach_thread.h,v 1.12 2003/11/11 18:12:40 manu Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2002-2003 The NetBSD Foundation, Inc.
|
||||
|
@ -171,13 +171,32 @@ typedef struct {
|
|||
mach_msg_trailer_t rep_trailer;
|
||||
} mach_thread_get_state_reply_t;
|
||||
|
||||
/* mach_thread_set_state */
|
||||
|
||||
typedef struct {
|
||||
mach_msg_header_t req_msgh;
|
||||
mach_ndr_record_t req_ndr;
|
||||
mach_thread_state_flavor_t req_flavor;
|
||||
mach_msg_type_number_t req_count;
|
||||
mach_integer_t req_state[144];
|
||||
} mach_thread_set_state_request_t;
|
||||
|
||||
typedef struct {
|
||||
mach_msg_header_t rep_msgh;
|
||||
mach_ndr_record_t rep_ndr;
|
||||
mach_kern_return_t rep_retval;
|
||||
mach_msg_trailer_t rep_trailer;
|
||||
} mach_thread_set_state_reply_t;
|
||||
|
||||
int mach_thread_policy(struct mach_trap_args *);
|
||||
int mach_thread_create_running(struct mach_trap_args *);
|
||||
int mach_thread_info(struct mach_trap_args *);
|
||||
int mach_thread_get_state(struct mach_trap_args *);
|
||||
int mach_thread_set_state(struct mach_trap_args *);
|
||||
|
||||
/* Theses are machine dependent functions */
|
||||
int mach_thread_state(struct lwp *, int, void *, int *);
|
||||
int mach_thread_get_state_machdep(struct lwp *, int, void *, int *);
|
||||
int mach_thread_set_state_machdep(struct lwp *, int, void *);
|
||||
void mach_create_thread_child(void *);
|
||||
|
||||
#endif /* _MACH_THREAD_H_ */
|
||||
|
|
Loading…
Reference in New Issue