2 * Copyright (c) 2003-2005 The Regents of The University of Michigan
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.
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.
28 * Authors: Steve Reinhardt
39 #include "sim/syscall_emul.hh"
40 #include "base/chunk_generator.hh"
41 #include "base/trace.hh"
42 #include "config/the_isa.hh"
43 #include "cpu/thread_context.hh"
44 #include "cpu/base.hh"
45 #include "mem/page_table.hh"
46 #include "sim/process.hh"
47 #include "sim/system.hh"
48 #include "sim/sim_exit.hh"
51 using namespace TheISA
;
54 SyscallDesc::doSyscall(int callnum
, LiveProcess
*process
, ThreadContext
*tc
)
59 DPRINTFR(SyscallVerbose
,
60 "%d: %s: syscall %s called w/arguments %d,%d,%d,%d\n",
61 curTick
, tc
->getCpuPtr()->name(), name
,
62 process
->getSyscallArg(tc
, index
),
63 process
->getSyscallArg(tc
, index
),
64 process
->getSyscallArg(tc
, index
),
65 process
->getSyscallArg(tc
, index
));
67 SyscallReturn retval
= (*funcPtr
)(this, callnum
, process
, tc
);
69 DPRINTFR(SyscallVerbose
, "%d: %s: syscall %s returns %d\n",
70 curTick
,tc
->getCpuPtr()->name(), name
, retval
.value());
72 if (!(flags
& SyscallDesc::SuppressReturnValue
))
73 process
->setSyscallReturn(tc
, retval
);
78 unimplementedFunc(SyscallDesc
*desc
, int callnum
, LiveProcess
*process
,
81 fatal("syscall %s (#%d) unimplemented.", desc
->name
, callnum
);
88 ignoreFunc(SyscallDesc
*desc
, int callnum
, LiveProcess
*process
,
92 warn("ignoring syscall %s(%d, %d, ...)", desc
->name
,
93 process
->getSyscallArg(tc
, index
), process
->getSyscallArg(tc
, index
));
100 exitFunc(SyscallDesc
*desc
, int callnum
, LiveProcess
*process
,
103 if (process
->system
->numRunningContexts() == 1) {
104 // Last running context... exit simulator
106 exitSimLoop("target called exit()",
107 process
->getSyscallArg(tc
, index
) & 0xff);
109 // other running threads... just halt this one
118 exitGroupFunc(SyscallDesc
*desc
, int callnum
, LiveProcess
*process
,
121 // really should just halt all thread contexts belonging to this
122 // process in case there's another process running...
124 exitSimLoop("target called exit()",
125 process
->getSyscallArg(tc
, index
) & 0xff);
132 getpagesizeFunc(SyscallDesc
*desc
, int num
, LiveProcess
*p
, ThreadContext
*tc
)
134 return (int)VMPageSize
;
139 brkFunc(SyscallDesc
*desc
, int num
, LiveProcess
*p
, ThreadContext
*tc
)
141 // change brk addr to first arg
143 Addr new_brk
= p
->getSyscallArg(tc
, index
);
145 // in Linux at least, brk(0) returns the current break value
146 // (note that the syscall and the glibc function have different behavior)
150 if (new_brk
> p
->brk_point
) {
151 // might need to allocate some new pages
152 for (ChunkGenerator
gen(p
->brk_point
, new_brk
- p
->brk_point
,
153 VMPageSize
); !gen
.done(); gen
.next()) {
154 if (!p
->pTable
->translate(gen
.addr()))
155 p
->pTable
->allocate(roundDown(gen
.addr(), VMPageSize
),
158 // if the address is already there, zero it out
161 TranslatingPort
*tp
= tc
->getMemPort();
163 // split non-page aligned accesses
164 Addr next_page
= roundUp(gen
.addr(), VMPageSize
);
165 uint32_t size_needed
= next_page
- gen
.addr();
166 tp
->memsetBlob(gen
.addr(), zero
, size_needed
);
167 if (gen
.addr() + VMPageSize
> next_page
&&
168 next_page
< new_brk
&&
169 p
->pTable
->translate(next_page
))
171 size_needed
= VMPageSize
- size_needed
;
172 tp
->memsetBlob(next_page
, zero
, size_needed
);
178 p
->brk_point
= new_brk
;
179 DPRINTF(SyscallVerbose
, "Break Point changed to: %#X\n", p
->brk_point
);
185 closeFunc(SyscallDesc
*desc
, int num
, LiveProcess
*p
, ThreadContext
*tc
)
188 int target_fd
= p
->getSyscallArg(tc
, index
);
189 int status
= close(p
->sim_fd(target_fd
));
191 p
->free_fd(target_fd
);
197 readFunc(SyscallDesc
*desc
, int num
, LiveProcess
*p
, ThreadContext
*tc
)
200 int fd
= p
->sim_fd(p
->getSyscallArg(tc
, index
));
201 Addr bufPtr
= p
->getSyscallArg(tc
, index
);
202 int nbytes
= p
->getSyscallArg(tc
, index
);
203 BufferArg
bufArg(bufPtr
, nbytes
);
205 int bytes_read
= read(fd
, bufArg
.bufferPtr(), nbytes
);
207 if (bytes_read
!= -1)
208 bufArg
.copyOut(tc
->getMemPort());
214 writeFunc(SyscallDesc
*desc
, int num
, LiveProcess
*p
, ThreadContext
*tc
)
217 int fd
= p
->sim_fd(p
->getSyscallArg(tc
, index
));
218 Addr bufPtr
= p
->getSyscallArg(tc
, index
);
219 int nbytes
= p
->getSyscallArg(tc
, index
);
220 BufferArg
bufArg(bufPtr
, nbytes
);
222 bufArg
.copyIn(tc
->getMemPort());
224 int bytes_written
= write(fd
, bufArg
.bufferPtr(), nbytes
);
228 return bytes_written
;
233 lseekFunc(SyscallDesc
*desc
, int num
, LiveProcess
*p
, ThreadContext
*tc
)
236 int fd
= p
->sim_fd(p
->getSyscallArg(tc
, index
));
237 uint64_t offs
= p
->getSyscallArg(tc
, index
);
238 int whence
= p
->getSyscallArg(tc
, index
);
240 off_t result
= lseek(fd
, offs
, whence
);
242 return (result
== (off_t
)-1) ? -errno
: result
;
247 _llseekFunc(SyscallDesc
*desc
, int num
, LiveProcess
*p
, ThreadContext
*tc
)
250 int fd
= p
->sim_fd(p
->getSyscallArg(tc
, index
));
251 uint64_t offset_high
= p
->getSyscallArg(tc
, index
);
252 uint32_t offset_low
= p
->getSyscallArg(tc
, index
);
253 Addr result_ptr
= p
->getSyscallArg(tc
, index
);
254 int whence
= p
->getSyscallArg(tc
, index
);
256 uint64_t offset
= (offset_high
<< 32) | offset_low
;
258 uint64_t result
= lseek(fd
, offset
, whence
);
259 result
= TheISA::htog(result
);
261 if (result
== (off_t
)-1) {
265 // The seek succeeded.
266 // Copy "result" to "result_ptr"
267 // XXX We'll assume that the size of loff_t is 64 bits on the
269 BufferArg
result_buf(result_ptr
, sizeof(result
));
270 memcpy(result_buf
.bufferPtr(), &result
, sizeof(result
));
271 result_buf
.copyOut(tc
->getMemPort());
276 return (result
== (off_t
)-1) ? -errno
: result
;
281 munmapFunc(SyscallDesc
*desc
, int num
, LiveProcess
*p
, ThreadContext
*tc
)
283 // given that we don't really implement mmap, munmap is really easy
288 const char *hostname
= "m5.eecs.umich.edu";
291 gethostnameFunc(SyscallDesc
*desc
, int num
, LiveProcess
*p
, ThreadContext
*tc
)
294 Addr bufPtr
= p
->getSyscallArg(tc
, index
);
295 int name_len
= p
->getSyscallArg(tc
, index
);
296 BufferArg
name(bufPtr
, name_len
);
298 strncpy((char *)name
.bufferPtr(), hostname
, name_len
);
300 name
.copyOut(tc
->getMemPort());
306 getcwdFunc(SyscallDesc
*desc
, int num
, LiveProcess
*p
, ThreadContext
*tc
)
310 Addr bufPtr
= p
->getSyscallArg(tc
, index
);
311 unsigned long size
= p
->getSyscallArg(tc
, index
);
312 BufferArg
buf(bufPtr
, size
);
314 // Is current working directory defined?
315 string cwd
= p
->getcwd();
317 if (cwd
.length() >= size
) {
321 strncpy((char *)buf
.bufferPtr(), cwd
.c_str(), size
);
322 result
= cwd
.length();
325 if (getcwd((char *)buf
.bufferPtr(), size
) != NULL
) {
326 result
= strlen((char *)buf
.bufferPtr());
333 buf
.copyOut(tc
->getMemPort());
335 return (result
== -1) ? -errno
: result
;
340 readlinkFunc(SyscallDesc
*desc
, int num
, LiveProcess
*p
, ThreadContext
*tc
)
345 if (!tc
->getMemPort()->tryReadString(path
, p
->getSyscallArg(tc
, index
)))
346 return (TheISA::IntReg
)-EFAULT
;
348 // Adjust path for current working directory
349 path
= p
->fullPath(path
);
351 Addr bufPtr
= p
->getSyscallArg(tc
, index
);
352 size_t bufsiz
= p
->getSyscallArg(tc
, index
);
354 BufferArg
buf(bufPtr
, bufsiz
);
356 int result
= readlink(path
.c_str(), (char *)buf
.bufferPtr(), bufsiz
);
358 buf
.copyOut(tc
->getMemPort());
360 return (result
== -1) ? -errno
: result
;
364 unlinkFunc(SyscallDesc
*desc
, int num
, LiveProcess
*p
, ThreadContext
*tc
)
369 if (!tc
->getMemPort()->tryReadString(path
, p
->getSyscallArg(tc
, index
)))
370 return (TheISA::IntReg
)-EFAULT
;
372 // Adjust path for current working directory
373 path
= p
->fullPath(path
);
375 int result
= unlink(path
.c_str());
376 return (result
== -1) ? -errno
: result
;
381 mkdirFunc(SyscallDesc
*desc
, int num
, LiveProcess
*p
, ThreadContext
*tc
)
386 if (!tc
->getMemPort()->tryReadString(path
, p
->getSyscallArg(tc
, index
)))
387 return (TheISA::IntReg
)-EFAULT
;
389 // Adjust path for current working directory
390 path
= p
->fullPath(path
);
392 mode_t mode
= p
->getSyscallArg(tc
, index
);
394 int result
= mkdir(path
.c_str(), mode
);
395 return (result
== -1) ? -errno
: result
;
399 renameFunc(SyscallDesc
*desc
, int num
, LiveProcess
*p
, ThreadContext
*tc
)
404 if (!tc
->getMemPort()->tryReadString(old_name
, p
->getSyscallArg(tc
, index
)))
409 if (!tc
->getMemPort()->tryReadString(new_name
, p
->getSyscallArg(tc
, index
)))
412 // Adjust path for current working directory
413 old_name
= p
->fullPath(old_name
);
414 new_name
= p
->fullPath(new_name
);
416 int64_t result
= rename(old_name
.c_str(), new_name
.c_str());
417 return (result
== -1) ? -errno
: result
;
421 truncateFunc(SyscallDesc
*desc
, int num
, LiveProcess
*p
, ThreadContext
*tc
)
426 if (!tc
->getMemPort()->tryReadString(path
, p
->getSyscallArg(tc
, index
)))
429 off_t length
= p
->getSyscallArg(tc
, index
);
431 // Adjust path for current working directory
432 path
= p
->fullPath(path
);
434 int result
= truncate(path
.c_str(), length
);
435 return (result
== -1) ? -errno
: result
;
439 ftruncateFunc(SyscallDesc
*desc
, int num
,
440 LiveProcess
*process
, ThreadContext
*tc
)
443 int fd
= process
->sim_fd(process
->getSyscallArg(tc
, index
));
448 off_t length
= process
->getSyscallArg(tc
, index
);
450 int result
= ftruncate(fd
, length
);
451 return (result
== -1) ? -errno
: result
;
455 truncate64Func(SyscallDesc
*desc
, int num
,
456 LiveProcess
*process
, ThreadContext
*tc
)
461 if (!tc
->getMemPort()->tryReadString(path
, process
->getSyscallArg(tc
, index
)))
464 int64_t length
= process
->getSyscallArg(tc
, index
, 64);
466 // Adjust path for current working directory
467 path
= process
->fullPath(path
);
470 int result
= truncate(path
.c_str(), length
);
472 int result
= truncate64(path
.c_str(), length
);
474 return (result
== -1) ? -errno
: result
;
478 ftruncate64Func(SyscallDesc
*desc
, int num
,
479 LiveProcess
*process
, ThreadContext
*tc
)
482 int fd
= process
->sim_fd(process
->getSyscallArg(tc
, index
));
487 int64_t length
= process
->getSyscallArg(tc
, index
, 64);
490 int result
= ftruncate(fd
, length
);
492 int result
= ftruncate64(fd
, length
);
494 return (result
== -1) ? -errno
: result
;
498 umaskFunc(SyscallDesc
*desc
, int num
, LiveProcess
*process
, ThreadContext
*tc
)
500 // Letting the simulated program change the simulator's umask seems like
501 // a bad idea. Compromise by just returning the current umask but not
502 // changing anything.
503 mode_t oldMask
= umask(0);
509 chownFunc(SyscallDesc
*desc
, int num
, LiveProcess
*p
, ThreadContext
*tc
)
514 if (!tc
->getMemPort()->tryReadString(path
, p
->getSyscallArg(tc
, index
)))
518 uint32_t owner
= p
->getSyscallArg(tc
, index
);
519 uid_t hostOwner
= owner
;
520 uint32_t group
= p
->getSyscallArg(tc
, index
);
521 gid_t hostGroup
= group
;
523 // Adjust path for current working directory
524 path
= p
->fullPath(path
);
526 int result
= chown(path
.c_str(), hostOwner
, hostGroup
);
527 return (result
== -1) ? -errno
: result
;
531 fchownFunc(SyscallDesc
*desc
, int num
, LiveProcess
*process
, ThreadContext
*tc
)
534 int fd
= process
->sim_fd(process
->getSyscallArg(tc
, index
));
540 uint32_t owner
= process
->getSyscallArg(tc
, index
);
541 uid_t hostOwner
= owner
;
542 uint32_t group
= process
->getSyscallArg(tc
, index
);
543 gid_t hostGroup
= group
;
545 int result
= fchown(fd
, hostOwner
, hostGroup
);
546 return (result
== -1) ? -errno
: result
;
551 dupFunc(SyscallDesc
*desc
, int num
, LiveProcess
*process
, ThreadContext
*tc
)
554 int fd
= process
->sim_fd(process
->getSyscallArg(tc
, index
));
558 Process::FdMap
*fdo
= process
->sim_fd_obj(fd
);
560 int result
= dup(fd
);
561 return (result
== -1) ? -errno
:
562 process
->alloc_fd(result
, fdo
->filename
, fdo
->flags
, fdo
->mode
, false);
567 fcntlFunc(SyscallDesc
*desc
, int num
, LiveProcess
*process
,
571 int fd
= process
->getSyscallArg(tc
, index
);
573 if (fd
< 0 || process
->sim_fd(fd
) < 0)
576 int cmd
= process
->getSyscallArg(tc
, index
);
579 // if we really wanted to support this, we'd need to do it
580 // in the target fd space.
581 warn("fcntl(%d, F_DUPFD) not supported, error returned\n", fd
);
584 case 1: // F_GETFD (get close-on-exec flag)
585 case 2: // F_SETFD (set close-on-exec flag)
588 case 3: // F_GETFL (get file flags)
589 case 4: // F_SETFL (set file flags)
590 // not sure if this is totally valid, but we'll pass it through
591 // to the underlying OS
592 warn("fcntl(%d, %d) passed through to host\n", fd
, cmd
);
593 return fcntl(process
->sim_fd(fd
), cmd
);
596 case 7: // F_GETLK (get lock)
597 case 8: // F_SETLK (set lock)
598 case 9: // F_SETLKW (set lock and wait)
599 // don't mess with file locking... just act like it's OK
600 warn("File lock call (fcntl(%d, %d)) ignored.\n", fd
, cmd
);
604 warn("Unknown fcntl command %d\n", cmd
);
610 fcntl64Func(SyscallDesc
*desc
, int num
, LiveProcess
*process
,
614 int fd
= process
->getSyscallArg(tc
, index
);
616 if (fd
< 0 || process
->sim_fd(fd
) < 0)
619 int cmd
= process
->getSyscallArg(tc
, index
);
622 warn("fcntl64(%d, F_GETLK64) not supported, error returned\n", fd
);
625 case 34: // F_SETLK64
626 case 35: // F_SETLKW64
627 warn("fcntl64(%d, F_SETLK(W)64) not supported, error returned\n", fd
);
631 // not sure if this is totally valid, but we'll pass it through
632 // to the underlying OS
633 warn("fcntl64(%d, %d) passed through to host\n", fd
, cmd
);
634 return fcntl(process
->sim_fd(fd
), cmd
);
640 pipePseudoFunc(SyscallDesc
*desc
, int callnum
, LiveProcess
*process
,
643 int fds
[2], sim_fds
[2];
644 int pipe_retval
= pipe(fds
);
646 if (pipe_retval
< 0) {
651 sim_fds
[0] = process
->alloc_fd(fds
[0], "PIPE-READ", O_WRONLY
, -1, true);
652 sim_fds
[1] = process
->alloc_fd(fds
[1], "PIPE-WRITE", O_RDONLY
, -1, true);
654 process
->setReadPipeSource(sim_fds
[0], sim_fds
[1]);
655 // Alpha Linux convention for pipe() is that fd[0] is returned as
656 // the return value of the function, and fd[1] is returned in r20.
657 tc
->setIntReg(SyscallPseudoReturnReg
, sim_fds
[1]);
663 getpidPseudoFunc(SyscallDesc
*desc
, int callnum
, LiveProcess
*process
,
666 // Make up a PID. There's no interprocess communication in
667 // fake_syscall mode, so there's no way for a process to know it's
668 // not getting a unique value.
670 tc
->setIntReg(SyscallPseudoReturnReg
, process
->ppid());
671 return process
->pid();
676 getuidPseudoFunc(SyscallDesc
*desc
, int callnum
, LiveProcess
*process
,
679 // Make up a UID and EUID... it shouldn't matter, and we want the
680 // simulation to be deterministic.
683 tc
->setIntReg(SyscallPseudoReturnReg
, process
->euid()); //EUID
684 return process
->uid(); // UID
689 getgidPseudoFunc(SyscallDesc
*desc
, int callnum
, LiveProcess
*process
,
692 // Get current group ID. EGID goes in r20.
693 tc
->setIntReg(SyscallPseudoReturnReg
, process
->egid()); //EGID
694 return process
->gid();
699 setuidFunc(SyscallDesc
*desc
, int callnum
, LiveProcess
*process
,
702 // can't fathom why a benchmark would call this.
704 warn("Ignoring call to setuid(%d)\n", process
->getSyscallArg(tc
, index
));
709 getpidFunc(SyscallDesc
*desc
, int callnum
, LiveProcess
*process
,
712 // Make up a PID. There's no interprocess communication in
713 // fake_syscall mode, so there's no way for a process to know it's
714 // not getting a unique value.
716 tc
->setIntReg(SyscallPseudoReturnReg
, process
->ppid()); //PID
717 return process
->pid();
721 getppidFunc(SyscallDesc
*desc
, int callnum
, LiveProcess
*process
,
724 return process
->ppid();
728 getuidFunc(SyscallDesc
*desc
, int callnum
, LiveProcess
*process
,
731 return process
->uid(); // UID
735 geteuidFunc(SyscallDesc
*desc
, int callnum
, LiveProcess
*process
,
738 return process
->euid(); // UID
742 getgidFunc(SyscallDesc
*desc
, int callnum
, LiveProcess
*process
,
745 return process
->gid();
749 getegidFunc(SyscallDesc
*desc
, int callnum
, LiveProcess
*process
,
752 return process
->egid();
757 cloneFunc(SyscallDesc
*desc
, int callnum
, LiveProcess
*process
,
761 IntReg flags
= process
->getSyscallArg(tc
, index
);
762 IntReg newStack
= process
->getSyscallArg(tc
, index
);
764 DPRINTF(SyscallVerbose
, "In sys_clone:\n");
765 DPRINTF(SyscallVerbose
, " Flags=%llx\n", flags
);
766 DPRINTF(SyscallVerbose
, " Child stack=%llx\n", newStack
);
769 if (flags
!= 0x10f00) {
770 warn("This sys_clone implementation assumes flags "
771 "CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD "
772 "(0x10f00), and may not work correctly with given flags "
776 ThreadContext
* ctc
; // child thread context
777 if ( ( ctc
= process
->findFreeContext() ) != NULL
) {
778 DPRINTF(SyscallVerbose
, " Found unallocated thread context\n");
780 ctc
->clearArchRegs();
782 // Arch-specific cloning code
783 #if THE_ISA == ALPHA_ISA or THE_ISA == X86_ISA
784 // Cloning the misc. regs for these archs is enough
785 TheISA::copyMiscRegs(tc
, ctc
);
786 #elif THE_ISA == SPARC_ISA
787 TheISA::copyRegs(tc
, ctc
);
789 // TODO: Explain what this code actually does :-)
790 ctc
->setIntReg(NumIntArchRegs
+ 6, 0);
791 ctc
->setIntReg(NumIntArchRegs
+ 4, 0);
792 ctc
->setIntReg(NumIntArchRegs
+ 3, NWindows
- 2);
793 ctc
->setIntReg(NumIntArchRegs
+ 5, NWindows
);
794 ctc
->setMiscReg(MISCREG_CWP
, 0);
795 ctc
->setIntReg(NumIntArchRegs
+ 7, 0);
796 ctc
->setMiscRegNoEffect(MISCREG_TL
, 0);
797 ctc
->setMiscRegNoEffect(MISCREG_ASI
, ASI_PRIMARY
);
799 for (int y
= 8; y
< 32; y
++)
800 ctc
->setIntReg(y
, tc
->readIntReg(y
));
802 fatal("sys_clone is not implemented for this ISA\n");
805 // Set up stack register
806 ctc
->setIntReg(TheISA::StackPointerReg
, newStack
);
808 // Set up syscall return values in parent and child
809 ctc
->setIntReg(ReturnValueReg
, 0); // return value, child
811 // Alpha needs SyscallSuccessReg=0 in child
812 #if THE_ISA == ALPHA_ISA
813 ctc
->setIntReg(TheISA::SyscallSuccessReg
, 0);
816 // In SPARC/Linux, clone returns 0 on pseudo-return register if
817 // parent, non-zero if child
818 #if THE_ISA == SPARC_ISA
819 tc
->setIntReg(TheISA::SyscallPseudoReturnReg
, 0);
820 ctc
->setIntReg(TheISA::SyscallPseudoReturnReg
, 1);
823 ctc
->setPC(tc
->readNextPC());
824 ctc
->setNextPC(tc
->readNextPC() + sizeof(TheISA::MachInst
));
825 ctc
->setNextNPC(tc
->readNextNPC() + sizeof(TheISA::MachInst
));
829 // Should return nonzero child TID in parent's syscall return register,
830 // but for our pthread library any non-zero value will work
833 fatal("Called sys_clone, but no unallocated thread contexts found!\n");