### Super()

LONG Super( new_stack )

LONG new_stack;

| Super() inquires and modifies the current CPU mode.
Opcode | 32 (0x0020)
Availability | All GEMDOS versions.
Parameters | stack can take the following values: SUP_SET (0): The processor is placed in supervisor mode and the the function returns the old supervisor stack pointer (ssp) used by the process. The process's user stack pointer will be used as the supervisor stack pointer. SUP_INQ (1): The functions returns -1 if the CPU is in supervisor mode and 0 if it is in user mode. other: Just like with, SUP_SET, the CPU is placed in supervisor mode. But at the difference of SUP_SET, the supervisor stack pointer of the process is set to new_stack.
Binding |
    pea     new_stack,-(sp)
    move.w  #$0020,-(sp)
    trap    #1
    addq.l  #6,sp
Return Value | In SUP_INQ mode, the current state of the processor (-1 if supervisor, 0 if user), otherwize the old supervisor stack pointer.
Comments | When being in supervisor, calling Super with a new_stack not being SUP_INQ will make the process go back in user mode. The supervisor stack pointer is copied into the user stack pointer, and the supervisor stack pointer is then set to new_stack, except if new_stack was NULL, because it would mean that you want the system stack pointer to be NULL, which is very dangerous. When this happens, the stack pointers remain unchanged and the SIGSYS signal (12) is raised. Also, if you are in SECURELEVEL > 1, you must have root privileges to get into supervisor mode. If you don't have them and call Super(), the SIGSYS signal (12) will be raised.
See Also | Supexec()