Commit Graph

59 Commits

Author SHA1 Message Date
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
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
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
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 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
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
manu ae748e840c Implement timebase_info. We don't know exactly what it should do yet... 2002-11-29 17:08:16 +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
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 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
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
manu a0d341067e Added host_info(PRIORITY_INFO) 2002-11-20 07:17:11 +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 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
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
manu 114cae0e54 Fix the stack layout on program startup. This should be:
(8 bytes boundary) PAGE_SIZE   argc    argv  .... envp
2002-11-12 19:01:18 +00:00
manu f130f7a839 In mach_reply_port, don't increment the returned port for now, this confuses
the binary on the second launch.
In mach_vm_map, hack in a failure so that we fail exactly like Darwin when
mapping a page at address 0
Add vm_allocate trap
2002-11-12 06:14:39 +00:00
manu 3eb20e3576 mach_ports_lookup allocate one page of memory and returns its address.
On error, most traps return a short packet with just an error code, emulate
this correctly.
2002-11-12 05:18:31 +00:00
manu d56caea9ae - Cleanup msg bits and trailer values
- a few dumb bug fixes
2002-11-11 09:28:00 +00:00
manu 293d243256 Introduce a better error reporting, using mach error codes
It seems there is no need to use dynamic allocation in mach_host_info.
2002-11-11 01:18:44 +00:00
manu 38455f4db0 The message id of replies is simply the message id of the request plus 100... 2002-11-10 22:05:35 +00:00
manu 556831bae9 More mach traps:
mach_port_deallocate, task_get_special_port, mach_ports_lookup,
vm_deallocate, vm_map, host_get_clock_service.
2002-11-10 21:53:40 +00:00
manu e9adbe1e47 Added mach_sys_msg_trap system call, and the host_page_size trap. 2002-11-10 09:41:45 +00:00
manu 4855282dc6 Implment one command of the host_info mach trap, which check for mach_msg_trap
availability
2002-11-10 02:18:03 +00:00
manu 873ed6f9ee Added support for Darwin's PowerPC-only system calls:
ppccalls, with system call numbers starting at 0x6000
fasttraps, with system call numbers starting at 0x7FF0

Because the Mach system call dispatching code has grown a bit
too much, introduce an inline function to handle it (mach_syscall_dispatch).

While we are there, remove the Mach and Linux includes from
arch/powerpc/powerpc/syscall.c and push them into
arch/powerpc/powerpc/{mach|linux}_syscall.c
2002-11-03 23:17:18 +00:00
jdolecek 81d274c850 make compile without DEBUG_MACH 2002-11-01 20:04:40 +00:00
jdolecek 1524c4bf08 set struct emul's nsysent to compat SYS_NSYSENT, not SYS_MAXSYSCALL 2002-11-01 19:26:21 +00:00
christos 1e48015df9 more debugging for the overwrite trap. 2002-10-30 15:04:17 +00:00
manu e5620d742d KNF 2002-10-27 22:22:04 +00:00
manu 998f955471 Inaccurate comment fixed: This is not about SVR4, it's Mach 2002-10-27 21:41:51 +00:00