* lib/alloca.s: alloca() implemeted.

* lib/Makefile: build it.
* import/alloca.hb: declare alloca.


git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@4103 1b9489fe-b721-0410-924e-b54b9192deb8
This commit is contained in:
Minero Aoki 2008-12-07 15:55:40 +00:00
parent b598628af9
commit 76fd64dc52
4 changed files with 26 additions and 1 deletions

View File

@ -1,3 +1,11 @@
Mon Dec 8 00:55:33 2008 Minero Aoki <aamine@loveruby.net>
* lib/alloca.s: alloca() implemeted.
* lib/Makefile: build it.
* import/alloca.hb: declare alloca.
Sun Dec 7 23:26:50 2008 Minero Aoki <aamine@loveruby.net>
* net: revert r4100; implementing alloca() is too difficult for

3
import/alloca.hb Normal file
View File

@ -0,0 +1,3 @@
import stddef;
extern void* alloca(size_t len);

View File

@ -1,7 +1,7 @@
CBC = ../bin/cbc
CBFLAGS = -O -fPIC
TARGET = libcbc.a
OBJS = stdarg.o
OBJS = stdarg.o alloca.o
.SUFFIXES:
.SUFFIXES: .cb .s .o

14
lib/alloca.s Normal file
View File

@ -0,0 +1,14 @@
.text
.globl alloca
.type alloca,@function
alloca:
addl $4, %esp
movl -4(%esp), %ecx
movl (%esp), %eax
addl $3, %eax
andl $-4, %eax
subl %eax, %esp
movl %esp, %eax
addl $4, %eax
jmp *%ecx
.size alloca, .-alloca