minix/servers/vm/break.c
David van Moolenbroek 6b3f4dc157 Input infrastructure, INPUT server, PCKBD driver
This commit separates the low-level keyboard driver from TTY, putting
it in a separate driver (PCKBD). The commit also separates management
of raw input devices from TTY, and puts it in a separate server
(INPUT). All keyboard and mouse input from hardware is sent by drivers
to the INPUT server, which either sends it to a process that has
opened a raw input device, or otherwise forwards it to TTY for
standard processing.

Design by Dirk Vogt. Prototype by Uli Kastlunger.

Additional changes made to the prototype:

- the event communication is now based on USB HID codes; all input
  drivers have to use USB codes to describe events;
- all TTY keymaps have been converted to USB format, with the effect
  that a single keymap covers all keys; there is no (static) escaped
  keymap anymore;
- further keymap tweaks now allow remapping of literally all keys;
- input device renumbering and protocol rewrite;
- INPUT server rewrite, with added support for cancel and select;
- PCKBD reimplementation, including PC/AT-to-USB translation;
- support for manipulating keyboard LEDs has been added;
- keyboard and mouse multiplexer devices have been added to INPUT,
  primarily so that an X server need only open two devices;
- a new "libinputdriver" library abstracts away protocol details from
  input drivers, and should be used by all future input drivers;
- both INPUT and PCKBD can be restarted;
- TTY is now scheduled by KERNEL, so that it won't be punished for
  running a lot; without this, simply running "yes" on the console
  kills the system;
- the KIOCBELL IOCTL has been moved to /dev/console;
- support for the SCANCODES termios setting has been removed;
- obsolete keymap compression has been removed;
- the obsolete Olivetti M24 keymap has been removed.

Change-Id: I3a672fb8c4fd566734e4b46d3994b4b7fc96d578
2014-03-01 09:04:55 +01:00

71 lines
2.2 KiB
C

/* The MINIX model of memory allocation reserves a fixed amount of memory for
* the combined text, data, and stack segments. The amount used for a child
* process created by FORK is the same as the parent had. If the child does
* an EXEC later, the new size is taken from the header of the file EXEC'ed.
*
* The layout in memory consists of the text segment, followed by the data
* segment, followed by a gap (unused memory), followed by the stack segment.
* The data segment grows upward and the stack grows downward, so each can
* take memory from the gap. If they meet, the process must be killed. The
* procedures in this file deal with the growth of the data and stack segments.
*
* The entry points into this file are:
* do_brk: BRK/SBRK system calls to grow or shrink the data segment
*/
#define _SYSTEM 1
#include <minix/callnr.h>
#include <minix/com.h>
#include <minix/config.h>
#include <minix/const.h>
#include <minix/ds.h>
#include <minix/endpoint.h>
#include <minix/minlib.h>
#include <minix/type.h>
#include <minix/ipc.h>
#include <minix/sysutil.h>
#include <minix/syslib.h>
#include <minix/bitmap.h>
#include <errno.h>
#include <env.h>
#include "glo.h"
#include "vm.h"
#include "proto.h"
#include "util.h"
#define DATA_CHANGED 1 /* flag value when data segment size changed */
#define STACK_CHANGED 2 /* flag value when stack size changed */
/*===========================================================================*
* do_brk *
*===========================================================================*/
int do_brk(message *msg)
{
/* Perform the brk(addr) system call.
* The parameter, 'addr' is the new virtual address in D space.
*/
int proc;
if(vm_isokendpt(msg->VMB_ENDPOINT, &proc) != OK) {
printf("VM: bogus endpoint VM_BRK %d\n", msg->VMB_ENDPOINT);
return EINVAL;
}
return real_brk(&vmproc[proc], (vir_bytes) msg->VMB_ADDR);
}
/*===========================================================================*
* real_brk *
*===========================================================================*/
int real_brk(struct vmproc *vmp, vir_bytes v)
{
if(map_region_extend_upto_v(vmp, v) == OK) {
return OK;
}
return(ENOMEM);
}