Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #include <as-layout.h>
0003 
0004 .section .__syscall_stub, "ax"
0005 
0006     .globl batch_syscall_stub
0007 batch_syscall_stub:
0008     /* %esp comes in as "top of page" */
0009     mov %esp, %ecx
0010     /* %esp has pointer to first operation */
0011     add $8, %esp
0012 again:
0013     /* load length of additional data */
0014     mov 0x0(%esp), %eax
0015 
0016     /* if(length == 0) : end of list */
0017     /* write possible 0 to header */
0018     mov %eax, 0x4(%ecx)
0019     cmpl    $0, %eax
0020     jz  done
0021 
0022     /* save current pointer */
0023     mov %esp, 0x4(%ecx)
0024 
0025     /* skip additional data */
0026     add %eax, %esp
0027 
0028     /* load syscall-# */
0029     pop %eax
0030 
0031     /* load syscall params */
0032     pop %ebx
0033     pop %ecx
0034     pop %edx
0035     pop %esi
0036     pop %edi
0037     pop %ebp
0038 
0039     /* execute syscall */
0040     int $0x80
0041 
0042     /* restore top of page pointer in %ecx */
0043     mov %esp, %ecx
0044     andl    $(~UM_KERN_PAGE_SIZE) + 1, %ecx
0045 
0046     /* check return value */
0047     pop %ebx
0048     cmp %ebx, %eax
0049     je  again
0050 
0051 done:
0052     /* save return value */
0053     mov %eax, (%ecx)
0054 
0055     /* stop */
0056     int3