📄 do_env.c
字号:
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
#include "general.h"
#include "hd_info_struct.h"
#include "dir_entry.h"
#include "msdos_dir_entry.h"
#include "d_inode.h"
#include "m_inode.h"
#include "buffer_head.h"
#include "fat_cache.h"
#include "file.h"
#include "hd_request_struct.h"
#include "super_block.h"
#include "common_head.h"
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
void backup_env(unsigned long the_entry)
{
unsigned long * temp_pLong;
int temp_i;
temp_pLong = (unsigned long *)kernel_stack;
temp_pLong = temp_pLong + 2032;
for (temp_i = 0; temp_i < 16; temp_i++)
old_REGS[temp_i] = temp_pLong[temp_i];
temp_pLong[15] = 0x33; ////old SS
temp_pLong[14] = ((unsigned long)exec_stackptr) - 0x800000; ////old ESP
temp_pLong[13] = (temp_pLong[13] & 0xffffbaff) | 0x00000200; ////old EFLAGS
temp_pLong[12] = 0x2b; ////old CS
temp_pLong[11] = the_entry; ////old EIP
temp_pLong[10] = 0x33; ////GS
temp_pLong[9] = 0x33; ////FS
temp_pLong[8] = 0x33; ////ES
temp_pLong[7] = 0x33; ////DS
temp_pLong[6] = 0; ////EBP
temp_pLong[5] = 0; ////EDI
temp_pLong[4] = 0; ////ESI
temp_pLong[3] = 0; ////EDX
temp_pLong[2] = 0; ////ECX
temp_pLong[1] = 0; ////EBX
temp_pLong[0] = 0; ////EAX
return;
}
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
void restore_env(void)
{
unsigned long * temp_pLong;
int temp_i;
temp_pLong = (unsigned long *)kernel_stack;
temp_pLong = temp_pLong + 2032;
for (temp_i = 0; temp_i < 16; temp_i++)
temp_pLong[temp_i] = old_REGS[temp_i];
return;
}
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -