diff options
author | kib <kib@FreeBSD.org> | 2009-04-01 13:09:26 +0000 |
---|---|---|
committer | kib <kib@FreeBSD.org> | 2009-04-01 13:09:26 +0000 |
commit | 253f7779bc4142bb2814f0f44999bc0e48e9bbe5 (patch) | |
tree | b58cda2045e48f43c2d8ff644f3d5c3a859f6e99 /sys/amd64/include/proc.h | |
parent | d2c67f9684a76233c58b569abc3a56c24f6a64db (diff) | |
download | FreeBSD-src-253f7779bc4142bb2814f0f44999bc0e48e9bbe5.zip FreeBSD-src-253f7779bc4142bb2814f0f44999bc0e48e9bbe5.tar.gz |
Save and restore segment registers on amd64 when entering and leaving
the kernel on amd64. Fill and read segment registers for mcontext and
signals. Handle traps caused by restoration of the
invalidated selectors.
Implement user-mode creation and manipulation of the process-specific
LDT descriptors for amd64, see sysarch(2).
Implement support for TSS i/o port access permission bitmap for amd64.
Context-switch LDT and TSS. Do not save and restore segment registers on
the context switch, that is handled by kernel enter/leave trampolines
now. Remove segment restore code from the signal trampolines for
freebsd/amd64, freebsd/ia32 and linux/i386 for the same reason.
Implement amd64-specific compat shims for sysarch.
Linuxolator (temporary ?) switched to use gsbase for thread_area pointer.
TODO:
Currently, gdb is not adapted to show segment registers from struct reg.
Also, no machine-depended ptrace command is added to set segment
registers for debugged process.
In collaboration with: pho
Discussed with: peter
Reviewed by: jhb
Linuxolator tested by: dchagin
Diffstat (limited to 'sys/amd64/include/proc.h')
-rw-r--r-- | sys/amd64/include/proc.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/sys/amd64/include/proc.h b/sys/amd64/include/proc.h index a3ebd79..33d5181 100644 --- a/sys/amd64/include/proc.h +++ b/sys/amd64/include/proc.h @@ -33,6 +33,13 @@ #ifndef _MACHINE_PROC_H_ #define _MACHINE_PROC_H_ +#include <machine/segments.h> + +struct proc_ldt { + caddr_t ldt_base; + int ldt_refcnt; +}; + /* * Machine-dependent part of the proc structure for AMD64. */ @@ -42,6 +49,8 @@ struct mdthread { }; struct mdproc { + struct proc_ldt *md_ldt; /* (t) per-process ldt */ + struct system_segment_descriptor md_ldt_sd; }; #ifdef _KERNEL @@ -55,6 +64,18 @@ struct mdproc { (char *)&td; \ } while (0) +void set_user_ldt(struct mdproc *); +struct proc_ldt *user_ldt_alloc(struct proc *, int); +void user_ldt_free(struct thread *); +void user_ldt_deref(struct proc_ldt *); +struct sysarch_args; +int sysarch_ldt(struct thread *td, struct sysarch_args *uap, int uap_space); +int amd64_set_ldt_data(struct thread *td, int start, int num, + struct user_segment_descriptor *descs); + +extern struct mtx dt_lock; +extern int max_ldt_segment; + #endif /* _KERNEL */ #endif /* !_MACHINE_PROC_H_ */ |