Index: head/sys/amd64/linux/linux_locore.asm =================================================================== --- head/sys/amd64/linux/linux_locore.asm +++ head/sys/amd64/linux/linux_locore.asm @@ -0,0 +1,108 @@ +/* $FreeBSD$ */ + +#include "linux_assym.h" /* system definitions */ +#include /* miscellaneous asm macros */ + +#include /* system call numbers */ + + .data + + .globl linux_platform +linux_platform: + .asciz "x86_64" + + + .text +/* + * To avoid excess stack frame the signal trampoline code emulates + * the 'call' instruction. + */ +NON_GPROF_ENTRY(linux_rt_sigcode) + movq %rsp, %rbx /* preserve sigframe */ + call .getip +.getip: + popq %rax + add $.startrtsigcode-.getip, %rax /* ret address */ + pushq %rax + jmp *LINUX_RT_SIGF_HANDLER(%rbx) +.startrtsigcode: + movq $LINUX_SYS_linux_rt_sigreturn,%rax /* linux_rt_sigreturn() */ + syscall /* enter kernel with args */ + hlt +.endrtsigcode: +0: jmp 0b + +NON_GPROF_ENTRY(__vdso_clock_gettime) + movq $LINUX_SYS_linux_clock_gettime,%rax + syscall + ret +.weak clock_gettime +.set clock_gettime, __vdso_clock_gettime + +NON_GPROF_ENTRY(__vdso_time) + movq $LINUX_SYS_linux_time,%rax + syscall + ret +.weak time +.set time, __vdso_time + +NON_GPROF_ENTRY(__vdso_gettimeofday) + movq $LINUX_SYS_gettimeofday,%rax + syscall + ret +.weak gettimeofday +.set gettimeofday, __vdso_gettimeofday + +NON_GPROF_ENTRY(__vdso_getcpu) + movq $-38,%rax /* not implemented */ + ret +.weak getcpu +.set getcpu, __vdso_getcpu + +#if 0 + .section .note.Linux, "a",@note + .long 2f - 1f /* namesz */ + .balign 4 + .long 4f - 3f /* descsz */ + .long 0 +1: + .asciz "Linux" +2: + .balign 4 +3: + .long LINUX_VERSION_CODE +4: + .balign 4 + .previous +#endif + + .section .eh_frame,"a",@progbits +.LSTARTFRAMEDLSI0: + .long .LENDCIEDLSI0-.LSTARTCIEDLSI0 +.LSTARTCIEDLSI0: + .long 0 /* CIE ID */ + .byte 1 /* Version number */ + .string "zR" /* NULL-terminated + * augmentation string + */ + .uleb128 1 /* Code alignment factor */ + .sleb128 -4 /* Data alignment factor */ + .byte 8 /* Return address register column */ + .uleb128 1 /* Augmentation value length */ + .byte 0x1b /* DW_EH_PE_pcrel|DW_EH_PE_sdata4. */ + .byte 0x0c /* DW_CFA_def_cfa */ + .uleb128 4 + .uleb128 4 + .byte 0x88 /* DW_CFA_offset, column 0x8 */ + .uleb128 1 + .align 4 +.LENDCIEDLSI0: + .long .LENDFDEDLSI0-.LSTARTFDEDLSI0 /* Length FDE */ +.LSTARTFDEDLSI0: + .long .LSTARTFDEDLSI0-.LSTARTFRAMEDLSI0 /* CIE pointer */ + .long .startrtsigcode-. /* PC-relative start address */ + .long .endrtsigcode-.startrtsigcode + .uleb128 0 + .align 4 +.LENDFDEDLSI0: + .previous Index: head/sys/amd64/linux/linux_locore.s =================================================================== --- head/sys/amd64/linux/linux_locore.s +++ head/sys/amd64/linux/linux_locore.s @@ -1,108 +0,0 @@ -/* $FreeBSD$ */ - -#include "linux_assym.h" /* system definitions */ -#include /* miscellaneous asm macros */ - -#include /* system call numbers */ - - .data - - .globl linux_platform -linux_platform: - .asciz "x86_64" - - - .text -/* - * To avoid excess stack frame the signal trampoline code emulates - * the 'call' instruction. - */ -NON_GPROF_ENTRY(linux_rt_sigcode) - movq %rsp, %rbx /* preserve sigframe */ - call .getip -.getip: - popq %rax - add $.startrtsigcode-.getip, %rax /* ret address */ - pushq %rax - jmp *LINUX_RT_SIGF_HANDLER(%rbx) -.startrtsigcode: - movq $LINUX_SYS_linux_rt_sigreturn,%rax /* linux_rt_sigreturn() */ - syscall /* enter kernel with args */ - hlt -.endrtsigcode: -0: jmp 0b - -NON_GPROF_ENTRY(__vdso_clock_gettime) - movq $LINUX_SYS_linux_clock_gettime,%rax - syscall - ret -.weak clock_gettime -.set clock_gettime, __vdso_clock_gettime - -NON_GPROF_ENTRY(__vdso_time) - movq $LINUX_SYS_linux_time,%rax - syscall - ret -.weak time -.set time, __vdso_time - -NON_GPROF_ENTRY(__vdso_gettimeofday) - movq $LINUX_SYS_gettimeofday,%rax - syscall - ret -.weak gettimeofday -.set gettimeofday, __vdso_gettimeofday - -NON_GPROF_ENTRY(__vdso_getcpu) - movq $-38,%rax /* not implemented */ - ret -.weak getcpu -.set getcpu, __vdso_getcpu - -#if 0 - .section .note.Linux, "a",@note - .long 2f - 1f /* namesz */ - .balign 4 - .long 4f - 3f /* descsz */ - .long 0 -1: - .asciz "Linux" -2: - .balign 4 -3: - .long LINUX_VERSION_CODE -4: - .balign 4 - .previous -#endif - - .section .eh_frame,"a",@progbits -.LSTARTFRAMEDLSI0: - .long .LENDCIEDLSI0-.LSTARTCIEDLSI0 -.LSTARTCIEDLSI0: - .long 0 /* CIE ID */ - .byte 1 /* Version number */ - .string "zR" /* NULL-terminated - * augmentation string - */ - .uleb128 1 /* Code alignment factor */ - .sleb128 -4 /* Data alignment factor */ - .byte 8 /* Return address register column */ - .uleb128 1 /* Augmentation value length */ - .byte 0x1b /* DW_EH_PE_pcrel|DW_EH_PE_sdata4. */ - .byte 0x0c /* DW_CFA_def_cfa */ - .uleb128 4 - .uleb128 4 - .byte 0x88 /* DW_CFA_offset, column 0x8 */ - .uleb128 1 - .align 4 -.LENDCIEDLSI0: - .long .LENDFDEDLSI0-.LSTARTFDEDLSI0 /* Length FDE */ -.LSTARTFDEDLSI0: - .long .LSTARTFDEDLSI0-.LSTARTFRAMEDLSI0 /* CIE pointer */ - .long .startrtsigcode-. /* PC-relative start address */ - .long .endrtsigcode-.startrtsigcode - .uleb128 0 - .align 4 -.LENDFDEDLSI0: - .previous Index: head/sys/amd64/linux32/linux32_locore.asm =================================================================== --- head/sys/amd64/linux32/linux32_locore.asm +++ head/sys/amd64/linux32/linux32_locore.asm @@ -0,0 +1,156 @@ +/* $FreeBSD$ */ + +#include "linux32_assym.h" /* system definitions */ +#include /* miscellaneous asm macros */ + +#include /* system call numbers */ + +.data + + .globl linux_platform +linux_platform: + .asciz "i686" + +.text +.code32 + +/* + * To avoid excess stack frame the signal trampoline code emulates + * the 'call' instruction. + */ +NON_GPROF_ENTRY(linux32_sigcode) + movl %esp, %ebx /* preserve sigframe */ + call .getip0 +.getip0: + popl %eax + add $.startsigcode-.getip0, %eax /* ret address */ + push %eax + jmp *LINUX_SIGF_HANDLER(%ebx) +.startsigcode: + popl %eax + movl $LINUX32_SYS_linux_sigreturn,%eax /* linux_sigreturn() */ + int $0x80 /* enter kernel with args */ +.endsigcode: +0: jmp 0b + +NON_GPROF_ENTRY(linux32_rt_sigcode) + leal LINUX_RT_SIGF_UC(%esp),%ebx /* linux ucp */ + leal LINUX_RT_SIGF_SC(%ebx),%ecx /* linux sigcontext */ + movl %esp, %edi + call .getip1 +.getip1: + popl %eax + add $.startrtsigcode-.getip1, %eax /* ret address */ + push %eax + jmp *LINUX_RT_SIGF_HANDLER(%edi) +.startrtsigcode: + movl $LINUX32_SYS_linux_rt_sigreturn,%eax /* linux_rt_sigreturn() */ + int $0x80 /* enter kernel with args */ +.endrtsigcode: +0: jmp 0b + +NON_GPROF_ENTRY(linux32_vsyscall) +.startvsyscall: + int $0x80 + ret +.endvsyscall: + +#if 0 + .section .note.Linux, "a",@note + .long 2f - 1f /* namesz */ + .balign 4 + .long 4f - 3f /* descsz */ + .long 0 +1: + .asciz "Linux" +2: + .balign 4 +3: + .long LINUX_VERSION_CODE +4: + .balign 4 + .previous +#endif + +#define do_cfa_expr(offset) \ + .byte 0x0f; /* DW_CFA_def_cfa_expression */ \ + .uleb128 11f-10f; /* length */ \ +10: .byte 0x74; /* DW_OP_breg4 */ \ + .sleb128 offset; /* offset */ \ + .byte 0x06; /* DW_OP_deref */ \ +11: + + + /* CIE */ + .section .eh_frame,"a",@progbits +.LSTARTFRAMEDLSI1: + .long .LENDCIEDLSI1-.LSTARTCIEDLSI1 +.LSTARTCIEDLSI1: + .long 0 /* CIE ID */ + .byte 1 /* Version number */ + .string "zRS" /* NULL-terminated + * augmentation string + */ + .uleb128 1 /* Code alignment factor */ + .sleb128 -4 /* Data alignment factor */ + .byte 8 /* Return address + * register column + */ + .uleb128 1 /* Augmentation value length */ + .byte 0x1b /* DW_EH_PE_pcrel|DW_EH_PE_sdata4. */ + .byte 0 /* DW_CFA_nop */ + .align 4 +.LENDCIEDLSI1: + + /* FDE */ + .long .LENDFDEDLSI1-.LSTARTFDEDLSI1 /* Length FDE */ +.LSTARTFDEDLSI1: + .long .LSTARTFDEDLSI1-.LSTARTFRAMEDLSI1 /* CIE pointer */ + .long .startsigcode-. /* PC-relative start address */ + .long .endsigcode-.startsigcode + .uleb128 0 /* Augmentation */ + do_cfa_expr(LINUX_SIGF_SC-8) + .align 4 +.LENDFDEDLSI1: + + .long .LENDFDEDLSI2-.LSTARTFDEDLSI2 /* Length FDE */ +.LSTARTFDEDLSI2: + .long .LSTARTFDEDLSI2-.LSTARTFRAMEDLSI1 /* CIE pointer */ + .long .startrtsigcode-. /* PC-relative start address */ + .long .endrtsigcode-.startrtsigcode + .uleb128 0 /* Augmentation */ + do_cfa_expr(LINUX_RT_SIGF_SC-4+LINUX_SC_ESP) + .align 4 +.LENDFDEDLSI2: + .previous + + .section .eh_frame,"a",@progbits +.LSTARTFRAMEDLSI2: + .long .LENDCIEDLSI2-.LSTARTCIEDLSI2 +.LSTARTCIEDLSI2: + .long 0 /* CIE ID */ + .byte 1 /* Version number */ + .string "zR" /* NULL-terminated + * augmentation string + */ + .uleb128 1 /* Code alignment factor */ + .sleb128 -4 /* Data alignment factor */ + .byte 8 /* Return address register column */ + .uleb128 1 /* Augmentation value length */ + .byte 0x1b /* DW_EH_PE_pcrel|DW_EH_PE_sdata4. */ + .byte 0x0c /* DW_CFA_def_cfa */ + .uleb128 4 + .uleb128 4 + .byte 0x88 /* DW_CFA_offset, column 0x8 */ + .uleb128 1 + .align 4 +.LENDCIEDLSI2: + .long .LENDFDEDLSI3-.LSTARTFDEDLSI3 /* Length FDE */ +.LSTARTFDEDLSI3: + .long .LSTARTFDEDLSI3-.LSTARTFRAMEDLSI2 /* CIE pointer */ + .long .startvsyscall-. /* PC-relative start address */ + .long .endvsyscall-.startvsyscall + .uleb128 0 + .align 4 +.LENDFDEDLSI3: + .previous Index: head/sys/amd64/linux32/linux32_locore.s =================================================================== --- head/sys/amd64/linux32/linux32_locore.s +++ head/sys/amd64/linux32/linux32_locore.s @@ -1,156 +0,0 @@ -/* $FreeBSD$ */ - -#include "linux32_assym.h" /* system definitions */ -#include /* miscellaneous asm macros */ - -#include /* system call numbers */ - -.data - - .globl linux_platform -linux_platform: - .asciz "i686" - -.text -.code32 - -/* - * To avoid excess stack frame the signal trampoline code emulates - * the 'call' instruction. - */ -NON_GPROF_ENTRY(linux32_sigcode) - movl %esp, %ebx /* preserve sigframe */ - call .getip0 -.getip0: - popl %eax - add $.startsigcode-.getip0, %eax /* ret address */ - push %eax - jmp *LINUX_SIGF_HANDLER(%ebx) -.startsigcode: - popl %eax - movl $LINUX32_SYS_linux_sigreturn,%eax /* linux_sigreturn() */ - int $0x80 /* enter kernel with args */ -.endsigcode: -0: jmp 0b - -NON_GPROF_ENTRY(linux32_rt_sigcode) - leal LINUX_RT_SIGF_UC(%esp),%ebx /* linux ucp */ - leal LINUX_RT_SIGF_SC(%ebx),%ecx /* linux sigcontext */ - movl %esp, %edi - call .getip1 -.getip1: - popl %eax - add $.startrtsigcode-.getip1, %eax /* ret address */ - push %eax - jmp *LINUX_RT_SIGF_HANDLER(%edi) -.startrtsigcode: - movl $LINUX32_SYS_linux_rt_sigreturn,%eax /* linux_rt_sigreturn() */ - int $0x80 /* enter kernel with args */ -.endrtsigcode: -0: jmp 0b - -NON_GPROF_ENTRY(linux32_vsyscall) -.startvsyscall: - int $0x80 - ret -.endvsyscall: - -#if 0 - .section .note.Linux, "a",@note - .long 2f - 1f /* namesz */ - .balign 4 - .long 4f - 3f /* descsz */ - .long 0 -1: - .asciz "Linux" -2: - .balign 4 -3: - .long LINUX_VERSION_CODE -4: - .balign 4 - .previous -#endif - -#define do_cfa_expr(offset) \ - .byte 0x0f; /* DW_CFA_def_cfa_expression */ \ - .uleb128 11f-10f; /* length */ \ -10: .byte 0x74; /* DW_OP_breg4 */ \ - .sleb128 offset; /* offset */ \ - .byte 0x06; /* DW_OP_deref */ \ -11: - - - /* CIE */ - .section .eh_frame,"a",@progbits -.LSTARTFRAMEDLSI1: - .long .LENDCIEDLSI1-.LSTARTCIEDLSI1 -.LSTARTCIEDLSI1: - .long 0 /* CIE ID */ - .byte 1 /* Version number */ - .string "zRS" /* NULL-terminated - * augmentation string - */ - .uleb128 1 /* Code alignment factor */ - .sleb128 -4 /* Data alignment factor */ - .byte 8 /* Return address - * register column - */ - .uleb128 1 /* Augmentation value length */ - .byte 0x1b /* DW_EH_PE_pcrel|DW_EH_PE_sdata4. */ - .byte 0 /* DW_CFA_nop */ - .align 4 -.LENDCIEDLSI1: - - /* FDE */ - .long .LENDFDEDLSI1-.LSTARTFDEDLSI1 /* Length FDE */ -.LSTARTFDEDLSI1: - .long .LSTARTFDEDLSI1-.LSTARTFRAMEDLSI1 /* CIE pointer */ - .long .startsigcode-. /* PC-relative start address */ - .long .endsigcode-.startsigcode - .uleb128 0 /* Augmentation */ - do_cfa_expr(LINUX_SIGF_SC-8) - .align 4 -.LENDFDEDLSI1: - - .long .LENDFDEDLSI2-.LSTARTFDEDLSI2 /* Length FDE */ -.LSTARTFDEDLSI2: - .long .LSTARTFDEDLSI2-.LSTARTFRAMEDLSI1 /* CIE pointer */ - .long .startrtsigcode-. /* PC-relative start address */ - .long .endrtsigcode-.startrtsigcode - .uleb128 0 /* Augmentation */ - do_cfa_expr(LINUX_RT_SIGF_SC-4+LINUX_SC_ESP) - .align 4 -.LENDFDEDLSI2: - .previous - - .section .eh_frame,"a",@progbits -.LSTARTFRAMEDLSI2: - .long .LENDCIEDLSI2-.LSTARTCIEDLSI2 -.LSTARTCIEDLSI2: - .long 0 /* CIE ID */ - .byte 1 /* Version number */ - .string "zR" /* NULL-terminated - * augmentation string - */ - .uleb128 1 /* Code alignment factor */ - .sleb128 -4 /* Data alignment factor */ - .byte 8 /* Return address register column */ - .uleb128 1 /* Augmentation value length */ - .byte 0x1b /* DW_EH_PE_pcrel|DW_EH_PE_sdata4. */ - .byte 0x0c /* DW_CFA_def_cfa */ - .uleb128 4 - .uleb128 4 - .byte 0x88 /* DW_CFA_offset, column 0x8 */ - .uleb128 1 - .align 4 -.LENDCIEDLSI2: - .long .LENDFDEDLSI3-.LSTARTFDEDLSI3 /* Length FDE */ -.LSTARTFDEDLSI3: - .long .LSTARTFDEDLSI3-.LSTARTFRAMEDLSI2 /* CIE pointer */ - .long .startvsyscall-. /* PC-relative start address */ - .long .endvsyscall-.startvsyscall - .uleb128 0 - .align 4 -.LENDFDEDLSI3: - .previous Index: head/sys/arm64/linux/linux_locore.asm =================================================================== --- head/sys/arm64/linux/linux_locore.asm +++ head/sys/arm64/linux/linux_locore.asm @@ -0,0 +1,58 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (C) 2018 Turing Robotic Industries Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +/* + * arm64 Linux VDSO implementation. + */ + +#include + + .data + + .globl linux_platform +linux_platform: + .asciz "arm64" + + .text + +ENTRY(__kernel_rt_sigreturn) + brk #0 /* LINUXTODO: implement __kernel_rt_sigreturn */ + ret + +ENTRY(__kernel_gettimeofday) + brk #0 /* LINUXTODO: implement __kernel_gettimeofday */ + ret + +ENTRY(__kernel_clock_gettime) + brk #0 /* LINUXTODO: implement __kernel_clock_gettime */ + ret + +ENTRY(__kernel_clock_getres) + brk #0 /* LINUXTODO: implement __kernel_clock_getres */ + ret Index: head/sys/arm64/linux/linux_locore.s =================================================================== --- head/sys/arm64/linux/linux_locore.s +++ head/sys/arm64/linux/linux_locore.s @@ -1,58 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (C) 2018 Turing Robotic Industries Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -/* - * arm64 Linux VDSO implementation. - */ - -#include - - .data - - .globl linux_platform -linux_platform: - .asciz "arm64" - - .text - -ENTRY(__kernel_rt_sigreturn) - brk #0 /* LINUXTODO: implement __kernel_rt_sigreturn */ - ret - -ENTRY(__kernel_gettimeofday) - brk #0 /* LINUXTODO: implement __kernel_gettimeofday */ - ret - -ENTRY(__kernel_clock_gettime) - brk #0 /* LINUXTODO: implement __kernel_clock_gettime */ - ret - -ENTRY(__kernel_clock_getres) - brk #0 /* LINUXTODO: implement __kernel_clock_getres */ - ret Index: head/sys/conf/files.amd64 =================================================================== --- head/sys/conf/files.amd64 +++ head/sys/conf/files.amd64 @@ -45,7 +45,7 @@ clean "linux32_assym.h" # linux32_locore.o optional compat_linux32 \ - dependency "linux32_assym.h $S/amd64/linux32/linux32_locore.s" \ + dependency "linux32_assym.h $S/amd64/linux32/linux32_locore.asm" \ compile-with "${CC} -x assembler-with-cpp -DLOCORE -m32 -shared -s -pipe -I. -I$S -Werror -Wall -fPIC -fno-common -nostdinc -nostdlib -Wl,-T$S/amd64/linux32/linux32_vdso.lds.s -Wl,-soname=linux32_vdso.so,--eh-frame-hdr,-warn-common ${.IMPSRC} -o ${.TARGET}" \ no-obj no-implicit-rule \ clean "linux32_locore.o" Index: head/sys/conf/files.i386 =================================================================== --- head/sys/conf/files.i386 +++ head/sys/conf/files.i386 @@ -32,7 +32,7 @@ clean "linux_assym.h" # linux_locore.o optional compat_linux \ - dependency "linux_assym.h $S/i386/linux/linux_locore.s" \ + dependency "linux_assym.h $S/i386/linux/linux_locore.asm" \ compile-with "${CC} -x assembler-with-cpp -DLOCORE -shared -s -pipe -I. -I$S -Werror -Wall -fPIC -fno-common -nostdinc -nostdlib -Wl,-T$S/i386/linux/linux_vdso.lds.s -Wl,-soname=linux_vdso.so,--eh-frame-hdr,-warn-common ${.IMPSRC} -o ${.TARGET}" \ no-obj no-implicit-rule \ clean "linux_locore.o" Index: head/sys/i386/linux/linux_locore.asm =================================================================== --- head/sys/i386/linux/linux_locore.asm +++ head/sys/i386/linux/linux_locore.asm @@ -0,0 +1,149 @@ +/* $FreeBSD$ */ + +#include "linux_assym.h" /* system definitions */ +#include /* miscellaneous asm macros */ + +#include /* system call numbers */ + +#include "assym.inc" + +/* + * To avoid excess stack frame the signal trampoline code emulates + * the 'call' instruction. + */ +NON_GPROF_ENTRY(linux_sigcode) + movl %esp, %ebx /* preserve sigframe */ + call .getip0 +.getip0: + popl %eax + add $.startsigcode-.getip0, %eax /* ret address */ + push %eax + jmp *LINUX_SIGF_HANDLER(%ebx) +.startsigcode: + popl %eax /* gcc unwind code need this */ + movl $LINUX_SYS_linux_sigreturn,%eax /* linux_sigreturn() */ + int $0x80 /* enter kernel with args */ +.endsigcode: +0: jmp 0b + +NON_GPROF_ENTRY(linux_rt_sigcode) + leal LINUX_RT_SIGF_UC(%esp),%ebx /* linux ucp */ + leal LINUX_RT_SIGF_SC(%ebx),%ecx /* linux sigcontext */ + movl %esp, %edi + call .getip1 +.getip1: + popl %eax + add $.startrtsigcode-.getip1, %eax /* ret address */ + push %eax + jmp *LINUX_RT_SIGF_HANDLER(%edi) +.startrtsigcode: + movl $LINUX_SYS_linux_rt_sigreturn,%eax /* linux_rt_sigreturn() */ + int $0x80 /* enter kernel with args */ +.endrtsigcode: +0: jmp 0b + +NON_GPROF_ENTRY(linux_vsyscall) +.startvsyscall: + int $0x80 + ret +.endvsyscall: + +#if 0 + .section .note.Linux, "a",@note + .long 2f - 1f /* namesz */ + .balign 4 + .long 4f - 3f /* descsz */ + .long 0 +1: + .asciz "Linux" +2: + .balign 4 +3: + .long LINUX_VERSION_CODE +4: + .balign 4 + .previous +#endif + +#define do_cfa_expr(offset) \ + .byte 0x0f; /* DW_CFA_def_cfa_expression */ \ + .uleb128 11f-10f; /* length */ \ +10: .byte 0x74; /* DW_OP_breg4 */ \ + .sleb128 offset; /* offset */ \ + .byte 0x06; /* DW_OP_deref */ \ +11: + + + /* CIE */ + .section .eh_frame,"a",@progbits +.LSTARTFRAMEDLSI1: + .long .LENDCIEDLSI1-.LSTARTCIEDLSI1 +.LSTARTCIEDLSI1: + .long 0 /* CIE ID */ + .byte 1 /* Version number */ + .string "zRS" /* NULL-terminated + * augmentation string + */ + .uleb128 1 /* Code alignment factor */ + .sleb128 -4 /* Data alignment factor */ + .byte 8 /* Return address + * register column + */ + .uleb128 1 /* Augmentation value length */ + .byte 0x1b /* DW_EH_PE_pcrel|DW_EH_PE_sdata4. */ + .byte 0 /* DW_CFA_nop */ + .align 4 +.LENDCIEDLSI1: + + /* FDE */ + .long .LENDFDEDLSI1-.LSTARTFDEDLSI1 /* Length FDE */ +.LSTARTFDEDLSI1: + .long .LSTARTFDEDLSI1-.LSTARTFRAMEDLSI1 /* CIE pointer */ + .long .startsigcode-. /* PC-relative start address */ + .long .endsigcode-.startsigcode + .uleb128 0 /* Augmentation */ + do_cfa_expr(LINUX_SIGF_SC-8) + .align 4 +.LENDFDEDLSI1: + + .long .LENDFDEDLSI2-.LSTARTFDEDLSI2 /* Length FDE */ +.LSTARTFDEDLSI2: + .long .LSTARTFDEDLSI2-.LSTARTFRAMEDLSI1 /* CIE pointer */ + .long .startrtsigcode-. /* PC-relative start address */ + .long .endrtsigcode-.startrtsigcode + .uleb128 0 /* Augmentation */ + do_cfa_expr(LINUX_RT_SIGF_SC-4+LINUX_SC_ESP) + .align 4 +.LENDFDEDLSI2: + .previous + + .section .eh_frame,"a",@progbits +.LSTARTFRAMEDLSI2: + .long .LENDCIEDLSI2-.LSTARTCIEDLSI2 +.LSTARTCIEDLSI2: + .long 0 /* CIE ID */ + .byte 1 /* Version number */ + .string "zR" /* NULL-terminated + * augmentation string + */ + .uleb128 1 /* Code alignment factor */ + .sleb128 -4 /* Data alignment factor */ + .byte 8 /* Return address register column */ + .uleb128 1 /* Augmentation value length */ + .byte 0x1b /* DW_EH_PE_pcrel|DW_EH_PE_sdata4. */ + .byte 0x0c /* DW_CFA_def_cfa */ + .uleb128 4 + .uleb128 4 + .byte 0x88 /* DW_CFA_offset, column 0x8 */ + .uleb128 1 + .align 4 +.LENDCIEDLSI2: + .long .LENDFDEDLSI3-.LSTARTFDEDLSI3 /* Length FDE */ +.LSTARTFDEDLSI3: + .long .LSTARTFDEDLSI3-.LSTARTFRAMEDLSI2 /* CIE pointer */ + .long .startvsyscall-. /* PC-relative start address */ + .long .endvsyscall-.startvsyscall + .uleb128 0 + .align 4 +.LENDFDEDLSI3: + .previous Index: head/sys/i386/linux/linux_locore.s =================================================================== --- head/sys/i386/linux/linux_locore.s +++ head/sys/i386/linux/linux_locore.s @@ -1,149 +0,0 @@ -/* $FreeBSD$ */ - -#include "linux_assym.h" /* system definitions */ -#include /* miscellaneous asm macros */ - -#include /* system call numbers */ - -#include "assym.inc" - -/* - * To avoid excess stack frame the signal trampoline code emulates - * the 'call' instruction. - */ -NON_GPROF_ENTRY(linux_sigcode) - movl %esp, %ebx /* preserve sigframe */ - call .getip0 -.getip0: - popl %eax - add $.startsigcode-.getip0, %eax /* ret address */ - push %eax - jmp *LINUX_SIGF_HANDLER(%ebx) -.startsigcode: - popl %eax /* gcc unwind code need this */ - movl $LINUX_SYS_linux_sigreturn,%eax /* linux_sigreturn() */ - int $0x80 /* enter kernel with args */ -.endsigcode: -0: jmp 0b - -NON_GPROF_ENTRY(linux_rt_sigcode) - leal LINUX_RT_SIGF_UC(%esp),%ebx /* linux ucp */ - leal LINUX_RT_SIGF_SC(%ebx),%ecx /* linux sigcontext */ - movl %esp, %edi - call .getip1 -.getip1: - popl %eax - add $.startrtsigcode-.getip1, %eax /* ret address */ - push %eax - jmp *LINUX_RT_SIGF_HANDLER(%edi) -.startrtsigcode: - movl $LINUX_SYS_linux_rt_sigreturn,%eax /* linux_rt_sigreturn() */ - int $0x80 /* enter kernel with args */ -.endrtsigcode: -0: jmp 0b - -NON_GPROF_ENTRY(linux_vsyscall) -.startvsyscall: - int $0x80 - ret -.endvsyscall: - -#if 0 - .section .note.Linux, "a",@note - .long 2f - 1f /* namesz */ - .balign 4 - .long 4f - 3f /* descsz */ - .long 0 -1: - .asciz "Linux" -2: - .balign 4 -3: - .long LINUX_VERSION_CODE -4: - .balign 4 - .previous -#endif - -#define do_cfa_expr(offset) \ - .byte 0x0f; /* DW_CFA_def_cfa_expression */ \ - .uleb128 11f-10f; /* length */ \ -10: .byte 0x74; /* DW_OP_breg4 */ \ - .sleb128 offset; /* offset */ \ - .byte 0x06; /* DW_OP_deref */ \ -11: - - - /* CIE */ - .section .eh_frame,"a",@progbits -.LSTARTFRAMEDLSI1: - .long .LENDCIEDLSI1-.LSTARTCIEDLSI1 -.LSTARTCIEDLSI1: - .long 0 /* CIE ID */ - .byte 1 /* Version number */ - .string "zRS" /* NULL-terminated - * augmentation string - */ - .uleb128 1 /* Code alignment factor */ - .sleb128 -4 /* Data alignment factor */ - .byte 8 /* Return address - * register column - */ - .uleb128 1 /* Augmentation value length */ - .byte 0x1b /* DW_EH_PE_pcrel|DW_EH_PE_sdata4. */ - .byte 0 /* DW_CFA_nop */ - .align 4 -.LENDCIEDLSI1: - - /* FDE */ - .long .LENDFDEDLSI1-.LSTARTFDEDLSI1 /* Length FDE */ -.LSTARTFDEDLSI1: - .long .LSTARTFDEDLSI1-.LSTARTFRAMEDLSI1 /* CIE pointer */ - .long .startsigcode-. /* PC-relative start address */ - .long .endsigcode-.startsigcode - .uleb128 0 /* Augmentation */ - do_cfa_expr(LINUX_SIGF_SC-8) - .align 4 -.LENDFDEDLSI1: - - .long .LENDFDEDLSI2-.LSTARTFDEDLSI2 /* Length FDE */ -.LSTARTFDEDLSI2: - .long .LSTARTFDEDLSI2-.LSTARTFRAMEDLSI1 /* CIE pointer */ - .long .startrtsigcode-. /* PC-relative start address */ - .long .endrtsigcode-.startrtsigcode - .uleb128 0 /* Augmentation */ - do_cfa_expr(LINUX_RT_SIGF_SC-4+LINUX_SC_ESP) - .align 4 -.LENDFDEDLSI2: - .previous - - .section .eh_frame,"a",@progbits -.LSTARTFRAMEDLSI2: - .long .LENDCIEDLSI2-.LSTARTCIEDLSI2 -.LSTARTCIEDLSI2: - .long 0 /* CIE ID */ - .byte 1 /* Version number */ - .string "zR" /* NULL-terminated - * augmentation string - */ - .uleb128 1 /* Code alignment factor */ - .sleb128 -4 /* Data alignment factor */ - .byte 8 /* Return address register column */ - .uleb128 1 /* Augmentation value length */ - .byte 0x1b /* DW_EH_PE_pcrel|DW_EH_PE_sdata4. */ - .byte 0x0c /* DW_CFA_def_cfa */ - .uleb128 4 - .uleb128 4 - .byte 0x88 /* DW_CFA_offset, column 0x8 */ - .uleb128 1 - .align 4 -.LENDCIEDLSI2: - .long .LENDFDEDLSI3-.LSTARTFDEDLSI3 /* Length FDE */ -.LSTARTFDEDLSI3: - .long .LSTARTFDEDLSI3-.LSTARTFRAMEDLSI2 /* CIE pointer */ - .long .startvsyscall-. /* PC-relative start address */ - .long .endvsyscall-.startvsyscall - .uleb128 0 - .align 4 -.LENDFDEDLSI3: - .previous Index: head/sys/modules/linux64/Makefile =================================================================== --- head/sys/modules/linux64/Makefile +++ head/sys/modules/linux64/Makefile @@ -29,7 +29,7 @@ linux_assym.h: linux_genassym.o sh ${SYSDIR}/kern/genassym.sh linux_genassym.o > ${.TARGET} -linux_locore.o: linux_locore.s linux_assym.h +linux_locore.o: linux_locore.asm linux_assym.h ${CC} -x assembler-with-cpp -DLOCORE -shared -mcmodel=small \ -pipe -I. -I${SYSDIR} -Werror -Wall -fno-common -fPIC -nostdinc \ -Wl,-T${SRCTOP}/sys/${MACHINE}/linux/${VDSO}.lds.s \