00001
00002
00003
00004
00005
00006 #include<linux/linkage.h>
00007 #include<misc.h>
00008 #include<ssdef.h>
00009 #include<system_data_cells.h>
00010 #include<linux/kernel.h>
00011 #include<asm/segment.h>
00012
00013 asmlinkage int exe_exit(unsigned int code) {
00014 #ifdef __x86_64__
00015 long dummy;
00016 __asm__ __volatile__ ("movq %%rsp,%0; ":"=r" (dummy) );
00017 #endif
00018 struct _exh * exh = ctl_gl_thexec;
00019 if (exh) {
00020 ctl_gl_thexec = exh->exh$l_flink;
00021 #ifdef __i386__
00022 char ** addr = ((long)&code) + 0x28;
00023 (*addr)=exh->exh_l_handler;
00024 #if 1
00025
00026 addr[-3] = __SUPERVISOR_DS;
00027 addr[-2] = __SUPERVISOR_DS;
00028 addr[1] = __SUPERVISOR_CS;
00029 #endif
00030 if (exh->exh_l_first_arg) {
00031 addr = ((long)addr) + 0xc;
00032 *addr = exh->exh_l_first_arg + 4;
00033 #if 1
00034
00035 addr[1] = __SUPERVISOR_DS;
00036 #endif
00037 }
00038 #else
00039 char ** addr = ((long)dummy+0x60);
00040 (*addr)=exh->exh_l_handler;
00041 if (exh->exh_l_first_arg) {
00042 addr = ((long)addr) + 0x18;
00043 *addr = exh->exh_l_first_arg + 0x8;
00044 }
00045 #endif
00046 return SS__NORMAL;
00047 } else {
00048 #if 0
00049 return sys_exit(code);
00050 #endif
00051 do_exit((code&0xff)<<8);
00052 }
00053 }
00054