2 Copyright © 2012, 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 The will remember the current state of the task storage slots
32 An id will be returned whit which the current state can be restored
33 using RestoreTaskStorageSlots().
34 NULL is returned when not enough memory was available.
47 ******************************************************************************/
51 struct ETask
*et
= GetETask(FindTask(NULL
));
52 IPTR
*taskstorage
, *tsout
;
55 if (!et
|| et
->et_TaskStorage
== NULL
)
58 taskstorage
= et
->et_TaskStorage
;
59 slots
= taskstorage
[__TS_FIRSTSLOT
];
61 /* NOTE: Saved task storage *must not* be passed around
62 * to another task! This is why it is not MEMF_PUBLIC.
64 tsout
= AllocMem(slots
* sizeof(tsout
[0]), MEMF_ANY
);
66 CopyMemQuick(taskstorage
, tsout
, slots
* sizeof(tsout
[0]));
69 D(bug("SaveTaskStorage: taskstorage=%x, size=%d, tsout=%x\n",
70 taskstorage
, size
, tsout