change startup code to call munmap()/munmap_text() to map out
own 0-pages.
This commit is contained in:
parent
1c217d038c
commit
da8360c0a3
@ -1,3 +1,4 @@
|
|||||||
|
#
|
||||||
! This is the C run-time start-off routine. It's job is to take the
|
! This is the C run-time start-off routine. It's job is to take the
|
||||||
! arguments as put on the stack by EXEC, and to parse them and set them up the
|
! arguments as put on the stack by EXEC, and to parse them and set them up the
|
||||||
! way _main expects them.
|
! way _main expects them.
|
||||||
@ -6,6 +7,8 @@
|
|||||||
! simplistic. We simply check for some magic value, but there is no other
|
! simplistic. We simply check for some magic value, but there is no other
|
||||||
! way.
|
! way.
|
||||||
|
|
||||||
|
#include <sys/vm_i386.h>
|
||||||
|
|
||||||
.sect .text; .sect .rom; .sect .data; .sect .bss
|
.sect .text; .sect .rom; .sect .data; .sect .bss
|
||||||
|
|
||||||
.define begtext, begdata, begbss
|
.define begtext, begdata, begbss
|
||||||
@ -19,6 +22,7 @@ begdata:
|
|||||||
begbss:
|
begbss:
|
||||||
|
|
||||||
.define crtso, __penviron, __penvp, __fpu_present
|
.define crtso, __penviron, __penvp, __fpu_present
|
||||||
|
.define __minix_datastart, __minix_mainjump, __minix_unmapzero
|
||||||
.extern _main, _exit
|
.extern _main, _exit
|
||||||
.sect .text
|
.sect .text
|
||||||
crtso:
|
crtso:
|
||||||
@ -49,6 +53,12 @@ crtso:
|
|||||||
smsw ax
|
smsw ax
|
||||||
testb al, 0x4 ! EM bit in MSW
|
testb al, 0x4 ! EM bit in MSW
|
||||||
setz (__fpu_present) ! True if not set
|
setz (__fpu_present) ! True if not set
|
||||||
|
jmp __minix_mainjump
|
||||||
|
|
||||||
|
.align I386_PAGE_SIZE
|
||||||
|
__minix_mainjump:
|
||||||
|
! unmap zero pages
|
||||||
|
call __minix_unmapzero
|
||||||
|
|
||||||
call _main ! main(argc, argv, envp)
|
call _main ! main(argc, argv, envp)
|
||||||
|
|
||||||
@ -57,10 +67,27 @@ crtso:
|
|||||||
|
|
||||||
hlt ! force a trap if exit fails
|
hlt ! force a trap if exit fails
|
||||||
|
|
||||||
|
__minix_unmapzero:
|
||||||
|
|
||||||
|
! unmap 0-page code
|
||||||
|
push I386_PAGE_SIZE
|
||||||
|
push crtso
|
||||||
|
call _munmap_text ! munmap_text(crtso, I386_PAGE_SIZE)
|
||||||
|
add esp, 8
|
||||||
|
|
||||||
|
! unmap 0-page data
|
||||||
|
push I386_PAGE_SIZE
|
||||||
|
push romstart
|
||||||
|
call _munmap ! munmap(romstart, I386_PAGE_SIZE)
|
||||||
|
add esp, 8
|
||||||
|
|
||||||
|
ret
|
||||||
|
|
||||||
.sect .rom
|
.sect .rom
|
||||||
.data4 0 ! Separate I&D: *NULL == 0
|
romstart:
|
||||||
! Also keeps the first string in the
|
.space I386_PAGE_SIZE
|
||||||
! program from appearing at location 0!
|
__minix_datastart:
|
||||||
|
.space 4
|
||||||
.sect .data
|
.sect .data
|
||||||
__penviron:
|
__penviron:
|
||||||
.data4 __penvp ! Pointer to environ, or hidden pointer
|
.data4 __penvp ! Pointer to environ, or hidden pointer
|
||||||
|
Loading…
x
Reference in New Issue
Block a user