#include <us_manager/helper.h>
#include <us_manager/us_common_file.h>
#include <task_ctx/task_ctx.h>
+#include <kprobe/swap_ktd.h>
struct pf_group {
}
+static void pf_ktd_init(struct task_struct *task, void *data)
+{
+ bool *in_pf = (bool *)data;
+
+ *in_pf = false;
+}
+
+static void pf_ktd_exit(struct task_struct *task, void *data)
+{
+}
+
+static struct ktask_data pf_ktd = {
+ .init = pf_ktd_init,
+ .exit = pf_ktd_exit,
+ .size = sizeof(bool),
+};
+
+static inline void set_in_pf(bool is_in_pf, struct task_struct *task)
+{
+ *(bool *)swap_ktd(&pf_ktd, task) = is_in_pf;
+}
+
+static inline bool check_in_pf(struct task_struct *task)
+{
+ return *(bool *)swap_ktd(&pf_ktd, task);
+}
+
+
/* struct pl_struct */
static struct pl_struct *create_pl_struct(struct sspt_proc *proc)
{
struct sspt_proc *proc;
enum pf_inst_flag flag;
+ set_in_pf(true, task);
+
flag = pfg_check_task(task);
switch (flag) {
case PIF_FIRST:
case PIF_SECOND:
break;
}
+
+ set_in_pf(false, task);
}
/**
struct sspt_proc *proc;
enum pf_inst_flag flag;
+ /* Skip page fault if we're already handling one */
+ if (check_in_pf(task))
+ return;
+
+ set_in_pf(true, task);
+
flag = pfg_check_task(task);
switch (flag) {
case PIF_FIRST:
case PIF_NONE:
break;
}
+
+ set_in_pf(false, task);
}
/**
sspt_proc_read_unlock();
}
+int pfg_init(void)
+{
+ return swap_ktd_reg(&pf_ktd);
+}
+
+void pfg_exit(void)
+{
+ swap_ktd_unreg(&pf_ktd);
+}
+
/**
* @brief For debug
*