linux/arch/x86/um/stub_32.S
<<
>>
Prefs
   1/* SPDX-License-Identifier: GPL-2.0 */
   2#include <as-layout.h>
   3
   4.section .__syscall_stub, "ax"
   5
   6        .globl batch_syscall_stub
   7batch_syscall_stub:
   8        /* %esp comes in as "top of page" */
   9        mov %esp, %ecx
  10        /* %esp has pointer to first operation */
  11        add $8, %esp
  12again:
  13        /* load length of additional data */
  14        mov     0x0(%esp), %eax
  15
  16        /* if(length == 0) : end of list */
  17        /* write possible 0 to header */
  18        mov     %eax, 0x4(%ecx)
  19        cmpl    $0, %eax
  20        jz      done
  21
  22        /* save current pointer */
  23        mov     %esp, 0x4(%ecx)
  24
  25        /* skip additional data */
  26        add     %eax, %esp
  27
  28        /* load syscall-# */
  29        pop     %eax
  30
  31        /* load syscall params */
  32        pop     %ebx
  33        pop     %ecx
  34        pop     %edx
  35        pop     %esi
  36        pop     %edi
  37        pop     %ebp
  38
  39        /* execute syscall */
  40        int     $0x80
  41
  42        /* restore top of page pointer in %ecx */
  43        mov     %esp, %ecx
  44        andl    $(~UM_KERN_PAGE_SIZE) + 1, %ecx
  45
  46        /* check return value */
  47        pop     %ebx
  48        cmp     %ebx, %eax
  49        je      again
  50
  51done:
  52        /* save return value */
  53        mov     %eax, (%ecx)
  54
  55        /* stop */
  56        int3
  57