File: memory.h

package info (click to toggle)
emile 0.10-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 1,716 kB
  • ctags: 2,737
  • sloc: ansic: 18,908; makefile: 726; asm: 622; sh: 2
file content (30 lines) | stat: -rw-r--r-- 548 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/*
 *
 * (c) 2004,2005 Laurent Vivier <LaurentVivier@wanadoo.fr>
 *
 */

#ifndef __MACOS_MEMORY_H__
#define __MACOS_MEMORY_H__

#include <macos/traps.h>

static inline void DisposePtr(void* ptr)
{
	asm("move.l %0, %%a0\n"
		Trap(_DisposePtr)
	    :: "g" (ptr) : "%%d0", UNPRESERVED_REGS);
}

static inline void* NewPtr(unsigned long byteCount)
{
	register void* ptr;

	asm("move.l %1, %%d0\n"
		Trap(_NewPtr)
	    "	move.l %%a0, %0\n"
	    : "=g" (ptr) : "g" (byteCount) : "%%d0", UNPRESERVED_REGS);

	return ptr;
}
#endif /* __MACOS_MEMORY_H__ */