* [uml-devel] SYSEMU for 2.6.7
@ 2004-06-18 18:49 BlaisorBlade
2004-06-18 18:57 ` Christopher S. Aker
0 siblings, 1 reply; 2+ messages in thread
From: BlaisorBlade @ 2004-06-18 18:49 UTC (permalink / raw)
To: user-mode-linux-devel; +Cc: Laurent Vivier, roland
[-- Attachment #1: Type: text/plain, Size: 297 bytes --]
I'm attaching the host patch, adapted a bit for 2.6.7. I'm sure it needs this
change (it's just a case change to entry.S) but I didn't compile it yet... I
checked the other file but there is no relevant change in 2.6.7.
Bye
--
Paolo Giarrusso, aka Blaisorblade
Linux registered user n. 292729
[-- Attachment #2: host-sysemu-2.6.7-1.patch --]
[-- Type: text/x-diff, Size: 4794 bytes --]
---
vanilla-linux-2.6.7-SKAS-paolo/arch/i386/kernel/entry.S | 7 ++
vanilla-linux-2.6.7-SKAS-paolo/arch/i386/kernel/ptrace.c | 31 +++++++++-
vanilla-linux-2.6.7-SKAS-paolo/include/asm-i386/thread_info.h | 2
vanilla-linux-2.6.7-SKAS-paolo/include/linux/ptrace.h | 1
4 files changed, 40 insertions(+), 1 deletion(-)
diff -puN arch/i386/kernel/entry.S~sysemu-2.6.7 arch/i386/kernel/entry.S
--- vanilla-linux-2.6.7-SKAS/arch/i386/kernel/entry.S~sysemu-2.6.7 2004-06-18 14:23:23.000000000 +0200
+++ vanilla-linux-2.6.7-SKAS-paolo/arch/i386/kernel/entry.S 2004-06-18 14:29:22.000000000 +0200
@@ -280,6 +280,9 @@ ENTRY(system_call)
GET_THREAD_INFO(%ebp)
cmpl $(nr_syscalls), %eax
jae syscall_badsys
+ # system call emulation
+ testb $(_TIF_SYSCALL_EMU),TI_flags(%ebp)
+ jnz syscall_emu_entry
# system call tracing in operation
testb $(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT),TI_flags(%ebp)
jnz syscall_trace_entry
@@ -333,6 +336,10 @@ work_notifysig_v86:
call do_notify_resume
jmp restore_all
+ # perform syscall emulation
+syscall_emu_entry:
+ call do_syscall_emu
+ jmp syscall_exit
# perform syscall exit tracing
ALIGN
syscall_trace_entry:
diff -puN arch/i386/kernel/ptrace.c~sysemu-2.6.7 arch/i386/kernel/ptrace.c
--- vanilla-linux-2.6.7-SKAS/arch/i386/kernel/ptrace.c~sysemu-2.6.7 2004-06-18 14:28:54.000000000 +0200
+++ vanilla-linux-2.6.7-SKAS-paolo/arch/i386/kernel/ptrace.c 2004-06-18 14:29:22.000000000 +0200
@@ -358,6 +358,7 @@ asmlinkage int sys_ptrace(long request,
}
break;
+ case PTRACE_SCEMU: /* continue and replace next syscall */
case PTRACE_SYSCALL: /* continue and stop at next (return from) syscall */
case PTRACE_CONT: { /* restart after signal. */
long tmp;
@@ -365,6 +366,12 @@ asmlinkage int sys_ptrace(long request,
ret = -EIO;
if ((unsigned long) data > _NSIG)
break;
+ if (request == PTRACE_SCEMU) {
+ set_tsk_thread_flag(child, TIF_SYSCALL_EMU);
+ }
+ else {
+ clear_tsk_thread_flag(child, TIF_SYSCALL_EMU);
+ }
if (request == PTRACE_SYSCALL) {
set_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
}
@@ -405,7 +412,7 @@ asmlinkage int sys_ptrace(long request,
ret = -EIO;
if ((unsigned long) data > _NSIG)
break;
- clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
+ clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE|TIF_SYSCALL_EMU);
if ((child->ptrace & PT_DTRACE) == 0) {
/* Spurious delayed TF traps may occur */
child->ptrace |= PT_DTRACE;
@@ -605,3 +612,25 @@ void do_syscall_trace(struct pt_regs *re
current->exit_code = 0;
}
}
+
+void do_syscall_emu(void)
+{
+ if (!test_thread_flag(TIF_SYSCALL_EMU))
+ return;
+ if (!(current->ptrace & PT_PTRACED))
+ return;
+ /* the 0x80 provides a way for the tracing parent to distinguish
+ between a syscall stop and SIGTRAP delivery */
+ ptrace_notify(SIGTRAP | ((current->ptrace & PT_TRACESYSGOOD)
+ ? 0x80 : 0));
+
+ /*
+ * this isn't the same as continuing with a signal, but it will do
+ * for normal use. strace only continues with a signal if the
+ * stopping signal is not SIGTRAP. -brl
+ */
+ if (current->exit_code) {
+ send_sig(current->exit_code, current, 1);
+ current->exit_code = 0;
+ }
+}
diff -puN include/asm-i386/thread_info.h~sysemu-2.6.7 include/asm-i386/thread_info.h
--- vanilla-linux-2.6.7-SKAS/include/asm-i386/thread_info.h~sysemu-2.6.7 2004-06-18 14:28:59.000000000 +0200
+++ vanilla-linux-2.6.7-SKAS-paolo/include/asm-i386/thread_info.h 2004-06-18 14:29:22.000000000 +0200
@@ -143,6 +143,7 @@ static inline unsigned long current_stac
#define TIF_NEED_RESCHED 3 /* rescheduling necessary */
#define TIF_SINGLESTEP 4 /* restore singlestep on return to user mode */
#define TIF_IRET 5 /* return with iret */
+#define TIF_SYSCALL_EMU 6 /* syscall emulation active */
#define TIF_SYSCALL_AUDIT 7 /* syscall auditing active */
#define TIF_POLLING_NRFLAG 16 /* true if poll_idle() is polling TIF_NEED_RESCHED */
@@ -152,6 +153,7 @@ static inline unsigned long current_stac
#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)
#define _TIF_SINGLESTEP (1<<TIF_SINGLESTEP)
#define _TIF_IRET (1<<TIF_IRET)
+#define _TIF_SYSCALL_EMU (1<<TIF_SYSCALL_EMU)
#define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT)
#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG)
diff -puN include/linux/ptrace.h~sysemu-2.6.7 include/linux/ptrace.h
--- vanilla-linux-2.6.7-SKAS/include/linux/ptrace.h~sysemu-2.6.7 2004-06-18 14:29:05.000000000 +0200
+++ vanilla-linux-2.6.7-SKAS-paolo/include/linux/ptrace.h 2004-06-18 14:29:22.000000000 +0200
@@ -20,6 +20,7 @@
#define PTRACE_DETACH 0x11
#define PTRACE_SYSCALL 24
+#define PTRACE_SCEMU 31
/* 0x4200-0x4300 are reserved for architecture-independent additions. */
#define PTRACE_SETOPTIONS 0x4200
_
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [uml-devel] SYSEMU for 2.6.7
2004-06-18 18:49 [uml-devel] SYSEMU for 2.6.7 BlaisorBlade
@ 2004-06-18 18:57 ` Christopher S. Aker
0 siblings, 0 replies; 2+ messages in thread
From: Christopher S. Aker @ 2004-06-18 18:57 UTC (permalink / raw)
To: BlaisorBlade, user-mode-linux-devel; +Cc: Laurent Vivier, roland
> I'm attaching the host patch, adapted a bit for 2.6.7. I'm sure it needs this
> change (it's just a case change to entry.S) but I didn't compile it yet... I
> checked the other file but there is no relevant change in 2.6.7.
That's the same change I made yesterday (and a while ago with 2.6.4), along with
your 2.6.7-skas patch. I'm now running this on six production boxes with no
problems.
Thanks!
-Chris
-------------------------------------------------------
This SF.Net email is sponsored by The 2004 JavaOne(SM) Conference
Learn from the experts at JavaOne(SM), Sun's Worldwide Java Developer
Conference, June 28 - July 1 at the Moscone Center in San Francisco, CA
REGISTER AND SAVE! http://java.sun.com/javaone/sf Priority Code NWMGYKND
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2004-06-18 18:55 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-06-18 18:49 [uml-devel] SYSEMU for 2.6.7 BlaisorBlade
2004-06-18 18:57 ` Christopher S. Aker
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox