Enhance reboot decoding
* linux/reboot.h: New file. * system.c (bootflags1, bootflags2, bootflags3, sys_reboot): Move... * reboot.c: ... here. (bootflags2, bootflags3): Update constants. * Makefile.am (strace_SOURCES): Add reboot.c. (EXTRA_DIST): Add linux/reboot.h.
This commit is contained in:
parent
90aa9f4d72
commit
9aaf88c000
@ -34,6 +34,7 @@ strace_SOURCES = \
|
||||
process.c \
|
||||
ptp.c \
|
||||
quota.c \
|
||||
reboot.c \
|
||||
resource.c \
|
||||
scsi.c \
|
||||
signal.c \
|
||||
@ -137,6 +138,7 @@ EXTRA_DIST = \
|
||||
linux/powerpc/syscallent.h \
|
||||
linux/powerpc/syscallent1.h \
|
||||
linux/ptp_clock.h \
|
||||
linux/reboot.h \
|
||||
linux/s390/ioctlent.h.in \
|
||||
linux/s390/syscallent.h \
|
||||
linux/s390x/ioctlent.h.in \
|
||||
|
39
linux/reboot.h
Normal file
39
linux/reboot.h
Normal file
@ -0,0 +1,39 @@
|
||||
#ifndef _LINUX_REBOOT_H
|
||||
#define _LINUX_REBOOT_H
|
||||
|
||||
/*
|
||||
* Magic values required to use _reboot() system call.
|
||||
*/
|
||||
|
||||
#define LINUX_REBOOT_MAGIC1 0xfee1dead
|
||||
#define LINUX_REBOOT_MAGIC2 672274793
|
||||
#define LINUX_REBOOT_MAGIC2A 85072278
|
||||
#define LINUX_REBOOT_MAGIC2B 369367448
|
||||
#define LINUX_REBOOT_MAGIC2C 537993216
|
||||
|
||||
|
||||
/*
|
||||
* Commands accepted by the _reboot() system call.
|
||||
*
|
||||
* RESTART Restart system using default command and mode.
|
||||
* HALT Stop OS and give system control to ROM monitor, if any.
|
||||
* CAD_ON Ctrl-Alt-Del sequence causes RESTART command.
|
||||
* CAD_OFF Ctrl-Alt-Del sequence sends SIGINT to init task.
|
||||
* POWER_OFF Stop OS and remove all power from system, if possible.
|
||||
* RESTART2 Restart system using given command string.
|
||||
* SW_SUSPEND Suspend system using software suspend if compiled in.
|
||||
* KEXEC Restart system using a previously loaded Linux kernel
|
||||
*/
|
||||
|
||||
#define LINUX_REBOOT_CMD_RESTART 0x01234567
|
||||
#define LINUX_REBOOT_CMD_HALT 0xCDEF0123
|
||||
#define LINUX_REBOOT_CMD_CAD_ON 0x89ABCDEF
|
||||
#define LINUX_REBOOT_CMD_CAD_OFF 0x00000000
|
||||
#define LINUX_REBOOT_CMD_POWER_OFF 0x4321FEDC
|
||||
#define LINUX_REBOOT_CMD_RESTART2 0xA1B2C3D4
|
||||
#define LINUX_REBOOT_CMD_SW_SUSPEND 0xD000FCE2
|
||||
#define LINUX_REBOOT_CMD_KEXEC 0x45584543
|
||||
|
||||
|
||||
|
||||
#endif /* _LINUX_REBOOT_H */
|
45
reboot.c
Normal file
45
reboot.c
Normal file
@ -0,0 +1,45 @@
|
||||
#include "defs.h"
|
||||
#include <linux/reboot.h>
|
||||
|
||||
static const struct xlat bootflags1[] = {
|
||||
XLAT(LINUX_REBOOT_MAGIC1),
|
||||
XLAT_END
|
||||
};
|
||||
|
||||
static const struct xlat bootflags2[] = {
|
||||
XLAT(LINUX_REBOOT_MAGIC2),
|
||||
XLAT(LINUX_REBOOT_MAGIC2A),
|
||||
XLAT(LINUX_REBOOT_MAGIC2B),
|
||||
XLAT(LINUX_REBOOT_MAGIC2C),
|
||||
XLAT_END
|
||||
};
|
||||
|
||||
static const struct xlat bootflags3[] = {
|
||||
XLAT(LINUX_REBOOT_CMD_RESTART),
|
||||
XLAT(LINUX_REBOOT_CMD_HALT),
|
||||
XLAT(LINUX_REBOOT_CMD_CAD_ON),
|
||||
XLAT(LINUX_REBOOT_CMD_CAD_OFF),
|
||||
XLAT(LINUX_REBOOT_CMD_POWER_OFF),
|
||||
XLAT(LINUX_REBOOT_CMD_RESTART2),
|
||||
XLAT(LINUX_REBOOT_CMD_SW_SUSPEND),
|
||||
XLAT(LINUX_REBOOT_CMD_KEXEC),
|
||||
XLAT_END
|
||||
};
|
||||
|
||||
int
|
||||
sys_reboot(struct tcb *tcp)
|
||||
{
|
||||
if (exiting(tcp))
|
||||
return 0;
|
||||
|
||||
printflags(bootflags1, tcp->u_arg[0], "LINUX_REBOOT_MAGIC_???");
|
||||
tprints(", ");
|
||||
printflags(bootflags2, tcp->u_arg[1], "LINUX_REBOOT_MAGIC_???");
|
||||
tprints(", ");
|
||||
printflags(bootflags3, tcp->u_arg[2], "LINUX_REBOOT_CMD_???");
|
||||
if (tcp->u_arg[2] == LINUX_REBOOT_CMD_RESTART2) {
|
||||
tprints(", ");
|
||||
printstr(tcp, tcp->u_arg[3], -1);
|
||||
}
|
||||
return 0;
|
||||
}
|
40
system.c
40
system.c
@ -275,46 +275,6 @@ sys_syslog(struct tcb *tcp)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#include <linux/reboot.h>
|
||||
static const struct xlat bootflags1[] = {
|
||||
XLAT(LINUX_REBOOT_MAGIC1),
|
||||
XLAT_END
|
||||
};
|
||||
|
||||
static const struct xlat bootflags2[] = {
|
||||
XLAT(LINUX_REBOOT_MAGIC2),
|
||||
XLAT(LINUX_REBOOT_MAGIC2A),
|
||||
XLAT(LINUX_REBOOT_MAGIC2B),
|
||||
XLAT_END
|
||||
};
|
||||
|
||||
static const struct xlat bootflags3[] = {
|
||||
XLAT(LINUX_REBOOT_CMD_CAD_OFF),
|
||||
XLAT(LINUX_REBOOT_CMD_RESTART),
|
||||
XLAT(LINUX_REBOOT_CMD_HALT),
|
||||
XLAT(LINUX_REBOOT_CMD_CAD_ON),
|
||||
XLAT(LINUX_REBOOT_CMD_POWER_OFF),
|
||||
XLAT(LINUX_REBOOT_CMD_RESTART2),
|
||||
XLAT_END
|
||||
};
|
||||
|
||||
int
|
||||
sys_reboot(struct tcb *tcp)
|
||||
{
|
||||
if (entering(tcp)) {
|
||||
printflags(bootflags1, tcp->u_arg[0], "LINUX_REBOOT_MAGIC_???");
|
||||
tprints(", ");
|
||||
printflags(bootflags2, tcp->u_arg[1], "LINUX_REBOOT_MAGIC_???");
|
||||
tprints(", ");
|
||||
printflags(bootflags3, tcp->u_arg[2], "LINUX_REBOOT_CMD_???");
|
||||
if (tcp->u_arg[2] == LINUX_REBOOT_CMD_RESTART2) {
|
||||
tprints(", ");
|
||||
printstr(tcp, tcp->u_arg[3], -1);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef M68K
|
||||
static const struct xlat cacheflush_scope[] = {
|
||||
#ifdef FLUSH_SCOPE_LINE
|
||||
|
Loading…
x
Reference in New Issue
Block a user