* same with xv6
[mascara-docs.git] / i386 / standford / 2004 / src / lab4 / inc / asm.h
blobdd43159c42be386843390f577e6e16e6e660ebd3
1 /* See COPYRIGHT for copyright information. */
3 #ifndef _ASM_H_
4 #define _ASM_H_
6 /*
7 * Entry point for a procedure called from C
8 */
9 #define ASENTRY(proc) .align 2; .globl proc; .type proc,@function; proc:
10 #define ENTRY(proc) ASENTRY(## proc)
13 * Align a branch target and fill the gap with NOP's
15 #define ALIGN_TEXT .align 2,0x90
16 #define SUPERALIGN_TEXT .p2align 4,0x90 /* 16-byte alignment, nop filled */
20 * gas won't do logical shifts in computed immediates!
22 #define SRL(val, shamt) (((val) >> (shamt)) & ~(-1 << (32 - (shamt))))
24 #define DEF_SYM(symbol, addr) \
25 asm(".globl _" #symbol "\n" \
26 "\t.set _" #symbol ",%P0" \
27 :: "i" (addr))
29 #endif /* _ASM_H_ */