static void *nt_prpsinfo(void *ptr) { struct elf_prpsinfo prpsinfo; memset(&prpsinfo, 0, sizeof(prpsinfo)); prpsinfo.pr_sname = 'R'; strcpy(prpsinfo.pr_fname, "vmlinux"); return nt_init(ptr, NT_PRPSINFO, &prpsinfo, sizeof(prpsinfo), KEXEC_CORE_NOTE_NAME); }
static void *nt_fpregset(void *ptr, struct save_area *sa) { elf_fpregset_t nt_fpregset; memset(&nt_fpregset, 0, sizeof(nt_fpregset)); memcpy(&nt_fpregset.fpc, &sa->fp_ctrl_reg, sizeof(sa->fp_ctrl_reg)); memcpy(&nt_fpregset.fprs, &sa->fp_regs, sizeof(sa->fp_regs)); return nt_init(ptr, NT_PRFPREG, &nt_fpregset, sizeof(nt_fpregset), "CORE"); }
static void *nt_vmcoreinfo(void *ptr) { unsigned long size; void *vmcoreinfo; vmcoreinfo = os_info_old_entry(OS_INFO_VMCOREINFO, &size); if (!vmcoreinfo) vmcoreinfo = get_vmcoreinfo_old(&size); if (!vmcoreinfo) return ptr; return nt_init(ptr, 0, vmcoreinfo, size, "VMCOREINFO"); }
static void *nt_prstatus(void *ptr, struct save_area *sa) { struct elf_prstatus nt_prstatus; static int cpu_nr = 1; memset(&nt_prstatus, 0, sizeof(nt_prstatus)); memcpy(&nt_prstatus.pr_reg.gprs, sa->gp_regs, sizeof(sa->gp_regs)); memcpy(&nt_prstatus.pr_reg.psw, sa->psw, sizeof(sa->psw)); memcpy(&nt_prstatus.pr_reg.acrs, sa->acc_regs, sizeof(sa->acc_regs)); nt_prstatus.pr_pid = cpu_nr; cpu_nr++; return nt_init(ptr, NT_PRSTATUS, &nt_prstatus, sizeof(nt_prstatus), "CORE"); }
/* * Initialize vmcoreinfo note (new kernel) */ static void *nt_vmcoreinfo(void *ptr) { char nt_name[11], *vmcoreinfo; Elf64_Nhdr note; void *addr; if (copy_from_oldmem(&addr, &S390_lowcore.vmcore_info, sizeof(addr))) return ptr; memset(nt_name, 0, sizeof(nt_name)); if (copy_from_oldmem(¬e, addr, sizeof(note))) return ptr; if (copy_from_oldmem(nt_name, addr + sizeof(note), sizeof(nt_name) - 1)) return ptr; if (strcmp(nt_name, "VMCOREINFO") != 0) return ptr; vmcoreinfo = kzalloc_panic(note.n_descsz + 1); if (copy_from_oldmem(vmcoreinfo, addr + 24, note.n_descsz)) return ptr; vmcoreinfo[note.n_descsz + 1] = 0; return nt_init(ptr, 0, vmcoreinfo, note.n_descsz, "VMCOREINFO"); }
static void *nt_s390_prefix(void *ptr, struct save_area *sa) { return nt_init(ptr, NT_S390_PREFIX, &sa->pref_reg, sizeof(sa->pref_reg), KEXEC_CORE_NOTE_NAME); }
static void *nt_s390_ctrs(void *ptr, struct save_area *sa) { return nt_init(ptr, NT_S390_CTRS, &sa->ctrl_regs, sizeof(sa->ctrl_regs), KEXEC_CORE_NOTE_NAME); }
static void *nt_s390_tod_preg(void *ptr, struct save_area *sa) { return nt_init(ptr, NT_S390_TODPREG, &sa->tod_reg, sizeof(sa->tod_reg), KEXEC_CORE_NOTE_NAME); }
static void *nt_s390_tod_cmp(void *ptr, struct save_area *sa) { return nt_init(ptr, NT_S390_TODCMP, &sa->clk_cmp, sizeof(sa->clk_cmp), KEXEC_CORE_NOTE_NAME); }
static void *nt_s390_timer(void *ptr, struct save_area *sa) { return nt_init(ptr, NT_S390_TIMER, &sa->timer, sizeof(sa->timer), KEXEC_CORE_NOTE_NAME); }
int main(int argc, char **argv) { char **t; int t0; #ifdef USE_LOCALE setlocale(LC_ALL, ""); #endif #ifdef WINNT /* Do not use __try if compiling with MinGW */ #ifndef MINGW __try { #endif /* MINGW */ /* Start NT if we are compiling with MinGW, don't otherwise */ #ifdef MINGW nt_init(); #else //nt_init(); #endif /* MINGW */ fork_init(); /* Do not use __except if compiling with MinGW */ #ifndef MINGW }__except(1) { dprintf("damn 0x%08x\n",GetExceptionCode()); return 1; }; #endif /* MINGW */ #endif /* WINNT */ global_permalloc(); /* * Provisionally set up the type table to allow metafication. * This will be done properly when we have decided if we are * interactive */ typtab['\0'] |= IMETA; typtab[STOUC(Meta) ] |= IMETA; typtab[STOUC(Marker)] |= IMETA; for (t0 = (int)STOUC(Pound); t0 <= (int)STOUC(Nularg); t0++) typtab[t0] |= ITOK | IMETA; for (t = argv; *t; *t = metafy(*t, -1, META_ALLOC), t++); #ifndef WINNT if (!(zsh_name = strrchr(argv[0], '/'))) #else if (!(zsh_name = strrchr(argv[0], '/')) && !(zsh_name = strrchr(argv[0], '\\')) && !(zsh_name = strchr(argv[0],':')) // !(argv[0][1] ==':') ) #endif /* WINNT */ zsh_name = argv[0]; else zsh_name++; if (*zsh_name == '-') zsh_name++; fdtable_size = OPEN_MAX; fdtable = zcalloc(fdtable_size); emulate(zsh_name, 1); /* initialises most options */ opts[LOGINSHELL] = (**argv == '-'); opts[MONITOR] = 1; /* may be unset in init_io() */ opts[PRIVILEGED] = (getuid() != geteuid() || getgid() != getegid()); opts[USEZLE] = 1; /* may be unset in init_io() */ parseargs(argv); /* sets INTERACTIVE, SHINSTDIN and SINGLECOMMAND */ SHTTY = -1; init_io(); setupvals(); init_signals(); global_heapalloc(); run_init_scripts(); init_misc(); for (;;) { do loop(1,0); while (tok != ENDINPUT); if (!(isset(IGNOREEOF) && interact)) { #if 0 if (interact) fputs(islogin ? "logout\n" : "exit\n", shout); #endif zexit(lastval, 0); continue; } noexitct++; if (noexitct >= 10) { stopmsg = 1; zexit(lastval, 0); } zerrnam("zsh", (!islogin) ? "use 'exit' to exit." : "use 'logout' to logout.", NULL, 0); } return 0; /* WINNT change, patch I think */ }