summaryrefslogtreecommitdiffstats
path: root/sys/i386/linux/linux_machdep.c
diff options
context:
space:
mode:
authorjulian <julian@FreeBSD.org>2001-09-12 08:38:13 +0000
committerjulian <julian@FreeBSD.org>2001-09-12 08:38:13 +0000
commit5596676e6c6c1e81e899cd0531f9b1c28a292669 (patch)
treeb1a19fcdf05759281fab0d89efb13f0fdf42102e /sys/i386/linux/linux_machdep.c
parent83e00d4274950d2b531c24692cd123538ffbddb9 (diff)
downloadFreeBSD-src-5596676e6c6c1e81e899cd0531f9b1c28a292669.zip
FreeBSD-src-5596676e6c6c1e81e899cd0531f9b1c28a292669.tar.gz
KSE Milestone 2
Note ALL MODULES MUST BE RECOMPILED make the kernel aware that there are smaller units of scheduling than the process. (but only allow one thread per process at this time). This is functionally equivalent to teh previousl -current except that there is a thread associated with each process. Sorry john! (your next MFC will be a doosie!) Reviewed by: peter@freebsd.org, dillon@freebsd.org X-MFC after: ha ha ha ha
Diffstat (limited to 'sys/i386/linux/linux_machdep.c')
-rw-r--r--sys/i386/linux/linux_machdep.c128
1 files changed, 64 insertions, 64 deletions
diff --git a/sys/i386/linux/linux_machdep.c b/sys/i386/linux/linux_machdep.c
index dfae7f4..ba443bb 100644
--- a/sys/i386/linux/linux_machdep.c
+++ b/sys/i386/linux/linux_machdep.c
@@ -99,13 +99,13 @@ bsd_to_linux_sigaltstack(int bsa)
}
int
-linux_execve(struct proc *p, struct linux_execve_args *args)
+linux_execve(struct thread *td, struct linux_execve_args *args)
{
struct execve_args bsd;
caddr_t sg;
sg = stackgap_init();
- CHECKALTEXIST(p, &sg, args->path);
+ CHECKALTEXIST(td, &sg, args->path);
#ifdef DEBUG
if (ldebug(execve))
@@ -115,7 +115,7 @@ linux_execve(struct proc *p, struct linux_execve_args *args)
bsd.fname = args->path;
bsd.argv = args->argp;
bsd.envv = args->envp;
- return (execve(p, &bsd));
+ return (execve(td, &bsd));
}
struct l_ipc_kludge {
@@ -124,7 +124,7 @@ struct l_ipc_kludge {
};
int
-linux_ipc(struct proc *p, struct linux_ipc_args *args)
+linux_ipc(struct thread *td, struct linux_ipc_args *args)
{
switch (args->what & 0xFFFF) {
@@ -134,7 +134,7 @@ linux_ipc(struct proc *p, struct linux_ipc_args *args)
a.semid = args->arg1;
a.tsops = args->ptr;
a.nsops = args->arg2;
- return (linux_semop(p, &a));
+ return (linux_semop(td, &a));
}
case LINUX_SEMGET: {
struct linux_semget_args a;
@@ -142,7 +142,7 @@ linux_ipc(struct proc *p, struct linux_ipc_args *args)
a.key = args->arg1;
a.nsems = args->arg2;
a.semflg = args->arg3;
- return (linux_semget(p, &a));
+ return (linux_semget(td, &a));
}
case LINUX_SEMCTL: {
struct linux_semctl_args a;
@@ -154,7 +154,7 @@ linux_ipc(struct proc *p, struct linux_ipc_args *args)
error = copyin((caddr_t)args->ptr, &a.arg, sizeof(a.arg));
if (error)
return (error);
- return (linux_semctl(p, &a));
+ return (linux_semctl(td, &a));
}
case LINUX_MSGSND: {
struct linux_msgsnd_args a;
@@ -163,7 +163,7 @@ linux_ipc(struct proc *p, struct linux_ipc_args *args)
a.msgp = args->ptr;
a.msgsz = args->arg2;
a.msgflg = args->arg3;
- return (linux_msgsnd(p, &a));
+ return (linux_msgsnd(td, &a));
}
case LINUX_MSGRCV: {
struct linux_msgrcv_args a;
@@ -186,14 +186,14 @@ linux_ipc(struct proc *p, struct linux_ipc_args *args)
a.msgp = args->ptr;
a.msgtyp = args->arg5;
}
- return (linux_msgrcv(p, &a));
+ return (linux_msgrcv(td, &a));
}
case LINUX_MSGGET: {
struct linux_msgget_args a;
a.key = args->arg1;
a.msgflg = args->arg2;
- return (linux_msgget(p, &a));
+ return (linux_msgget(td, &a));
}
case LINUX_MSGCTL: {
struct linux_msgctl_args a;
@@ -201,7 +201,7 @@ linux_ipc(struct proc *p, struct linux_ipc_args *args)
a.msqid = args->arg1;
a.cmd = args->arg2;
a.buf = args->ptr;
- return (linux_msgctl(p, &a));
+ return (linux_msgctl(td, &a));
}
case LINUX_SHMAT: {
struct linux_shmat_args a;
@@ -210,13 +210,13 @@ linux_ipc(struct proc *p, struct linux_ipc_args *args)
a.shmaddr = args->ptr;
a.shmflg = args->arg2;
a.raddr = (l_ulong *)args->arg3;
- return (linux_shmat(p, &a));
+ return (linux_shmat(td, &a));
}
case LINUX_SHMDT: {
struct linux_shmdt_args a;
a.shmaddr = args->ptr;
- return (linux_shmdt(p, &a));
+ return (linux_shmdt(td, &a));
}
case LINUX_SHMGET: {
struct linux_shmget_args a;
@@ -224,7 +224,7 @@ linux_ipc(struct proc *p, struct linux_ipc_args *args)
a.key = args->arg1;
a.size = args->arg2;
a.shmflg = args->arg3;
- return (linux_shmget(p, &a));
+ return (linux_shmget(td, &a));
}
case LINUX_SHMCTL: {
struct linux_shmctl_args a;
@@ -232,7 +232,7 @@ linux_ipc(struct proc *p, struct linux_ipc_args *args)
a.shmid = args->arg1;
a.cmd = args->arg2;
a.buf = args->ptr;
- return (linux_shmctl(p, &a));
+ return (linux_shmctl(td, &a));
}
default:
break;
@@ -242,7 +242,7 @@ linux_ipc(struct proc *p, struct linux_ipc_args *args)
}
int
-linux_old_select(struct proc *p, struct linux_old_select_args *args)
+linux_old_select(struct thread *td, struct linux_old_select_args *args)
{
struct l_old_select_argv linux_args;
struct linux_select_args newsel;
@@ -262,11 +262,11 @@ linux_old_select(struct proc *p, struct linux_old_select_args *args)
newsel.writefds = linux_args.writefds;
newsel.exceptfds = linux_args.exceptfds;
newsel.timeout = linux_args.timeout;
- return (linux_select(p, &newsel));
+ return (linux_select(td, &newsel));
}
int
-linux_fork(struct proc *p, struct linux_fork_args *args)
+linux_fork(struct thread *td, struct linux_fork_args *args)
{
int error;
@@ -275,16 +275,16 @@ linux_fork(struct proc *p, struct linux_fork_args *args)
printf(ARGS(fork, ""));
#endif
- if ((error = fork(p, (struct fork_args *)args)) != 0)
+ if ((error = fork(td, (struct fork_args *)args)) != 0)
return (error);
- if (p->p_retval[1] == 1)
- p->p_retval[0] = 0;
+ if (td->td_retval[1] == 1)
+ td->td_retval[0] = 0;
return (0);
}
int
-linux_vfork(struct proc *p, struct linux_vfork_args *args)
+linux_vfork(struct thread *td, struct linux_vfork_args *args)
{
int error;
@@ -293,11 +293,11 @@ linux_vfork(struct proc *p, struct linux_vfork_args *args)
printf(ARGS(vfork, ""));
#endif
- if ((error = vfork(p, (struct vfork_args *)args)) != 0)
+ if ((error = vfork(td, (struct vfork_args *)args)) != 0)
return (error);
/* Are we the child? */
- if (p->p_retval[1] == 1)
- p->p_retval[0] = 0;
+ if (td->td_retval[1] == 1)
+ td->td_retval[0] = 0;
return (0);
}
@@ -308,7 +308,7 @@ linux_vfork(struct proc *p, struct linux_vfork_args *args)
#define CLONE_PID 0x1000
int
-linux_clone(struct proc *p, struct linux_clone_args *args)
+linux_clone(struct thread *td, struct linux_clone_args *args)
{
int error, ff = RFPROC | RFSTOPPED;
struct proc *p2;
@@ -341,14 +341,14 @@ linux_clone(struct proc *p, struct linux_clone_args *args)
ff |= RFFDG;
mtx_lock(&Giant);
- error = fork1(p, ff, &p2);
+ error = fork1(td, ff, &p2);
if (error == 0) {
- p->p_retval[0] = p2->p_pid;
- p->p_retval[1] = 0;
+ td->td_retval[0] = p2->p_pid;
+ td->td_retval[1] = 0;
PROC_LOCK(p2);
p2->p_sigparent = exit_signal;
- p2->p_frame->tf_esp = (unsigned int)args->stack;
+ p2->p_thread.td_frame->tf_esp = (unsigned int)args->stack;
#ifdef DEBUG
if (ldebug(clone))
@@ -361,7 +361,7 @@ linux_clone(struct proc *p, struct linux_clone_args *args)
*/
mtx_lock_spin(&sched_lock);
p2->p_stat = SRUN;
- setrunqueue(p2);
+ setrunqueue(&p2->p_thread);
mtx_unlock_spin(&sched_lock);
PROC_UNLOCK(p2);
}
@@ -384,8 +384,9 @@ struct l_mmap_argv {
#define GUARD_SIZE (4 * PAGE_SIZE)
int
-linux_mmap(struct proc *p, struct linux_mmap_args *args)
+linux_mmap(struct thread *td, struct linux_mmap_args *args)
{
+ struct proc *p = td->td_proc;
struct mmap_args /* {
caddr_t addr;
size_t len;
@@ -501,11 +502,11 @@ linux_mmap(struct proc *p, struct linux_mmap_args *args)
bsd_args.flags, bsd_args.fd, (int)bsd_args.pos);
#endif
- return (mmap(p, &bsd_args));
+ return (mmap(td, &bsd_args));
}
int
-linux_pipe(struct proc *p, struct linux_pipe_args *args)
+linux_pipe(struct thread *td, struct linux_pipe_args *args)
{
int error;
int reg_edx;
@@ -515,26 +516,26 @@ linux_pipe(struct proc *p, struct linux_pipe_args *args)
printf(ARGS(pipe, "*"));
#endif
- reg_edx = p->p_retval[1];
- error = pipe(p, 0);
+ reg_edx = td->td_retval[1];
+ error = pipe(td, 0);
if (error) {
- p->p_retval[1] = reg_edx;
+ td->td_retval[1] = reg_edx;
return (error);
}
- error = copyout(p->p_retval, args->pipefds, 2*sizeof(int));
+ error = copyout(td->td_retval, args->pipefds, 2*sizeof(int));
if (error) {
- p->p_retval[1] = reg_edx;
+ td->td_retval[1] = reg_edx;
return (error);
}
- p->p_retval[1] = reg_edx;
- p->p_retval[0] = 0;
+ td->td_retval[1] = reg_edx;
+ td->td_retval[0] = 0;
return (0);
}
int
-linux_ioperm(struct proc *p, struct linux_ioperm_args *args)
+linux_ioperm(struct thread *td, struct linux_ioperm_args *args)
{
struct sysarch_args sa;
struct i386_ioperm_args *iia;
@@ -547,28 +548,28 @@ linux_ioperm(struct proc *p, struct linux_ioperm_args *args)
iia->enable = args->enable;
sa.op = I386_SET_IOPERM;
sa.parms = (char *)iia;
- return (sysarch(p, &sa));
+ return (sysarch(td, &sa));
}
int
-linux_iopl(struct proc *p, struct linux_iopl_args *args)
+linux_iopl(struct thread *td, struct linux_iopl_args *args)
{
int error;
if (args->level < 0 || args->level > 3)
return (EINVAL);
- if ((error = suser(p)) != 0)
+ if ((error = suser_td(td)) != 0)
return (error);
if (securelevel > 0)
return (EPERM);
- p->p_frame->tf_eflags = (p->p_frame->tf_eflags & ~PSL_IOPL) |
+ td->td_frame->tf_eflags = (td->td_frame->tf_eflags & ~PSL_IOPL) |
(args->level * (PSL_IOPL / 3));
return (0);
}
int
-linux_modify_ldt(p, uap)
- struct proc *p;
+linux_modify_ldt(td, uap)
+ struct thread *td;
struct linux_modify_ldt_args *uap;
{
int error;
@@ -591,8 +592,8 @@ linux_modify_ldt(p, uap)
ldt->num = uap->bytecount / sizeof(union descriptor);
args.op = I386_GET_LDT;
args.parms = (char*)ldt;
- error = sysarch(p, &args);
- p->p_retval[0] *= sizeof(union descriptor);
+ error = sysarch(td, &args);
+ td->td_retval[0] *= sizeof(union descriptor);
break;
case 0x01: /* write_ldt */
case 0x11: /* write_ldt */
@@ -621,7 +622,7 @@ linux_modify_ldt(p, uap)
desc->sd.sd_gran = ld.limit_in_pages;
args.op = I386_SET_LDT;
args.parms = (char*)ldt;
- error = sysarch(p, &args);
+ error = sysarch(td, &args);
break;
default:
error = EINVAL;
@@ -637,7 +638,7 @@ linux_modify_ldt(p, uap)
}
int
-linux_sigaction(struct proc *p, struct linux_sigaction_args *args)
+linux_sigaction(struct thread *td, struct linux_sigaction_args *args)
{
l_osigaction_t osa;
l_sigaction_t act, oact;
@@ -661,7 +662,7 @@ linux_sigaction(struct proc *p, struct linux_sigaction_args *args)
act.lsa_mask.__bits[0] = osa.lsa_mask;
}
- error = linux_do_sigaction(p, args->sig, args->nsa ? &act : NULL,
+ error = linux_do_sigaction(td, args->sig, args->nsa ? &act : NULL,
args->osa ? &oact : NULL);
if (args->osa != NULL && !error) {
@@ -682,7 +683,7 @@ linux_sigaction(struct proc *p, struct linux_sigaction_args *args)
* enables the signal to happen with a different register set.
*/
int
-linux_sigsuspend(struct proc *p, struct linux_sigsuspend_args *args)
+linux_sigsuspend(struct thread *td, struct linux_sigsuspend_args *args)
{
struct sigsuspend_args bsd;
sigset_t *sigmask;
@@ -699,12 +700,12 @@ linux_sigsuspend(struct proc *p, struct linux_sigsuspend_args *args)
mask.__bits[0] = args->mask;
linux_to_bsd_sigset(&mask, sigmask);
bsd.sigmask = sigmask;
- return (sigsuspend(p, &bsd));
+ return (sigsuspend(td, &bsd));
}
int
-linux_rt_sigsuspend(p, uap)
- struct proc *p;
+linux_rt_sigsuspend(td, uap)
+ struct thread *td;
struct linux_rt_sigsuspend_args *uap;
{
l_sigset_t lmask;
@@ -729,12 +730,13 @@ linux_rt_sigsuspend(p, uap)
bmask = stackgap_alloc(&sg, sizeof(sigset_t));
linux_to_bsd_sigset(&lmask, bmask);
bsd.sigmask = bmask;
- return (sigsuspend(p, &bsd));
+ return (sigsuspend(td, &bsd));
}
int
-linux_pause(struct proc *p, struct linux_pause_args *args)
+linux_pause(struct thread *td, struct linux_pause_args *args)
{
+ struct proc *p = td->td_proc;
struct sigsuspend_args bsd;
sigset_t *sigmask;
caddr_t sg = stackgap_init();
@@ -749,13 +751,11 @@ linux_pause(struct proc *p, struct linux_pause_args *args)
*sigmask = p->p_sigmask;
PROC_UNLOCK(p);
bsd.sigmask = sigmask;
- return (sigsuspend(p, &bsd));
+ return (sigsuspend(td, &bsd));
}
int
-linux_sigaltstack(p, uap)
- struct proc *p;
- struct linux_sigaltstack_args *uap;
+linux_sigaltstack(struct thread *td, struct linux_sigaltstack_args *uap)
{
struct sigaltstack_args bsd;
stack_t *ss, *oss;
@@ -786,7 +786,7 @@ linux_sigaltstack(p, uap)
bsd.ss = ss;
bsd.oss = oss;
- error = sigaltstack(p, &bsd);
+ error = sigaltstack(td, &bsd);
if (!error && oss != NULL) {
lss.ss_sp = oss->ss_sp;
OpenPOWER on IntegriCloud