Commit Graph

3248 Commits

Author SHA1 Message Date
cl a580f34fa7 SA_SIGINFO support for m68k (compat aoutm68k) 2003-09-22 14:31:27 +00:00
jdolecek bc83b2f421 make compile after last change (!) 2003-09-21 19:29:10 +00:00
jdolecek 7cea8a1389 cleanup & uniform descriptor owner handling:
* introduce fsetown(), fgetown(), fownsignal() - this sets/retrieves/signals
  the owner of descriptor, according to appropriate sematics
  of TIOCSPGRP/FIOSETOWN/SIOCSPGRP/TIOCGPGRP/FIOGETOWN/SIOCGPGRP ioctl; use
  these routines instead of custom code where appropriate
* make every place handling TIOCSPGRP/TIOCGPGRP handle also FIOSETOWN/FIOGETOWN
  properly, and remove the translation of FIO[SG]OWN to TIOC[SG]PGRP
  in sys_ioctl() & sys_fcntl()
* also remove the socket-specific hack in sys_ioctl()/sys_fcntl() and
  pass the ioctls down to soo_ioctl() as any other ioctl

change discussed on tech-kern@
2003-09-21 19:16:48 +00:00
christos 9b18cdecf8 Now that we have siginfo, use it, instead of pretending to have one. 2003-09-21 17:42:23 +00:00
pooka ec398e6f4d regen 2003-09-18 14:50:07 +00:00
pooka 3e2a629fec Add a good enuf emulation of the MAP_STACK flag to the mmap()
syscall.  This allows programs which use MAP_STACK to work instead
of failing in weird and wonderous ways.
2003-09-18 14:44:09 +00:00
christos dd61a2eb87 catch up with latest sigctx changes; reported by John Heasley, thanks! 2003-09-15 18:35:02 +00:00
manu 9972873c7d Handle mouseup and mousdown events
Add three sysctl to choose wsdisplay unit and screen and wsmux that
ioframebuffer and iohidsystem will use.
2003-09-14 09:48:42 +00:00
christos 0c73068f06 regen 2003-09-13 18:44:49 +00:00
christos 2cfe0b047e add __HAVE_SIGINFO 2003-09-13 18:44:30 +00:00
manu 755716d281 Darwin's I/O reverse the mouse's Y axis. 2003-09-13 16:35:47 +00:00
manu 08f5f5b835 Bugfix: notifications sent by iohidsystem kernel threads are to be
hnalded as mmessages coming from the kernel, since the threas has
no p->p_emuldata
2003-09-13 16:07:44 +00:00
jdolecek a034152027 move dupfd from struct proc to struct lwp - it's per-LWP, not per-process; we
use curlwp where the lwp is not directly available, i.e. in device open
routines

briefly discussed on tech-kern
2003-09-13 08:32:10 +00:00
jdolecek ce8305a84c g/c #if 0'ed code 2003-09-13 08:22:51 +00:00
jdolecek 69150f5b25 ptyname[] must not be static, the contents are modified later in the routine 2003-09-13 08:15:25 +00:00
manu 11d6605f3f Sync between parent and child in iohdisystem thread so that the child has
time to get its parmeteres before the parent throw them away
2003-09-13 07:56:54 +00:00
christos 1ccdaf7265 regen 2003-09-12 12:47:00 +00:00
christos bfff25cc7c Fixes for __sigreturn14 2003-09-12 12:46:47 +00:00
christos d56d80d37d regen 2003-09-12 02:10:55 +00:00
christos 3178a811f8 catch up with sigreturn changes 2003-09-12 02:10:33 +00:00
manu f816300903 (file missing from the previous commit, I copy/past the commit log)
Some initial support for IOHIDSystem. This gives us some pointer moves in X11
(not really related the the actual mouse movement, but this will come).

The darwin_iohidsystem_thread reads events from wscons, translates them
into IOHIDSystem events and wakes up the userland client with a notification.
To do this, I had to improve the void implementation of
io_connect_set_notification_port() to actually register something (I assumed
a single notification port, which makes some sense since only one process
seems to be able to open the driver)

Missing bits:
- we do not take event masks given by the process into account.
- the notification message has not been checked against Darwin
- events are badly translated
2003-09-11 23:18:10 +00:00
manu f9c483a301 Some initial support for IOHIDSystem. This gives us some pointer moves in X11
(not really related the the actual mouse movement, but this will come).

The darwin_iohidsystem_thread reads events from wscons, translates them
into IOHIDSystem events and wakes up the userland client with a notification.
To do this, I had to improve the void implementation of
io_connect_set_notification_port() to actually register something (I assumed
a single notification port, which makes some sense since only one process
seems to be able to open the driver)

Missing bits:
- we do not take event masks given by the process into account.
- the notification message has not been checked against Darwin
- events are badly translated
2003-09-11 23:16:18 +00:00
christos 9a680b9da0 regen 2003-09-10 19:47:49 +00:00
christos df9305fe0c sys__sigreturn14 -> compat_16_sys___sigreturn14 2003-09-10 19:47:40 +00:00
christos e09c2a122c don't abuse the native sigcode. 2003-09-10 16:44:56 +00:00
christos 61f50ff333 someone forgot to commit code. make this compile again. 2003-09-10 16:44:45 +00:00
rafal ece5b8e67d Catch up to Christos' SIGINFO changes. 2003-09-07 21:37:19 +00:00
manu 606e47547a Typo 2003-09-07 09:07:19 +00:00
manu 8e53685a40 Fix the build by removing machine dependent stuff from darwin_sysctl.h (it
is included by userland build, and it included darwin_machdep.h, which is
unavaillable for most arches)
2003-09-07 08:05:47 +00:00
manu 7dda8d2416 KERN_PROC and KERN_PROCARGS sysctl. This helps ps working (it's not
yet perfect)
2003-09-06 23:54:47 +00:00
manu 4de9ba3f19 Added vm_region_64 and thread_info 2003-09-06 23:52:25 +00:00
manu f600082353 Added vm_region_64 and thread_info 2003-09-06 23:52:24 +00:00
erh 96cd5369b0 Use vn_marktext to set the VTEXT flag on the vnode of the executable.
This satisfies the KASSERT at the beginning of vmvmd_map_pagedvn() and avoids
an immediate panic when attempting to execute a PECOFF binary.
2003-09-06 22:55:06 +00:00
christos e2c278d8c0 SA_SIGINFO changes 2003-09-06 22:09:20 +00:00
manu f88ed86b14 regen 2003-09-06 11:50:25 +00:00
manu bfc0bb09ef Convert dev_t for mknod 2003-09-06 11:50:00 +00:00
manu 2add551792 regen 2003-09-06 11:18:50 +00:00
manu e0a2c17b59 Correctly translate dev_t in stat/fstat/lstat 2003-09-06 11:18:03 +00:00
manu 72fb398585 regen 2003-09-03 07:29:29 +00:00
manu fcd3e861d0 Implement Darwin's FIODTYPE ioctl (get a file d_type) 2003-09-03 07:28:38 +00:00
manu 244c38a2ae regen 2003-09-02 21:48:49 +00:00
manu c4c193473f correct translation for struct statfs in getfsstat, ststfs and fstatfs 2003-09-02 21:31:01 +00:00
manu 80ae13b4df Handle colormap change requests 2003-08-31 21:10:22 +00:00
manu 2a523b0455 Correctly map the framebuffer. XDarwin display its background shade, hurrah! 2003-08-31 14:17:25 +00:00
manu ebd83433da If a Darwin process using the framebuffer (e.g.: XDarwin) crashes without
restoring text mode, do the job ourselves. This avoids letting the
user on an unusable console
2003-08-29 23:11:40 +00:00
manu 553c82ed11 Switch the console to graphic mode before trying to udv_attach the
framebuffer.
2003-08-29 22:03:13 +00:00
manu 850173c462 Correctly get framebuffer dimensions 2003-08-28 21:47:02 +00:00
manu 41a89bc98d Fix a buffer overflow that was leading to various kernel crashes 2003-08-26 21:52:18 +00:00
chs 939df36e55 add support for non-executable mappings (where the hardware allows this)
and make the stack and heap non-executable by default.  the changes
fall into two basic catagories:

 - pmap and trap-handler changes.  these are all MD:
   = alpha: we already track per-page execute permission with the (software)
	PG_EXEC bit, so just have the trap handler pay attention to it.
   = i386: use a new GDT segment for %cs for processes that have no
	executable mappings above a certain threshold (currently the
	bottom of the stack).  track per-page execute permission with
	the last unused PTE bit.
   = powerpc/ibm4xx: just use the hardware exec bit.
   = powerpc/oea: we already track per-page exec bits, but the hardware only
	implements non-exec mappings at the segment level.  so track the
	number of executable mappings in each segment and turn on the no-exec
	segment bit iff the count is 0.  adjust the trap handler to deal.
   = sparc (sun4m): fix our use of the hardware protection bits.
	fix the trap handler to recognize text faults.
   = sparc64: split the existing unified TSB into data and instruction TSBs,
	and only load TTEs into the appropriate TSB(s) for the permissions.
	fix the trap handler to check for execute permission.
   = not yet implemented: amd64, hppa, sh5

 - changes in all the emulations that put a signal trampoline on the stack.
   instead, we now put the trampoline into a uvm_aobj and map that into
   the process separately.

