Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 15247
b: refs/heads/master
c: f85c657
h: refs/heads/master
i:
  15245: f6eb5f6
  15243: 4570106
  15239: 971b9a5
  15231: 2b27ce5
v: v3
  • Loading branch information
Jean Delvare authored and Mauro Carvalho Chehab committed Dec 19, 2005
1 parent a99af20 commit 70b20ea
Show file tree
Hide file tree
Showing 42 changed files with 247 additions and 437 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: bcb97940f31ded5ac551da8bfc849583203fc6f2
refs/heads/master: f85c657ff1f712abd5207a95fba8a5fcc282ab04
4 changes: 2 additions & 2 deletions trunk/Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
VERSION = 2
PATCHLEVEL = 6
SUBLEVEL = 15
EXTRAVERSION =-rc6
NAME=Sliding Snow Leopard
EXTRAVERSION =-rc5
NAME=Affluent Albatross

# *DOCUMENTATION*
# To see a list of typical targets execute "make help"
Expand Down
8 changes: 4 additions & 4 deletions trunk/arch/arm/kernel/calls.S
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ __syscall_start:
.long sys_wait4
/* 115 */ .long sys_swapoff
.long sys_sysinfo
.long sys_ipc
.long sys_ipc_wrapper
.long sys_fsync
.long sys_sigreturn_wrapper
/* 120 */ .long sys_clone_wrapper
Expand Down Expand Up @@ -254,7 +254,7 @@ __syscall_start:
.long sys_fremovexattr
.long sys_tkill
.long sys_sendfile64
/* 240 */ .long sys_futex
/* 240 */ .long sys_futex_wrapper
.long sys_sched_setaffinity
.long sys_sched_getaffinity
.long sys_io_setup
Expand Down Expand Up @@ -284,7 +284,7 @@ __syscall_start:
.long sys_fstatfs64
.long sys_tgkill
.long sys_utimes
/* 270 */ .long sys_arm_fadvise64_64
/* 270 */ .long sys_arm_fadvise64_64_wrapper
.long sys_pciconfig_iobase
.long sys_pciconfig_read
.long sys_pciconfig_write
Expand Down Expand Up @@ -333,7 +333,7 @@ __syscall_start:
.long sys_inotify_init
.long sys_inotify_add_watch
.long sys_inotify_rm_watch
.long sys_mbind
.long sys_mbind_wrapper
/* 320 */ .long sys_get_mempolicy
.long sys_set_mempolicy
__syscall_end:
Expand Down
49 changes: 0 additions & 49 deletions trunk/arch/arm/kernel/entry-armv.S
Original file line number Diff line number Diff line change
Expand Up @@ -611,47 +611,6 @@ ENTRY(__switch_to)
.globl __kuser_helper_start
__kuser_helper_start:

/*
* Reference prototype:
*
* void __kernel_memory_barrier(void)
*
* Input:
*
* lr = return address
*
* Output:
*
* none
*
* Clobbered:
*
* the Z flag might be lost
*
* Definition and user space usage example:
*
* typedef void (__kernel_dmb_t)(void);
* #define __kernel_dmb (*(__kernel_dmb_t *)0xffff0fa0)
*
* Apply any needed memory barrier to preserve consistency with data modified
* manually and __kuser_cmpxchg usage.
*
* This could be used as follows:
*
* #define __kernel_dmb() \
* asm volatile ( "mov r0, #0xffff0fff; mov lr, pc; sub pc, r0, #95" \
* : : : "lr","cc" )
*/

__kuser_memory_barrier: @ 0xffff0fa0

#if __LINUX_ARM_ARCH__ >= 6 && defined(CONFIG_SMP)
mcr p15, 0, r0, c7, c10, 5 @ dmb
#endif
mov pc, lr

.align 5

