Merge with head, hopefully the last time for this batch.
[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/se_translating_port_proxy.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 struct AuxVector<uint32_t>;
90 template struct 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(name(), M5_pid);
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 initVirtMem = new SETranslatingPortProxy(*system->getSystemPort(), this,
238 SETranslatingPortProxy::Always);
239 }
240
241 // map simulator fd sim_fd to target fd tgt_fd
242 void
243 Process::dup_fd(int sim_fd, int tgt_fd)
244 {
245 if (tgt_fd < 0 || tgt_fd > MAX_FD)
246 panic("Process::dup_fd tried to dup past MAX_FD (%d)", tgt_fd);
247
248 Process::FdMap *fdo = &fd_map[tgt_fd];
249 fdo->fd = sim_fd;
250 }
251
252
253 // generate new target fd for sim_fd
254 int
255 Process::alloc_fd(int sim_fd, string filename, int flags, int mode, bool pipe)
256 {
257 // in case open() returns an error, don't allocate a new fd
258 if (sim_fd == -1)
259 return -1;
260
261 // find first free target fd
262 for (int free_fd = 0; free_fd <= MAX_FD; ++free_fd) {
263 Process::FdMap *fdo = &fd_map[free_fd];
264 if (fdo->fd == -1) {
265 fdo->fd = sim_fd;
266 fdo->filename = filename;
267 fdo->mode = mode;
268 fdo->fileOffset = 0;
269 fdo->flags = flags;
270 fdo->isPipe = pipe;
271 fdo->readPipeSource = 0;
272 return free_fd;
273 }
274 }
275
276 panic("Process::alloc_fd: out of file descriptors!");
277 }
278
279
280 // free target fd (e.g., after close)
281 void
282 Process::free_fd(int tgt_fd)
283 {
284 Process::FdMap *fdo = &fd_map[tgt_fd];
285 if (fdo->fd == -1)
286 warn("Process::free_fd: request to free unused fd %d", tgt_fd);
287
288 fdo->fd = -1;
289 fdo->filename = "NULL";
290 fdo->mode = 0;
291 fdo->fileOffset = 0;
292 fdo->flags = 0;
293 fdo->isPipe = false;
294 fdo->readPipeSource = 0;
295 }
296
297
298 // look up simulator fd for given target fd
299 int
300 Process::sim_fd(int tgt_fd)
301 {
302 if (tgt_fd < 0 || tgt_fd > MAX_FD)
303 return -1;
304
305 return fd_map[tgt_fd].fd;
306 }
307
308 Process::FdMap *
309 Process::sim_fd_obj(int tgt_fd)
310 {
311 if (tgt_fd < 0 || tgt_fd > MAX_FD)
312 return NULL;
313
314 return &fd_map[tgt_fd];
315 }
316
317 void
318 Process::allocateMem(Addr vaddr, int64_t size, bool clobber)
319 {
320 int npages = divCeil(size, (int64_t)VMPageSize);
321 Addr paddr = system->allocPhysPages(npages);
322 pTable->map(vaddr, paddr, size, clobber);
323 }
324
325 bool
326 Process::fixupStackFault(Addr vaddr)
327 {
328 // Check if this is already on the stack and there's just no page there
329 // yet.
330 if (vaddr >= stack_min && vaddr < stack_base) {
331 allocateMem(roundDown(vaddr, VMPageSize), VMPageSize);
332 return true;
333 }
334
335 // We've accessed the next page of the stack, so extend it to include
336 // this address.
337 if (vaddr < stack_min && vaddr >= stack_base - max_stack_size) {
338 while (vaddr < stack_min) {
339 stack_min -= TheISA::PageBytes;
340 if (stack_base - stack_min > max_stack_size)
341 fatal("Maximum stack size exceeded\n");
342 if (stack_base - stack_min > 8 * 1024 * 1024)
343 fatal("Over max stack size for one thread\n");
344 allocateMem(stack_min, TheISA::PageBytes);
345 inform("Increasing stack size by one page.");
346 };
347 return true;
348 }
349 return false;
350 }
351
352 // find all offsets for currently open files and save them
353 void
354 Process::fix_file_offsets()
355 {
356 Process::FdMap *fdo_stdin = &fd_map[STDIN_FILENO];
357 Process::FdMap *fdo_stdout = &fd_map[STDOUT_FILENO];
358 Process::FdMap *fdo_stderr = &fd_map[STDERR_FILENO];
359 string in = fdo_stdin->filename;
360 string out = fdo_stdout->filename;
361 string err = fdo_stderr->filename;
362
363 // initialize file descriptors to default: same as simulator
364 int stdin_fd, stdout_fd, stderr_fd;
365
366 if (in == "stdin" || in == "cin")
367 stdin_fd = STDIN_FILENO;
368 else if (in == "None")
369 stdin_fd = -1;
370 else {
371 // open standard in and seek to the right location
372 stdin_fd = Process::openInputFile(in);
373 if (lseek(stdin_fd, fdo_stdin->fileOffset, SEEK_SET) < 0)
374 panic("Unable to seek to correct location in file: %s", in);
375 }
376
377 if (out == "stdout" || out == "cout")
378 stdout_fd = STDOUT_FILENO;
379 else if (out == "stderr" || out == "cerr")
380 stdout_fd = STDERR_FILENO;
381 else if (out == "None")
382 stdout_fd = -1;
383 else {
384 stdout_fd = Process::openOutputFile(out);
385 if (lseek(stdout_fd, fdo_stdout->fileOffset, SEEK_SET) < 0)
386 panic("Unable to seek to correct location in file: %s", out);
387 }
388
389 if (err == "stdout" || err == "cout")
390 stderr_fd = STDOUT_FILENO;
391 else if (err == "stderr" || err == "cerr")
392 stderr_fd = STDERR_FILENO;
393 else if (err == "None")
394 stderr_fd = -1;
395 else if (err == out)
396 stderr_fd = stdout_fd;
397 else {
398 stderr_fd = Process::openOutputFile(err);
399 if (lseek(stderr_fd, fdo_stderr->fileOffset, SEEK_SET) < 0)
400 panic("Unable to seek to correct location in file: %s", err);
401 }
402
403 fdo_stdin->fd = stdin_fd;
404 fdo_stdout->fd = stdout_fd;
405 fdo_stderr->fd = stderr_fd;
406
407
408 for (int free_fd = 3; free_fd <= MAX_FD; ++free_fd) {
409 Process::FdMap *fdo = &fd_map[free_fd];
410 if (fdo->fd != -1) {
411 if (fdo->isPipe){
412 if (fdo->filename == "PIPE-WRITE")
413 continue;
414 else {
415 assert (fdo->filename == "PIPE-READ");
416 //create a new pipe
417 int fds[2];
418 int pipe_retval = pipe(fds);
419
420 if (pipe_retval < 0) {
421 // error
422 panic("Unable to create new pipe.");
423 }
424 fdo->fd = fds[0]; //set read pipe
425 Process::FdMap *fdo_write = &fd_map[fdo->readPipeSource];
426 if (fdo_write->filename != "PIPE-WRITE")
427 panic ("Couldn't find write end of the pipe");
428
429 fdo_write->fd = fds[1];//set write pipe
430 }
431 } else {
432 //Open file
433 int fd = open(fdo->filename.c_str(), fdo->flags, fdo->mode);
434
435 if (fd == -1)
436 panic("Unable to open file: %s", fdo->filename);
437 fdo->fd = fd;
438
439 //Seek to correct location before checkpoint
440 if (lseek(fd,fdo->fileOffset, SEEK_SET) < 0)
441 panic("Unable to seek to correct location in file: %s",
442 fdo->filename);
443 }
444 }
445 }
446 }
447
448 void
449 Process::find_file_offsets()
450 {
451 for (int free_fd = 0; free_fd <= MAX_FD; ++free_fd) {
452 Process::FdMap *fdo = &fd_map[free_fd];
453 if (fdo->fd != -1) {
454 fdo->fileOffset = lseek(fdo->fd, 0, SEEK_CUR);
455 } else {
456 fdo->filename = "NULL";
457 fdo->fileOffset = 0;
458 }
459 }
460 }
461
462 void
463 Process::setReadPipeSource(int read_pipe_fd, int source_fd)
464 {
465 Process::FdMap *fdo = &fd_map[read_pipe_fd];
466 fdo->readPipeSource = source_fd;
467 }
468
469 void
470 Process::FdMap::serialize(std::ostream &os)
471 {
472 SERIALIZE_SCALAR(fd);
473 SERIALIZE_SCALAR(isPipe);
474 SERIALIZE_SCALAR(filename);
475 SERIALIZE_SCALAR(flags);
476 SERIALIZE_SCALAR(readPipeSource);
477 SERIALIZE_SCALAR(fileOffset);
478 }
479
480 void
481 Process::FdMap::unserialize(Checkpoint *cp, const std::string &section)
482 {
483 UNSERIALIZE_SCALAR(fd);
484 UNSERIALIZE_SCALAR(isPipe);
485 UNSERIALIZE_SCALAR(filename);
486 UNSERIALIZE_SCALAR(flags);
487 UNSERIALIZE_SCALAR(readPipeSource);
488 UNSERIALIZE_SCALAR(fileOffset);
489 }
490
491 void
492 Process::serialize(std::ostream &os)
493 {
494 SERIALIZE_SCALAR(brk_point);
495 SERIALIZE_SCALAR(stack_base);
496 SERIALIZE_SCALAR(stack_size);
497 SERIALIZE_SCALAR(stack_min);
498 SERIALIZE_SCALAR(next_thread_stack_base);
499 SERIALIZE_SCALAR(mmap_start);
500 SERIALIZE_SCALAR(mmap_end);
501 SERIALIZE_SCALAR(nxm_start);
502 SERIALIZE_SCALAR(nxm_end);
503 find_file_offsets();
504 pTable->serialize(os);
505 for (int x = 0; x <= MAX_FD; x++) {
506 nameOut(os, csprintf("%s.FdMap%d", name(), x));
507 fd_map[x].serialize(os);
508 }
509 SERIALIZE_SCALAR(M5_pid);
510
511 }
512
513 void
514 Process::unserialize(Checkpoint *cp, const std::string &section)
515 {
516 UNSERIALIZE_SCALAR(brk_point);
517 UNSERIALIZE_SCALAR(stack_base);
518 UNSERIALIZE_SCALAR(stack_size);
519 UNSERIALIZE_SCALAR(stack_min);
520 UNSERIALIZE_SCALAR(next_thread_stack_base);
521 UNSERIALIZE_SCALAR(mmap_start);
522 UNSERIALIZE_SCALAR(mmap_end);
523 UNSERIALIZE_SCALAR(nxm_start);
524 UNSERIALIZE_SCALAR(nxm_end);
525 pTable->unserialize(cp, section);
526 for (int x = 0; x <= MAX_FD; x++) {
527 fd_map[x].unserialize(cp, csprintf("%s.FdMap%d", section, x));
528 }
529 fix_file_offsets();
530 UNSERIALIZE_OPT_SCALAR(M5_pid);
531 // The above returns a bool so that you could do something if you don't
532 // find the param in the checkpoint if you wanted to, like set a default
533 // but in this case we'll just stick with the instantianted value if not
534 // found.
535 }
536
537
538 ////////////////////////////////////////////////////////////////////////
539 //
540 // LiveProcess member definitions
541 //
542 ////////////////////////////////////////////////////////////////////////
543
544
545 LiveProcess::LiveProcess(LiveProcessParams * params, ObjectFile *_objFile)
546 : Process(params), objFile(_objFile),
547 argv(params->cmd), envp(params->env), cwd(params->cwd)
548 {
549 __uid = params->uid;
550 __euid = params->euid;
551 __gid = params->gid;
552 __egid = params->egid;
553 __pid = params->pid;
554 __ppid = params->ppid;
555
556 prog_fname = params->cmd[0];
557
558 // load up symbols, if any... these may be used for debugging or
559 // profiling.
560 if (!debugSymbolTable) {
561 debugSymbolTable = new SymbolTable();
562 if (!objFile->loadGlobalSymbols(debugSymbolTable) ||
563 !objFile->loadLocalSymbols(debugSymbolTable)) {
564 // didn't load any symbols
565 delete debugSymbolTable;
566 debugSymbolTable = NULL;
567 }
568 }
569 }
570
571 void
572 LiveProcess::syscall(int64_t callnum, ThreadContext *tc)
573 {
574 num_syscalls++;
575
576 SyscallDesc *desc = getDesc(callnum);
577 if (desc == NULL)
578 fatal("Syscall %d out of range", callnum);
579
580 desc->doSyscall(callnum, this, tc);
581 }
582
583 IntReg
584 LiveProcess::getSyscallArg(ThreadContext *tc, int &i, int width)
585 {
586 return getSyscallArg(tc, i);
587 }
588
589 LiveProcess *
590 LiveProcess::create(LiveProcessParams * params)
591 {
592 LiveProcess *process = NULL;
593
594 string executable =
595 params->executable == "" ? params->cmd[0] : params->executable;
596 ObjectFile *objFile = createObjectFile(executable);
597 if (objFile == NULL) {
598 fatal("Can't load object file %s", executable);
599 }
600
601 if (objFile->isDynamic())
602 fatal("Object file is a dynamic executable however only static "
603 "executables are supported!\n Please recompile your "
604 "executable as a static binary and try again.\n");
605
606 #if THE_ISA == ALPHA_ISA
607 if (objFile->getArch() != ObjectFile::Alpha)
608 fatal("Object file architecture does not match compiled ISA (Alpha).");
609
610 switch (objFile->getOpSys()) {
611 case ObjectFile::Tru64:
612 process = new AlphaTru64Process(params, objFile);
613 break;
614
615 case ObjectFile::UnknownOpSys:
616 warn("Unknown operating system; assuming Linux.");
617 // fall through
618 case ObjectFile::Linux:
619 process = new AlphaLinuxProcess(params, objFile);
620 break;
621
622 default:
623 fatal("Unknown/unsupported operating system.");
624 }
625 #elif THE_ISA == SPARC_ISA
626 if (objFile->getArch() != ObjectFile::SPARC64 &&
627 objFile->getArch() != ObjectFile::SPARC32)
628 fatal("Object file architecture does not match compiled ISA (SPARC).");
629 switch (objFile->getOpSys()) {
630 case ObjectFile::UnknownOpSys:
631 warn("Unknown operating system; assuming Linux.");
632 // fall through
633 case ObjectFile::Linux:
634 if (objFile->getArch() == ObjectFile::SPARC64) {
635 process = new Sparc64LinuxProcess(params, objFile);
636 } else {
637 process = new Sparc32LinuxProcess(params, objFile);
638 }
639 break;
640
641
642 case ObjectFile::Solaris:
643 process = new SparcSolarisProcess(params, objFile);
644 break;
645
646 default:
647 fatal("Unknown/unsupported operating system.");
648 }
649 #elif THE_ISA == X86_ISA
650 if (objFile->getArch() != ObjectFile::X86_64 &&
651 objFile->getArch() != ObjectFile::I386)
652 fatal("Object file architecture does not match compiled ISA (x86).");
653 switch (objFile->getOpSys()) {
654 case ObjectFile::UnknownOpSys:
655 warn("Unknown operating system; assuming Linux.");
656 // fall through
657 case ObjectFile::Linux:
658 if (objFile->getArch() == ObjectFile::X86_64) {
659 process = new X86_64LinuxProcess(params, objFile);
660 } else {
661 process = new I386LinuxProcess(params, objFile);
662 }
663 break;
664
665 default:
666 fatal("Unknown/unsupported operating system.");
667 }
668 #elif THE_ISA == MIPS_ISA
669 if (objFile->getArch() != ObjectFile::Mips)
670 fatal("Object file architecture does not match compiled ISA (MIPS).");
671 switch (objFile->getOpSys()) {
672 case ObjectFile::UnknownOpSys:
673 warn("Unknown operating system; assuming Linux.");
674 // fall through
675 case ObjectFile::Linux:
676 process = new MipsLinuxProcess(params, objFile);
677 break;
678
679 default:
680 fatal("Unknown/unsupported operating system.");
681 }
682 #elif THE_ISA == ARM_ISA
683 if (objFile->getArch() != ObjectFile::Arm &&
684 objFile->getArch() != ObjectFile::Thumb)
685 fatal("Object file architecture does not match compiled ISA (ARM).");
686 switch (objFile->getOpSys()) {
687 case ObjectFile::UnknownOpSys:
688 warn("Unknown operating system; assuming Linux.");
689 // fall through
690 case ObjectFile::Linux:
691 process = new ArmLinuxProcess(params, objFile, objFile->getArch());
692 break;
693 case ObjectFile::LinuxArmOABI:
694 fatal("M5 does not support ARM OABI binaries. Please recompile with an"
695 " EABI compiler.");
696 default:
697 fatal("Unknown/unsupported operating system.");
698 }
699 #elif THE_ISA == POWER_ISA
700 if (objFile->getArch() != ObjectFile::Power)
701 fatal("Object file architecture does not match compiled ISA (Power).");
702 switch (objFile->getOpSys()) {
703 case ObjectFile::UnknownOpSys:
704 warn("Unknown operating system; assuming Linux.");
705 // fall through
706 case ObjectFile::Linux:
707 process = new PowerLinuxProcess(params, objFile);
708 break;
709
710 default:
711 fatal("Unknown/unsupported operating system.");
712 }
713 #else
714 #error "THE_ISA not set"
715 #endif
716
717 if (process == NULL)
718 fatal("Unknown error creating process object.");
719 return process;
720 }
721
722 LiveProcess *
723 LiveProcessParams::create()
724 {
725 return LiveProcess::create(this);
726 }