| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Make it explicit where we use port names versus actual ports. For the 64
bit kernel, port names and ports are of different size so this corrects
the syscall arguments and internal structs to have the right size.
This patch also uncovered several issues we need to solve to make
GNUMach work well on 64 bits. First, the mach_msg call will receive 4
byte port names while the kernel "thinks" they are 8 bytes, which will
be a problem. Also, when we send a message, the kernel translates the
port names into port pointers in the message copied from user space.
This also won't work on 64 bits. In this patch, I added several TODOs to fix
the issues later.
Message-Id: <Y4cCzNmc6vC4bjsX@viriathus>
|
| |
|
|
|
|
| |
Message-Id: <Y4QQFkTUR4M60Gx0@viriathus>
|
|
|
|
| |
We cannot assume that the processor is little-endian.
|
|
|
|
|
|
|
|
| |
* kern/bootstrap.c: use rpc_ vm types to put the bootstrap module
arguments on the stack, make it consistent with user-space types.
Signed-off-by: Luca Dariz <luca@orpolo.org>
Message-Id: <20220628101054.446126-4-luca@orpolo.org>
|
|
|
|
|
|
|
|
|
| |
* kern/printf.c: remove unnecessary #include and reorder
This allows the file to be reused for minimal user-space tests.
Signed-off-by: Luca Dariz <luca@orpolo.org>
Message-Id: <20220628101054.446126-14-luca@orpolo.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* include/mach/mach_port.defs
- use C type mach_port_name_array_t
* include/mach/port.h:
- add new types mach_port_name_t and mach_port_name_array_t
- refine mach_port_t type for user and kernel space
- use port names in mach_port_status to allow compilation of 64-bit
- use port name to have uniform sizes and remove the
old_mach_port_status_t as it's unused
* include/mach/std_types.defs
- use C type mach_port_name_array_t
* kern/thread.{h,c}
- fix prototype to use port names. So far it seems the only rpc to
cause a conflict between the mig-generated header and the regular
header, so compilation fails.
Signed-off-by: Luca Dariz <luca@orpolo.org>
Message-Id: <20220403145955.120742-2-luca@orpolo.org>
|
|
|
|
|
| |
Signed-off-by: Luca Dariz <luca@orpolo.org>
Message-Id: <20220628101054.446126-13-luca@orpolo.org>
|
|
|
|
|
|
|
|
|
| |
* use _raw_ structs where we refer to the bootloader-provided data
* remove unused structures
* fix 64 bit boot
Signed-off-by: Luca Dariz <luca@orpolo.org>
Message-Id: <20220205175129.309469-3-luca@orpolo.org>
|
|
|
|
| |
Message-Id: <Yo+lzS7RtW5ZjQHN@debian>
|
|
|
|
|
| |
We do not want to destroy the port and release the stack if thread is
NULL, i.e. we will fail.
|
|
|
|
|
| |
This follows mig's cf4bcc3f1435 ("Also add const qualifiers on server
side")
|
|
|
|
|
| |
881fe9da8bd1 ("kern/thread.c: some minor style changes") introduced a
spurious comment.
|
|
|
|
|
|
|
| |
Greeting, I have changed some stuff in kern/thread.c which makes code
more readable for me. Maybe it will be usefull.
Message-Id: <20211230082643.8171-1-sys.arch.adam@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
vm_page_grab was systematically using the VM_PAGE_SEL_DIRECTMAP selector
to play safe with existing code.
This adds a flags parameter to let callers of vm_page_grab specify their
constraints.
Linux drivers need 32bit dmas, Xen drivers use kvtophys to clear some
data. Callers of kmem_pagealloc_physmem and vm_page_grab_phys_addr also use
kvtophys. Otherwise allocations can go to highmem.
This fixes the allocation jam in the directmap segment.
* vm/vm_page.h (VM_PAGE_DMA, VM_PAGE_DMA32, VM_PAGE_DIRECTMAP,
VM_PAGE_HIGHMEM): New macros.
(vm_page_grab): Add flags parameter.
* vm/vm_resident.c (vm_page_grab): Choose allocation selector according
to flags parameter.
(vm_page_convert, vm_page_alloc): Pass VM_PAGE_HIGHMEM to vm_page_grab.
(vm_page_grab_phys_addr): Pass VM_PAGE_DIRECTMAP to vm_page_grab.
* vm/vm_fault.c (vm_fault_page): Pass VM_PAGE_HIGHMEM to vm_page_grab.
* vm/vm_map.c (vm_map_copy_steal_pages): Pass VM_PAGE_HIGHMEM to vm_page_grab.
* kern/slab.c (kmem_pagealloc_physmem): Pass VM_PAGE_DIRECTMAP to vm_page_grab.
* i386/intel/pmap.c (pmap_page_table_page_alloc): Pass VM_PAGE_DIRECTMAP to
vm_page_grab.
* xen/block.c (device_read): Pass VM_PAGE_DIRECTMAP to vm_page_grab.
* linux/dev/glue/block.c (alloc_buffer): Pass VM_PAGE_DMA32 to vm_page_grab.
|
| |
|
|
|
|
|
| |
* kern/thread.c (thread_info): Set last_processor to 0 when the thread
never ran.
|
|
|
|
|
|
|
| |
thread->last_processor is a processor_t, not a slot number.
* kern/thread.c (thread_info): Set sched_info->last_processor to
thread->last_processor->slot_num rather than thread->last_processor.
|
| |
|
|
|
|
| |
Message-Id: <20210326094850.2606-4-damien@zamaudio.com>
|
|
|
|
|
|
|
| |
It seems that ld.so sometimes gets into troubles and hangs at bootstrap.
* kern/elf-load.c (exec_load): When x.e_type == ET_DYN || x.e_type ==
ET_REL, add 128MiB as loadbase.
|
|
|
|
|
| |
* kern/bootstrap.c (STACK_SIZE): Set to 128KB. glibc's
__MAX_ALLOCA_CUTOFF is 64K by default.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* configfrag.ac (--enable-ncpus): Add option to set $mach_ncpus.
* i386/i386/cpu_number.h (CPU_NUMBER, cpu_number): New macros, set to 0 for
now.
* i386/i386/db_interface.c (cpu_interrupt_to_db): New function.
* i386/i386/db_interface.h (cpu_interrupt_to_db): New declaration.
* i386/i386/mp_desc.c (int_stack_base): New array.
(intel_startCPU): New function.
* i386/i386at/model_dep.c: Include <i386/smp.h>
(int_stack_top, int_stack_base): Turn into arrays
(i386at_init): Update accesses accordingly.
* i386/i386at/model_dep.h (int_stack_top, int_stack_base, ON_INT_STACK):
Likewise.
* i386/intel/pmap.c (cpus_active, cpus_idle, cpu_update_needed): Add
variables.
* i386/intel/pmap.h (cpus_active, cpus_idle, cpu_update_needed): Mark
extern.
* kern/cpu_number.h: Include <machine/cpu_number.h>
* linux/dev/arch/i386/kernel/irq.c (local_bh_count, local_irq_count):
Hardcode to the address of intr_count. We will not use the Linux code in
SMP mode anyway.
|
|
|
|
|
|
|
|
|
|
| |
This pseudoclass generalize the initialization and access of SMP data,
allowing expands it to other architectures. In x86, the functions calls to apic functions.
*kern/smp.c: Source file. Implements a interface to load the SMP functions for the current architecture.
*kern/smp.h: Header file. Add declaration for smp_data structure.
*i386/i386/smp.c: Source file. Implements a set of functions to manage the SMP actions in i386
*i386/i386/smp.h: Header file. Add declarations for SMP functions in i386.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This allows privileged userland drivers to get notifications of hardware
interrupts.
Initial work by Zheng Da, reworked by Damien Zammit and myself.
* Makefrag.am (libkernel_a_SOURCES): Add device/intr.c and
device/intr.h.
(include_device_HEADERS): Add include/device/notify.defs and
include/device/notify.h.
* device/dev_hdr.h (name_equal): Add declaration.
* device/ds_routines.c: Include <device/intr.h>
(ds_device_intr_register, ds_device_intr_ack): New functions.
* device/intr.c, device/intr.h: New files.
* doc/mach.texi (Device Interrupt): New section.
* i386/Makefrag.am (libkernel_a_SOURCES): Add i386/i386/irq.c and
i386/i386/irq.h.
* i386/i386/irq.c, i386/i386/irq.h: New files.
* i386/i386at/conf.c: Include <device/intr.h>.
(irqname): New macro.
(dev_name_list): Add irq device.
* include/device/device.defs (device_intr_register, device_intr_ack):
New RPCs.
* include/device/notify.defs, include/device/notify.h: New files.
* kern/startup.c: Include <device/intr.h>
(start_kernel_threads): Start intr_thread thread.
* linux/dev/arch/i386/kernel/irq.c: Include <device/intr.h>
(linux_action): Add user_intr field.
(linux_intr): Call user_intr action if any.
(mask_irq, unmask_irq): Move functions to i386/i386/pic.c
(__disable_irq, __enable_irq): Move functions to i386/i386/irq.c.
(install_user_intr_handler): New function.
(request_irq): Initialize user_intr field.
* linux/src/include/asm-i386/irq.h (__disable_irq, __enable_irq): Remove
prototypes.
* i386/i386/pic.c (mask_irq, unmask_irq): New functions.
* i386/i386/pic.h (mask_irq, unmask_irq): New prototypes.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is free for experimenting RPCs, with no backward compatibility guarantees.
* Makefrag.am (EXTRA_DIST): Add kern/experimental.srv.
(include_mach_HEADERS): Add include/mach/experimental.defs.
(nodist_lib_dep_tr_for_defs_a_SOURCES): Add
kern/experimental.server.defs.c.
(nodist_libkernel_a_SOURCES): Add kern/experimental.server.h,
kern/experimental.server.c, kern/experimental.server.msgids.
(nodist_libkernel_a_SOURCES): Add kern/experimental.server.defs.
* include/mach/experimental.defs: New file.
* kern/experimental.srv: New file.
* kern/ipc_kobject.c: Include <kern/experimental.server.h>.
(ipc_kobject_server): Call experimental_server_routine.
|
|
|
|
|
|
|
| |
The addition of the mach_trap_name field made the 64bit unused field
spurious.
* kern/syscall_sw.h (mach_trap_t): Remove `unused' field.
|
|
|
|
|
|
|
|
|
| |
When giving the port to a bootstrap task to another bootstrap task, we
need to add a reference. This shows up on error-cleanup (e.g. when
forgetting to define the root).
* kern/bootstrap.c (boot_script_insert_task_port): Call
ipc_port_make_send on `task''s itk_sself.
|
|
|
|
|
| |
* kern/boot_script.c: Include <kern/printf.h>.
(boot_script_exec): Print missing symbol name on symbol lookup error.
|
|
|
|
| |
* kern/boot_script.c (add_arg): Make val parameter long.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
which will be the default in gcc-10.
* device/io_req.h (io_inband_cache): Add extern qualifier.
* device/tty.h (tthiwat, ttlowat): Likewise.
* i386/i386/db_machdep.h (ddb_regs): Likewise.
* kern/cpu_number.h (master_cpu): Likewise.
* kern/time_stamp.h (ts_tick_count): Likewise.
* linux/src/drivers/scsi/in2000.h (proc_scsi_in2000): Likewise.
* device/ds_routines.c (io_inband_cache): New variable.
* i386/i386/db_interface.c (ddb_regs): Likewise.
* kern/processor.c (master_cpu): Likewise.
* kern/time_stamp.c (ts_tick_count): Likewise.
* linux/pcmcia-cs/modules/pci_fixup.c (pci_root): Remove variable.
|
|
|
|
|
| |
* kern/bootstrap.c (bootstrap_create): Support loading 32bit binaries on
64bit.
|
|
|
|
| |
* kern/syscall_sw.h (mach_trap_t): Fix structure for 64bit.
|
|
|
|
|
| |
* kern/startup.c (setup_main): When memory size overflows
machine_info.memory_size, set to maximum size.
|
|
|
|
|
|
|
| |
Nowadays' processors are way fast enough to handle everything fine.
* kern/sched_prim.c (thread_setrun): Do not check against target
processor being master.
|
|
|
|
|
|
|
| |
* include/mach/thread_info.h (thread info structures): Add new member
"last_processor" in thread_sched_info.
* kern/thread.c (thread management): Fill new member "last_processor" in
thread_info() function.
|
|
|
|
| |
* kern/task.c (task_create_kernel): Fix passing string size.
|
|
|
|
|
| |
* kern/gsync.c (temp_mapping): Initialize start address to
VM_MIN_KERNEL_ADDRESS.
|
|
|
|
|
|
|
|
|
|
|
| |
A new thread will mosty probably start working, assume it will take
its share of CPU, to avoid having to find it out slowly. Decaying will
however fix that quickly if it actually does not work.
This fixes stalling issues when a program keeps creating threads.
* kern/thread.c (thread_create): Set new_thread's cpu_usage and
sched_usage to a fair share of the current load.
|
|
|
|
|
|
|
|
|
| |
sched_tick is incremented only once per second, not once per tick.
* kern/task.c (consider_task_collect): Divide task_collect_max_rate by
(hz / 1) to get a number of scheduler ticks.
* kern/thread.c (consider_thread_collect): Divide thread_collect_max_rate by
(hz / 1) to get a number of scheduler ticks.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This wasn't building and is not useful with nowaday's hardware.
* configfrag.ac (SIMPLE_CLOCK): Do not define.
* kern/sched.h [SIMPLE_CLOCK] (sched_usec): Remove variable declaration.
* kern/sched_prim.c [SIMPLE_CLOCK] (sched_usec): Remove variable.
[SIMPLE_CLOCK] (sched_init): Do not initialize sched_usec variable.
[SIMPLE_CLOCK] (recompute_priorities): Do not tinker sched_usec
variable.
* kern/thread.c [SIMPLE_CLOCK] (thread_info): Do not ajust for clock
drift.
|
|
|
|
|
|
|
|
| |
Give smaller quantums to processes, to get more frequent context
switches. This fixes some reactivity for concurrent processes.
* kern/sched.h (MIN_QUANTUM): Define to hz / 33.
* kern/sched_prim.c (sched_init): Use MIN_QUANTUM instead of hz / 10.
|
|
|
|
|
|
|
|
|
|
|
| |
6a2342010811 ("Increase number of priorities") increased NRQS but didn't
increase PRI_SHIFT to extend the use of the additional queues by the
scheduler. This does it. While at it, extend to NRQS to 64, the double
of the original 32, to keep all values coherent.
* i386/i386/sched_param.h (PRI_SHIFT): Set from 18 to 17.
* kern/sched.h (PRI_SHIFT): Set from 18 to 17.
(NRQS): Set to 64.
|
|
|
|
|
|
| |
As reported by Almudena Garcia <liberamenso10000@gmail.com>
* kern/ast.h [NCPUS > 1] (cause_ast_check): Add prototype.
|
|
|
|
|
|
| |
As reported by Almudena Garcia <liberamenso10000@gmail.com>
* kern/cpu_number.h [NCPUS != 1] (CPU_L1_SIZE): Define macro.
|
|
|
|
| |
* kern/machine.h (action_thread): Add prototype.
|
|
|
|
| |
* kern/sched_prim.c (assert_wait): Fix panic format.
|
|
|
|
| |
* kern/ast.c (ast_check): Fix panic format.
|
|
|
|
|
|
| |
* kern/task.c (task_ledger_acquire): Remove function that I added by
accident.
(task_ledger_release): Likewise.
|
|
|
|
| |
* kern/task.c (task_create_kernel): Handle NULL parent tasks.
|