/*
* Reference prototype:
*
Expand Down Expand Up @@ -683,8 +642,6 @@ __kuser_memory_barrier: @ 0xffff0fa0
* The C flag is also set if *ptr was changed to allow for assembly
* optimization in the calling code.
*
* Note: this routine already includes memory barriers as needed.
*
* For example, a user space atomic_add implementation could look like this:
*
* #define atomic_add(ptr, val) \
Expand Down Expand Up @@ -741,16 +698,10 @@ __kuser_cmpxchg: @ 0xffff0fc0

#else

#ifdef CONFIG_SMP
mcr p15, 0, r0, c7, c10, 5 @ dmb
#endif
ldrex r3, [r2]
subs r3, r3, r0
strexeq r3, r1, [r2]
rsbs r0, r3, #0
#ifdef CONFIG_SMP
mcr p15, 0, r0, c7, c10, 5 @ dmb
#endif
mov pc, lr

#endif
Expand Down
20 changes: 18 additions & 2 deletions trunk/arch/arm/kernel/entry-common.S
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ ENTRY(vector_swi)
#endif
enable_irq

stmdb sp!, {r4, r5} @ push fifth and sixth args
str r4, [sp, #-S_OFF]! @ push fifth arg

get_thread_info tsk
ldr ip, [tsk, #TI_FLAGS] @ check for syscall tracing
Expand Down Expand Up @@ -204,7 +204,7 @@ ENTRY(sys_call_table)
* Special system call wrappers
*/
@ r0 = syscall number
@ r8 = syscall table
@ r5 = syscall table
.type sys_syscall, #function
sys_syscall:
eor scno, r0, #__NR_SYSCALL_BASE
Expand Down Expand Up @@ -255,6 +255,22 @@ sys_sigaltstack_wrapper:
ldr r2, [sp, #S_OFF + S_SP]
b do_sigaltstack

sys_futex_wrapper:
str r5, [sp, #4] @ push sixth arg
b sys_futex

sys_arm_fadvise64_64_wrapper:
str r5, [sp, #4] @ push r5 to stack
b sys_arm_fadvise64_64

sys_mbind_wrapper:
str r5, [sp, #4]
b sys_mbind

sys_ipc_wrapper:
str r5, [sp, #4] @ push sixth arg
b sys_ipc

/*
* Note: off_4k (r5) is always units of 4K. If we can't do the requested
* offset, we return EINVAL.
Expand Down
2 changes: 0 additions & 2 deletions trunk/arch/um/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -289,8 +289,6 @@ source "arch/um/Kconfig.net"

source "drivers/net/Kconfig"

source "drivers/connector/Kconfig"

source "fs/Kconfig"

source "security/Kconfig"
Expand Down
4 changes: 0 additions & 4 deletions trunk/arch/um/Makefile-x86_64
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,3 @@ CHECKFLAGS += -m64

ELF_ARCH := i386:x86-64
ELF_FORMAT := elf64-x86-64

# Not on all 64-bit distros /lib is a symlink to /lib64. PLD is an example.

LINK-$(CONFIG_LD_SCRIPT_DYN) += -Wl,-rpath,/lib64
29 changes: 13 additions & 16 deletions trunk/arch/um/include/sysdep-i386/stub.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,8 @@
#ifndef __SYSDEP_STUB_H
#define __SYSDEP_STUB_H

#include <sys/mman.h>
#include <asm/ptrace.h>
#include <asm/unistd.h>
#include "stub-data.h"
#include "kern_constants.h"
#include "uml-config.h"

extern void stub_segv_handler(int sig);
extern void stub_clone_handler(void);
Expand Down Expand Up @@ -80,22 +76,23 @@ static inline long stub_syscall5(long syscall, long arg1, long arg2, long arg3,
return ret;
}

static inline void trap_myself(void)
static inline long stub_syscall6(long syscall, long arg1, long arg2, long arg3,
long arg4, long arg5, long arg6)
{
__asm("int3");
long ret;

__asm__ volatile ("push %%ebp ; movl %%eax,%%ebp ; movl %1,%%eax ; "
"int $0x80 ; pop %%ebp"
: "=a" (ret)
: "g" (syscall), "b" (arg1), "c" (arg2), "d" (arg3),
"S" (arg4), "D" (arg5), "0" (arg6));

return ret;
}

static inline void remap_stack(int fd, unsigned long offset)
static inline void trap_myself(void)
{
__asm__ volatile ("movl %%eax,%%ebp ; movl %0,%%eax ; int $0x80 ;"
"movl %7, %%ebx ; movl %%eax, (%%ebx)"
: : "g" (STUB_MMAP_NR), "b" (UML_CONFIG_STUB_DATA),
"c" (UM_KERN_PAGE_SIZE),
"d" (PROT_READ | PROT_WRITE),
"S" (MAP_FIXED | MAP_SHARED), "D" (fd),
"a" (offset),
"i" (&((struct stub_data *) UML_CONFIG_STUB_DATA)->err)
: "memory");
__asm("int3");
}

#endif
30 changes: 13 additions & 17 deletions trunk/arch/um/include/sysdep-x86_64/stub.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,8 @@
#ifndef __SYSDEP_STUB_H
#define __SYSDEP_STUB_H

#include <sys/mman.h>
#include <asm/unistd.h>
#include <sysdep/ptrace_user.h>
#include "stub-data.h"
#include "kern_constants.h"
#include "uml-config.h"

extern void stub_segv_handler(int sig);
extern void stub_clone_handler(void);
Expand Down Expand Up @@ -85,23 +81,23 @@ static inline long stub_syscall5(long syscall, long arg1, long arg2, long arg3,
return ret;
}

static inline void trap_myself(void)
static inline long stub_syscall6(long syscall, long arg1, long arg2, long arg3,
long arg4, long arg5, long arg6)
{
__asm("int3");
long ret;

__asm__ volatile ("movq %5,%%r10 ; movq %6,%%r8 ; "
"movq %7, %%r9; " __syscall : "=a" (ret)
: "0" (syscall), "D" (arg1), "S" (arg2), "d" (arg3),
"g" (arg4), "g" (arg5), "g" (arg6)
: __syscall_clobber, "r10", "r8", "r9" );

return ret;
}

static inline void remap_stack(long fd, unsigned long offset)
static inline void trap_myself(void)
{
__asm__ volatile ("movq %4,%%r10 ; movq %5,%%r8 ; "
"movq %6, %%r9; " __syscall "; movq %7, %%rbx ; "
"movq %%rax, (%%rbx)":
: "a" (STUB_MMAP_NR), "D" (UML_CONFIG_STUB_DATA),
"S" (UM_KERN_PAGE_SIZE),
"d" (PROT_READ | PROT_WRITE),
"g" (MAP_FIXED | MAP_SHARED), "g" (fd),
"g" (offset),
"i" (&((struct stub_data *) UML_CONFIG_STUB_DATA)->err)
: __syscall_clobber, "r10", "r8", "r9" );
__asm("int3");
}

#endif
23 changes: 10 additions & 13 deletions trunk/arch/um/kernel/skas/clone.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,11 @@
* on some systems.
*/

#define STUB_DATA(field) (((struct stub_data *) UML_CONFIG_STUB_DATA)->field)

void __attribute__ ((__section__ (".__syscall_stub")))
stub_clone_handler(void)
{
struct stub_data *data = (struct stub_data *) UML_CONFIG_STUB_DATA;
long err;

err = stub_syscall2(__NR_clone, CLONE_PARENT | CLONE_FILES | SIGCHLD,
Expand All @@ -34,21 +35,17 @@ stub_clone_handler(void)
if(err)
goto out;

err = stub_syscall3(__NR_setitimer, ITIMER_VIRTUAL,
(long) &data->timer, 0);
err = stub_syscall3(__NR_setitimer, ITIMER_VIRTUAL,
(long) &STUB_DATA(timer), 0);
if(err)
goto out;

remap_stack(data->fd, data->offset);
goto done;

err = stub_syscall6(STUB_MMAP_NR, UML_CONFIG_STUB_DATA,
UM_KERN_PAGE_SIZE, PROT_READ | PROT_WRITE,
MAP_FIXED | MAP_SHARED, STUB_DATA(fd),
STUB_DATA(offset));
out:
/* save current result.
* Parent: pid;
* child: retcode of mmap already saved and it jumps around this
* assignment
*/
data->err = err;
done:
/* save current result. Parent: pid; child: retcode of mmap */
STUB_DATA(err) = err;
trap_myself();
}
5 changes: 5 additions & 0 deletions trunk/arch/um/scripts/Makefile.rules
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ define unprofile
endef


# The stubs and unmap.o can't try to call mcount or update basic block data
define unprofile
$(patsubst -pg,,$(patsubst -fprofile-arcs -ftest-coverage,,$(1)))
endef

# cmd_make_link checks to see if the $(foo-dir) variable starts with a /. If
# so, it's considered to be a path relative to $(srcdir) rather than
# $(srcdir)/arch/$(SUBARCH). This is because x86_64 wants to get ldt.c from
Expand Down
45 changes: 14 additions & 31 deletions trunk/block/scsi_ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -442,37 +442,11 @@ static int sg_scsi_ioctl(struct file *file, request_queue_t *q,
return err;
}


/* Send basic block requests */
static int __blk_send_generic(request_queue_t *q, struct gendisk *bd_disk, int cmd, int data)
{
struct request *rq;
int err;

rq = blk_get_request(q, WRITE, __GFP_WAIT);
rq->flags |= REQ_BLOCK_PC;
rq->data = NULL;
rq->data_len = 0;
rq->timeout = BLK_DEFAULT_TIMEOUT;
memset(rq->cmd, 0, sizeof(rq->cmd));
rq->cmd[0] = cmd;
rq->cmd[4] = data;
rq->cmd_len = 6;
err = blk_execute_rq(q, bd_disk, rq, 0);
blk_put_request(rq);

return err;
}

static inline int blk_send_start_stop(request_queue_t *q, struct gendisk *bd_disk, int data)
{
return __blk_send_generic(q, bd_disk, GPCMD_START_STOP_UNIT, data);
}

int scsi_cmd_ioctl(struct file *file, struct gendisk *bd_disk, unsigned int cmd, void __user *arg)
{
request_queue_t *q;
int err;
struct request *rq;
int close = 0, err;

q = bd_disk->queue;
if (!q)
Expand Down Expand Up @@ -590,10 +564,19 @@ int scsi_cmd_ioctl(struct file *file, struct gendisk *bd_disk, unsigned int cmd,
err = sg_scsi_ioctl(file, q, bd_disk, arg);
break;
case CDROMCLOSETRAY:
err = blk_send_start_stop(q, bd_disk, 0x03);
break;
close = 1;
case CDROMEJECT:
err = blk_send_start_stop(q, bd_disk, 0x02);
rq = blk_get_request(q, WRITE, __GFP_WAIT);
rq->flags |= REQ_BLOCK_PC;
rq->data = NULL;
rq->data_len = 0;
rq->timeout = BLK_DEFAULT_TIMEOUT;
memset(rq->cmd, 0, sizeof(rq->cmd));
rq->cmd[0] = GPCMD_START_STOP_UNIT;
rq->cmd[4] = 0x02 + (close != 0);
rq->cmd_len = 6;
err = blk_execute_rq(q, bd_disk, rq, 0);
blk_put_request(rq);
break;
default:
err = -ENOTTY;
Expand Down
Loading

0 comments on commit 70b20ea

Please sign in to comment.