Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!ucbvax!dog.ee.lbl.gov!elf.ee.lbl.gov!torek From: torek@elf.ee.lbl.gov (Chris Torek) Newsgroups: comp.arch Subject: Re: standard extensions Message-ID: <10321@dog.ee.lbl.gov> Date: 26 Feb 91 21:38:43 GMT References: <3381.27c548c3@iccgcc.decnet.ab.com> <1991Feb25.135057.23667@linus.mitre.org> <1991Feb25.201406.18643@bingvaxu.cc.binghamton.edu> <1991Feb26.172239.10089@watdragon.waterloo.edu> Reply-To: torek@elf.ee.lbl.gov (Chris Torek) Organization: Lawrence Berkeley Laboratory, Berkeley Lines: 36 X-Local-Date: Tue, 26 Feb 91 13:38:43 PST In article <1991Feb26.172239.10089@watdragon.waterloo.edu> ccplumb@rose.uwaterloo.ca (Colin Plumb) writes: >The people who really love gcc's assembler inlining features are OS writers. Funny you should mention that.... /* load byte from alternate address space */ static __inline int lduba(void *loc, int asi) { int result; #ifdef PARANOIA if ((unsigned)asi > 15) panic("lduba asi"); #endif __asm __volatile("lduba [%1]%2,%0" : "=r" (result) : "r" (loc), "n" (asi)); return (result); } [sparc] or: #define _spl(s) \ ({ \ register int _spl_r; \ \ asm __volatile ("clrl %0; movew sr,%0; movew %1,sr" : \ "&=d" (_spl_r) : "di" (s)); \ _spl_r; \ }) #define spl1() _spl(PSL_S|PSL_IPL1) [680x0] -- In-Real-Life: Chris Torek, Lawrence Berkeley Lab EE div (+1 415 486 5427) Berkeley, CA Domain: torek@ee.lbl.gov Brought to you by Super Global Mega Corp .com