From: BlaisorBlade <blaisorblade_spam@yahoo.it>
To: user-mode-linux-devel@lists.sourceforge.net
Cc: Laurent Vivier <LaurentVivier@wanadoo.fr>, roland <for_spam@gmx.de>
Subject: [uml-devel] SYSEMU for 2.6.7
Date: Fri, 18 Jun 2004 20:49:59 +0200 [thread overview]
Message-ID: <200406182049.59129.blaisorblade_spam@yahoo.it> (raw)
[-- 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
_
next reply other threads:[~2004-06-18 18:40 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-06-18 18:49 BlaisorBlade [this message]
2004-06-18 18:57 ` [uml-devel] SYSEMU for 2.6.7 Christopher S. Aker
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200406182049.59129.blaisorblade_spam@yahoo.it \
--to=blaisorblade_spam@yahoo.it \
--cc=LaurentVivier@wanadoo.fr \
--cc=for_spam@gmx.de \
--cc=user-mode-linux-devel@lists.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox