1 package com.tapina.robe.swi.clib.stdlib;
2
3 import com.tapina.robe.runtime.Environment;
4 import com.tapina.robe.runtime.RawDataBlock;
5 import com.tapina.robe.swi.clib.Stub;
6
7 /***
8 * This function allocates an area of memory of size specified in a1.
9 * The contents of the space are undefined.
10 * Returns: Pointer to space, or NULL if failed (never fails).
11 */
12 public class Malloc extends Stub {
13 public void executeStub(Environment environment) {
14 final int[] R = environment.getCpu().R;
15 final RawDataBlock block = environment.getMemoryMap().createSystemDataBlock(R[0]);
16 R[0] = block.getAddress();
17 }
18 }