diff options
author | Flavio Cruz <flaviocruz@gmail.com> | 2023-01-11 23:23:24 -0500 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2023-01-13 00:59:16 +0100 |
commit | 566c227636481b246d928772ebeaacbc7c37145b (patch) | |
tree | 5438a78f92517b7b3882f328ba6cf4fca2c1215c | |
parent | 92fad38a043b75ed6b435b3efa574ede91dbe9ee (diff) | |
download | gnumach-566c227636481b246d928772ebeaacbc7c37145b.tar.gz gnumach-566c227636481b246d928772ebeaacbc7c37145b.tar.bz2 gnumach-566c227636481b246d928772ebeaacbc7c37145b.zip |
Create kern/mach4.h and kern/mach_host.h and define the RPC prototypes for mach4.defs and mach_host.defs.
Also move more mach_debug rpcs to kern/mach_debug.h.
Message-Id: <Y7+LPMLOafUQrNHZ@jupiter.tail36e24.ts.net>
-rw-r--r-- | Makefrag.am | 2 | ||||
-rw-r--r-- | ipc/mach_debug.c | 1 | ||||
-rw-r--r-- | kern/host.c | 1 | ||||
-rw-r--r-- | kern/ipc_host.c | 2 | ||||
-rw-r--r-- | kern/ipc_mig.h | 9 | ||||
-rw-r--r-- | kern/ipc_tt.c | 1 | ||||
-rw-r--r-- | kern/mach4.h | 66 | ||||
-rw-r--r-- | kern/mach_debug.h | 73 | ||||
-rw-r--r-- | kern/mach_host.h | 86 | ||||
-rw-r--r-- | kern/machine.c | 1 | ||||
-rw-r--r-- | kern/pc_sample.c | 1 | ||||
-rw-r--r-- | kern/thread.c | 2 | ||||
-rw-r--r-- | vm/vm_debug.c | 1 |
13 files changed, 246 insertions, 0 deletions
diff --git a/Makefrag.am b/Makefrag.am index 8a82caee..cb5651a2 100644 --- a/Makefrag.am +++ b/Makefrag.am @@ -173,6 +173,8 @@ libkernel_a_SOURCES += \ kern/mach_debug.h \ kern/mach_factor.c \ kern/mach_factor.h \ + kern/mach_host.h \ + kern/mach4.h \ kern/machine.c \ kern/machine.h \ kern/macros.h \ diff --git a/ipc/mach_debug.c b/ipc/mach_debug.c index ecbfca47..57c3133a 100644 --- a/ipc/mach_debug.c +++ b/ipc/mach_debug.c @@ -41,6 +41,7 @@ #include <mach/vm_param.h> #include <mach_debug/hash_info.h> #include <kern/host.h> +#include <kern/mach_debug.h> #include <vm/vm_map.h> #include <vm/vm_kern.h> #include <ipc/ipc_space.h> diff --git a/kern/host.c b/kern/host.c index 3271b0cd..4490a8e1 100644 --- a/kern/host.c +++ b/kern/host.c @@ -42,6 +42,7 @@ #include <kern/processor.h> #include <kern/ipc_host.h> #include <kern/mach_clock.h> +#include <kern/mach_host.h> #include <mach/vm_param.h> host_data_t realhost; diff --git a/kern/ipc_host.c b/kern/ipc_host.c index 6163beff..0f35689a 100644 --- a/kern/ipc_host.c +++ b/kern/ipc_host.c @@ -35,6 +35,7 @@ #include <mach/message.h> #include <kern/debug.h> #include <kern/host.h> +#include <kern/mach_host.h> #include <kern/processor.h> #include <kern/task.h> #include <kern/thread.h> @@ -42,6 +43,7 @@ #include <kern/ipc_kobject.h> #include <ipc/ipc_port.h> #include <ipc/ipc_space.h> +#include <mach/mach_traps.h> #include <machine/machspl.h> /* for spl */ diff --git a/kern/ipc_mig.h b/kern/ipc_mig.h index 469f629c..e3ad6deb 100644 --- a/kern/ipc_mig.h +++ b/kern/ipc_mig.h @@ -139,4 +139,13 @@ io_return_t syscall_device_writev_request( io_buf_vec_t *iovec, vm_size_t iocount); +mach_port_name_t mig_get_reply_port(void); + +void mig_dealloc_reply_port(mach_port_t reply_port); + +void mig_put_reply_port(mach_port_t reply_port); + +vm_size_t +mig_strncpy(char *dest, const char *src, int len); + #endif /* _IPC_MIG_H_ */ diff --git a/kern/ipc_tt.c b/kern/ipc_tt.c index d2a22f9f..63f6e77a 100644 --- a/kern/ipc_tt.c +++ b/kern/ipc_tt.c @@ -32,6 +32,7 @@ #include <mach/boolean.h> #include <mach/kern_return.h> #include <mach/mach_param.h> +#include <mach/mach_traps.h> #include <mach/task_special_ports.h> #include <mach/thread_special_ports.h> #include <vm/vm_kern.h> diff --git a/kern/mach4.h b/kern/mach4.h new file mode 100644 index 00000000..bff5d187 --- /dev/null +++ b/kern/mach4.h @@ -0,0 +1,66 @@ +/* + * Copyright (C) 2023 Free Software Foundation, Inc. + * + * This file is part of GNU Mach. + * + * GNU Mach is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2, or (at your option) any later + * version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef _KERN_MACH4_H +#define _KERN_MACH4_H + +#include <kern/thread.h> + +/* RPCs */ + +kern_return_t +thread_enable_pc_sampling( + thread_t thread, + int *tickp, + sampled_pc_flavor_t flavors); + +kern_return_t +thread_disable_pc_sampling( + thread_t thread, + int *samplecntp); + +kern_return_t +task_enable_pc_sampling( + task_t task, + int *tickp, + sampled_pc_flavor_t flavors); + +kern_return_t +task_disable_pc_sampling( + task_t task, + int *samplecntp); + +kern_return_t +thread_get_sampled_pcs( + thread_t thread, + sampled_pc_seqno_t *seqnop, + sampled_pc_array_t sampled_pcs_out, + int *sampled_pcs_cntp); + +kern_return_t +task_get_sampled_pcs( + task_t task, + sampled_pc_seqno_t *seqnop, + sampled_pc_array_t sampled_pcs_out, + int *sampled_pcs_cntp); + +/* End of RPCs */ + +#endif /* _KERN_MACH4_H */ diff --git a/kern/mach_debug.h b/kern/mach_debug.h index 63b8ae96..3d49b321 100644 --- a/kern/mach_debug.h +++ b/kern/mach_debug.h @@ -35,6 +35,79 @@ kern_return_t host_load_symbol_table( unsigned int symbtab_count); #endif /* defined(MACH_KDB) && defined(MACH_DEBUG) */ +kern_return_t +mach_port_get_srights( + ipc_space_t space, + mach_port_name_t name, + mach_port_rights_t *srightsp); + +kern_return_t +mach_port_dnrequest_info( + ipc_space_t space, + mach_port_name_t name, + unsigned int *totalp, + unsigned int *usedp); + +kern_return_t +mach_port_kernel_object( + ipc_space_t space, + mach_port_name_t name, + unsigned int *typep, + vm_offset_t *addrp); + +kern_return_t +host_ipc_marequest_info( + host_t host, + unsigned int *maxp, + hash_info_bucket_array_t *infop, + unsigned int *countp); + +#if MACH_DEBUG +kern_return_t host_slab_info(host_t host, cache_info_array_t *infop, + unsigned int *infoCntp); +#endif /* MACH_DEBUG */ + +kern_return_t processor_set_stack_usage( + processor_set_t pset, + unsigned int *totalp, + vm_size_t *spacep, + vm_size_t *residentp, + vm_size_t *maxusagep, + vm_offset_t *maxstackp); + +kern_return_t host_stack_usage( + host_t host, + vm_size_t *reservedp, + unsigned int *totalp, + vm_size_t *spacep, + vm_size_t *residentp, + vm_size_t *maxusagep, + vm_offset_t *maxstackp); + +kern_return_t +mach_vm_region_info( + vm_map_t map, + vm_offset_t address, + vm_region_info_t *regionp, + ipc_port_t *portp); + +kern_return_t +mach_vm_object_info( + vm_object_t object, + vm_object_info_t *infop, + ipc_port_t *shadowp, + ipc_port_t *copyp); + +kern_return_t +mach_vm_object_pages( + vm_object_t object, + vm_page_info_array_t *pagesp, + natural_t *countp); + +kern_return_t +host_virtual_physical_table_info(const host_t host, + hash_info_bucket_array_t *infop, natural_t *countp); + /* End of RPCs */ #endif /* _KERN_MACH_DEBUG_H */ diff --git a/kern/mach_host.h b/kern/mach_host.h new file mode 100644 index 00000000..de644494 --- /dev/null +++ b/kern/mach_host.h @@ -0,0 +1,86 @@ +/* + * Copyright (C) 2023 Free Software Foundation, Inc. + * + * This file is part of GNU Mach. + * + * GNU Mach is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2, or (at your option) any later + * version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef _KERN_MACH_HOST_H +#define _KERN_MACH_HOST_H + +#include <kern/processor.h> +#include <kern/host.h> +#include <mach/host_info.h> + +/* RPCs */ + +kern_return_t host_processors( + const host_t host, + processor_array_t *processor_list, + natural_t *countp); + +kern_return_t host_info( + const host_t host, + int flavor, + host_info_t info, + natural_t *count); + +kern_return_t host_kernel_version( + const host_t host, + kernel_version_t out_version); + +kern_return_t +host_processor_sets( + const host_t host, + processor_set_name_array_t *pset_list, + natural_t *count); + +kern_return_t +host_processor_set_priv( + const host_t host, + processor_set_t pset_name, + processor_set_t *pset); + +kern_return_t +processor_set_default( + const host_t host, + processor_set_t *pset); + +kern_return_t +host_reboot(const host_t host, int options); + +kern_return_t +host_get_boot_info( + host_t priv_host, + kernel_boot_info_t boot_info); + +kern_return_t task_get_assignment( + task_t task, + processor_set_t *pset); + +kern_return_t +thread_wire( + host_t host, + thread_t thread, + boolean_t wired); + +kern_return_t thread_get_assignment( + thread_t thread, + processor_set_t *pset); + +/* End of RPCs */ + +#endif /* _KERN_MACH_HOST_H */ diff --git a/kern/machine.c b/kern/machine.c index fdf59ce7..cf8060d7 100644 --- a/kern/machine.c +++ b/kern/machine.c @@ -45,6 +45,7 @@ #include <kern/ipc_host.h> #include <kern/host.h> #include <kern/machine.h> +#include <kern/mach_host.h> #include <kern/lock.h> #include <kern/processor.h> #include <kern/queue.h> diff --git a/kern/pc_sample.c b/kern/pc_sample.c index 6c891fe1..280d8b54 100644 --- a/kern/pc_sample.c +++ b/kern/pc_sample.c @@ -35,6 +35,7 @@ #include <kern/host.h> #include <kern/thread.h> #include <kern/pc_sample.h> +#include <kern/mach4.h> #include <kern/mach_clock.h> #if MACH_PCSAMPLE diff --git a/kern/thread.c b/kern/thread.c index c420869f..06825bff 100644 --- a/kern/thread.c +++ b/kern/thread.c @@ -45,6 +45,8 @@ #include <kern/eventcount.h> #include <kern/ipc_mig.h> #include <kern/ipc_tt.h> +#include <kern/mach_debug.h> +#include <kern/mach_host.h> #include <kern/processor.h> #include <kern/queue.h> #include <kern/sched.h> diff --git a/vm/vm_debug.c b/vm/vm_debug.c index c76e63b7..526bb163 100644 --- a/vm/vm_debug.c +++ b/vm/vm_debug.c @@ -46,6 +46,7 @@ #include <vm/vm_map.h> #include <vm/vm_kern.h> #include <vm/vm_object.h> +#include <kern/mach_debug.h> #include <kern/task.h> #include <kern/host.h> #include <kern/printf.h> |