|
|
1.1 ! root 1: /* -*- asm -*- ! 2: * ! 3: * Creation Date: <2001/02/03 19:38:07 samuel> ! 4: * Time-stamp: <2003/07/08 18:55:50 samuel> ! 5: * ! 6: * <asmdefs.h> ! 7: * ! 8: * Common assembly definitions ! 9: * ! 10: * Copyright (C) 2001, 2002, 2003 Samuel Rydh ([email protected]) ! 11: * ! 12: * This program is free software; you can redistribute it and/or ! 13: * modify it under the terms of the GNU General Public License ! 14: * as published by the Free Software Foundation ! 15: * ! 16: */ ! 17: ! 18: #ifndef _H_ASMDEFS ! 19: #define _H_ASMDEFS ! 20: ! 21: /************************************************************************/ ! 22: /* High/low halfword compatibility macros */ ! 23: /************************************************************************/ ! 24: ! 25: #ifndef __darwin__ ! 26: #define ha16( v ) (v)##@ha ! 27: #define hi16( v ) (v)##@h ! 28: #define lo16( v ) (v)##@l ! 29: #endif ! 30: #define HA(v) ha16(v) ! 31: #define HI(v) hi16(v) ! 32: #define LO(v) lo16(v) ! 33: ! 34: /* from Linux: include/asm-powerpc/ppc_asm.h */ ! 35: /* ! 36: * Copyright (C) 1995-1999 Gary Thomas, Paul Mackerras, Cort Dougan. ! 37: */ ! 38: ! 39: /* General Purpose Registers (GPRs) */ ! 40: ! 41: #define r0 0 ! 42: #define r1 1 ! 43: #define r2 2 ! 44: #define r3 3 ! 45: #define r4 4 ! 46: #define r5 5 ! 47: #define r6 6 ! 48: #define r7 7 ! 49: #define r8 8 ! 50: #define r9 9 ! 51: #define r10 10 ! 52: #define r11 11 ! 53: #define r12 12 ! 54: #define r13 13 ! 55: #define r14 14 ! 56: #define r15 15 ! 57: #define r16 16 ! 58: #define r17 17 ! 59: #define r18 18 ! 60: #define r19 19 ! 61: #define r20 20 ! 62: #define r21 21 ! 63: #define r22 22 ! 64: #define r23 23 ! 65: #define r24 24 ! 66: #define r25 25 ! 67: #define r26 26 ! 68: #define r27 27 ! 69: #define r28 28 ! 70: #define r29 29 ! 71: #define r30 30 ! 72: #define r31 31 ! 73: ! 74: /************************************************************************/ ! 75: /* MISC */ ! 76: /************************************************************************/ ! 77: ! 78: #ifdef __powerpc64__ ! 79: ! 80: #define LOAD_REG_IMMEDIATE(D, x) \ ! 81: lis (D), (x)@highest ; \ ! 82: ori (D), (D), (x)@higher ; \ ! 83: sldi (D), (D), 32 ; \ ! 84: oris (D), (D), (x)@h ; \ ! 85: ori (D), (D), (x)@l ! 86: ! 87: #define LOAD_REG_FUNC(D, x) \ ! 88: LOAD_REG_IMMEDIATE((D), (x)) ; \ ! 89: ld (D), 0(D) ! 90: ! 91: #else ! 92: ! 93: #define LOAD_REG_IMMEDIATE(D, x) \ ! 94: lis (D), HA(x) ; \ ! 95: addi (D), (D), LO(x) ! 96: ! 97: #define LOAD_REG_FUNC(D, x) \ ! 98: LOAD_REG_IMMEDIATE((D), (x)) ! 99: ! 100: #endif ! 101: ! 102: #ifdef __powerpc64__ ! 103: #define PPC_LL ld ! 104: #define PPC_STL std ! 105: #define PPC_STLU stdu ! 106: #define RFI rfid ! 107: #define MTMSRD(r) mtmsrd r ! 108: #define DATA_LONG(x) .quad x ! 109: #define BRANCH_LABEL(name) . ## name ! 110: #define PPC_LR_STKOFF 16 ! 111: #else ! 112: #define PPC_LL lwz ! 113: #define PPC_STL stw ! 114: #define PPC_STLU stwu ! 115: #define RFI rfi ! 116: #define MTMSRD(r) mtmsr r ! 117: #define DATA_LONG(x) .long x ! 118: #define BRANCH_LABEL(name) name ! 119: #define PPC_LR_STKOFF 4 ! 120: #endif ! 121: ! 122: #ifndef __darwin__ ! 123: #define GLOBL( name ) .globl name ; name ! 124: #define EXTERN( name ) name ! 125: #else ! 126: /* an underscore is needed on Darwin */ ! 127: #define GLOBL( name ) .globl _##name ; name: ; _##name ! 128: #define EXTERN( name ) _##name ! 129: #endif ! 130: ! 131: #if defined(__powerpc64__) && !defined(__darwin__) ! 132: #define _GLOBAL(name) \ ! 133: .align 2 ; \ ! 134: .section ".opd", "aw" ; \ ! 135: .globl name ; \ ! 136: .globl .##name ; \ ! 137: name: \ ! 138: .quad .##name ; \ ! 139: .quad .TOC.@tocbase ; \ ! 140: .quad 0 ; \ ! 141: .previous ; \ ! 142: .type .##name, @function ; \ ! 143: .##name ! 144: #else ! 145: #define _GLOBAL(name) \ ! 146: GLOBL(name) ! 147: #endif ! 148: ! 149: #define BIT(n) (1<<(31-(n))) ! 150: ! 151: #endif /* _H_ASMDEFS */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.