📄 exec.c
字号:
#include "hos.h"unsigned long EXEC_load_body(char *buf){ // load code in buf to 0x30000000 //memcpy(0x30000000, buf, strlen(buf)); printk("in EXEC load body\n"); mymemcpy(0x0300000, buf, 14); // for now return 0x300000;}int do_execve(struct pt_regs *regs){// regs->ecx points to the file path for exec char *path; int x; char buf[512]; unsigned long * xx; unsigned long start_loc; path=regs->ecx; printk("path is %s\n",path); x=do_open(path); do_read(x, buf, 512); printk("the buf read from disk is: "); for(x=0;x<14;x++) printk("%x ", buf[x]); start_loc = EXEC_load_body(buf); printk("the code at 0x300000 is: "); xx=(unsigned long *)0x300000; for(x=0;x<4;x++) printk("%x ", xx[x]); // change starting ip regs->eip = start_loc;}int sys_execve(struct pt_regs regs){ return do_execve(®s);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -