Commit graph

399 commits

Author SHA1 Message Date
Ben Gras c8f3b10909 fix a few more minix specific warnings
. also disable stack protection feature for gcc,
	  causes build errors for pkgsrc gcc on minix

Change-Id: I1c6e2bcb4d948098d642543d7b2711284ee55c72
2013-08-27 16:16:03 +00:00
Igor Smolyar 3ef93645b9 Use ARM_VM_SECTION_MASK to determine kernel base address
To map kernel we use 1M sections therefore we should use
ARM_VM_SECTION_MASK to determine base address.

Change-Id: I0b97fe459f2325d702aad9b7b1e8e066d9721b87
2013-08-19 09:53:25 +02:00
Antoine Leca 9f467932a6 VMWare poweroff magic cli;hlt sequence
Change-Id: I9d8f96cc2e6423b89eb743e27550225d8759ee1d
2013-08-11 23:55:43 +02:00
Lukasz Hryniuk 06154a34a4 Some more 64bit function eradication.
. Replace 64bit funcions with operators in arch_clock.c
  . Replace 64bit funcions with operators in proc.c
  . Replace 64bit funcions with operators in vbox.c
  . Replace 64bit funcions with operators in driver.c
  . Eradicates is_zero64, make_zero64, neg64

Change-Id: Ie4e1242a73534f114725271b2e2365b2004cb7b9
2013-08-07 12:35:53 +00:00
Antoine Leca da82f9b2e8 <a.out.h>, MINIX style: remove as obsolete
Change-Id: Icc8b7210d60a93ac9cc4610d676dcba270756410
2013-08-06 11:43:35 +02:00
Thomas Cort 6c6123d857 kernel: implement reboot for am335x/dm37xx
Change-Id: Ied288326b9af8f31223b2dd76a064e32c9a03c45
2013-08-05 10:23:00 -04:00
Thomas Cort 6d7eff8023 kernel: add support for am335x PMIC-base power-off
AM335X SoCs support power-off via a power management
chip (PMIC). An alarm in the real time clock is used
to trigger the PMIC to cut the power.

To ensure the alarm goes off when the system is in
a safe state, the RTC is frozen when the alarm is
set. At the last moment, the kernel unfreezes the RTC
to let the alarm go off.

This patch adds a mini driver for unfreezing the RTC
as well as code to handle RBT_POWEROFF on Minix/arm.

Change-Id: I7d48e75791e3a81bdd2f7704997193a269409fe8
2013-08-05 10:22:59 -04:00
Thomas Cort 2dab6a5384 kernel: i2c padconf workaround
The padconf library runs in user mode, but to actually affect the
padconf register contents, the processor has to be in privileged
mode. A full server based solution will be developed, but for now
just set the pinmux in the kernel at boot.

Change-Id: I170ed54dae64b27cd9bd8807445231598fb8e3e1
2013-07-15 11:11:13 -04:00
Ben Gras bb268230c4 kernel: maintain stack alignment
. 'fixes' 64-bit varargs (i.e. printf("%llu", ..)) argument
	  retrieval bug
2013-06-25 09:53:15 +00:00
Ben Gras cdf2f55a90 kernel, arm ucontext: ARM DBG=-g run fixes
kernel:
	. modules can be as big as the space (8MB) between them
	  instead of 4MB; memory is slightly bigger with DBG=-g

arm ucontext:
	. r4 is clobbered by the restore function, as it's
	  used as a scratch register, causing problems for the
	  DBG=-g build
	. r1-r3 are safe for scratch registers, as they are
	  caller-save, so use r3 instead; and don't bother
	  restoring r1-r3, but preserve r4

vfs:
	. improve TLL pointer sanity check a bit

Change-Id: I0e3cfc367fdc14477e40d04b5e044f288ca4cc7d
2013-06-24 16:57:30 +02:00
Ben Gras 8e7c0604bd arm timer fix
. set 'done' once initialized so 32-bit read frc works,
	  thanks to keesj
	. make sure the software-implemented upper 32 bit of the 64-bit
	  "tsc" value works OK by adding an assert in one of its calls

Change-Id: I5ce24fea919f4610c6a86ac7ec9f04b1815620c2
2013-06-19 13:11:32 +02:00
Ben Gras 5bc48ef12e kernel, libsys: make it arm-target-independent
. by making the address and frequency of the
	  free running clock kinfo members, set at runtime
	  in the kernel, instead of compile time constants
	  in libsys

Change-Id: I4a8387302d4d3ffd47d2448525725683a74c9a4f
2013-06-17 09:55:36 +02:00
Kees Jongenburger a2fcba659c arm:remove pre 1:1 mapping workarounds.
Change-Id: I5a690cf5a561cdca9b9c1f031402f80fd203c92d
2013-06-12 16:42:20 +02:00
Kees Jongenburger a5a693a046 arm:no longer rely on a 1:1 phys mapping for device memory.
Change-Id: Ie3f61069f882c37dbb81dee813fdfd883e7468cf
2013-06-12 16:42:12 +02:00
Anton Kuijsten 1d71e39b73 Gold linker support for entire source tree 2013-06-11 22:51:02 +02:00
Ben Gras 2d2a1a077d panic: declare as printf-style-checked
. and related fixes

Change-Id: I5131ac57dc53d8aec8d421a34c5ceea383404d7a
2013-05-31 13:35:25 +00:00
Xiaoguang Sun 26428d4bc6 Add acpi poweroff
Use acpi poweroff if it's possible.

Change-Id: I103cc288523bf63fa536750b1d408ac88bbe35fb
Signed-off-by: Ben Gras <ben@minix3.org>
Signed-off-by: Tomas Hruby <tom@minix3.org>
2013-05-29 16:12:33 +00:00
Kees Jongenburger 3139ce9631 arm:omap timers remove hardcoded base address.
Omap timers remove hardcoded base address and add some initial
support for the beaglebone's timers. Frclock_util will need
refactoring to remain independent of the ARM flavour.

Change-Id: I2b5d04e930364262c81b5686de634c0a51796b23
2013-05-24 14:03:14 +02:00
Kees Jongenburger 534b19187e arm:configure tick per ms to reflect the free running clock.
Change-Id: Ifc02658d6ae48dd01a868bfaa3d60f77bc6cc800
2013-05-24 13:59:04 +02:00
Kees Jongenburger 2856cec5b9 arm:interupt handling remove hardcoded base address.
Remove hardcoded base address for the omap interrupt handler and add
interrupt names for AM335X in omap_intr.h.

Change-Id: Ie606d8612f55990d55f9db655583052f53950e8e
2013-05-24 13:59:04 +02:00
Kees Jongenburger c40df92bf2 arm:add AM335X serial
Change-Id: I728622ddd4f59529d15e8ac2499c41fa815eee3b
2013-05-24 11:17:52 +02:00
Kees Jongenburger 69dc6a4f15 arm:keep kernel and modules in the first 256MB of memory.
Keep kernel and modules in the first 256MB of memory in preparation
for the beaglebone. That target only has 256 MB of memory.

Change-Id: I3d92247b5d4e5d3aab7388fe01c2f5713d6a4593
2013-05-24 11:17:52 +02:00
Kees Jongenburger 571ea5b4d7 arm:remove hardcoded base address for the in kernel serial.
Removed hardcoded base address for in kernel serial. This will ease
porting to different boards and allow us to remap i/o at later stage.

Change-Id: I4a4e00ed2aa2f94dfe928dc43a6816d3b94576b7
2013-05-24 11:17:52 +02:00
Kees Jongenburger 5d15ac7c20 arm:kernel simplify the in kernel serial.
Simplify the in kernel serial header to a minimum. The driver doing
the real handling is the tty driver.

Change-Id: I5d487d71a3d22906313aa8af5e9d84b0751a6868
2013-05-24 11:17:52 +02:00
Ben Gras d12d57dcd8 arm: recognize instruction fetch pagefault
. an instruction fetch pagefault generates a prefetch
	  abort exception, this should also be a source of
	  a pagefault event
	. the saved_lr argument to the C exception handler was
	  sometimes an address, sometimes a pointer to that address;
	  the kernel sometimes dereferences it, so it should always be
	  an in-kernel address, never a userspace address. fix in mpx.S
	  makes it always a pointer.
	. move dumping of all processes over serial out of
	  the arch-specific arch_system.c
2013-05-21 15:05:06 +02:00
Kees Jongenburger 1e1ff96aea arm:vm caching fix.
Improve reliability by using write trough cache.
2013-05-16 20:39:20 +02:00
Kees Jongenburger b9cb8251bc arm:make no assumptions about TRE and AFE
The bootloader can leave the system control register
in at state that doesn't match our setup. make no assumptions
and configure TRE and AFE.
2013-05-16 20:39:19 +02:00
Kees Jongenburger e6bac75a8b ARM:Rename ARM_BIG_PAGE to ARM_SECTION.
The natural term to use when talking about MINIX big pages on ARM
is SECTION. A section is a level 1 page table entry pointing to
a 1MB area.

Change-Id: I9bd27ca99bc772126c31c27a537b1415db20c4a6
2013-04-29 11:42:26 +02:00
Ben Gras 0cfff08e56 libexec: mmap support, prealloc variants
In libexec, split the memory allocation method into cleared and
non-cleared. Cleared gives zeroed memory, non-cleared gives 'junk'
memory (that will be overwritten anyway, and so needn't be cleared)
that is faster to get.

Also introduce the 'memmap' method that can be used, if available,
to map code and data from executables into a process using the
third-party mmap() mode.

Change-Id: I26694fd3c21deb8b97e01ed675dfc14719b0672b
2013-04-24 10:18:16 +00:00
Kees Jongenburger 390f852bd1 arm:cleanup remove special case memory handling.
We used to load the memory driver above the other modules to allow
the memory driver (ramdisk) to grow. We no longer want or need this
this as we have a working mmc driver.
2013-04-12 20:52:57 +02:00
David van Moolenbroek 50e46307de Move MINIX reboot definitions into minix/reboot.h
Also fix a buffer overflow in commands/reboot/sh_wall.c.

Change-Id: I3a61057c4f0221d1700e14d44520b4ad17f1dbe1
2013-03-20 16:50:01 +00:00
Ben Gras 5acaa0814f kernel, ramdisk: some boot unification
To use the new SD building script, Linux has to be configured with
loop.max_part=15 on the command line (or set at module load time)
to make the loopback device see the partitions.

This commit removes a lot of differences between the ARM and x86
boot ramdisk and rc scripts. It changes the ARM build from running
from ramdisk to requiring a full filesystem on the SD image and
booting into it.

	. ramdisk: remove some arm-only utilities only used for running
	  from the shell
	. remove ARM-only rc.arm, proto.arm.small, ttys and mylogin.sh
	  boot-time ramdisk files
	. change kernel to add "arch" variable so userland knows what
	  we're running on from sysenv
	. make ARM use the regular ramdisk rc file, changed to distinguish
	  i386-only and ARM-only drivers; requires rootdevname to be set
	. change /etc/rc and /usr/etc/rc to start i386-only drivers only on
	  i386 systems
	. change the kernel/arm to have a special case for the memory
	  driver to load it higher so it can be bigger
	. add uEnv.txt, cmdline.txt and a for now highly linux-dependent
	  SD preparation script arm_sdimage.sh to the git repository in
	  releasetools/

Change-Id: I68910ba4e96ee80f7a12b65e48b5d39b43ca6397
2013-03-07 14:29:27 +00:00
Thomas Veerman e232e0cbf0 Kernel: make shutdown more verbose
Change-Id: Iab5fed4cb617a9dbce164ff81c7dedf408e9fd98
2013-03-04 10:13:50 +00:00
Ben Gras 2aa82a9c7b ARM: kernel: fix sanity check for copying
. phys_copy() (taken from memcpy) can legitimately
	  cause pagefaults below the source/dest address due
	  to word-alignment

Change-Id: Ibee8f069781d16caea671246c021fb17a2a892b1
2013-02-20 20:34:40 +01:00
Kees Jongenburger d47f512a13 kernel:handle improper svc calls gracefully.
Change-Id: Id0f694dd2a8c5981900601fcdb2112ee266d0d76
2013-02-19 17:02:29 +01:00
Ben Gras b18224051a kernel: more stack for vm 2013-02-19 13:53:56 +01:00
Lionel Sambuc e4fa9802cb ARM: Enable caches
First round, some more optimizations are possible and should be
activated.

Change-Id: I3b7dee7c82fbffd823a08bec1c5d5ebcf769f92f
2013-02-18 09:08:26 +01:00
Lionel Sambuc b36292e232 ARM: Fix interrupt management
Interrupts where not correctly masked while in kernel, which
breaks one of the current main assumptions.

Also remove some duplication on ARM asm files, and add a function
to check the status of ARM irqs (not compiled by default)

Change-Id: I3c25d2b388f93fd8fe423998b94b3c4f140ba831
2013-02-18 09:07:55 +01:00
Kees Jongenburger eff37b8a8b kernel:enable trace on arm.
Change-Id: Iabe6dfd758e8f1cdb4a18e2f2ab8f8ca988f3c86
2013-02-17 08:40:38 +01:00
Ben Gras 3bc6d7df06 impove memory accounting
. the total amount of memory in the system didn't include the memory
	  used by the boot-time modules and some dynamic allocation by the
	  kernel at boot time (to map in VM). especially apparent on our
	  ARM board with 'only' 512MB of memory and a huge ramdisk.
	. also: *add* the VM loaded module to the freelist after it has
	  been allocated for & mapped in instead of cutting it *out* of the
	  freelist! so we get a few more MB free..

Change-Id: If37ac32b21c9d38610830e21421264da4f20bc4f
2013-02-11 19:31:57 +01:00
Ben Gras 5a0585359d ARM divsi3.S: raise(SIGFPE) when called for
. raise(SIGFPE) for modulo-0/divide-0 operations in
	  internal int division functions
	. gcc: do not link with -lgcc anywhere so these internal
	  functions are always used from libc instead of (sometimes)
	  masked by -lgcc
	. together fixes test53 on ARM

Change-Id: I31ec19dfdd68b8a92695595da901874e63106f9d
2013-02-09 22:24:59 +01:00
Ben Gras 298b41b523 libexec: detect short files
if an exec() fails partway through reading in the sections, the target
process is already gone and a defunct process remains. sanity checking
the binary beforehand helps that.

test10 mutilates binaries and exec()s them on purpose; making an exec()
fail cleanly in such cases seems like acceptable behaviour.

fixes test10 on ARM.

Change-Id: I1ed9bb200ce469d4d349073cadccad5503b2fcb0
2013-02-04 12:04:35 +01:00
Ben Gras 8ea66915f2 kernel: scheduling fix for ARM
. make read_tsc_64 use the free-running clock, significantly
	  improving scheduling behaviour

Change-Id: Idf6a12f6e26be7fe3b3664c278cae846d8b2a442
2013-02-03 22:49:05 +01:00
Thomas Veerman db8c1ee9d0 ARM: provide free running clock to replace ccnt
The Cycle CouNTer on ARM cannot be used reliably as it wraps around
rather quickly and can be altered by user space (on Minix). Furthermore,
it's buggy when wrapping and is not implemented at all on the Linaro
Beagleboard emulator.

This patch programs GPTIMER10 as a free running clock at 1.625 MHz (it
doesn't generate interrupts). It's memory mapped into every process,
which enables libsys to provide micro_delay().

Change-Id: Iba004c6c62976762fe154ea390d69e518eec1531
2013-01-31 15:19:11 +00:00
Ben Gras e3e5cf6d34 arm: make signal handlers work
A few kernel and calling convention adjustments to make sigsend and
sigreturn work for arm.

	. provide a arch_proc_setcontext for earm in kernel
	. set LR in context of signal handler to provide a proper
	  return address (to __sigreturn)
	. change __sigreturn to retrieve the sigcontext pointer
	  from the sigframe struct and pass it to _sigreturn() in r0

Change-Id: Icd135a70595382c79d11d8dd9876f6a6f1df41f8
2013-01-30 04:10:12 +00:00
Thomas Veerman df0c35f0f5 Kernel/ARM: faster context save 2013-01-25 17:07:02 +00:00
Thomas Veerman fb4b3da7da Kernel/ARM: use modern srsdb invocation 2013-01-25 17:07:02 +00:00
Thomas Veerman 1a60a84cb7 ARM: clear BSS upon boot 2013-01-25 17:07:01 +00:00
Thomas Veerman c96cd5e1a0 ARM: provide means to pass boot cmdline 2013-01-25 17:07:01 +00:00
Ben Gras dcff984d6a kernel: fix sanity check 2013-01-18 21:38:28 +00:00