summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2023-01-25Set kr if copy cannot be copied to user spaceFlavio Cruz
Compiler will complain otherwise that kr is not initialized. Message-Id: <Y89oVcEnyPIiQ4ef@jupiter.tail36e24.ts.net>
2023-01-25dev_pager.c: use mach_msg_type_number_tFlavio Cruz
Otherwise it will fail to compile due to conflicting types. Message-Id: <Y89jA/6y4BgKW2Jb@jupiter.tail36e24.ts.net>
2023-01-24Use -O2 -g by default when compilingFlavio Cruz
After d5e5dd3401ea0d0475aa830c2171be5b8a72f4fa we can configure and make gnumach without glibc, however it no longer used -O2 -g in CFLAGS by default. This reverts that behavior. Message-Id: <Y8yihABKwOjqi4y3@jupiter.tail36e24.ts.net>
2023-01-24ddb: Add prototype for remote_db_enterSamuel Thibault
It will be useful for smp support.
2023-01-24Fix several warnings for -Wmissing-prototypesFlavio Cruz
* device/ds_routines.c: use static qualifier. * device/subrs.c: delete unused functions. * i386/i386/ast_check.c: include prototypes in kern/ast.h * i386/i386/db_disasm.c: Include prototypes in ddb/db_examine.h * i386/i386/db_interface.h: Define prototype for kdb_kentry. Expose debug methods feep and kd_debug_put. * i386/i386/db_trace.c: delete left over cthreads support, functions are not used. * i386/i386/model_dep.h: Define prototype for c_boot_entry. * i386/i386at/acpi_parse_apic.c: Static qualifiers. * i386/i386at/autoconf.c: Include header file for prototypes and remove dead code. * i386/i386at/autoconf.h: Fix prototype. * i386/i386at/com.c: Add static qualifiers, delete dead code. * i386/i386at/com.c: ditto. * i386/i386at/com.h: Define prototypes for debug functions. * i386/i386at/int_init.c: Include header. * i386/i386at/kd.c: Include header for debug interface. Remove dead kd_cmdreg_read and make xga_getpos static. * i386/i386at/kd_mouse.c: Static qualifiers. * i386/i386at/lpr.c: Dead lprpr. * i386/i386at/model_dep.c: Remove exit function. * kern/mach_clock.c: Include mig prototypes. * kern/mach_clock.h: Remove duplicates of mig prototypes. * kern/machine.c: Use static. * kern/startup.c: slave_main is unused. * kern/thread.h: Define thread_stats that is useful for debugging. * kern/timer.c: Keep db_thread_times since it can be used for debugging. * kern/timer.h: ditto. * linux/dev/glue/misc.c: Use mig header for host_get_time. Message-Id: <Y8oyiecaflCaYhaW@mercury.tail36e24.ts.net>
2023-01-19Remove existing old style definitions and use -Wold-style-definition.Flavio Cruz
Message-Id: <Y8mYd/pt/og4Tj5I@mercury.tail36e24.ts.net>
2023-01-19Include mig generated device headers to avoid missing prototypesFlavio Cruz
Some of the existing definitions lacked the const qualifier, which was added. Message-Id: <Y8mYZEKqWN43n2SA@mercury.tail36e24.ts.net>
2023-01-19Rename msg_is_misaligned and msg_alignSamuel Thibault
message.h is installed so we need to hide these behind a mach_ prefix
2023-01-19Add host_get_time64 RPC to return the time as time_value64_tFlavio Cruz
Also updated the mapped time to support the new 64-bit time while keeping compatible with the user land programs currently using it so they can be migrated in parallel.
2023-01-19Fix i386 PAE bootSamuel Thibault
2023-01-19Include mig generated headers to avoid warnings with -Wmissing-prototypes.Flavio Cruz
This also reverts 566c227636481b246d928772ebeaacbc7c37145b and 963b1794d7117064cee8ab5638b329db51dad854 Message-Id: <Y8d75KSqNL4FFInm@mercury.tail36e24.ts.net>
2023-01-18replace mach_port_t with mach_port_name_tLuca Dariz
This is a cleanup following the introduction of mach_port_name_t. The same set of changes is applied to all files: - rename mach_port_t to mach_port_name_t where a port name is used, - use MACH_PORT_NAME_NULL and MACH_PORT_NAME_DEAD where appropriate, - use invalid_port_to_name() and invalid_name_to_port() for conversion where appropriate, - use regular copyout() insted of copyout_port() when we deal with mach_port_name_t already before copyout, - use the new helper ipc_kmsg_copyout_object_to_port() when we really want to place a port name in the space of a mach_port_t. * include/mach/notify.h: Likewise * ipc/ipc_entry.c: Likewise * ipc/ipc_kmsg.c: Likewise * ipc/ipc_kmsg.h: Likewise, and add ipc_kmsg_copyout_object_to_port() * ipc/ipc_marequest.c: Likewise * ipc/ipc_object.c: Likewise * ipc/ipc_port.c: Likewise * ipc/ipc_space.h: Likewise * ipc/mach_msg.c: Likewise * ipc/mach_port.c: Likewise * kern/exception.c: Likewise * kern/ipc_mig.c: Likewise Message-Id: <20230116105857.240210-8-luca@orpolo.org>
2023-01-18add conversion helpers for invalid mach port namesLuca Dariz
* include/mach/port.h: add _NAME_ variants for port NULL and DEAD and add helpers to check for invalid port names * ipc/port.h: add helpers to properly convert to/from invalid mach port names. Message-Id: <20230116105857.240210-7-luca@orpolo.org>
2023-01-18adjust rdxtree key to the correct sizeLuca Dariz
* Makefile.am: define RDXTREE_KEY_32 Message-Id: <20230116105857.240210-6-luca@orpolo.org>
2023-01-18update writev syscall signature with rpc typesLuca Dariz
* device/device_emul.h: write/writev: update trap argument types * device/ds_routines.c: update argument types and adjust copyin * device/ds_routines.h: write/writev: update trap argument type * include/device/device_types.h: add rpc_io_buf_vec_t type * kern/ipc_mig.c: write/writev: update trap argument type * kern/ipc_mig.h: Likewise Message-Id: <20230116105857.240210-5-luca@orpolo.org>
2023-01-18update syscall signature with rpc_vm_* and mach_port_name_tLuca Dariz
* include/mach/mach_types.h: use mach port names * kern/ipc_mig.c: update vm types and use copyin/copyout helpers * kern/ipc_mig.h: Likewise Signed-off-by: Luca Dariz <luca@orpolo.org> Message-Id: <20230116105857.240210-4-luca@orpolo.org>
2023-01-18x86_64: expand and shrink messages in copy{in, out}msg routinesLuca Dariz
* i386/i386/copy_user.h: new file to handle 32/64 bit differences - add msg_usize() to recontruct the user-space message size - add copyin/copyout helpers for addresses and ports * include/mach/message.h: add msg alignment macros * ipc/ipc_kmsg.c: - copyin/out ports names instead of using pointer magic * ipc/ipc_mqueue.c: use msg_usize() to check if we can actually receive the message * ipc/mach_msg.c: Likewise for continuations in receive path * x86_64/Makefrag.am: add x86_64/copy_user.c * x86_64/copy_user.c: new file to handle message expansion and shrinking during copyinmsg/copyoutmsg for 64 bit kernels. - port names -> port pointers on all 64-bit builds - 32-bit pointer -> 64 bit pointer when using 32-bit userspace * x86_64/locore.S: remove copyinmsg() and copyoutmsg() Message-Id: <20230116105857.240210-3-luca@orpolo.org>
2023-01-18add msg_user_header_t for user-side msg structureLuca Dariz
* include/mach/message.h: use mach_msg_user_header_t only in KERNEL, and define it as mach_msh_header_t for user space * ipc/ipc_kmsg.c: use mach_msg_user_header_t where appropriate * ipc/ipc_kmsg.h: Likewise * ipc/mach_msg.c: Likewise * ipc/mach_msg.h: Likewise * kern/thread.h: Likewise Message-Id: <20230116105857.240210-2-luca@orpolo.org>
2023-01-18Add static qualifiersFlavio Cruz
stack_statistics, swapin_thread_continue, and memory_object_lock_page are not used outside their module.
2023-01-18Delete x86 string functionsFlavio Cruz
The i386 functions are not used and the more portable versions in kern/strings.c are faster (1-4x faster in synthetic benchmarks compiled with -O2 on my x86_64 box). Message-Id: <Y8Yt9FvIagB78uyR@jupiter.tail36e24.ts.net>
2023-01-18Delete util/putchar.{c,h} and util/puts.cFlavio Cruz
Those functions are unused. Message-Id: <Y8YtmejHMnhI9CLG@jupiter.tail36e24.ts.net>
2023-01-16fix warningsLuca Dariz
* ipc/ipc_kmsg.c: drop useless cast. * ipc/ipc_port.c: upcast rpc_vm_offset_t to full vm_offset_t * kern/pc_sample.c: Likewise Message-Id: <20230116130426.246584-4-luca@orpolo.org>
2023-01-16remove unused file ipc/mach_rpc.cLuca Dariz
* Makefrag.am: remove ipc/mach_rpc.c * ipc/mach_rpc.c: remove file, all functions here seem unused. Message-Id: <20230116130426.246584-3-luca@orpolo.org>
2023-01-16add required includeLuca Dariz
* kern/syscall_sw.h: add missing include Signed-off-by: Luca Dariz <luca@orpolo.org> Message-Id: <20230116130426.246584-2-luca@orpolo.org>
2023-01-16add missing argument namesLuca Dariz
* ddb/db_break.c: add argument name, compilation fails on Debian/Linux stable with gcc 10.2 otherwise. For some reason on Debian/Hurd a simple test program without argname succeeds, unless I force -std=c11 or similar; I suppose because newer gcc have different defaults. Gnumach seem to still require c89 for some older code, otherwise we could explicitely use gnu99/c99 or gnu11/c11. * ddb/db_cond.c: Likewise * ddb/db_examine.c: Likewise * ddb/db_macro.c: Likewise * ddb/db_watch.c: Likewise * device/dev_name.c: Likewise Message-Id: <20230116130426.246584-1-luca@orpolo.org>
2023-01-15Delete ffs and strrchr prototypes.Flavio Cruz
We use __builtin_ffs instead of ffs. strrchr is not used. Also removed the commented out memset implementation since it is implemented in arch-specific code. Message-Id: <Y8NOXbVzhBJknR29@mercury.tail36e24.ts.net>
2023-01-13Fix build for smpEtienne Brateau
ad51c68171cb6a1cae15c61ca0218bbee2c05485 missed one replacement which was not discovered because it’s only when building with smp enabled. Message-Id: <20230113144732.49786-1-etienne.brateau@gmail.com>
2023-01-13Create kern/mach4.h and kern/mach_host.h and define the RPC prototypes for ↵Flavio Cruz
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>
2023-01-13Use rpc_uintptr_t for protected payloads.Flavio Cruz
Not only is uintptr_t more accurate for what protected payloads are but we also provide compatibility for 64 + 32 bits. Also the use of natural_t in the RPC definition is wrong since it is always 32 bits. Message-Id: <Y7+LHVbmYxO/cSKs@jupiter.tail36e24.ts.net>
2023-01-10Preemptively fix warnings that will be caused by -Wmissing-prototypesFlavio Cruz
Declared RPCs in ipc/mach_port.c and ddb/db_ext_symtab.c in their corresponding headers. Ideally these should be used by mig instead of mig declaring its own prototypes. Message-Id: <Y7z/BQhmsBbRgxhe@jupiter.tail36e24.ts.net>
2023-01-10Update configure.ac so that we don't need glibc when running ./configure.Flavio Cruz
For x86_64-pc-gnu we still do not have a working glibc so ./configure will fail under a freestanding environment. We force ./configure to avoid running compiled C programs as a test which it is not needed when compiling a kernel. Message-Id: <Y7zYm44O0CNayuAe@jupiter.tail36e24.ts.net>
2023-01-09Remove unused db_set_variableFlavio Cruz
Message-Id: <Y7umiZGUjD3E+Duq@jupiter.tail36e24.ts.net>
2023-01-09Remove unused db_lookup_portFlavio Cruz
Message-Id: <Y7ulwrbHJZqKoBPn@jupiter.tail36e24.ts.net>
2023-01-09Export input structures used by Hurd in device/input.h.Flavio Cruz
Also delete sys/ioctl.h and merge it with device/input.h since it is only needed here. Message-Id: <Y7uirJzaJeOBzAmq@jupiter.tail36e24.ts.net>
2023-01-09Set max-page-size when linking the kernel to 0x1000.Flavio Cruz
With the exception of linux, x86_64 ld default's max-page-size is 2MB (default for i386 is 4K) and compiling gnumach with x86_64-pc-gnu-ld will generate a kernel image where the boot section starts at the file offset 2MB. This makes it unbootable on grub because the file is no longer multiboot. Here's the objdump -h output before the patch: Sections: Idx Name Size VMA LMA File off Algn 0 .boot 0000c000 0000000001000000 0000000001000000 00200000 2**12 CONTENTS, ALLOC, LOAD, READONLY, CODE 1 .text 0009078f 000000004100c000 000000000100c000 0020c000 2**2 CONTENTS, ALLOC, LOAD, READONLY, CODE 2 .rodata 000110fc 000000004109c7a0 000000000109c7a0 0029c7a0 2**5 CONTENTS, ALLOC, LOAD, READONLY, DATA 3 .eh_frame 000101f0 00000000410ad8a0 00000000010ad8a0 002ad8a0 2**3 CONTENTS, ALLOC, LOAD, READONLY, DATA 4 .data 000070a0 00000000412bdaa0 00000000012bdaa0 002bdaa0 2**5 CONTENTS, ALLOC, LOAD, DATA 5 .bss 00023f10 00000000412c5000 00000000012c5000 002c4b40 2**12 ALLOC 6 .comment 00000012 0000000000000000 0000000000000000 002c4b40 2**0 CONTENTS, READONLY After, when forcing ld's max-page-size to be 4K: Sections: Idx Name Size VMA LMA File off Algn 0 .boot 0000c000 0000000001000000 0000000001000000 00001000 2**12 CONTENTS, ALLOC, LOAD, READONLY, CODE 1 .text 0009078f 000000004100c000 000000000100c000 0000d000 2**2 CONTENTS, ALLOC, LOAD, READONLY, CODE 2 .rodata 000110fc 000000004109c7a0 000000000109c7a0 0009d7a0 2**5 CONTENTS, ALLOC, LOAD, READONLY, DATA 3 .eh_frame 000101f0 00000000410ad8a0 00000000010ad8a0 000ae8a0 2**3 CONTENTS, ALLOC, LOAD, READONLY, DATA 4 .data 000070a0 00000000410beaa0 00000000010beaa0 000beaa0 2**5 CONTENTS, ALLOC, LOAD, DATA 5 .bss 00023f10 00000000410c6000 00000000010c6000 000c5b40 2**12 ALLOC 6 .comment 00000012 0000000000000000 0000000000000000 000c5b40 2**0 CONTENTS, READONLY It is also possible that something is wrong with the linker script but couldn't find anything concrete so far. After this patch the kernel is bootable with x86_64-pc-gnu-ld (and far smaller in size). Message-Id: <Y7uJYpIsovhShREj@jupiter.tail36e24.ts.net>
2023-01-07Fix warning at pic_isa.cFlavio Cruz
Message-Id: <Y7exFz3ZkK6hLVdi@jupiter.tail36e24.ts.net>
2023-01-07Use grub-file instead of mbchk to test multiboot headerFlavio Cruz
mbchk is not part of grub2 and only available on grub-legacy. Message-Id: <Y7ewlry3pRHRAR/9@jupiter.tail36e24.ts.net>
2023-01-07Move cpu_down and other functions inside SMP ifdefFlavio Cruz
cpu_down is shown as not required when disabling SMP so moving it inside NCPUS > 1 to eliminate the warning. Note that the diff ended up looking a bit different due the way functions are laid out. Message-Id: <Y7ZH6aI3fhWNzyrY@jupiter.tail36e24.ts.net>
2023-01-05Fix ddb warnings introduced with -Wstrict-prototypesFlavio Cruz
Changed some ddb command functions to have the expected signature but not all of them due to the being difficult to inter-dependency between header files (for those just used cast). Message-Id: <Y7UO9HTfpZ8U0Nfy@mars>
2023-01-03Introduce time_value64_t to keep track of real time in the kernelFlavio Cruz
time_value64_t uses int64_t to track seconds and nanoseconds and hence is Y2038 proof. It does not have nano second resolution but it could be provided in the future. Removed include/sys/time.h as it remaps time_value_t into timeval which can create confusion. The timestamp from keyboard and mouse events is no longer set and replaced with rpc_time_value for better compatibility.
2023-01-01fix warning from -Wstrict-prototypesGuy-Fleury Iteriteka
Message-Id: <Y7GEhcafJ+4Wn3ao@falom>
2023-01-01convert K&R into ansiGuy-Fleury Iteriteka
Message-Id: <Y7GBQ5bk6ZQqtfda@falom>
2023-01-01convert K&R into ansi.Guy-Fleury Iteriteka
Message-Id: <Y7GBIF6mBjV6kBM+@falom>
2022-12-27Fix inttypes.h format constants for uintptr_t and intptr_t.Flavio Cruz
The format constants are not correct for 32 bits and there was duplication for PRIx* constants (replaced with octal constants). Fixed a few format warnings too. Message-Id: <Y6o5KsvtPavCYe8f@mars>
2022-12-27Delete kern_timestamp system call since it is not usedFlavio Cruz
Message-Id: <Y6r72z4cKVCMDSKy@mars>
2022-12-27Use uintptr_t to define vm_size_t/vm_offset_t/vm_addressFlavio Cruz
Message-Id: <Y6j9bnHphZp0ZPYC@mars>
2022-12-27Fix some warnings with -Wmissing-prototypes.Flavio Cruz
Marked some functions as static (private) as needed and added missing includes. This also revealed some dead code which was removed. Note that -Wmissing-prototypes is not enabled here since there is a bunch more warnings. Message-Id: <Y6j72lWRL9rsYy4j@mars>
2022-12-27Fix hardclock prototypeSamuel Thibault
2022-12-24intr: Drop irq parameterSamuel Thibault
This is not actually used.
2022-12-24Xen: Fix ivect prototypeSamuel Thibault
448889a4f0c3 ("Use -Wstrict-prototypes and fix warnings") simplified the prototype of ivect, so we have to update the Xen version.