originally from openbsd, adapted for netbsd by me.
2003-08-24 17:52:28 +00:00
dsl dc46f864d1 Hide prototype of linux_exec_setup_stack() inside #ifdef _KERNEL so
that sbin/sysctl will compile.
2003-08-21 15:08:25 +00:00
hannken 1a2d1be737 Fix syscall_vm86 argument:
struct trapframe -> struct trapframe *
2003-08-21 08:36:56 +00:00
he 6d211e7dbf Re-balance parens. 2003-08-18 20:34:18 +00:00
christos 329946a58b remove the args from the macro. 2003-08-14 02:17:07 +00:00
jdolecek c336185a31 regen - added wrapper for Linux ftruncate64() 2003-08-10 20:17:21 +00:00
jdolecek 94b152275c add Linux compat arg wrapper for ftruncate64(), and change linux compat
truncate64() wrapper to translate args structure
NetBSD truncate() and ftrucate() have hidden 'pad' argument, so we have
to do the argument translation

Problem found and patch supplied in PR kern/22360 by Ales Krenek

This is the last of syscalls with hidden 'pad' arg we didn't have
wrapper for; all the others (lseek, mmap, pwrite, pread) already had
wrapper before.
2003-08-10 20:16:20 +00:00
jdolecek 64bb562b50 fix linux_sys_p{read|write}() to actually call correct syscall after
arg massage, i.e. sys_p{read|write} as appropriate; up to now, the functions
called sys_{read|write}() by mistake
2003-08-09 17:11:51 +00:00
christos 36e09d1a2c Explain a diagnostic message a bit better, and make it a debug only message. 2003-08-09 14:16:44 +00:00
christos 3b9c3c5aab - GC all the setup_stack functions
- add one for linux/i386
2003-08-08 18:57:01 +00:00
christos 6f1990af06 Conditionally declare function that is not used all the time. 2003-08-08 18:55:26 +00:00
agc aad01611e7 Move UCB-licensed code from 4-clause to 3-clause licence.
Patches provided by Joel Baker in PR 22364, verified by myself.
2003-08-07 16:26:28 +00:00
manu c6eca571d5 irix_elf32_probe is now responsible for finding interpreter's load
address. We do that through the irix_load_addr function, which is
not IRIX specific at all. If another emulation needs it, it can
easily move to compat_util.c

With this change, IRIX dynamic binaries are able to link and run again
(top down UVM broke them a few weeks ago)
2003-08-06 01:04:44 +00:00
christos baccb9bad5 Another chicken sacrifice to the gcc3 warning gods. 2003-08-05 21:12:53 +00:00
jdolecek d6ade97eb9 use copyout() instead of subyte() 2003-08-02 20:23:48 +00:00
jdolecek e0fe42681d use copyin()/copyout() instead of fubyte()/subyte()
also nuke uvm_useracc() check, copyin()/copyout() do this atomically

XXX only compile-tested
2003-08-02 19:51:23 +00:00
jdolecek 16b74086ed replace fuword() with copyin(), and suword() with copyout() 2003-08-02 19:21:48 +00:00
mrg caa408bca7 (void_cast_for_gcc_3_3_msg_goes_here *) 2003-07-29 16:18:54 +00:00
jdolecek a2d0517af5 More complete sendmsg(2) and recvmsg(2) emulation:
* translate MSG_* flags
* rewrite CMSG level/type to appropriate NetBSD value on input, and to Linux
  value on output
* handle different CMSG_DATA alignment for some archs

This fixes SCM_RIGHTS passing. Other SCM_* types are not supported -
the set is different on NetBSD and Linux. SCM_TIMESTAMP doesn't seem
to be actually implemented in Linux 2.5.15, so it's not supported
for Linux binaries either (for now).

PR: 21577 by Todd Vierling
2003-07-27 19:30:03 +00:00
mrg 05602c761d add a cast appease gcc3.3 2003-07-27 05:04:02 +00:00
jdolecek 21f695a1ae add LINUX_SO_PEERNAME, LINUX_SO_TIMESTAMP where it has been missing
fix value for LINUX_SO_DETACH_FILTER on couple places (unused anyway)

