2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License as published by
4 * the Free Software Foundation; either version 2 of the License, or
5 * (at your option) any later version.
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16 * Copyright (C) Samsung Electronics, 2015
18 * 2015 Vyacheslav Cherkashin <v.cherkashin@samsung.com>
27 #include <linux/time.h>
28 #include <linux/types.h>
32 MSG_PROC_INFO = 0x0001,
33 MSG_TERMINATE = 0x0002,
36 MSG_FUNCTION_ENTRY = 0x0008,
37 MSG_FUNCTION_EXIT = 0x0009,
38 MSG_SYSCALL_ENTRY = 0x000a,
39 MSG_SYSCALL_EXIT = 0x000b,
40 MSG_FILE_FUNCTION_ENTRY = 0x000c,
41 MSG_FILE_FUNCTION_EXIT = 0x000d,
42 MSG_PROCESS_STATUS_INFO = 0x000e,
43 MSG_CONTEXT_SWITCH_ENTRY = 0x0010,
44 MSG_CONTEXT_SWITCH_EXIT = 0x0011,
45 MSG_PROC_MAP = 0x0012,
46 MSG_PROC_UNMAP = 0x0013,
47 MSG_PROC_COMM = 0x0014,
48 MSG_WEB_FUNCTION_ENTRY = 0x0015,
49 MSG_WEB_FUNCTION_EXIT = 0x0016,
56 SWAP_MSG_PRIV_DATA = 20,
57 SWAP_MSG_BUF_SIZE = 32 * 1024,
58 SWAP_MSG_PAYLOAD_SIZE = SWAP_MSG_BUF_SIZE - SWAP_MSG_PRIV_DATA
65 static inline u64 swap_msg_spec2time(struct timespec *ts)
67 return ((u64)ts->tv_nsec) << 32 | ts->tv_sec;
70 static inline u64 swap_msg_current_time(void)
74 return swap_msg_spec2time(&ts);
77 struct swap_msg *swap_msg_get(enum swap_msg_id id);
78 int swap_msg_flush(struct swap_msg *m, size_t size);
79 int swap_msg_flush_wakeupoff(struct swap_msg *m, size_t size);
80 void swap_msg_put(struct swap_msg *m);
82 static inline void *swap_msg_payload(struct swap_msg *m)
84 return (void *)m + SWAP_MSG_PRIV_DATA;
87 static inline size_t swap_msg_size(struct swap_msg *m)
89 return (size_t)SWAP_MSG_PAYLOAD_SIZE;
93 int swap_msg_pack_args(char *buf, int len,
94 const char *fmt, struct pt_regs *regs);
95 int swap_msg_pack_ret_val(char *buf, int len,
96 char ret_type, struct pt_regs *regs);
99 int swap_msg_raw(void *buf, size_t size);
100 void swap_msg_error(const char *fmt, ...);
102 void swap_msg_seq_num_reset(void);
103 void swap_msg_discard_reset(void);
104 int swap_msg_discard_get(void);
106 int swap_msg_init(void);
107 void swap_msg_exit(void);
110 #endif /* _SWAP_MSG_H */