exec.library: Use the new AROS_UFIx() macros
[AROS.git] / rom / exec / restoretaskstorage.c
blobc8ebba5b38b6bc25d395760f2c31a2ea2703f245
1 /*
2 Copyright © 2012, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include <exec/nodes.h>
7 #include <exec/lists.h>
8 #include <clib/macros.h>
10 #include "exec_intern.h"
11 #include "taskstorage.h"
13 #define DEBUG 0
14 #include <aros/debug.h>
16 /*****************************************************************************
18 NAME */
19 #include <proto/exec.h>
21 AROS_LH1(void, RestoreTaskStorage,
23 /* LOCATION */
24 AROS_LHA(APTR, id, A0),
25 struct ExecBase *, SysBase, 183, Exec)
27 /* FUNCTION
28 The will remmeber the current state of the task storage slots
30 INPUTS
31 id - id returned from SaveTaskStorage() referring to the state
33 RESULT
36 NOTES
38 EXAMPLE
40 BUGS
42 SEE ALSO
43 SaveTaskStorage()
45 INTERNALS
47 ******************************************************************************/
49 AROS_LIBFUNC_INIT
51 struct ETask *et = GetETask(FindTask(NULL));
52 IPTR *tsrestore = id;
54 if (!et)
55 return;
57 /* Be sure no other tasks access the information when it is in an
58 inconsistent state
60 Forbid();
62 if (et->et_TaskStorage) {
63 IPTR slots = et->et_TaskStorage[__TS_FIRSTSLOT];
64 FreeMem(et->et_TaskStorage, slots * sizeof(IPTR));
67 /* Restore content of TaskStorage */
68 et->et_TaskStorage = tsrestore;
70 Permit();
72 AROS_LIBFUNC_EXIT