The core x86 (32- and 64-bit) NLKD additions. Signed-Off-By: Jan Beulich Index: 2.6.14-nlkd/debug/nlkd/asm-x86.h =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ 2.6.14-nlkd/debug/nlkd/asm-x86.h 2005-11-03 12:14:32.000000000 +0100 @@ -0,0 +1,290 @@ +/***************************************************************************** + * + * File Name: asm-x86.h + * Created by: Jan Beulich + * %version: 2 % + * %derived_by: jbeulich % + * %date_modified: Thu Nov 03 04:14:19 2005 % + * + *****************************************************************************/ +/***************************************************************************** + * * + * Copyright (c) 2002-2005 Novell, Inc. All Rights Reserved. * + * * + * This program is free software; you can redistribute it and/or * + * modify it under the terms of version 2 of the GNU General Public License * + * as published by the Free Software Foundation. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, contact Novell, Inc. * + * * + * To contact Novell about this file by physical or electronic mail, * + * you may find current contact information at www.novell.com. * + * * + *****************************************************************************/ +/***************************************************************************** + * + * File Description: + * + *****************************************************************************/ + +.intel_syntax noprefix +.altmacro + +.equiv TRUE, 1 +.equiv FALSE, 0 + +.equiv byte, 1 +.equiv word, 2 +.equiv dword, 4 +.equiv fword, 6 +.equiv qword, 8 +.equiv tbyte, 10 +.equiv oword, 16 +.equiv xmmword, 16 + +.macro .extproc name + .global name + .type name, @function +.endm + +.macro .locproc name + .type name, @function + .align PROCEDURE_ALIGN, 0xCC +name: +#ifdef CONFIG_UNWIND_INFO + .cfi_startproc + .equ .eh.framereg, eh.SP + .equ .eh.frameptr, SP +#endif +.endm + +.macro .pubproc name + .locproc name + .global name +.endm + +.macro .hidproc name + .pubproc name + .hidden name +.endm + +.macro .endp name + .size name, .-name +#ifdef CONFIG_UNWIND_INFO + .cfi_endproc + .equ .eh.framereg, -1 + .equ .eh.frameptr, -1 +#endif +.endm + +.macro .locentry name, type=@notype + .type name, type +name: +.endm + +.macro .pubentry name, type + .locentry name, type + .global name +.endm + +.macro .hidentry name, type + .pubentry name, type + .hidden name +.endm + +.macro .rodata + .section .rodata, "a", @progbits +.endm + +// frame unwind info generation support + +.macro EHpush item:req, spill=TRUE + push item +#ifdef CONFIG_UNWIND_INFO + .if .eh.framereg == eh.SP + .cfi_adjust_cfa_offset .eh.stkword + .endif + .if spill + .ifdef eh.&item + .if .eh.preserved && (1 << eh.&item) + .cfi_rel_offset item, 0 + .endif + .endif + .endif +#endif +.endm + +.macro EHpushC item:req + .if 1 | item // just to make sure this is a constant + push item + .endif +#ifdef CONFIG_UNWIND_INFO + .if .eh.framereg == eh.SP + .cfi_adjust_cfa_offset .eh.stkword + .endif +#endif +.endm + +.macro EHpushO item:req + push offset item +#ifdef CONFIG_UNWIND_INFO + .if .eh.framereg == eh.SP + .cfi_adjust_cfa_offset .eh.stkword + .endif +#endif +.endm + +.macro EHpushV item:req + push [item] +#ifdef CONFIG_UNWIND_INFO + .if .eh.framereg == eh.SP + .cfi_adjust_cfa_offset .eh.stkword + .endif +#endif +.endm + +.macro EHpop item:req, fill=TRUE + pop item +#ifdef CONFIG_UNWIND_INFO + .if fill + .ifdef eh.&item + .if .eh.preserved && (1 << eh.&item) + .cfi_restore item + .endif + .endif + .endif + .if .eh.framereg == eh.SP + .cfi_adjust_cfa_offset -.eh.stkword + .endif +#endif +.endm + +.macro EHpopV item:req + pop [item] +#ifdef CONFIG_UNWIND_INFO + .if .eh.framereg == eh.SP + .cfi_adjust_cfa_offset -.eh.stkword + .endif +#endif +.endm + +.macro EHsetfr dst, src, offs=0 + .if eh.&dst <> eh.&src + .if offs == 0 + mov dst, src +#ifdef CONFIG_UNWIND_INFO + .cfi_def_cfa_register dst +#endif + .else + lea dst, [src + (offs) * .eh.stkword] +#ifdef CONFIG_UNWIND_INFO + .cfi_adjust_cfa_offset -(offs) * .eh.stkword + .cfi_def_cfa_register dst +#endif + .endif + .else + add dst, (offs) * .eh.stkword +#ifdef CONFIG_UNWIND_INFO + .cfi_adjust_cfa_offset -(offs) * .eh.stkword +#endif + .endif +#ifdef CONFIG_UNWIND_INFO + .equ .eh.framereg, eh.&dst + .equ .eh.frameptr, dst +#endif +.endm + +.macro EHenter frsz, level + enter frsz, level +#ifdef CONFIG_UNWIND_INFO + .if .eh.framereg <> eh.SP + .error "'enter' without SP-based frame is not supported." + .endif + .cfi_adjust_cfa_offset .eh.stkword + .cfi_rel_offset BP, 0 + .cfi_def_cfa_register BP + .equ .eh.framereg, eh.BP + .equ .eh.frameptr, BP +#endif +.endm + +.macro EHleave + leave +#ifdef CONFIG_UNWIND_INFO + .if .eh.framereg <> eh.BP + .error "'leave' without BP-based frame is not supported." + .endif + .cfi_def_cfa_register SP + .cfi_restore BP + .cfi_adjust_cfa_offset -.eh.stkword + .equ .eh.framereg, eh.SP + .equ .eh.frameptr, SP +#endif +.endm + +.macro EHspill offs:req, reg:req + mov [.eh.frameptr+(offs)*.eh.stkword], reg +#ifdef CONFIG_UNWIND_INFO + .if .eh.framereg == eh.SP &&&&& (offs) < 0 + .warning "Spill offset into SP-relative frame should be positive." + .endif + .cfi_offset reg, (offs)*.eh.stkword +#endif +.endm + +.macro EHfill reg:req, offs:req + mov reg, [.eh.frameptr+(offs)*.eh.stkword] +#ifdef CONFIG_UNWIND_INFO + .if .eh.framereg == eh.SP &&&&& (offs) < 0 + .warning "Fill offset into SP-relative frame should be positive." + .endif + .cfi_restore reg +#endif +.endm + +.macro EHpushf spill=TRUE + pushf +#ifdef CONFIG_UNWIND_INFO + .if .eh.framereg == eh.SP + .cfi_adjust_cfa_offset .eh.stkword + .endif + .if spill + .cfi_rel_offset FLAGS, 0 + .endif +#endif +.endm + +.macro EHpopf fill=TRUE + popf +#ifdef CONFIG_UNWIND_INFO + .if fill + .cfi_restore FLAGS + .endif + .if .eh.framereg == eh.SP + .cfi_adjust_cfa_offset -.eh.stkword + .endif +#endif +.endm + +.macro EHpushState +#ifdef CONFIG_UNWIND_INFO + .cfi_remember_state +#endif +.endm + +.macro EHpopState +#ifdef CONFIG_UNWIND_INFO + .cfi_restore_state +#endif +.endm + +#ifdef CONFIG_UNWIND_INFO +.equ .eh.framereg, -1 +.equ .eh.frameptr, -1 +#endif