SE/FS: Get rid of includes of config/full_system.hh.
[gem5.git] / src / sim / process.cc
1 /*
2 * Copyright (c) 2001-2005 The Regents of The University of Michigan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;
9 * redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution;
12 * neither the name of the copyright holders nor the names of its
13 * contributors may be used to endorse or promote products derived from
14 * this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * Authors: Nathan Binkert
29 * Steve Reinhardt
30 * Ali Saidi
31 */
32
33 #include <fcntl.h>
34 #include <unistd.h>
35
36 #include <cstdio>
37 #include <string>
38
39 #include "base/loader/object_file.hh"
40 #include "base/loader/symtab.hh"
41 #include "base/intmath.hh"
42 #include "base/statistics.hh"
43 #include "config/the_isa.hh"
44 #include "cpu/thread_context.hh"
45 #include "mem/page_table.hh"
46 #include "mem/physical.hh"
47 #include "mem/translating_port.hh"
48 #include "params/LiveProcess.hh"
49 #include "params/Process.hh"
50 #include "sim/debug.hh"
51 #include "sim/process.hh"
52 #include "sim/process_impl.hh"
53 #include "sim/stats.hh"
54 #include "sim/syscall_emul.hh"
55 #include "sim/system.hh"
56
57 #if THE_ISA == ALPHA_ISA
58 #include "arch/alpha/linux/process.hh"
59 #include "arch/alpha/tru64/process.hh"
60 #elif THE_ISA == SPARC_ISA
61 #include "arch/sparc/linux/process.hh"
62 #include "arch/sparc/solaris/process.hh"
63 #elif THE_ISA == MIPS_ISA
64 #include "arch/mips/linux/process.hh"
65 #elif THE_ISA == ARM_ISA
66 #include "arch/arm/linux/process.hh"
67 #elif THE_ISA == X86_ISA
68 #include "arch/x86/linux/process.hh"
69 #elif THE_ISA == POWER_ISA
70 #include "arch/power/linux/process.hh"
71 #else
72 #error "THE_ISA not set"
73 #endif
74
75
76 using namespace std;
77 using namespace TheISA;
78
79 // current number of allocated processes
80 int num_processes = 0;
81
82 template<class IntType>
83 AuxVector<IntType>::AuxVector(IntType type, IntType val)
84 {
85 a_type = TheISA::htog(type);
86 a_val = TheISA::htog(val);
87 }
88
89 template class AuxVector<uint32_t>;
90 template class AuxVector<uint64_t>;
91
92 Process::Process(ProcessParams * params)
93 : SimObject(params), system(params->system),
94 max_stack_size(params->max_stack_size)
95 {
96 string in = params->input;
97 string out = params->output;
98 string err = params->errout;
99
100 // initialize file descriptors to default: same as simulator
101 int stdin_fd, stdout_fd, stderr_fd;
102
103 if (in == "stdin" || in == "cin")
104 stdin_fd = STDIN_FILENO;
105 else if (in == "None")
106 stdin_fd = -1;
107 else
108 stdin_fd = Process::openInputFile(in);
109
110 if (out == "stdout" || out == "cout")
111 stdout_fd = STDOUT_FILENO;
112 else if (out == "stderr" || out == "cerr")
113 stdout_fd = STDERR_FILENO;
114 else if (out == "None")
115 stdout_fd = -1;
116 else
117 stdout_fd = Process::openOutputFile(out);
118
119 if (err == "stdout" || err == "cout")
120 stderr_fd = STDOUT_FILENO;
121 else if (err == "stderr" || err == "cerr")
122 stderr_fd = STDERR_FILENO;
123 else if (err == "None")
124 stderr_fd = -1;
125 else if (err == out)
126 stderr_fd = stdout_fd;
127 else
128 stderr_fd = Process::openOutputFile(err);
129
130 M5_pid = system->allocatePID();
131 // initialize first 3 fds (stdin, stdout, stderr)
132 Process::FdMap *fdo = &fd_map[STDIN_FILENO];
133 fdo->fd = stdin_fd;
134 fdo->filename = in;
135 fdo->flags = O_RDONLY;
136 fdo->mode = -1;
137 fdo->fileOffset = 0;
138
139 fdo = &fd_map[STDOUT_FILENO];
140 fdo->fd = stdout_fd;
141 fdo->filename = out;
142 fdo->flags = O_WRONLY | O_CREAT | O_TRUNC;
143 fdo->mode = 0774;
144 fdo->fileOffset = 0;
145
146 fdo = &fd_map[STDERR_FILENO];
147 fdo->fd = stderr_fd;
148 fdo->filename = err;
149 fdo->flags = O_WRONLY;
150 fdo->mode = -1;
151 fdo->fileOffset = 0;
152
153
154 // mark remaining fds as free
155 for (int i = 3; i <= MAX_FD; ++i) {
156 Process::FdMap *fdo = &fd_map[i];
157 fdo->fd = -1;
158 }
159
160 mmap_start = mmap_end = 0;
161 nxm_start = nxm_end = 0;
162 pTable = new PageTable(this);
163 // other parameters will be initialized when the program is loaded
164 }
165
166
167 void
168 Process::regStats()
169 {
170 using namespace Stats;
171
172 num_syscalls
173 .name(name() + ".num_syscalls")
174 .desc("Number of system calls")
175 ;
176 }
177
178 //
179 // static helper functions
180 //
181 int
182 Process::openInputFile(const string &filename)
183 {
184 int fd = open(filename.c_str(), O_RDONLY);
185
186 if (fd == -1) {
187 perror(NULL);
188 cerr << "unable to open \"" << filename << "\" for reading\n";
189 fatal("can't open input file");
190 }
191
192 return fd;
193 }
194
195
196 int
197 Process::openOutputFile(const string &filename)
198 {
199 int fd = open(filename.c_str(), O_WRONLY | O_CREAT | O_TRUNC, 0664);
200
201 if (fd == -1) {
202 perror(NULL);
203 cerr << "unable to open \"" << filename << "\" for writing\n";
204 fatal("can't open output file");
205 }
206
207 return fd;
208 }
209
210 ThreadContext *
211 Process::findFreeContext()
212 {
213 int size = contextIds.size();
214 ThreadContext *tc;
215 for (int i = 0; i < size; ++i) {
216 tc = system->getThreadContext(contextIds[i]);
217 if (tc->status() == ThreadContext::Halted) {
218 // inactive context, free to use
219 return tc;
220 }
221 }
222 return NULL;
223 }
224
225 void
226 Process::initState()
227 {
228 if (contextIds.empty())
229 fatal("Process %s is not associated with any HW contexts!\n", name());
230
231 // first thread context for this process... initialize & enable
232 ThreadContext *tc = system->getThreadContext(contextIds[0]);
233
234 // mark this context as active so it will start ticking.
235 tc->activate(0);
236
237 Port *mem_port;
238 mem_port = system->physmem->getPort("functional");
239 initVirtMem = new TranslatingPort("process init port", this,
240 TranslatingPort::Always);
241 mem_port->setPeer(initVirtMem);
242 initVirtMem->setPeer(mem_port);
243 }
244
245 // map simulator fd sim_fd to target fd tgt_fd
246 void
247 Process::dup_fd(int sim_fd, int tgt_fd)
248 {
249 if (tgt_fd < 0 || tgt_fd > MAX_FD)
250 panic("Process::dup_fd tried to dup past MAX_FD (%d)", tgt_fd);
251
252 Process::FdMap *fdo = &fd_map[tgt_fd];
253 fdo->fd = sim_fd;
254 }
255
256
257 // generate new target fd for sim_fd
258 int
259 Process::alloc_fd(int sim_fd, string filename, int flags, int mode, bool pipe)
260 {
261 // in case open() returns an error, don't allocate a new fd
262 if (sim_fd == -1)
263 return -1;
264
265 // find first free target fd
266 for (int free_fd = 0; free_fd <= MAX_FD; ++free_fd) {
267 Process::FdMap *fdo = &fd_map[free_fd];
268 if (fdo->fd == -1) {
269 fdo->fd = sim_fd;
270 fdo->filename = filename;
271 fdo->mode = mode;
272 fdo->fileOffset = 0;
273 fdo->flags = flags;
274 fdo->isPipe = pipe;
275 fdo->readPipeSource = 0;
276 return free_fd;
277 }
278 }
279
280 panic("Process::alloc_fd: out of file descriptors!");
281 }
282
283
284 // free target fd (e.g., after close)
285 void
286 Process::free_fd(int tgt_fd)
287 {
288 Process::FdMap *fdo = &fd_map[tgt_fd];
289 if (fdo->fd == -1)
290 warn("Process::free_fd: request to free unused fd %d", tgt_fd);
291
292 fdo->fd = -1;
293 fdo->filename = "NULL";
294 fdo->mode = 0;
295 fdo->fileOffset = 0;
296 fdo->flags = 0;
297 fdo->isPipe = false;
298 fdo->readPipeSource = 0;
299 }
300
301
302 // look up simulator fd for given target fd
303 int
304 Process::sim_fd(int tgt_fd)
305 {
306 if (tgt_fd < 0 || tgt_fd > MAX_FD)
307 return -1;
308
309 return fd_map[tgt_fd].fd;
310 }
311
312 Process::FdMap *
313 Process::sim_fd_obj(int tgt_fd)
314 {
315 if (tgt_fd < 0 || tgt_fd > MAX_FD)
316 return NULL;
317
318 return &fd_map[tgt_fd];
319 }
320
321 bool
322 Process::fixupStackFault(Addr vaddr)
323 {
324 // Check if this is already on the stack and there's just no page there
325 // yet.
326 if (vaddr >= stack_min && vaddr < stack_base) {
327 pTable->allocate(roundDown(vaddr, VMPageSize), VMPageSize);
328 return true;
329 }
330
331 // We've accessed the next page of the stack, so extend it to include
332 // this address.
333 if (vaddr < stack_min && vaddr >= stack_base - max_stack_size) {
334 while (vaddr < stack_min) {
335 stack_min -= TheISA::PageBytes;
336 if (stack_base - stack_min > max_stack_size)
337 fatal("Maximum stack size exceeded\n");
338 if (stack_base - stack_min > 8 * 1024 * 1024)
339 fatal("Over max stack size for one thread\n");
340 pTable->allocate(stack_min, TheISA::PageBytes);
341 inform("Increasing stack size by one page.");
342 };
343 return true;
344 }
345 warn("Not extending stack: address %#x isn't at the end of the stack.",
346 vaddr);
347 return false;
348 }
349
350 // find all offsets for currently open files and save them
351 void
352 Process::fix_file_offsets()
353 {
354 Process::FdMap *fdo_stdin = &fd_map[STDIN_FILENO];
355 Process::FdMap *fdo_stdout = &fd_map[STDOUT_FILENO];
356 Process::FdMap *fdo_stderr = &fd_map[STDERR_FILENO];
357 string in = fdo_stdin->filename;
358 string out = fdo_stdout->filename;
359 string err = fdo_stderr->filename;
360
361 // initialize file descriptors to default: same as simulator
362 int stdin_fd, stdout_fd, stderr_fd;
363
364 if (in == "stdin" || in == "cin")
365 stdin_fd = STDIN_FILENO;
366 else if (in == "None")
367 stdin_fd = -1;
368 else {
369 // open standard in and seek to the right location
370 stdin_fd = Process::openInputFile(in);
371 if (lseek(stdin_fd, fdo_stdin->fileOffset, SEEK_SET) < 0)
372 panic("Unable to seek to correct location in file: %s", in);
373 }
374
375 if (out == "stdout" || out == "cout")
376 stdout_fd = STDOUT_FILENO;
377 else if (out == "stderr" || out == "cerr")
378 stdout_fd = STDERR_FILENO;
379 else if (out == "None")
380 stdout_fd = -1;
381 else {
382 stdout_fd = Process::openOutputFile(out);
383 if (lseek(stdout_fd, fdo_stdout->fileOffset, SEEK_SET) < 0)
384 panic("Unable to seek to correct location in file: %s", out);
385 }
386
387 if (err == "stdout" || err == "cout")
388 stderr_fd = STDOUT_FILENO;
389 else if (err == "stderr" || err == "cerr")
390 stderr_fd = STDERR_FILENO;
391 else if (err == "None")
392 stderr_fd = -1;
393 else if (err == out)
394 stderr_fd = stdout_fd;
395 else {
396 stderr_fd = Process::openOutputFile(err);
397 if (lseek(stderr_fd, fdo_stderr->fileOffset, SEEK_SET) < 0)
398 panic("Unable to seek to correct location in file: %s", err);
399 }
400
401 fdo_stdin->fd = stdin_fd;
402 fdo_stdout->fd = stdout_fd;
403 fdo_stderr->fd = stderr_fd;
404
405
406 for (int free_fd = 3; free_fd <= MAX_FD; ++free_fd) {
407 Process::FdMap *fdo = &fd_map[free_fd];
408 if (fdo->fd != -1) {
409 if (fdo->isPipe){
410 if (fdo->filename == "PIPE-WRITE")
411 continue;
412 else {
413 assert (fdo->filename == "PIPE-READ");
414 //create a new pipe
415 int fds[2];
416 int pipe_retval = pipe(fds);
417
418 if (pipe_retval < 0) {
419 // error
420 panic("Unable to create new pipe.");
421 }
422 fdo->fd = fds[0]; //set read pipe
423 Process::FdMap *fdo_write = &fd_map[fdo->readPipeSource];
424 if (fdo_write->filename != "PIPE-WRITE")
425 panic ("Couldn't find write end of the pipe");
426
427 fdo_write->fd = fds[1];//set write pipe
428 }
429 } else {
430 //Open file
431 int fd = open(fdo->filename.c_str(), fdo->flags, fdo->mode);
432
433 if (fd == -1)
434 panic("Unable to open file: %s", fdo->filename);
435 fdo->fd = fd;
436
437 //Seek to correct location before checkpoint
438 if (lseek(fd,fdo->fileOffset, SEEK_SET) < 0)
439 panic("Unable to seek to correct location in file: %s",
440 fdo->filename);
441 }
442 }
443 }
444 }
445
446 void
447 Process::find_file_offsets()
448 {
449 for (int free_fd = 0; free_fd <= MAX_FD; ++free_fd) {
450 Process::FdMap *fdo = &fd_map[free_fd];
451 if (fdo->fd != -1) {
452 fdo->fileOffset = lseek(fdo->fd, 0, SEEK_CUR);
453 } else {
454 fdo->filename = "NULL";
455 fdo->fileOffset = 0;
456 }
457 }
458 }
459
460 void
461 Process::setReadPipeSource(int read_pipe_fd, int source_fd)
462 {
463 Process::FdMap *fdo = &fd_map[read_pipe_fd];
464 fdo->readPipeSource = source_fd;
465 }
466
467 void
468 Process::FdMap::serialize(std::ostream &os)
469 {
470 SERIALIZE_SCALAR(fd);
471 SERIALIZE_SCALAR(isPipe);
472 SERIALIZE_SCALAR(filename);
473 SERIALIZE_SCALAR(flags);
474 SERIALIZE_SCALAR(readPipeSource);
475 SERIALIZE_SCALAR(fileOffset);
476 }
477
478 void
479 Process::FdMap::unserialize(Checkpoint *cp, const std::string &section)
480 {
481 UNSERIALIZE_SCALAR(fd);
482 UNSERIALIZE_SCALAR(isPipe);
483 UNSERIALIZE_SCALAR(filename);
484 UNSERIALIZE_SCALAR(flags);
485 UNSERIALIZE_SCALAR(readPipeSource);
486 UNSERIALIZE_SCALAR(fileOffset);
487 }
488
489 void
490 Process::serialize(std::ostream &os)
491 {
492 SERIALIZE_SCALAR(brk_point);
493 SERIALIZE_SCALAR(stack_base);
494 SERIALIZE_SCALAR(stack_size);
495 SERIALIZE_SCALAR(stack_min);
496 SERIALIZE_SCALAR(next_thread_stack_base);
497 SERIALIZE_SCALAR(mmap_start);
498 SERIALIZE_SCALAR(mmap_end);
499 SERIALIZE_SCALAR(nxm_start);
500 SERIALIZE_SCALAR(nxm_end);
501 find_file_offsets();
502 pTable->serialize(os);
503 for (int x = 0; x <= MAX_FD; x++) {
504 nameOut(os, csprintf("%s.FdMap%d", name(), x));
505 fd_map[x].serialize(os);
506 }
507 SERIALIZE_SCALAR(M5_pid);
508
509 }
510
511 void
512 Process::unserialize(Checkpoint *cp, const std::string &section)
513 {
514 UNSERIALIZE_SCALAR(brk_point);
515 UNSERIALIZE_SCALAR(stack_base);
516 UNSERIALIZE_SCALAR(stack_size);
517 UNSERIALIZE_SCALAR(stack_min);
518 UNSERIALIZE_SCALAR(next_thread_stack_base);
519 UNSERIALIZE_SCALAR(mmap_start);
520 UNSERIALIZE_SCALAR(mmap_end);
521 UNSERIALIZE_SCALAR(nxm_start);
522 UNSERIALIZE_SCALAR(nxm_end);
523 pTable->unserialize(cp, section);
524 for (int x = 0; x <= MAX_FD; x++) {
525 fd_map[x].unserialize(cp, csprintf("%s.FdMap%d", section, x));
526 }
527 fix_file_offsets();
528 UNSERIALIZE_OPT_SCALAR(M5_pid);
529 // The above returns a bool so that you could do something if you don't
530 // find the param in the checkpoint if you wanted to, like set a default
531 // but in this case we'll just stick with the instantianted value if not
532 // found.
533 }
534
535
536 ////////////////////////////////////////////////////////////////////////
537 //
538 // LiveProcess member definitions
539 //
540 ////////////////////////////////////////////////////////////////////////
541
542
543 LiveProcess::LiveProcess(LiveProcessParams * params, ObjectFile *_objFile)
544 : Process(params), objFile(_objFile),
545 argv(params->cmd), envp(params->env), cwd(params->cwd)
546 {
547 __uid = params->uid;
548 __euid = params->euid;
549 __gid = params->gid;
550 __egid = params->egid;
551 __pid = params->pid;
552 __ppid = params->ppid;
553
554 prog_fname = params->cmd[0];
555
556 // load up symbols, if any... these may be used for debugging or
557 // profiling.
558 if (!debugSymbolTable) {
559 debugSymbolTable = new SymbolTable();
560 if (!objFile->loadGlobalSymbols(debugSymbolTable) ||
561 !objFile->loadLocalSymbols(debugSymbolTable)) {
562 // didn't load any symbols
563 delete debugSymbolTable;
564 debugSymbolTable = NULL;
565 }
566 }
567 }
568
569 void
570 LiveProcess::syscall(int64_t callnum, ThreadContext *tc)
571 {
572 num_syscalls++;
573
574 SyscallDesc *desc = getDesc(callnum);
575 if (desc == NULL)
576 fatal("Syscall %d out of range", callnum);
577
578 desc->doSyscall(callnum, this, tc);
579 }
580
581 IntReg
582 LiveProcess::getSyscallArg(ThreadContext *tc, int &i, int width)
583 {
584 return getSyscallArg(tc, i);
585 }
586
587 LiveProcess *
588 LiveProcess::create(LiveProcessParams * params)
589 {
590 LiveProcess *process = NULL;
591
592 string executable =
593 params->executable == "" ? params->cmd[0] : params->executable;
594 ObjectFile *objFile = createObjectFile(executable);
595 if (objFile == NULL) {
596 fatal("Can't load object file %s", executable);
597 }
598
599 if (objFile->isDynamic())
600 fatal("Object file is a dynamic executable however only static "
601 "executables are supported!\n Please recompile your "
602 "executable as a static binary and try again.\n");
603
604 #if THE_ISA == ALPHA_ISA
605 if (objFile->getArch() != ObjectFile::Alpha)
606 fatal("Object file architecture does not match compiled ISA (Alpha).");
607
608 switch (objFile->getOpSys()) {
609 case ObjectFile::Tru64:
610 process = new AlphaTru64Process(params, objFile);
611 break;
612
613 case ObjectFile::UnknownOpSys:
614 warn("Unknown operating system; assuming Linux.");
615 // fall through
616 case ObjectFile::Linux:
617 process = new AlphaLinuxProcess(params, objFile);
618 break;
619
620 default:
621 fatal("Unknown/unsupported operating system.");
622 }
623 #elif THE_ISA == SPARC_ISA
624 if (objFile->getArch() != ObjectFile::SPARC64 &&
625 objFile->getArch() != ObjectFile::SPARC32)
626 fatal("Object file architecture does not match compiled ISA (SPARC).");
627 switch (objFile->getOpSys()) {
628 case ObjectFile::UnknownOpSys:
629 warn("Unknown operating system; assuming Linux.");
630 // fall through
631 case ObjectFile::Linux:
632 if (objFile->getArch() == ObjectFile::SPARC64) {
633 process = new Sparc64LinuxProcess(params, objFile);
634 } else {
635 process = new Sparc32LinuxProcess(params, objFile);
636 }
637 break;
638
639
640 case ObjectFile::Solaris:
641 process = new SparcSolarisProcess(params, objFile);
642 break;
643
644 default:
645 fatal("Unknown/unsupported operating system.");
646 }
647 #elif THE_ISA == X86_ISA
648 if (objFile->getArch() != ObjectFile::X86_64 &&
649 objFile->getArch() != ObjectFile::I386)
650 fatal("Object file architecture does not match compiled ISA (x86).");
651 switch (objFile->getOpSys()) {
652 case ObjectFile::UnknownOpSys:
653 warn("Unknown operating system; assuming Linux.");
654 // fall through
655 case ObjectFile::Linux:
656 if (objFile->getArch() == ObjectFile::X86_64) {
657 process = new X86_64LinuxProcess(params, objFile);
658 } else {
659 process = new I386LinuxProcess(params, objFile);
660 }
661 break;
662
663 default:
664 fatal("Unknown/unsupported operating system.");
665 }
666 #elif THE_ISA == MIPS_ISA
667 if (objFile->getArch() != ObjectFile::Mips)
668 fatal("Object file architecture does not match compiled ISA (MIPS).");
669 switch (objFile->getOpSys()) {
670 case ObjectFile::UnknownOpSys:
671 warn("Unknown operating system; assuming Linux.");
672 // fall through
673 case ObjectFile::Linux:
674 process = new MipsLinuxProcess(params, objFile);
675 break;
676
677 default:
678 fatal("Unknown/unsupported operating system.");
679 }
680 #elif THE_ISA == ARM_ISA
681 if (objFile->getArch() != ObjectFile::Arm &&
682 objFile->getArch() != ObjectFile::Thumb)
683 fatal("Object file architecture does not match compiled ISA (ARM).");
684 switch (objFile->getOpSys()) {
685 case ObjectFile::UnknownOpSys:
686 warn("Unknown operating system; assuming Linux.");
687 // fall through
688 case ObjectFile::Linux:
689 process = new ArmLinuxProcess(params, objFile, objFile->getArch());
690 break;
691 case ObjectFile::LinuxArmOABI:
692 fatal("M5 does not support ARM OABI binaries. Please recompile with an"
693 " EABI compiler.");
694 default:
695 fatal("Unknown/unsupported operating system.");
696 }
697 #elif THE_ISA == POWER_ISA
698 if (objFile->getArch() != ObjectFile::Power)
699 fatal("Object file architecture does not match compiled ISA (Power).");
700 switch (objFile->getOpSys()) {
701 case ObjectFile::UnknownOpSys:
702 warn("Unknown operating system; assuming Linux.");
703 // fall through
704 case ObjectFile::Linux:
705 process = new PowerLinuxProcess(params, objFile);
706 break;
707
708 default:
709 fatal("Unknown/unsupported operating system.");
710 }
711 #else
712 #error "THE_ISA not set"
713 #endif
714
715 if (process == NULL)
716 fatal("Unknown error creating process object.");
717 return process;
718 }
719
720 LiveProcess *
721 LiveProcessParams::create()
722 {
723 return LiveProcess::create(this);
724 }