g/c LINUX_SCM_TIMESTAMP definition for some archs, it will be defined
in generic linux_socket.h
2003-07-26 19:59:29 +00:00
christos 91e13193ee make credentials work on the i386 by passing the original msg structure.
(from Todd Vierling)
2003-07-23 19:10:29 +00:00
christos b2163312f5 fix unused variable warning 2003-07-11 18:55:14 +00:00
manu 90c0f71598 Add HW_MACHINE sysctl 2003-07-10 14:47:34 +00:00
enami 5b4483be52 Actually move the prototype of native_to_linux_sigaltstack here. 2003-07-04 03:04:11 +00:00
christos 28f544c476 Regen. 2003-07-03 21:25:07 +00:00
christos c23e21bca5 Implement linux_rt_sigreturn for real. Add a hack for more plausible siginfo.
The java segv handler still segv's again inside the signal handler, but our
sample test program now works [gets the proper ucontext].
2003-07-03 21:24:27 +00:00
christos 72af603189 make the converter of sigaltstack public. 2003-07-03 21:22:32 +00:00
manu 0229e10bf3 Added a IOFBSETCOLORCONVERTTABLE method in ioframebuffer driver.
Added sanity check for user provided offsets in messages.
2003-07-01 19:15:47 +00:00
fvdl d5aece61d6 Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
2003-06-29 22:28:00 +00:00
thorpej 9f722af1c9 Adapt to ktrace/lwp changes. 2003-06-29 16:10:48 +00:00
thorpej 38271de3f4 Regen: adapt to linux mmap2 changes. 2003-06-29 16:08:36 +00:00
thorpej 8ab744356a Adapt to linux mmap2 changes. 2003-06-29 16:07:58 +00:00
thorpej f4fff81d3a Adapt to ktrace/lwp changes. 2003-06-29 15:49:49 +00:00
simonb 2bda3187f5 Fix 'struct lwp *' lossage. 2003-06-29 15:14:11 +00:00
jdolecek dc63267c8b properly FILE_USE/FILE_UNUSE descriptor in linux_sys_fcntl()
adresses PR kern/21628 by Wolfgang Solfrank
2003-06-29 14:51:28 +00:00
martin 69cd0c4a54 struct proc * -> struct lwp * 2003-06-29 13:33:51 +00:00
darrenr 257443876f 'struct proc *' -> 'struct lwp *' as required to get GENERIC for macppc built 2003-06-29 11:02:21 +00:00
martin 2edcbf6bb2 struct proc * -> struct lwp * 2003-06-29 10:37:45 +00:00
darrenr 9dc96360bb More changes for providing lwpid for ktrace (sparc GENERIC built) 2003-06-29 09:56:27 +00:00
simonb 0a144cd97c Fix 'struct lwp *' lossage. 2003-06-29 09:42:10 +00:00
enami 618a0ff610 Redo previous; struct proc *p is necessary if NSEQUENCER is non zero. 2003-06-29 05:26:25 +00:00
dogcow f842592241 these two got missed in darrenr's proc -> lwp changes 2003-06-29 03:29:14 +00:00
bouyer 63d28e64a6 Kill unused variable. 2003-06-28 22:52:53 +00:00
darrenr 960df3c8d1 Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records.  The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V
2003-06-28 14:20:43 +00:00
he 86cc24bba0 #ifdef _KERNEL_OPT police. 2003-06-28 08:31:16 +00:00
he 3686522ed1 Regenerate after adding include of linux_mmap.h. 2003-06-28 07:56:51 +00:00
he c7ace1c552 Need to include linux_mmap.h to get size of struct linux_sys_mmap2_args. 2003-06-28 07:55:08 +00:00
martin 9276710861 #ifdef _KERNEL_OPT police 2003-06-25 20:30:15 +00:00
augustss 6ef6cc143d Fix missing call to FILE_UNUSE. From kern/21946, from Todd Vierling. 2003-06-23 21:53:10 +00:00
christos 9d352b5c2c PR/21936: Todd Vierling: ioctl 'r' misinterpreted 2003-06-23 21:37:27 +00:00
christos 40e148ef6b PR/21948: Todd Vierling: Implement MAP_TRYFIXED for linux emulation. 2003-06-23 21:32:33 +00:00
christos c9a5d7edc1 Regen. 2003-06-23 21:26:30 +00:00
christos 35637451db PR/21937: Todd Vierling: Proper support for mmap2 2003-06-23 21:25:56 +00:00
erh 2f3650202c Add copyright+license. 2003-06-23 17:29:25 +00:00
martin 864f19482a #ifdef _KERNEL_OPT police 2003-06-23 14:59:21 +00:00
martin d505b18964 Make sure to include opt_foo.h if a defflag option FOO is used. 2003-06-23 11:00:59 +00:00
christos 5879a5dcf6 PR/21936: Todd Vierling: compat/linux: ioctl 'r' misinterpreted 2003-06-20 03:54:35 +00:00
christos c82b786eb3 simplify bsd_sys_bind() 2003-06-05 19:42:55 +00:00
manu c5defe555a Ooops, I deleted a debug printf just before committing and one bit was
remaining. While I'm there, fix a typo in a comment.
2003-06-05 18:51:40 +00:00
manu 278cce5ba7 regen 2003-06-05 12:28:01 +00:00
manu 2c3b365958 Search alternate /emul/* path for AF_LOCAL sockets at bind() time. 2003-06-05 12:26:27 +00:00
manu 9c3b5e7aec Replace strlcpy by strncpy so that it builds again 2003-06-04 19:51:03 +00:00
manu b5c252e8af Build again with SA 2003-06-04 19:34:32 +00:00
manu 899161bdbc Added vm_copy 2003-06-03 20:09:37 +00:00
manu faba943220 Added IOHIDSystem properties (this is about keyboard mapping)
Also added a ssize arg to mach trap args so that trap handler are aware
of the sent packet size.
2003-06-03 06:48:47 +00:00
manu 1ea26aeafe + In ioframebuffer driver:
We try to map the console framebuffer through wsdisplay. It seems to work,
 but we still need to _see_ something.
XXX Framebuffer size discovery is borken.

+ In ioframebuffer and iohidsystem:
More methods and more debug for io_connect_method_*

+ A few new IOKit mach traps.
2003-05-22 22:07:36 +00:00
manu 0d9cf0359a Added io_connect_add_client 2003-05-22 18:10:19 +00:00
nakayama 10e7db6bab Avoid strict-ailas warnings in gcc 3.3;
refer to change of sys/compat/netbsd32/netbsd32_netbsd.c r1.67 to r1.69.
2003-05-17 01:35:54 +00:00
itojun 51110d0c20 use strlcpy
[compat/svr4_32 should have bound check for SVR4_32_AUX_ARGSIZ]
2003-05-16 14:36:30 +00:00
manu 1ab318ff2d We had ugly magic values in io_connect_method_scalari_scalaro and friends.
Peeking at Darwin's header files gives some ideas of what we are doing here.

We know understand most of the stuff called by XDarwin and WindowServer before
mapping the framebuffer.
2003-05-15 23:35:37 +00:00
manu da05e7b4d3 Added io_service_close and the io_connect_map_memory method for
ioframebuffer's shared meory (used to handle the cursor).

XDarwin and WindowServer now fail on framebuffer mapping.
2003-05-14 18:28:04 +00:00
manu f75cb60078 One more I/O flavor for the ioframebuffer driver. XDarwin now crashes
when it comes to map the cursor shared memory (accroding to the source,
next step will be mapping the framebuffer, we are getting closer)
2003-05-14 15:50:38 +00:00
manu 31b52bb7f2 More efforts on the XDarwin front. Introduce io_connect_method_scalari_structo
and io_connect_method_structi_structo. We don't know at all how this stuff
works, but at least we can imitate what Darwin does.
2003-05-14 14:41:04 +00:00
manu 962a6c7d59 Fix a bug in io_registry_entry_get_property: one of the field in the
return packet was wrong (port descriptor instead of VM area descriptor),
thus leading to SIGSEGV when calling IOKit's IOFBCreateSharedCursor().

Now this is fixed we can move forward again on graphic mode.
2003-05-13 20:48:16 +00:00
christos 7218f10c3c sort the ioctl's so we can see what we've implemented and what we have not. 2003-05-07 14:21:20 +00:00
manu 4c94241d26 Make io_iterator_reset working for device class itaerators 2003-04-30 18:38:19 +00:00
manu f8c2ac11e9 typo 2003-04-30 18:05:47 +00:00
manu 9a5720f8f0 Added io_iterator_reset (there is a nundocumented flag argument, no idea
of its use yet)
2003-04-30 07:32:16 +00:00
manu d46d73437c Added the map_memory method for the IOKit, plus an implementation
for the IOHIDSystem driver in Darwin. IOHIDSystem provides access
to user interface devices.

Communication between userspace and kernel is done through a shared
memory page. Our plan is to have a kernel thread waiting on wscons
events (for now it just does nothing), and have it feeding the
shared page.
2003-04-29 22:16:38 +00:00
manu 30bb8c56a7 More debug 2003-04-29 22:12:51 +00:00
manu cbfe387fcc swapped the words in lseek offset reassembly (that was was confused-endian)
Removed useless include that came from a copy/paste.
2003-04-20 14:36:05 +00:00
christos 962f5ffade try to get this to work for both endian machines. 2003-04-20 00:32:16 +00:00
manu 1368d826d9 Regen 2003-04-20 00:10:20 +00:00
manu beca0eff14 Fixed an ABI bug in lseek: NetBSD pads the syscallarg structure because of
the off_t argument, Darwin does not. In order to get the off_t  argument
going through our syscall machinery, we declare it as two long arguments,
and we reassemble it in darwin_sys_lseek.
2003-04-20 00:09:41 +00:00
manu aa5f0948ad Improved bahvior for map_fd. When Darin uses findspace = 0, this seems to
request a mapping at fixed address, overlaying previously existing mappings.

The overlay is done by unmapping (sys_munmap) before mapping at fixed
location. This makes XDarwin able to link and run.
2003-04-19 21:41:15 +00:00
dsl 01761b17f4 Remove unnecessary caddr_t casts 2003-04-16 19:20:33 +00:00
christos c56f7f428b get rid of the ASYNCMAP ioctls 2003-04-12 05:00:38 +00:00
thorpej 5051d1c544 Use PAGE_SIZE rather than NBPG. 2003-04-09 00:39:38 +00:00
oki fb4bbe16fc Regen. 2003-04-08 10:58:55 +00:00
oki 105a3bb543 Added missing syscalls from native syscalls.master. 2003-04-08 10:57:56 +00:00
manu 0479104b05 First attempt with task_suspend/task_resume, but we hit some bugs somewhere
else in our code.
2003-04-06 17:58:49 +00:00
jdolecek 1b18fee640 this info is now in doc/RESPONSIBLE 2003-04-06 10:13:07 +00:00
manu c74de80216 Implement task_info 2003-04-05 21:18:02 +00:00
manu acab734a9e Fix a few bugs and get a better notification support (A sample program
actually works)
2003-04-05 19:27:51 +00:00
he 0a34406c13 Fill the target st_qspare array with 0, the source field has been reclaimed
for other use by the UFS2 merge, and this is just a filler anyway.
2003-04-02 22:14:23 +00:00
thorpej d071d9a8d0 Use PAGE_SIZE rather than NBPG. 2003-04-01 15:02:05 +00:00
thorpej d46b766d7d Use PAGE_SIZE rather than NBPG. 2003-04-01 14:45:09 +00:00
thorpej 24ab4adb9c Use PAGE_SIZE rather than NBPG. 2003-04-01 01:53:40 +00:00
thorpej f4a068d5c2 Use PAGE_SIZE rather than NBPG. 2003-04-01 01:43:29 +00:00
manu fd94bf9486 First work on notifications. Not really working for now. 2003-03-29 11:04:08 +00:00
he 9f8115667b Adapt to changed signature for ioctl routine (caddr_t -> void*). 2003-03-27 15:54:02 +00:00
nakayama ac2c6fba75 Make it compile again; follow fo_ioctl change (hi David!). 2003-03-22 07:54:22 +00:00
dsl bd99e3429d Use 'void *' instead of 'caddr_t' in prototypes of VOP_IOCTL, VOP_FCNTL
and VOP_ADVLOCK, delete casts from callers (and some to copyin/out).
2003-03-21 23:11:19 +00:00
dsl 60418b39b7 Change 'data' argument to fo_ioctl and fo_fcntl from 'caddr_t' to 'void *'.
Avoids a lot of casting and removes the need for some line breaks.
Removed a load of (caddr_t) casts from calls to copyin/copyout as well.
(approved by christos - he has a plan to remove caddr_t...)
2003-03-21 21:13:50 +00:00
dsl 9be8ac5294 Alternative pid/proc allocater, removes all searches associated with pid
lookup and allocation, and any dependency on NPROC or MAXUSERS.
NO_PID changed to -1 (and renamed NO_PGID) to remove artificial limit
on PID_MAX.
As discussed on tech-kern.
2003-03-19 11:36:32 +00:00
manu 523dbf2146 Quick and dirty version of io_registry_entry_get_properties. 2003-03-09 18:33:28 +00:00
he 385f6e3afe Remove to local declarations of "p" which are no more in use, to make
this compile again.
2003-03-08 01:20:21 +00:00
manu a6757a0de1 Less accurate vm_region, but it sticks better to Darwin results. 2003-03-05 22:39:48 +00:00
dsl 4c320740d2 Use do_setres{u,g}id for osf1_sys_set{u,g}id 2003-03-05 18:47:39 +00:00
dsl dfdb668a2e Reimplement linux_sys_setresgid() in terms of do_setresgid() 2003-03-05 18:46:11 +00:00
dsl eabc565aaf Use do_setresuid() to implement linux_sys_setresuid() 2003-03-05 18:44:46 +00:00
manu 03dfd69a01 Added vm_region and vm_msync traps 2003-03-03 22:07:39 +00:00
thorpej 5afa6838bf Do the syscall_plain/syscall_fancy dance on ARM. Shaves a fair number
of cycles off the syscall overhead.

Since all COMPAT_LINUX platforms now support __HAVE_SYSCALL_INTERN,
garbage-collect the LINUX_SYSCALL_FUNCTION stuff.
2003-03-01 04:36:38 +00:00
manu edcf894563 Notification request packets format, nothing implemented yet. 2003-02-28 09:30:23 +00:00
cgd cd122e4a2d in irix_syssgi_mapelf: use vn_marktext where necessary, and make sure
a file isn't accidentally left 'USE'd if an error occurs.  reviewed
by simonb.
2003-02-28 02:12:55 +00:00
yamt da8d9f98f5 make compat_linux struct file interlock friendly. 2003-02-27 16:04:15 +00:00
enami 37d7d10857 Remember the allocated ptimer object so that it won't leak. 2003-02-23 23:36:35 +00:00
pk 2931081a79 Make updating a file's reference and use count MP-safe. 2003-02-23 14:37:32 +00:00
manu c3be74fe41 Introduced IOKit driver methods. Moved back into Mach some IOKit driver
support that was in Darwin code. I get an empty darwin_iokit.c, which is
getting a good candidate for cvs delete.
2003-02-20 22:39:42 +00:00
jdolecek 25d6f89a59 update emul alarm syscalls to recent timer changes
problem encountered by Luke Mewburn for linux emul, problem spot
found by Enami Tsugutomo
2003-02-19 11:23:53 +00:00
jdolecek 853290d652 remove local idea of ELF_AUX_ARGSIZ - since this emul uses elf32_copyargs(),
it shouldn't override the size
2003-02-19 09:45:48 +00:00
manu 749de24f94 - Make sure darwin_iokit_ioframebuffer is invoked
- fix a mistake in mach_io_registry_entry_get_property message format
2003-02-16 18:33:35 +00:00
manu ca120fe1a2 Match IOHIDSystem and IOFramebuffer request in the IOKit and handle them in
Darwin specific files. The handler does nothing yet.

This needs some improvement. Darwin attaches an IOHIDSystem device to
each human-interface device in the tree: mouse, keyboard, and a few others.
For now we only emulate one IOHIDSystem device.
2003-02-16 15:02:05 +00:00
dsl 71d53fb2ed Use find_stopped_child() and proc_free() in compat wait() code to
avoid code duplication.
(approved by christos)
2003-02-14 10:19:14 +00:00
christos e163414ca5 include more opt_ files for nfs. 2003-02-10 17:33:13 +00:00
christos 1bc826ce5e getfh is needed for NFS server. 2003-02-10 17:30:08 +00:00
manu 80a30f1a31 A first attempt at providing access to our device tree through the IOKit.
Darwin's ioreg is able to display the tree.
2003-02-09 22:13:46 +00:00
manu 44af8c7eb4 More IOKit shell. This makes ioreg looping on device discovery: foobar
has a child called foobar, and so on.
2003-02-07 20:40:37 +00:00
manu d0139ca922 More iokit shell: it does nothing, but WindowServer get a bit more far
away and ends with a SIGSEGV.
2003-02-07 16:56:19 +00:00
manu 2e73bb80fe More IOKit basics. Also introduced a mach_port flag to get a precise idea
of what port is sending a message to the kernel.
2003-02-05 23:58:09 +00:00
manu 357afc4e2f Some bits of the first iokit call 2003-02-04 22:47:41 +00:00
manu a643d6a63e Fixed typo 2003-02-03 20:46:55 +00:00
manu 2cd19ab0b2 - WindowServer wants io_master_port? Give it a port!
- introduce mach_port_destroy (badly emulated for now)
- on fork/exec, don't set l_private, as the process might be not mature
enough to survive a proc_representative_lwp call (-> kernel panic)

Once we give WindowServer the io_master_port, it sends a message to it:

   305 WindowServer MMSG  id 2804 [0x1310009 -> 0x131000e] -12016 bytes, flags 0
x1513
   0x0000  0x00001513 0xffffd110 0x0131000e 0x01310009   .........1...1..
   0x0010  0xffffcfd0 0x00000af4 0x00000000 0x00000000   ................
   0x0020  0xffffcf60 0x00000052 0x3c646963 0x74204944   ...`...R<dict ID
   0x0030  0x3d223022 0x3e3c6b65 0x793e494f 0x50726f76   ="0"><key>IOProv
   0x0040  0x69646572 0x436c6173 0x733c2f6b 0x65793e3c   iderClass</key><
   0x0050  0x73747269 0x6e672049 0x443d2231 0x223e494f   string ID="1">IO
   0x0060  0x48494453 0x79737465 0x6d3c2f73 0x7472696e   HIDSystem</strin
   0x0070  0x673e3c2f 0x64696374 0x3e0047cc              g></dict>.G.

Did you ever dreamt about system call arguments in XML?
2003-02-02 19:06:31 +00:00
manu 34a458238c For cproc_t, use a per thread value instead of a per process value. ifdef
out l_emuldata in struct lwp until we actually use it.
2003-01-30 19:14:18 +00:00
atatat bede65472d Cull unused variables. Sigh.
PS - Cross compilers are cool.
2003-01-29 07:00:35 +00:00
manu 26723dc292 lwpified sproc emulation so that it builds and works again. COMPAT_IRIX
now has the level of functionnality it had before SA merge
2003-01-28 23:47:42 +00:00
atatat 59b8237f5e No need to pick a "default address" for mmap in compat code, since we
merely call sys_mmap() at the end anyway, and that will pick the
address for us, if it's needed.

Likewise for checking if /dev/zero is being mapped.
2003-01-28 21:57:42 +00:00
manu 7e15e89c0a Fixed dumb bug 2003-01-26 19:32:04 +00:00
manu ce8bd172b2 For thread creation, make the newly created thread runnable. Mach threads
are now functionnal again.
2003-01-26 19:02:14 +00:00
manu 55215e5266 Remove right duplication on thread creation, which became useless now we
are using lwp.
Enable kill -9 to kill parent thread waiting for its child.
Use upcallret instead of child_return for the newly created lwp.
Add debug messages for thread creation.

Thread creation are still broken...
2003-01-26 12:39:32 +00:00
manu 82a9c6faf0 Use per process emuldata for the thread id for now, but this will change
shortly. This makes hello world working again.
2003-01-24 22:35:43 +00:00
fvdl a3ff3a3038 Bump daddr_t to 64 bits. Replace it with int32_t in all places where
it was used on-disk, so that on-disk formats remain the same.
Remove ufs_daddr_t and ufs_lbn_t for the time being.
2003-01-24 21:55:02 +00:00
manu cb771e3c64 Make the beast build again (but it is still probably broken) 2003-01-24 21:37:01 +00:00
rafal 4490fd7293 Last bit of LWP'ification of compat_irix; this is probably wrong, but at
least it compiles and manu said he'd fix it up and test the whole kit when
he had a chance.
2003-01-22 21:04:50 +00:00
christos 2bb5209b1b lwp'ify 2003-01-22 17:48:02 +00:00
christos ed339f5241 regen. 2003-01-22 17:47:47 +00:00
christos bcc3424bc3 regen 2003-01-22 17:47:35 +00:00
christos 498aa03f2a lwp conversion 2003-01-22 17:47:03 +00:00
rafal 5234d1eb92 Mechanical LWP'ification of IRIX compat code; untested as of right now. 2003-01-22 12:58:22 +00:00
matt b03d17694a Do a preliminary switchover of the mach code to lwp's. It compiles now
but probably doesn't work.   That's for someone who understand this code
better.
2003-01-21 04:06:06 +00:00
matt de92ce633f Regen. 2003-01-21 04:02:37 +00:00
matt d8ad92c6b6 Add <sys/sa.h> 2003-01-21 04:02:10 +00:00
matt 312dfd8487 Adapt to the LWP world. 2003-01-21 04:01:09 +00:00
matt e093b867e9 Regen. 2003-01-21 04:00:02 +00:00
matt 6d793da904 Add <sys/sa.h> 2003-01-21 03:59:27 +00:00
jdolecek d4ad86a080 finish LWPify 2003-01-21 03:16:06 +00:00
martin 5adc155ebd Fix lwp_wait syscallargs. This closes PR 19941. 2003-01-20 08:27:40 +00:00
simonb b4cf696706 Don't need a semi-colon after the closing brace of a function. 2003-01-20 07:18:59 +00:00
simonb 276fd1665c The Double-Semi-Colon Police. 2003-01-20 05:29:53 +00:00
simonb 2eaedc2774 Remove variables that are only assigned too but not referenced. 2003-01-20 01:35:11 +00:00
thorpej 20ba6d6368 Regen to get correct RCS ID. 2003-01-19 16:49:12 +00:00
thorpej 39279e53b5 Merge the nathanw_sa branch. 2003-01-19 16:41:46 +00:00
thorpej f17177355f Regen for correct RCS ID. 2003-01-18 23:43:25 +00:00
thorpej d88bc9c3a2 Regen for correct RCS ID. 2003-01-18 23:36:48 +00:00
thorpej 9509ca1682 Regen for correct RCS IDs. 2003-01-18 23:36:09 +00:00
thorpej 6f62ffcd13 Regen to get correct RCS IDs. 2003-01-18 23:34:34 +00:00
thorpej a03cb2b851 Regen to get correct RCS ID. 2003-01-18 23:28:15 +00:00
christos c0b8b6d8c6 add compat_ossaudio 2003-01-18 22:34:23 +00:00
jdolecek 79509d7602 LWPify 2003-01-18 21:26:36 +00:00
thorpej 41978f782e Merge the nathanw_sa branch. 2003-01-18 21:21:28 +00:00
thorpej 8c0ee6a16b Merge the nathanw_sa branch. 2003-01-18 17:31:06 +00:00
thorpej 6576211dc0 Regen: Merge the nathanw_sa branch. 2003-01-18 08:49:59 +00:00
thorpej 71f181a907 Merge the nathanw_sa branch. 2003-01-18 08:49:22 +00:00
thorpej 6881e93b29 Regen: Merge the nathanw_sa branch. 2003-01-18 08:45:04 +00:00
thorpej 9b46ebe0bd Merge the nathanw_sa branch. 2003-01-18 08:44:26 +00:00
thorpej 84797271c2 Regen: Merge the nathanw_sa branch. 2003-01-18 08:38:50 +00:00
thorpej 540ba7bda5 Merge the nathanw_sa branch. 2003-01-18 08:38:14 +00:00
thorpej afdb47f3fb Regen: Merge the nathanw_sa branch. 2003-01-18 08:36:45 +00:00
thorpej fc54d21534 Merge the nathanw_sa branch. 2003-01-18 08:36:15 +00:00
thorpej 8cb74219bb Regen: Merge the nathanw_sa branch. 2003-01-18 08:35:00 +00:00
thorpej ca3240e089 Merge the nathanw_sa branch. 2003-01-18 08:33:08 +00:00
thorpej 34d5235cfa Regen: Merge the nathanw_sa branch. 2003-01-18 08:32:33 +00:00
thorpej df6b501dd4 Merge the nathanw_sa branch. 2003-01-18 08:32:04 +00:00
thorpej 27bb1001b7 Regen: Merge the nathanw_sa branch. 2003-01-18 08:29:08 +00:00
thorpej 6acc60d22d Merge the nathanw_sa branch. 2003-01-18 08:28:25 +00:00
thorpej 53e750d150 Regen: Merge the nathanw_sa branch. 2003-01-18 08:19:32 +00:00
thorpej 7024ec54cc Merge the nathanw_sa branch. 2003-01-18 08:18:50 +00:00
thorpej 9653eab062 Regen: Merge the nathanw_sa branch. 2003-01-18 08:07:52 +00:00
thorpej 3d60b73d4f Merge the nathanw_sa branch. 2003-01-18 08:06:20 +00:00
thorpej 42f134e02f Regen: Merge the nathanw_sa branch. 2003-01-18 08:05:32 +00:00
thorpej 46141a3135 Merge the nathanw_sa branch. 2003-01-18 08:02:46 +00:00
thorpej 16311b53c0 Regen: Merge the nathanw_sa branch. 2003-01-18 07:45:34 +00:00
thorpej 064d091d71 Merge the nathanw_sa branch. 2003-01-18 07:44:50 +00:00
thorpej 062c115a84 Regen: Merge the nathanw_sa branch. 2003-01-18 07:41:34 +00:00
thorpej a9d45e7ce9 Merge the nathanw_sa branch. 2003-01-18 07:40:44 +00:00
thorpej 790d584247 Regen: Merge the nathanw_sa branch. 2003-01-18 07:37:32 +00:00
thorpej f12607ba9f Merge the nathanw_sa branch. 2003-01-18 07:36:56 +00:00
thorpej acac9c96bb Regen: Merge the nathanw_sa branch. 2003-01-18 07:33:52 +00:00
thorpej 6762b37e5a Merge the nathanw_sa branch. 2003-01-18 07:28:34 +00:00
thorpej a83ddff873 Regen: Merge the nathanw_sa branch. 2003-01-18 07:21:52 +00:00
thorpej 179f14e286 Merge the nathanw_sa branch. 2003-01-18 07:21:14 +00:00
thorpej 85cf298c95 Regen: Merge the nathanw_sa branch. 2003-01-18 07:18:30 +00:00
thorpej d2275d51e1 Merge the nathanw_sa branch. 2003-01-18 06:55:21 +00:00
jdolecek 98cb17d023 add support for SNDCTL_DSP_SETDUPLEX ioctl to ossaudio emulation code
code provided by Andreas Wrede in PR kern/19793
2003-01-12 08:20:05 +00:00
oki 1b09272dff Use text size in COFF header instead of size of section header
marked as COFF_STYP_TEXT.
2003-01-08 17:43:51 +00:00
oki 31789669fa Use uprintf for debug print. 2003-01-08 12:29:44 +00:00
simonb 775343ebae Fix a tyop. 2003-01-08 00:39:44 +00:00
wiz 1035faff1d writable, not writeable. 2003-01-06 20:30:28 +00:00
wiz c053751628 compatibility, not compatiblity. 2003-01-06 13:26:24 +00:00
wiz 617b132aac Spell output with two ts. 2003-01-04 23:43:02 +00:00
manu f656d621e7 Here we enter the land of IOKit where the shadows lie.
There are two new mach traps:
mach_vm_make_memory_entry, mach_host_get_io_master. Now we need to find
the documentation to understand what they are supposed to do.
2003-01-04 15:15:01 +00:00
manu 4b219b054a I don't know where I saw this 8 bit shift for the inherit argument of
vm_inherit, but it's not usefull (it's even harmful), so remove it.
WindowServer still crashes but later.
2003-01-04 13:17:07 +00:00
manu 7f468ee029 Bug fixes for the fake pid hack.
WindowServer is now able to talk with mach_init to exchange bootstrap
information.
2003-01-03 14:47:27 +00:00
manu 80d406d8fe FIxed the way rights are recycled: the refcount makes only sense for
send, send once, and dead names, not for port sets and receive rights.
This make vi and telnet able to work again.

Also removed the all process right list and its lock, which got useless. The
all process lock is replaced by a per process lock, located in struct
mach_emuldata.

Also one bug fix: we did not correctly called Mach hooks for struct emuldata
initialization and release for Darwin processes.
2003-01-03 13:40:04 +00:00
manu 2c04ce0604 A better implementation of right carried by messages. We now correctly create
the right in the destination process.

This is a small step backward for functionnality: vi does not work anymore
because our right checks cause some spurious errors, but this will be fixed
later.
2003-01-02 12:46:06 +00:00
manu 0d5c4544d1 The first int on the stack is not the page size, it's the address of the
mach-O header. This is a guess based on what we have on Darwin, we need
to check other Mach systems to see if this value is Darwin specific or not.
Also updated copyright and removed useless debug
2003-01-01 15:18:25 +00:00
manu f3e11e72e9 Introduce port names, deallocate mach ressources at Darwin process exit 2002-12-31 15:47:37 +00:00
manu 6f978415df When the kernel transmits a message to a processs, remote and local port
are swapped. Also added some debug.
2002-12-31 13:09:38 +00:00
manu 48ad3f41b6 Remove some debug and make it build again wihout DEBUG_MACH 2002-12-31 09:32:03 +00:00
manu 1d1b901b90 bug fix: in debug functions, the port set right and the port set members
wer mixed up
2002-12-30 19:32:15 +00:00
manu d9f2a8dbcd - When mach_init saves the bootstrap port, make it the default bootstrap port
for any program we will launch later. This is a hack to avoid the need
of launching any Darwin binary as a child of mach_init
- More and more debug
2002-12-30 18:44:33 +00:00
manu f449715c66 When allocating a receive right on a port, don't forget to change
the reciever.
2002-12-30 12:46:19 +00:00
manu 27427542f4 When the right is not a port set, set the port set head to the right
itself. That way when we want to wakeup a receiver, we just have to
wakeup the port set head, it will work either for port set and for non
port sets.
2002-12-30 12:41:52 +00:00
manu 459d0be3a4 More hacks to make Darwin's /sbin/init happy with its pid. 2002-12-28 00:15:23 +00:00
manu 874517b438 - When MACH_MSG_RCV_LARGE is set, we must return a message with just a header
and a body.
- If mach_init is not availabkle for boostrap requests, try to handle them
in the kernel (we don't really handle them, we just try to avoid hanging there)
- minor tweaks.
2002-12-27 19:57:47 +00:00
manu 3b815ab820 We must also return pid 2 when mach_init asks for its pid after it forked init. 2002-12-27 19:54:54 +00:00
manu f464631d66 Several things:
1) rights should be shared by the threads within a process. While it would
be easier to handle this with the struct proc/struct lwp split, we attempt to
do this now by sharing the right lists. Because each right holds a reference
to struct proc, this might cause some problems later.
2) in pthread_exit, really exit the thread. Also reintialize the righ tlist to
make sure we will not destroy the parent's right list
3) rights can hold multiple permissions on a port (ie: send and receive). Fix th
is.
4) first attempt on right carried by messages. We still have to do rights carrie
d in the message body (complex messages).
2002-12-27 09:59:24 +00:00
manu 20fca78f89 regen 2002-12-26 14:41:34 +00:00
manu bab8693bba Added the mysterious system call 331 (it does not seems to be in the
header files anywhere). This is pthread_exit.
2002-12-26 14:41:05 +00:00
manu 2894c4a53f Handle the kernel clock service by the kernel. 2002-12-26 13:45:17 +00:00
manu f4d5ba5dbd Queue and dequeue message replies from kernel servers. This is less efficient,
but it sticks closer to the actual Mach semantics: the reply is queued at the
end of the queue. Also add more debug messages on port operations.
2002-12-26 11:41:46 +00:00
manu dc403d4519 Bootstrap messages are not for the kernel, they are for mach_init. 2002-12-24 16:40:46 +00:00
manu b2a7ace594 Better error reporting in mach_msg_trap: this system call does not use the
standard error codes.
2002-12-24 15:54:26 +00:00
manu 4d3d28af57 cosmetic 2002-12-24 15:53:46 +00:00
manu 93b65fbd1d regen 2002-12-24 12:29:28 +00:00
manu 185383e0a7 Typo 2002-12-24 12:29:06 +00:00
manu 41bfbd28fe On Darwin, mach_init is the system bootstrap process. It is responsible
for forking the traditional UNIX init(8) and it does the Mach port naming
service. We need mach_init for the naming service, but unfortunately, it
will only act as such if its PID is 1. We introduce a sysctl
(emul.darwin.init_pid) to fool a given process into thinking its PID is 1.
That way we can get mach_init into behaving as the name server.

Typical use:
/sbin/sysctl -w emul.darwin.init_pid=$$ ; exec /emul/darwin/sbin/mach_init
2002-12-24 12:15:45 +00:00
manu c075c4d7f5 Get less debug output 2002-12-24 12:13:15 +00:00
gmcgarry 6b5b61b136 Update for revised ktrsyscall() prototype.
Perhaps this file should be changed to use trace_enter() so that
systrace works for aliased syscalls?  Leave that for someone familiar
with the systrace system.
2002-12-23 01:08:45 +00:00
manu 360f1c3ebe Cosmetic changes, added a debug printf 2002-12-22 21:51:56 +00:00
mrg 131dc6aa08 catch up with changes in sparc64/autoconf.c. 2002-12-22 02:54:34 +00:00
gmcgarry 66c19fc50c Add stubs for scheduler syscalls. 2002-12-22 00:05:59 +00:00
gmcgarry 87aecbbd2c Add scheduler syscalls. 2002-12-22 00:04:29 +00:00
gmcgarry 53bdf646b5 Use yield() for voluntary context switches. 2002-12-22 00:00:22 +00:00
gmcgarry c4b66baf3f We do want yield() for voluntary context switches. Update comment. 2002-12-21 23:57:57 +00:00
manu 8958b6f9ba Handle receive operations on port sets 2002-12-21 23:50:47 +00:00
manu ccd9e9a24d Fix plain bugs that prevented insert_right and move_member from working correctly. 2002-12-21 23:50:00 +00:00
manu 3ee2623baa Make it build again 2002-12-21 23:48:47 +00:00
kristerw 084ae1f838 ibcs2_debug is used only for IBCS2_DEBUG, so no need to define it otherwise. 2002-12-21 15:48:57 +00:00
gmcgarry 16f1be1856 Flag a context switch using need_resched() rather than invoking yield().
Matches the linux compat approach.
2002-12-20 04:58:44 +00:00
manu 3b71b464b2 First attempt on mach ports sets. Also maitian only one list of rights
per process, as segregating recv, send and send_once did not buy anything.
2002-12-19 22:23:06 +00:00
manu f037b240d0 Instead of keeping track of the receiving process in struct mach_port,
keep track of the receive right for the port. There can be only one, and
the receive right references struct proc should we need it.

This makes easier to find the receive right associated with the port.
2002-12-17 22:48:33 +00:00
manu 391c8a71fc In mach_ports_lookup, allow the out of band data mapping anywhere we have
some free space
2002-12-17 22:47:07 +00:00
manu 5ba396cfb3 Added support for exchange of Mach messages between processes.
This does not buy us new functionnality for now, because we still have to
discover how mach_init (which acts as a name server, enabling processes to
discover each other's ports) is able to receive messages from other processes
(this is a bootstrap problem, and the bootstrap port might be the place to
search).

While we are there:
- removed a lot of debug which is now available using ktrace.
- reworked message handling to avoid mutliple copyin/copyout of the
same data. ktrace of Mach message now uses the in-kernel copy of the
message instead of copying it from userland.
- packed mach trap handlers arguments into a structure to avoid modifying
everything next time we have to add an argument.
2002-12-17 18:42:54 +00:00
simonb 4ec8d15e0d Use the already-filled-in-but-not-used native syscall args in
linux_sys_mknod().
2002-12-17 11:48:02 +00:00
tron ad9b98744f Include "uvm/uvm_param.h" to get definition of PAGE_MASK required for
last change.
2002-12-17 10:42:02 +00:00
christos c0bc51eec5 Don't allow non-page-aligned offsets! So dumb. From Jason Ish, thanks. 2002-12-16 19:37:03 +00:00
manu b8a9df5e21 FIrst attempt at mach ports and rights, which are needed if we ever want
to implement messages between kernel and userland.
While we are there, cleanup some debug messages.
2002-12-15 00:40:24 +00:00
manu 530e1a6b60 Added thread_switch and some bits of Mach semaphores 2002-12-12 23:18:20 +00:00
manu 66a29c52af Added a few Mach traps: mach_boostrap_register, mach_port_set_attributes,
mach_port_move_member, mach_port_set_attributes, mach_task_set_special_port,
(none do anything)
Added mach_thread_create_running, which creates a new Mach thread. It
provides the register context of the new thread. We use it in a child
function provided to fork1(). The child function is machine dependent and
is not yet implemented for i386.

The new thread crashes quickly, but at least it starts.
2002-12-12 00:29:23 +00:00
manu 39e39a5b0f Added vm_inherit mach trap. 2002-12-11 21:23:37 +00:00
jdolecek 0c7b52a284 linux_sys_mknod(): if creating device file (i.e. !fifo case), mask
the passed device number to only contain lower 16 bits; older glibc
appears to pass some junk in upper bits sometimes, resulting in incorrect
device entries being created

Problem initially analyzed by Thor Lancelot Simon.
2002-12-11 19:30:39 +00:00
manu 8d921b897b Added a few traps: port_type, port_set_attributes, port_insert_member,
and vm_protect.

This makes Darwin's /usr/bin/telnet working
2002-12-10 21:36:45 +00:00
thorpej e8cc3884de Rename __LDPGSZ to AOUT_LDPGSZ, to accurately reflect what it is. 2002-12-10 17:14:02 +00:00
thorpej 78ea2dd367 Use __LDPGSZ (which must be == USRTEXT) as the text address for a.out
executables, and eliminate the USRTEXT constant, which was only used
by the a.out exec code.
2002-12-10 05:14:24 +00:00
manu 1e050715ea Stupid (but harmful) copy/paste mistake. 2002-12-09 22:28:16 +00:00
manu 9e08cf7d46 Remove debug printf (now ktrace does the job) 2002-12-09 21:53:28 +00:00
manu 6492e2171f Added support for dumping mach messages in ktrace/kdump. While we are
there, KNFify a few functions.
2002-12-09 21:29:20 +00:00
manu 4386631757 regen 2002-12-08 21:53:57 +00:00
manu 9f6565f2bd A working fork/vfork implementation. Darwin fork differs from our fork by
two ways:
- the child gets its pid as retval[0] (userland stub will turn it into a 0),
retval[1] is 1 and it is 0 in the parent.
- in the child, the fork syscall is successful, hence we must skip the next
instruction.
2002-12-08 21:53:10 +00:00
junyoung 81ed087074 - Rename struct linux_ctx to linux_fpctx.
- KNF.
2002-12-08 11:20:22 +00:00
manu 3bc2c4cf57 Now it uses BSD system calls with alternate path checks in compat/common,
Darwin does not need freebsd_file.c anymore.
2002-12-08 00:52:04 +00:00
manu daccb0339c regen 2002-12-08 00:51:24 +00:00
manu 3b0f6d78ed Introduce BSD system calls with alternate patch checking (in /emul) in
compat/common, so that they can be shared by several emulations, and use
them for Darwin.

This removes the ugly dependance on FreeBSD freebsd_file.c for COMPAT_DARWIN
2002-12-08 00:50:23 +00:00
manu cafe31204f Try to emulate port_type and bootstrap_look_up (I have no idea of what I am
doing with this one!)
2002-12-07 21:23:03 +00:00
manu db18a73b3d Added vm_wire (unused yet) 2002-12-07 19:06:33 +00:00
manu 74a1ce8272 regen 2002-12-07 19:05:30 +00:00
manu e03fbf9432 The fp_status fasttrap is called processor_facilities_used in userland, and
we discovered the flags it was to collect. Now we need to emulate them, but
it is another story.

load_msr seems only used from kernel code.
2002-12-07 19:05:11 +00:00
manu bb8dabd15a regen 2002-12-07 15:33:36 +00:00
manu 9b84721494 Added implementation for cthread_self() and cthread_set_self(). Theses are
used to get and set the thread user value, which is an opaque pointer to
a per thread structure stored in userland. cthread_self() is used by Darwin
as an implementation for pthread_self(), which return the thread id.

We use the p_emuldata field of struct proc in order to keep track of the
thread user value. For now the value is per-process, but we will make it
per-thread when we will take care of threading.

While we are there, do some KNF
2002-12-07 15:33:01 +00:00
scw dc63c50793 After a discussion with various folks, fix the strict-alias warning
by ditching 'void *rt' and passing retval directly to sys_mmap().
2002-12-06 12:00:57 +00:00
tron 96ece1f13e Fix namespace collision caused by recent change to "linux_machdep.h". 2002-12-06 10:51:27 +00:00
scw f88b19a600 Avoid strict-alias warnings. 2002-12-06 09:57:58 +00:00
junyoung 9104ddf809 Fix compile error. 2002-12-06 03:37:19 +00:00
christos ef042d8e23 add a linux_rt_sigframe to support SA_SIGINFO, and use it when SA_SIGINFO
is requested. This appears to be how linuxthreads decides which signal handler
to use.
2002-12-06 00:02:59 +00:00
manu f0332ec923 In load_shared_file, do zero-fill uninitialized data segments that
explicitely request to be zero filled.
2002-12-05 22:48:53 +00:00
manu 56b9df9869 Improved mach_vm_map emulation: take into account proection, alignement,
and improve debug messages.
2002-12-04 22:55:11 +00:00
agc 35a5ff86d4 Make this compile in the presence of -Werror 2002-12-01 11:02:11 +00:00
jdolecek e1e0ff678b move ELF-specific items from irix_exec.c to irix_exec_elf32.c
merge the two emul_irix structures; the only difference was
  setregs function, which can be handled by exec-specific setregs hook
rename setregs_n32() to irix_n32_setregs(), and make it suitable
  as the exec-specific setregs hook
make irix_check_exec() a macro now that just single compare
2002-11-30 13:18:13 +00:00
jdolecek 6826135dbc make LKM friendlier by only including opt_* #ifdef _KERNEL_OPT 2002-11-30 12:28:26 +00:00
jdolecek c9710a72e0 Get the dynamic interpreter location using emul_find_interp(), so that
it checks both the alternative/emul tree, and the non-emul tree.
This makes it possible to run chrooted emulated binaries without need
to setup shadow /emul tree within the chroot hierarchy.

XXX sligh code rearrangement was necessary, change not tested
2002-11-29 19:40:14 +00:00
jdolecek da2945cc37 add comment why this doesn't need to use emul_find_interp() 2002-11-29 19:35:25 +00:00
jdolecek 1bf46cc0f0 use emul_find_interp(), rathern than calling emul_find() second time
with prefix set to "/"
XXX not tested
2002-11-29 19:15:15 +00:00
jdolecek 47cd9b85d6 Get the dynamic interpreter location using emul_find_interp(), so that
it checks both the alternative/emul tree, and the non-emul tree.
This makes it possible to run chrooted emulated binaries without need
to setup shadow /emul tree within the chroot hierarchy.
Only tested for COMPAT_LINUX, changes to other compat modules were
mechanical.
Fixes kern/19161 by Christian Groessler.
2002-11-29 19:13:14 +00:00
manu ae748e840c Implement timebase_info. We don't know exactly what it should do yet... 2002-11-29 17:08:16 +00:00
jdolecek 302af6f02e add emul_find_interp() function: the function looks for interpreter
in alternative emul tree first, and updates interpreter pathname
if found there; if not found in alternative emul tree, pathname
without the emul prefix is checked, and error returned if the file
doesn't exist
2002-11-29 17:08:06 +00:00
jdolecek b99fe89374 de-__P() 2002-11-29 16:32:50 +00:00
fvdl 6df30bca4f Patch that actually works for previous, from Jaromir Dolecek. 2002-11-29 14:32:27 +00:00
manu f47b85037b Added a few kern sysctl which are the same on Darwin and NetBSD. 2002-11-29 13:18:09 +00:00
manu 65adabf7aa Filter the flag bits we get from Darwin's sigaction when giving them to
our native sigaction beacause unknown bits cause sigaction to fail with EINVAL.
2002-11-29 13:17:22 +00:00
itojun 02185dab0f setsockopt(IPPROTO_IPV6, IPV6_V6ONLY, 0) for AF_INET6 sockets,
to meet with the default behavior of linux.
review: fvdl/christos
XXX interactions with net.inet6.ip6.v6only?
2002-11-29 01:34:55 +00:00
itojun e2a7bfda88 minor KNF (indent) 2002-11-28 23:46:15 +00:00
manu de5d0b9706 Remove __P 2002-11-28 21:23:54 +00:00
manu 0f239dc026 Check for alternate receive buffer for mach_msg_overwrite_trap
Check for target buffer length, and fail if it is too short
Move mach_msg_trap and mach_msg_overwrite_trap to their own file
Remove some useless debug messages now we have ktrace
Remove __P()
2002-11-28 21:21:32 +00:00
jdolecek b3b1ed9f7d back previous off, it makes the probe function mistaken some linux
binaries as freebsd
problem reported in thread 'installing suse_base on current
i386 sets time to 1970' on current-users
2002-11-28 15:08:36 +00:00
atatat 7caa308c63 Complete the rename: s/sa_/<compat>_sa_/g
Also tweak the darwin siginfo stuff to avoid the same type of collision.
2002-11-27 16:44:01 +00:00
tron 7ef75ab314 Fix namespace clash caused by addition of sigaction(2). 2002-11-27 14:36:12 +00:00
manu dfa96ff4b3 Add signal delivery for the PowerPC. Everything is implemented except siginfo.
The stack layout is observed from stack dumps on Darwin, so it should be
very accurate.
2002-11-26 23:54:09 +00:00
lukem 0635de35a3 Remove KDIR=, since SYS_INCLUDE=symlinks and KDIR are not supported any more. 2002-11-26 23:30:07 +00:00
christos 116bcb05d0 rename: s/sa_/<compat>sa/g 2002-11-26 18:43:20 +00:00
christos daa59d8957 rename sa_ -> linux_sa_
first attempt at providing siginfo_t to the signal handler.
2002-11-26 18:42:38 +00:00
manu 6ce9cf3a84 regen 2002-11-26 08:10:58 +00:00
manu 11aa9ca2f6 Add thread_policy and clock_get_time mach traps. Implement
mach_sys_clock_sleep_trap. This makes sleep(3) emulation working.
2002-11-26 08:10:14 +00:00
manu bd9d3fb902 There are functions to convert between sigaction and sigaction13. Use them. 2002-11-26 00:05:41 +00:00
manu 29a7621173 regen 2002-11-25 22:26:21 +00:00
manu 53356d6169 Added an empty shell for signal delivery. Now we just have to fill the
machine dependant bits.
2002-11-25 22:25:12 +00:00
schmonz aee43321d1 Report ourselves as Linux 2.4.18 on powerpc, too. 2002-11-25 10:34:34 +00:00
thorpej d32a923263 Avoid strict-alias warnings. 2002-11-25 02:31:14 +00:00
thorpej c8f5c657b5 Add ULL to a 64-bit integer constant. 2002-11-25 02:11:23 +00:00
manu 5bdd9578e4 Better vm_allocate emulation. 2002-11-24 17:22:59 +00:00
manu 1aaacd96d2 Give a second chance when vm_allocate fail, by finding another free region.
Seems to fix some problems.
2002-11-24 11:49:36 +00:00
wiz ad774d9d77 Fix stack alignment; uses same alignment as COMPAT_LINUX.
Found by manu.
2002-11-23 17:35:06 +00:00
manu 1ee1245718 Add support for two Darwin sysctl 2002-11-23 02:18:53 +00:00
manu af59b63bbd We now have the exact stack initial stack layout of Darwin:
macho_hdr, argc, *argv, NULL, *envp, NULL, progname, NULL,
*progname, **argv, **envp

Where progname is a pointer to the program name as given in the first
argument to execve(), and macho_hdr a pointer to the Mach-O header at
the beginning of the executable file.
2002-11-21 19:53:40 +00:00
jdolecek 2ca4879bd1 g/c also mips-specific linux ELF copyargs function prototype and
linux ELF defines, use generic Aux32Info instead
this also adresses kern/19047 by FUKAUMI Naoki
2002-11-21 15:32:32 +00:00
jdolecek 0a624a0c15 back previous off; port can only supply LINUX_ELF_AUX_ENTRIES if it also
overrides the ELF copyargs function
2002-11-21 15:20:28 +00:00
jdolecek 3590104898 g/c local definition of LINUX_ELF_AUX_ENTRIES 2002-11-21 15:18:37 +00:00
manu 1af0fa979f Better immitate Darwin startup stack layout: there is a slot for the program
name after envp, and the 0x1000 at the beginning is a pointer to the binary
mach header (we don't emulate this correctly yet).
2002-11-20 23:54:39 +00:00
manu a0d341067e Added host_info(PRIORITY_INFO) 2002-11-20 07:17:11 +00:00
christos 733d2a038f Make the OSABI and the branding optional. Tested by Ben Collver, thanks. 2002-11-19 22:38:07 +00:00
christos 63e4ec4bd7 implement mach_insert_port_right() 2002-11-19 19:54:07 +00:00
christos 645fa8d600 remove stack adjustment. 2002-11-19 16:29:32 +00:00
christos 8012fc6cf2 use mach_integer_t instead of just int. 2002-11-19 16:18:43 +00:00
manu fe8f53c2a4 in mach_sys_map_fd, if the mapping failed because of the requested place
is already used, we want to remap to another place. The vmcmd must be
completely rebuild, else things does not work as expected, as the vmcmd has
been modified by the first mapping attempt.
2002-11-17 18:39:48 +00:00
manu 55c5227095 Add vm_map and vnode locking 2002-11-17 16:51:12 +00:00
manu 08616982e5 regen 2002-11-17 02:48:12 +00:00
manu 9215e8d4ed regen 2002-11-17 02:48:11 +00:00
manu 7d02c9fff8 Implement mach_sys_load_shared_file. This are not complete yet, especially
wrt to the flags, but at least it does relocations.
2002-11-17 02:46:24 +00:00
manu a26a564e59 Implment map_fd mach trap
Fix host_info(BASIC_INFO) which was broken wrt to the number of field
returned.
2002-11-16 20:00:29 +00:00
manu 745fc5c9a0 Change a syscal name 2002-11-16 19:59:19 +00:00
uebayasi c041971257 Fix compilation errors introduced by recent trace_enter()/ktrsyscall() changes.
Provided by FUKAUMI Naoki <naoki at fukaumi dot org> in kern/19070.
2002-11-16 07:40:38 +00:00
wdk b0fb4471b2 Fix LINUX_ELF_AUX_ENTRIES sociability issue with Mips based ports 2002-11-15 22:44:57 +00:00
christos 7ae22e4da5 it is not kosher to include the same file twice. 2002-11-15 16:10:51 +00:00
manu ffc06908b6 Regen 2002-11-14 21:48:23 +00:00
manu 897d942130 Use FreeBSD emulation to get pathname lookups in /emul/darwin. These FreeBSD
emulated system call just check in /emul and call the native system call.
2002-11-14 21:47:15 +00:00
christos 09495207e1 darwin needs us. 2002-11-14 21:38:51 +00:00
christos b165b2e229 improve on debugging. 2002-11-14 21:17:30 +00:00
christos f9ddf42b17 the host basic info belongs with the cpu.
attempt to make the semaphore traps work, by doing nothing.
2002-11-14 19:44:06 +00:00
jdolecek 6788e239e4 we now export information about CLK_TCK via ELF aux args, no need to
hardcode '100' for times(2) anymore; use 'hz' instead
2002-11-13 15:20:04 +00:00
jdolecek cee43b67cc add generic linux compat ELF copyargs function
this gives:
* linux sysconf(_SC_CLK_TCK) gives correct value for linux binaries (hz)
  even if hz != 100
* glibc gets proper information on real/effective uid and enables
  secure mode for suid binaries

g/c LINUX_COPYARGS_FUNCTION, replaced by linux ELF copyargs function
g/c alpha-specific linux ELF copyargs function and linux ELF defines
2002-11-13 15:16:27 +00:00
jdolecek 9def367548 need to use Aux32Info explicitly, not AuxInfo alone, to work
within context of kern/exec_conf.c
2002-11-13 14:35:15 +00:00