2 Copyright © 2012-2015, The AROS Development Team. All rights reserved.
6 #include <exec/nodes.h>
7 #include <exec/lists.h>
9 #include "exec_intern.h"
10 #include "taskstorage.h"
13 #include <aros/debug.h>
15 /*****************************************************************************
18 #include <proto/exec.h>
20 AROS_LH0(APTR
, SaveTaskStorage
,
23 struct ExecBase
*, SysBase
, 182, Exec
)
26 This function remembers the current state of the task storage slots.
27 An ID will be returned with which the current state can be restored
28 using RestoreTaskStorage(). NULL is returned when not enough memory
35 id - ID for use with RestoreTaskStorage(), or NULL.
48 ******************************************************************************/
52 struct Task
*ThisTask
= GET_THIS_TASK
;
53 struct ETask
*et
= ThisTask
? GetETask(ThisTask
) : NULL
;
54 IPTR
*taskstorage
, *tsout
;
57 if (!et
|| et
->et_TaskStorage
== NULL
)
60 taskstorage
= et
->et_TaskStorage
;
61 slots
= taskstorage
[__TS_FIRSTSLOT
];
63 /* NOTE: Saved task storage *must not* be passed around
64 * to another task! This is why it is not MEMF_PUBLIC.
66 tsout
= AllocMem(slots
* sizeof(tsout
[0]), MEMF_ANY
);
68 CopyMemQuick(taskstorage
, tsout
, slots
* sizeof(tsout
[0]));
71 D(bug("SaveTaskStorage: taskstorage=%x, size=%d, tsout=%x\n",
72 taskstorage
, size
, tsout