Article View: de.comp.gnu
Article #36Re: was macht alloca?
From: Ralf Wenk
Date: Fri, 04 Sep 1992 21:49
Date: Fri, 04 Sep 1992 21:49
60 lines
2266 bytes
2266 bytes
root@monad.swb.de (System Administrator) writes: > Apropos Bison: ich habe neulich bison 1.14 bekommen (ja, ich weiss, > mittlerweile gibt's 1.18). Auf meinem kleine Atari laeuft MINIX, > es gab beim compilieren also keinen grossen Probleme. Nur > reklamiert der Linker, dass er eine Funktion namens 'alloca' nicht > finden koenne. Ich habe mir zunaechst mit einem '#define alloca malloc' > befolfen, aber da gibt's auch noch Probleme. WAS MACHT ALLOCA DENN SO?!? > Und wo bekomme ich es her? Gar obermerkwuerdig. Was fuer ein ST MINIX hast Du denn ? Alloca() gibt es dafuer schon seit zig Jahren. Seit 1.5 ist es offiziell dabei (lib/atari/alloca.s). Hier der Code (ah, da steht es ja - zig = 3 Jahre 10 Monate): ! EFTH MINIX report #57 - November 1988 - alloca(3) for MINIX-ST ! .define _alloca .sect text ! ! alloca() for Minix ! by Peter S. Housel 8/15/88 - in the public domain ! ! Changed for 68000 - Terrence W. Holm & ! - Frans Meulenbroeks - Nov. 1988 ! ! Stack frame: ! on entry on return ! | ... | | ... | ! |-----------| <=caller sp |-----------| ! | size arg | | | ! |-----------| |alloca data| ! | ret addr | | ... | ! |-----------| <=sp |-----------| <= return value in d0 ! | dummy word| ! |-----------| <= sp ! .globl _alloca .globl _brksize _alloca: move.l (a7),a0 ! save return address move.l a7,d0 add.l #6,d0 ! d0 = sp from calling routine clr.l d1 move.w 4(a7),d1 sub.l d1,d0 ! d0 = beginning of alloca block and.b #0xfc,d0 ! round to long address move.l _brksize,d1 add.l #40,d1 ! ensure space below new sp cmp.l d1,d0 ble fail move.l d0,a7 ! set new sp sub.l #2,a7 ! push a dummy value for caller to remove jmp (a0) ! jump back to caller fail: clr.l d0 ! return NULL pointer rts -- -- Ralf Wenk -- ralf@ptavv.ka.sub.org
Technical Details
Message-ID:
<1992Sep4.214911.01627@ptavv.ka.sub.org>Path:
arc1-ca.pugleaf.net!sparky!uunet!spool.mu.edu!nigel.msen.com!yale.edu!ira.uka.de!smurf.sub.org!flatlin!ptavv!ralfReferences:
<920829440@monad.swb.de>Show Full Headers
Complete Article Headers
Newsgroups: de.comp.gnu Path: arc1-ca.pugleaf.net!sparky!uunet!spool.mu.edu!nigel.msen.com!yale.edu!ira.uka.de!smurf.sub.org!flatlin!ptavv!ralf From: ralf@ptavv.ka.sub.org (Ralf Wenk) Subject: Re: was macht alloca? Message-ID: <1992Sep4.214911.01627@ptavv.ka.sub.org> Organization: The known space References: <920829440@monad.swb.de> Date: Fri, 4 Sep 1992 21:49:11 GMT Lines: 60