Kernel: Cleanup constructor calls
This commit is contained in:
parent
2ae2ede0b2
commit
ddf1babfe1
|
@ -216,12 +216,11 @@ higher_half:
|
||||||
# call global constuctors
|
# call global constuctors
|
||||||
call _init
|
call _init
|
||||||
|
|
||||||
movl $__init_array_start, %ebx
|
movl $g_init_array_start, %ebx
|
||||||
jmp 2f
|
jmp 2f
|
||||||
1: movl (%ebx), %eax
|
1: call *(%ebx)
|
||||||
call *%eax
|
|
||||||
addl $4, %ebx
|
addl $4, %ebx
|
||||||
2: cmpl $__init_array_end, %ebx
|
2: cmpl $g_init_array_end, %ebx
|
||||||
jne 1b
|
jne 1b
|
||||||
|
|
||||||
# call to the kernel itself (clear ebp for stacktrace)
|
# call to the kernel itself (clear ebp for stacktrace)
|
||||||
|
|
|
@ -14,11 +14,3 @@ _fini:
|
||||||
pushl %ebp
|
pushl %ebp
|
||||||
movl %esp, %ebp
|
movl %esp, %ebp
|
||||||
/* gcc will nicely put the contents of crtbegin.o's .fini section here. */
|
/* gcc will nicely put the contents of crtbegin.o's .fini section here. */
|
||||||
|
|
||||||
.section .init_array
|
|
||||||
.global __init_array_start
|
|
||||||
__init_array_start:
|
|
||||||
|
|
||||||
.section .fini_array
|
|
||||||
.global __fini_array_start
|
|
||||||
__fini_array_start:
|
|
||||||
|
|
|
@ -8,11 +8,3 @@
|
||||||
/* gcc will nicely put the contents of crtend.o's .fini section here. */
|
/* gcc will nicely put the contents of crtend.o's .fini section here. */
|
||||||
popl %ebp
|
popl %ebp
|
||||||
ret
|
ret
|
||||||
|
|
||||||
.section .init_array
|
|
||||||
.global __init_array_end
|
|
||||||
__init_array_end:
|
|
||||||
|
|
||||||
.section .fini_array
|
|
||||||
.global __fini_array_end
|
|
||||||
__fini_array_end:
|
|
||||||
|
|
|
@ -30,6 +30,12 @@ SECTIONS
|
||||||
{
|
{
|
||||||
*(.rodata.*)
|
*(.rodata.*)
|
||||||
}
|
}
|
||||||
|
.init_array ALIGN(4K) : AT(ADDR(.init_array) - KERNEL_OFFSET)
|
||||||
|
{
|
||||||
|
g_init_array_start = .;
|
||||||
|
*(.init_array)
|
||||||
|
g_init_array_end = .;
|
||||||
|
}
|
||||||
.data ALIGN(4K) : AT(ADDR(.data) - KERNEL_OFFSET)
|
.data ALIGN(4K) : AT(ADDR(.data) - KERNEL_OFFSET)
|
||||||
{
|
{
|
||||||
g_kernel_writable_start = .;
|
g_kernel_writable_start = .;
|
||||||
|
|
|
@ -216,12 +216,11 @@ higher_half:
|
||||||
# call global constuctors
|
# call global constuctors
|
||||||
call _init
|
call _init
|
||||||
|
|
||||||
movq $__init_array_start, %rbx
|
movq $g_init_array_start, %rbx
|
||||||
jmp 2f
|
jmp 2f
|
||||||
1: movq (%rbx), %rax
|
1: call *(%rbx)
|
||||||
call *%rax
|
|
||||||
addq $8, %rbx
|
addq $8, %rbx
|
||||||
2: cmpq $__init_array_end, %rbx
|
2: cmpq $g_init_array_end, %rbx
|
||||||
jne 1b
|
jne 1b
|
||||||
|
|
||||||
# call to the kernel itself (clear rbp for stacktrace)
|
# call to the kernel itself (clear rbp for stacktrace)
|
||||||
|
|
|
@ -14,11 +14,3 @@ _fini:
|
||||||
pushq %rbp
|
pushq %rbp
|
||||||
movq %rsp, %rbp
|
movq %rsp, %rbp
|
||||||
/* gcc will nicely put the contents of crtbegin.o's .fini section here. */
|
/* gcc will nicely put the contents of crtbegin.o's .fini section here. */
|
||||||
|
|
||||||
.section .init_array
|
|
||||||
.global __init_array_start
|
|
||||||
__init_array_start:
|
|
||||||
|
|
||||||
.section .fini_array
|
|
||||||
.global __fini_array_start
|
|
||||||
__fini_array_start:
|
|
||||||
|
|
|
@ -8,11 +8,3 @@
|
||||||
/* gcc will nicely put the contents of crtend.o's .fini section here. */
|
/* gcc will nicely put the contents of crtend.o's .fini section here. */
|
||||||
popq %rbp
|
popq %rbp
|
||||||
ret
|
ret
|
||||||
|
|
||||||
.section .init_array
|
|
||||||
.global __init_array_end
|
|
||||||
__init_array_end:
|
|
||||||
|
|
||||||
.section .fini_array
|
|
||||||
.global __fini_array_end
|
|
||||||
__fini_array_end:
|
|
||||||
|
|
|
@ -30,6 +30,12 @@ SECTIONS
|
||||||
{
|
{
|
||||||
*(.rodata.*)
|
*(.rodata.*)
|
||||||
}
|
}
|
||||||
|
.init_array ALIGN(4K) : AT(ADDR(.init_array) - KERNEL_OFFSET)
|
||||||
|
{
|
||||||
|
g_init_array_start = .;
|
||||||
|
*(.init_array)
|
||||||
|
g_init_array_end = .;
|
||||||
|
}
|
||||||
.data ALIGN(4K) : AT(ADDR(.data) - KERNEL_OFFSET)
|
.data ALIGN(4K) : AT(ADDR(.data) - KERNEL_OFFSET)
|
||||||
{
|
{
|
||||||
g_kernel_writable_start = .;
|
g_kernel_writable_start = .;
|
||||||
|
|
Loading…
Reference in New Issue