Clean this up a bit, and use the trap gate to enter the kernel.
This commit is contained in:
parent
87ce99227c
commit
c1a45e7763
|
@ -27,7 +27,7 @@
|
|||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: mdprologue.S,v 1.4 1994/08/03 15:57:58 pk Exp $
|
||||
* $Id: mdprologue.S,v 1.5 1994/10/26 19:41:13 mycroft Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
|
@ -35,7 +35,6 @@
|
|||
*/
|
||||
|
||||
#include <sys/syscall.h>
|
||||
#define LCALL(x,y) .byte 0x9a ; .long y; .word x
|
||||
|
||||
.text
|
||||
.globl _binder, _binder_entry
|
||||
|
@ -46,27 +45,28 @@
|
|||
|
||||
_rtl: # crt0 calls us here
|
||||
pushl %ebp # Allocate stack frame
|
||||
movl %esp, %ebp
|
||||
movl %esp,%ebp
|
||||
pushl %ebx
|
||||
|
||||
call 1f # PIC function prologue
|
||||
1:
|
||||
popl %ebx
|
||||
addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %ebx
|
||||
addl $_GLOBAL_OFFSET_TABLE_+[.-1b],%ebx
|
||||
|
||||
movl 12(%ebp), %eax # Extract data from interface structure
|
||||
movl 12(%ebp),%eax # Extract data from interface structure
|
||||
movl (%eax),%eax # base address of ld.so (first field)
|
||||
# setup arguments for rtld()
|
||||
movl (%ebx), %ecx # 1st entry in GOT is our __DYNAMIC
|
||||
addl %eax, %ecx # add load address
|
||||
movl (%ebx),%ecx # 1st entry in GOT is our __DYNAMIC
|
||||
addl %eax,%ecx # add load address
|
||||
pushl %ecx # 3rd arg
|
||||
pushl 12(%ebp) # 2nd arg == &crt.
|
||||
pushl 8(%ebp) # 1st arg == version
|
||||
addl _rtld@GOT(%ebx), %eax # relocate address of function
|
||||
addl _rtld@GOT(%ebx),%eax # relocate address of function
|
||||
call %eax # _rtld(version, crtp, DYNAMIC)
|
||||
addl $12,%esp # pop arguments
|
||||
|
||||
movl -4(%ebp), %ebx # restore %ebx
|
||||
leave # remove stack frame,
|
||||
popl %ebx
|
||||
leave # remove stack frame
|
||||
ret # let's rock
|
||||
|
||||
# First call to a procedure generally comes through here for
|
||||
|
@ -74,19 +74,19 @@ _rtl: # crt0 calls us here
|
|||
|
||||
_binder_entry:
|
||||
pushl %ebp # setup a stack frame
|
||||
movl %esp, %ebp
|
||||
movl %esp,%ebp
|
||||
pusha # save all regs
|
||||
|
||||
movl $0, %eax # clear
|
||||
movl 4(%ebp), %esi # return address in PLT
|
||||
movw (%esi), %ax # get hold of relocation number
|
||||
subl $6, %esi # make it point to the jmpslot
|
||||
xorl %eax,%eax # clear
|
||||
movl 4(%ebp),%esi # return address in PLT
|
||||
movw (%esi),%ax # get hold of relocation number
|
||||
subl $6,%esi # make it point to the jmpslot
|
||||
|
||||
pushl %eax # pushd arguments
|
||||
pushl %esi #
|
||||
call _binder@PLT # _binder(rpc, index)
|
||||
addl $8, %esp # pop arguments
|
||||
movl %eax, 4(%ebp) # return value from _binder() == actual
|
||||
addl $8,%esp # pop arguments
|
||||
movl %eax,4(%ebp) # return value from _binder() == actual
|
||||
# address of function
|
||||
popa # restore regs
|
||||
leave # remove our stack frame
|
||||
|
@ -98,24 +98,23 @@ _binder_entry:
|
|||
|
||||
.globl _getreuid, _getregid
|
||||
_getreuid:
|
||||
lea SYS_getuid, %eax
|
||||
LCALL(7,0)
|
||||
movl $SYS_getuid,%eax
|
||||
int $0x80
|
||||
jc out
|
||||
movl 4(%esp), %ecx # get 1st arg
|
||||
movl %eax, (%ecx) # put value in it
|
||||
movl 8(%esp), %ecx # same for 2nd arg
|
||||
movl %edx, (%ecx) #
|
||||
movl 4(%esp),%ecx # get 1st arg
|
||||
movl %eax,(%ecx) # put value in it
|
||||
movl 8(%esp),%ecx # same for 2nd arg
|
||||
movl %edx,(%ecx) #
|
||||
ret # done
|
||||
|
||||
_getregid:
|
||||
lea SYS_getgid, %eax
|
||||
LCALL(7,0)
|
||||
movl $SYS_getgid,%eax
|
||||
int $0x80
|
||||
jc out
|
||||
movl 4(%esp), %ecx # get 1st arg
|
||||
movl %eax, (%ecx) # put value in it
|
||||
movl 8(%esp), %ecx # same for 2nd arg
|
||||
movl %edx, (%ecx) #
|
||||
movl 4(%esp),%ecx # get 1st arg
|
||||
movl %eax,(%ecx) # put value in it
|
||||
movl 8(%esp),%ecx # same for 2nd arg
|
||||
movl %edx,(%ecx) #
|
||||
ret # done
|
||||
|
||||
out: jmp cerror@PLT # Call common error routine
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: mdprologue.S,v 1.4 1994/08/03 15:57:58 pk Exp $
|
||||
* $Id: mdprologue.S,v 1.5 1994/10/26 19:41:13 mycroft Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
|
@ -35,7 +35,6 @@
|
|||
*/
|
||||
|
||||
#include <sys/syscall.h>
|
||||
#define LCALL(x,y) .byte 0x9a ; .long y; .word x
|
||||
|
||||
.text
|
||||
.globl _binder, _binder_entry
|
||||
|
@ -46,27 +45,28 @@
|
|||
|
||||
_rtl: # crt0 calls us here
|
||||
pushl %ebp # Allocate stack frame
|
||||
movl %esp, %ebp
|
||||
movl %esp,%ebp
|
||||
pushl %ebx
|
||||
|
||||
call 1f # PIC function prologue
|
||||
1:
|
||||
popl %ebx
|
||||
addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %ebx
|
||||
addl $_GLOBAL_OFFSET_TABLE_+[.-1b],%ebx
|
||||
|
||||
movl 12(%ebp), %eax # Extract data from interface structure
|
||||
movl 12(%ebp),%eax # Extract data from interface structure
|
||||
movl (%eax),%eax # base address of ld.so (first field)
|
||||
# setup arguments for rtld()
|
||||
movl (%ebx), %ecx # 1st entry in GOT is our __DYNAMIC
|
||||
addl %eax, %ecx # add load address
|
||||
movl (%ebx),%ecx # 1st entry in GOT is our __DYNAMIC
|
||||
addl %eax,%ecx # add load address
|
||||
pushl %ecx # 3rd arg
|
||||
pushl 12(%ebp) # 2nd arg == &crt.
|
||||
pushl 8(%ebp) # 1st arg == version
|
||||
addl _rtld@GOT(%ebx), %eax # relocate address of function
|
||||
addl _rtld@GOT(%ebx),%eax # relocate address of function
|
||||
call %eax # _rtld(version, crtp, DYNAMIC)
|
||||
addl $12,%esp # pop arguments
|
||||
|
||||
movl -4(%ebp), %ebx # restore %ebx
|
||||
leave # remove stack frame,
|
||||
popl %ebx
|
||||
leave # remove stack frame
|
||||
ret # let's rock
|
||||
|
||||
# First call to a procedure generally comes through here for
|
||||
|
@ -74,19 +74,19 @@ _rtl: # crt0 calls us here
|
|||
|
||||
_binder_entry:
|
||||
pushl %ebp # setup a stack frame
|
||||
movl %esp, %ebp
|
||||
movl %esp,%ebp
|
||||
pusha # save all regs
|
||||
|
||||
movl $0, %eax # clear
|
||||
movl 4(%ebp), %esi # return address in PLT
|
||||
movw (%esi), %ax # get hold of relocation number
|
||||
subl $6, %esi # make it point to the jmpslot
|
||||
xorl %eax,%eax # clear
|
||||
movl 4(%ebp),%esi # return address in PLT
|
||||
movw (%esi),%ax # get hold of relocation number
|
||||
subl $6,%esi # make it point to the jmpslot
|
||||
|
||||
pushl %eax # pushd arguments
|
||||
pushl %esi #
|
||||
call _binder@PLT # _binder(rpc, index)
|
||||
addl $8, %esp # pop arguments
|
||||
movl %eax, 4(%ebp) # return value from _binder() == actual
|
||||
addl $8,%esp # pop arguments
|
||||
movl %eax,4(%ebp) # return value from _binder() == actual
|
||||
# address of function
|
||||
popa # restore regs
|
||||
leave # remove our stack frame
|
||||
|
@ -98,24 +98,23 @@ _binder_entry:
|
|||
|
||||
.globl _getreuid, _getregid
|
||||
_getreuid:
|
||||
lea SYS_getuid, %eax
|
||||
LCALL(7,0)
|
||||
movl $SYS_getuid,%eax
|
||||
int $0x80
|
||||
jc out
|
||||
movl 4(%esp), %ecx # get 1st arg
|
||||
movl %eax, (%ecx) # put value in it
|
||||
movl 8(%esp), %ecx # same for 2nd arg
|
||||
movl %edx, (%ecx) #
|
||||
movl 4(%esp),%ecx # get 1st arg
|
||||
movl %eax,(%ecx) # put value in it
|
||||
movl 8(%esp),%ecx # same for 2nd arg
|
||||
movl %edx,(%ecx) #
|
||||
ret # done
|
||||
|
||||
_getregid:
|
||||
lea SYS_getgid, %eax
|
||||
LCALL(7,0)
|
||||
movl $SYS_getgid,%eax
|
||||
int $0x80
|
||||
jc out
|
||||
movl 4(%esp), %ecx # get 1st arg
|
||||
movl %eax, (%ecx) # put value in it
|
||||
movl 8(%esp), %ecx # same for 2nd arg
|
||||
movl %edx, (%ecx) #
|
||||
movl 4(%esp),%ecx # get 1st arg
|
||||
movl %eax,(%ecx) # put value in it
|
||||
movl 8(%esp),%ecx # same for 2nd arg
|
||||
movl %edx,(%ecx) #
|
||||
ret # done
|
||||
|
||||
out: jmp cerror@PLT # Call common error routine
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: mdprologue.S,v 1.4 1994/08/03 15:57:58 pk Exp $
|
||||
* $Id: mdprologue.S,v 1.5 1994/10/26 19:41:13 mycroft Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
|
@ -35,7 +35,6 @@
|
|||
*/
|
||||
|
||||
#include <sys/syscall.h>
|
||||
#define LCALL(x,y) .byte 0x9a ; .long y; .word x
|
||||
|
||||
.text
|
||||
.globl _binder, _binder_entry
|
||||
|
@ -46,27 +45,28 @@
|
|||
|
||||
_rtl: # crt0 calls us here
|
||||
pushl %ebp # Allocate stack frame
|
||||
movl %esp, %ebp
|
||||
movl %esp,%ebp
|
||||
pushl %ebx
|
||||
|
||||
call 1f # PIC function prologue
|
||||
1:
|
||||
popl %ebx
|
||||
addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %ebx
|
||||
addl $_GLOBAL_OFFSET_TABLE_+[.-1b],%ebx
|
||||
|
||||
movl 12(%ebp), %eax # Extract data from interface structure
|
||||
movl 12(%ebp),%eax # Extract data from interface structure
|
||||
movl (%eax),%eax # base address of ld.so (first field)
|
||||
# setup arguments for rtld()
|
||||
movl (%ebx), %ecx # 1st entry in GOT is our __DYNAMIC
|
||||
addl %eax, %ecx # add load address
|
||||
movl (%ebx),%ecx # 1st entry in GOT is our __DYNAMIC
|
||||
addl %eax,%ecx # add load address
|
||||
pushl %ecx # 3rd arg
|
||||
pushl 12(%ebp) # 2nd arg == &crt.
|
||||
pushl 8(%ebp) # 1st arg == version
|
||||
addl _rtld@GOT(%ebx), %eax # relocate address of function
|
||||
addl _rtld@GOT(%ebx),%eax # relocate address of function
|
||||
call %eax # _rtld(version, crtp, DYNAMIC)
|
||||
addl $12,%esp # pop arguments
|
||||
|
||||
movl -4(%ebp), %ebx # restore %ebx
|
||||
leave # remove stack frame,
|
||||
popl %ebx
|
||||
leave # remove stack frame
|
||||
ret # let's rock
|
||||
|
||||
# First call to a procedure generally comes through here for
|
||||
|
@ -74,19 +74,19 @@ _rtl: # crt0 calls us here
|
|||
|
||||
_binder_entry:
|
||||
pushl %ebp # setup a stack frame
|
||||
movl %esp, %ebp
|
||||
movl %esp,%ebp
|
||||
pusha # save all regs
|
||||
|
||||
movl $0, %eax # clear
|
||||
movl 4(%ebp), %esi # return address in PLT
|
||||
movw (%esi), %ax # get hold of relocation number
|
||||
subl $6, %esi # make it point to the jmpslot
|
||||
xorl %eax,%eax # clear
|
||||
movl 4(%ebp),%esi # return address in PLT
|
||||
movw (%esi),%ax # get hold of relocation number
|
||||
subl $6,%esi # make it point to the jmpslot
|
||||
|
||||
pushl %eax # pushd arguments
|
||||
pushl %esi #
|
||||
call _binder@PLT # _binder(rpc, index)
|
||||
addl $8, %esp # pop arguments
|
||||
movl %eax, 4(%ebp) # return value from _binder() == actual
|
||||
addl $8,%esp # pop arguments
|
||||
movl %eax,4(%ebp) # return value from _binder() == actual
|
||||
# address of function
|
||||
popa # restore regs
|
||||
leave # remove our stack frame
|
||||
|
@ -98,24 +98,23 @@ _binder_entry:
|
|||
|
||||
.globl _getreuid, _getregid
|
||||
_getreuid:
|
||||
lea SYS_getuid, %eax
|
||||
LCALL(7,0)
|
||||
movl $SYS_getuid,%eax
|
||||
int $0x80
|
||||
jc out
|
||||
movl 4(%esp), %ecx # get 1st arg
|
||||
movl %eax, (%ecx) # put value in it
|
||||
movl 8(%esp), %ecx # same for 2nd arg
|
||||
movl %edx, (%ecx) #
|
||||
movl 4(%esp),%ecx # get 1st arg
|
||||
movl %eax,(%ecx) # put value in it
|
||||
movl 8(%esp),%ecx # same for 2nd arg
|
||||
movl %edx,(%ecx) #
|
||||
ret # done
|
||||
|
||||
_getregid:
|
||||
lea SYS_getgid, %eax
|
||||
LCALL(7,0)
|
||||
movl $SYS_getgid,%eax
|
||||
int $0x80
|
||||
jc out
|
||||
movl 4(%esp), %ecx # get 1st arg
|
||||
movl %eax, (%ecx) # put value in it
|
||||
movl 8(%esp), %ecx # same for 2nd arg
|
||||
movl %edx, (%ecx) #
|
||||
movl 4(%esp),%ecx # get 1st arg
|
||||
movl %eax,(%ecx) # put value in it
|
||||
movl 8(%esp),%ecx # same for 2nd arg
|
||||
movl %edx,(%ecx) #
|
||||
ret # done
|
||||
|
||||
out: jmp cerror@PLT # Call common error routine
|
||||
|
||||
|
|
Loading…
Reference in New Issue