/[gxemul]/trunk/src/useremul.c
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/src/useremul.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 20 by dpavlin, Mon Oct 8 16:19:23 2007 UTC revision 28 by dpavlin, Mon Oct 8 16:20:26 2007 UTC
# Line 1  Line 1 
1  /*  /*
2   *  Copyright (C) 2004-2005  Anders Gavare.  All rights reserved.   *  Copyright (C) 2004-2006  Anders Gavare.  All rights reserved.
3   *   *
4   *  Redistribution and use in source and binary forms, with or without   *  Redistribution and use in source and binary forms, with or without
5   *  modification, are permitted provided that the following conditions are met:   *  modification, are permitted provided that the following conditions are met:
# Line 25  Line 25 
25   *  SUCH DAMAGE.   *  SUCH DAMAGE.
26   *   *
27   *   *
28   *  $Id: useremul.c,v 1.66 2005/11/11 13:23:15 debug Exp $   *  $Id: useremul.c,v 1.71 2006/07/14 16:33:27 debug Exp $
29   *   *
30   *  Userland (syscall) emulation.   *  Userland (syscall) emulation.
31   *   *
# Line 40  Line 40 
40   *      Dynamic ELFs?   *      Dynamic ELFs?
41   *   *
42   *      Try to prefix "/emul/mips/" or similar to all filenames,   *      Try to prefix "/emul/mips/" or similar to all filenames,
43   *              and only if that fails, try the given filename   *              and only if that fails, try the given filename.
44     *              Read this setting from an environment variable, and only
45     *              if there is none, fall back to hardcoded string.
46   *   *
47   *      Automagic errno translation?   *      Automagic errno translation!
48   *   *
49   *      Memory allocation? mmap etc.   *      Memory allocation? mmap, munmap, mprotect, etc.
50     *              mprotect = unmap in dyntrans...
51   *   *
52   *      File descriptor (0,1,2) assumptions?   *      File descriptor (0,1,2) assumptions? Find and fix these?
53   *   *
54   *   *
55   *  This module needs more cleanup.   *  This module needs more cleanup.
56   *  -------------------------------   *  -------------------------------
57   *   *
58   *   *
59   *  NOTE:  This module (useremul.c) is just a quick hack to see if   *  NOTE:  This module (useremul.c) is just a quick hack so far, to see if
60   *         userland emulation works at all.   *         userland emulation works at all. It only works for Hello World-
61     *         style programs compiled for FreeBSD/alpha or NetBSD/mips.
62   */   */
63    
64  #include <errno.h>  #include <errno.h>
# Line 364  static unsigned char *get_userland_buf(s Line 368  static unsigned char *get_userland_buf(s
368          uint64_t baseaddr, uint64_t len)          uint64_t baseaddr, uint64_t len)
369  {  {
370          unsigned char *charbuf;          unsigned char *charbuf;
371          ssize_t i;          size_t i;
372    
373          charbuf = malloc(len);          charbuf = malloc(len);
374          if (charbuf == NULL) {          if (charbuf == NULL) {
# Line 699  static void useremul__freebsd(struct cpu Line 703  static void useremul__freebsd(struct cpu
703          case 58:res = useremul_readlink(cpu, &err, arg0, arg1, arg2);          case 58:res = useremul_readlink(cpu, &err, arg0, arg1, arg2);
704                  break;                  break;
705    
706            case 73:/* munmap. TODO */
707                    res = 1;
708                    break;
709    
710          case 117:res = useremul_getrusage(cpu, &err, arg0, arg1);          case 117:res = useremul_getrusage(cpu, &err, arg0, arg1);
711                  break;                  break;
712    
# Line 1712  static void add_useremul(char *name, int Line 1720  static void add_useremul(char *name, int
1720  void useremul_list_emuls(void)  void useremul_list_emuls(void)
1721  {  {
1722          struct syscall_emul *sep;          struct syscall_emul *sep;
1723          int iadd = 8;          int iadd = DEBUG_INDENTATION * 2;
1724    
1725          sep = first_syscall_emul;          sep = first_syscall_emul;
1726    

Legend:
Removed from v.20  
changed lines
  Added in v.28

  ViewVC Help
Powered by ViewVC 1.1.26