/* * nd.s new/delete library * * Author: Max Feoktistov * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. * * Compile * command: as nd.s -o nd.o */ ;//as nd.s -o nd.o .data .global id_heap id_heap: .long 0; .text .global _malloc .global ___builtin_new .global ___builtin_vec_new ___builtin_vec_new: ___builtin_new: _malloc: movl id_heap,%eax orl %eax,%eax jnz 1f call _GetProcessHeap mov %eax,id_heap orl %eax,%eax jz 2f 1: pushl 4(%esp) pushl $8 pushl %eax call _HeapAlloc ret 2: ;//Error xorl %eax,%eax ret .global _free .global ___builtin_vec_delete .global ___builtin_delete ___builtin_vec_delete: ___builtin_delete: _free: pushl 4(%esp) pushl $0 pushl id_heap call _HeapFree ret