Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 83172
b: refs/heads/master
c: 4bdf8bc
h: refs/heads/master
v: v3
  • Loading branch information
Jeff Dike authored and Linus Torvalds committed Feb 5, 2008
1 parent c43e89c commit ddb4ded
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 22 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: ee56314b79039b669396ee04aac3e342cd2e5a1f
refs/heads/master: 4bdf8bc4a15d4540d71db9fa01955db5edcf89ec
34 changes: 21 additions & 13 deletions trunk/arch/um/include/as-layout.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,31 @@
#include "kern_constants.h"

/*
* Assembly doesn't want any casting, but C does, so define these
* without casts here, and define new symbols with casts inside the C
* section.
* Stolen from linux/const.h, which can't be directly included since
* this is used in userspace code, which has no access to the kernel
* headers. Changed to be suitable for adding casts to the start,
* rather than "UL" to the end.
*/
#define ASM_STUB_CODE (UML_CONFIG_TOP_ADDR - 2 * UM_KERN_PAGE_SIZE)
#define ASM_STUB_DATA (UML_CONFIG_TOP_ADDR - UM_KERN_PAGE_SIZE)
#define ASM_STUB_START ASM_STUB_CODE

/*
* This file is included by the assembly stubs, which just want the
* definitions above.
/* Some constant macros are used in both assembler and
* C code. Therefore we cannot annotate them always with
* 'UL' and other type specifiers unilaterally. We
* use the following macros to deal with this.
*/
#ifndef __ASSEMBLY__

#define STUB_CODE ((unsigned long) ASM_STUB_CODE)
#define STUB_DATA ((unsigned long) ASM_STUB_DATA)
#define STUB_START ((unsigned long) ASM_STUB_START)
#ifdef __ASSEMBLY__
#define _AC(X, Y) (Y)
#else
#define __AC(X, Y) (X (Y))
#define _AC(X, Y) __AC(X, Y)
#endif

#define STUB_CODE _AC((unsigned long), \
UML_CONFIG_TOP_ADDR - 2 * UM_KERN_PAGE_SIZE)
#define STUB_DATA _AC((unsigned long), UML_CONFIG_TOP_ADDR - UM_KERN_PAGE_SIZE)
#define STUB_START _AC(, STUB_CODE)

#ifndef __ASSEMBLY__

#include "sysdep/ptrace.h"

Expand Down
8 changes: 4 additions & 4 deletions trunk/arch/um/sys-i386/stub.S
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,20 @@
.globl batch_syscall_stub
batch_syscall_stub:
/* load pointer to first operation */
mov $(ASM_STUB_DATA+8), %esp
mov $(STUB_DATA+8), %esp

again:
/* load length of additional data */
mov 0x0(%esp), %eax

/* if(length == 0) : end of list */
/* write possible 0 to header */
mov %eax, ASM_STUB_DATA+4
mov %eax, STUB_DATA+4
cmpl $0, %eax
jz done

/* save current pointer */
mov %esp, ASM_STUB_DATA+4
mov %esp, STUB_DATA+4

/* skip additional data */
add %eax, %esp
Expand All @@ -46,7 +46,7 @@ again:

done:
/* save return value */
mov %eax, ASM_STUB_DATA
mov %eax, STUB_DATA

/* stop */
int3
8 changes: 4 additions & 4 deletions trunk/arch/um/sys-x86_64/stub.S
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,18 @@ syscall_stub:
/* We don't have 64-bit constants, so this constructs the address
* we need.
*/
movq $(ASM_STUB_DATA >> 32), %rbx
movq $(STUB_DATA >> 32), %rbx
salq $32, %rbx
movq $(ASM_STUB_DATA & 0xffffffff), %rcx
movq $(STUB_DATA & 0xffffffff), %rcx
or %rcx, %rbx
movq %rax, (%rbx)
int3

.globl batch_syscall_stub
batch_syscall_stub:
mov $(ASM_STUB_DATA >> 32), %rbx
mov $(STUB_DATA >> 32), %rbx
sal $32, %rbx
mov $(ASM_STUB_DATA & 0xffffffff), %rax
mov $(STUB_DATA & 0xffffffff), %rax
or %rax, %rbx
/* load pointer to first operation */
mov %rbx, %rsp
Expand Down

0 comments on commit ddb4ded

Please sign in to comment.