11 Commits
gdb ... v3.2.0

Author SHA1 Message Date
Ben Gras
116fcea5be include netdrv_tg3 on cd 2012-02-26 23:36:00 +01:00
Tomas Hruby
d991abdd34 Revert "SMP - no_apic=0 and acpi=1 set when CONFIG_SMP=y"
This reverts commit c468f4efa5.

Since we use the new boot loader, this hack is no longer necessary.
2012-02-24 14:58:48 +01:00
Antoine Leca
dd9c147444 Cosmetic boot fix.
The NetBSD boot loader loads automatically the kernel module appropriate
for the detected root file system; it is preset at "ffs".  The MINIX3fs
support does not reset the underlying global variable, since there are
no use for this on MINIX.  As a result, the boot loader searches for
/ffs.kmod, and issues two warnings about "module failure to open/load."
2012-02-24 13:29:58 +01:00
Ben Gras
60a4f87b0b fix for -lsys assert(): call panic()
. call panic() instead of abort() so that stacktraces are printed
	. also call printf(..) instead of fprintf(stderr, ..)
2012-02-24 13:10:27 +01:00
Ben Gras
16a468ccec start modules at 16MB
. keep more memory free below 16MB for e.g. lance
2012-02-24 11:51:07 +01:00
Arun Thomas
f55f1f3e52 kernel: Update copyright date 2012-02-22 16:39:41 +01:00
Ben Gras
47627954a0 allow elvis to be invoked as ex 2012-02-22 01:52:20 +01:00
Arun Thomas
72cab7a281 mkimage: use a lower start address 2012-02-21 15:52:18 +01:00
Thomas Veerman
93a8d9f260 VFS: fix last_dir not returning last directory
If the provided path was only a single component (i.e., without
slashes), then last_dir would return early and skip the symlink
detection (i.e., check whether the path ends in a symlink and resolve
that first before returning). This bug triggered an assert in open
which expects that an advance after an last_dir (with VMNT_WRITE lock)
does not yield another vmnt lock.
2012-02-21 10:22:45 +00:00
Ben Gras
665ce9d4e1 try multiple reset methods
. fixes reboot-hang under vbox
	. makes experience nicer under vmware
	. taken from netbsd reset code
2012-02-20 23:54:28 +01:00
Thomas Veerman
3b3ea9dc32 VFS: remove erroneous assert
The assert was meant as an additional check to the assert in link.c:198.
The reasoning behind the assert in link.c:198 is that once you've
obtained a write lock on a vmnt, you can't get an additional read lock
on the same vmnt. However, that does not always hold for the assert in
path.c:281 where the situation could be that you've obtained a read lock
and managed to get another read lock (this is possible). In other words,
the assert in path.c:281 is not the right place to check for that
situation.
2012-02-20 14:16:19 +00:00
13 changed files with 102 additions and 86 deletions

View File

@@ -29,6 +29,10 @@ BINDIR= /usr/bin
LINKS+= ${BINDIR}/elvis ${BINDIR}/vi
.endif
.if !exists(${BINDIR}/ex)
LINKS+= ${BINDIR}/elvis ${BINDIR}/ex
.endif
MAN.elvis=
MAN.ctags=
MAN.ref=

View File

@@ -364,3 +364,13 @@ PUBLIC short cpu_load(void)
*last_idle = *current_idle;
return load;
}
PUBLIC void busy_delay_ms(int ms)
{
u64_t cycles = ms_2_cpu_time(ms), tsc0, tsc, tsc1;
read_tsc_64(&tsc0);
tsc1 = tsc0 + cycles;
do { read_tsc_64(&tsc); } while(tsc < tsc1);
return;
}

View File

@@ -63,6 +63,62 @@ PUBLIC __dead void arch_monitor(void)
monitor();
}
#define KBCMDP 4 /* kbd controller port (O) */
#define KBC_PULSE0 0xfe /* pulse output bit 0 */
#define IO_KBD 0x060 /* 8042 Keyboard */
void
reset(void)
{
uint8_t b;
/*
* The keyboard controller has 4 random output pins, one of which is
* connected to the RESET pin on the CPU in many PCs. We tell the
* keyboard controller to pulse this line a couple of times.
*/
outb(IO_KBD + KBCMDP, KBC_PULSE0);
busy_delay_ms(100);
outb(IO_KBD + KBCMDP, KBC_PULSE0);
busy_delay_ms(100);
/*
* Attempt to force a reset via the Reset Control register at
* I/O port 0xcf9. Bit 2 forces a system reset when it
* transitions from 0 to 1. Bit 1 selects the type of reset
* to attempt: 0 selects a "soft" reset, and 1 selects a
* "hard" reset. We try a "hard" reset. The first write sets
* bit 1 to select a "hard" reset and clears bit 2. The
* second write forces a 0 -> 1 transition in bit 2 to trigger
* a reset.
*/
outb(0xcf9, 0x2);
outb(0xcf9, 0x6);
busy_delay_ms(500); /* wait 0.5 sec to see if that did it */
/*
* Attempt to force a reset via the Fast A20 and Init register
* at I/O port 0x92. Bit 1 serves as an alternate A20 gate.
* Bit 0 asserts INIT# when set to 1. We are careful to only
* preserve bit 1 while setting bit 0. We also must clear bit
* 0 before setting it if it isn't already clear.
*/
b = inb(0x92);
if (b != 0xff) {
if ((b & 0x1) != 0)
outb(0x92, b & 0xfe);
outb(0x92, b | 0x1);
busy_delay_ms(500); /* wait 0.5 sec to see if that did it */
}
/* Triple fault */
x86_triplefault();
/* Give up on resetting */
while(1) {
;
}
}
PRIVATE __dead void arch_bios_poweroff(void)
{
u32_t cr0;
@@ -609,31 +665,9 @@ u32_t params_size, params_offset, mon_ds;
PUBLIC int arch_get_params(char *params, int maxsize)
{
int size = 0;
#ifdef CONFIG_SMP
/*
* FIXME
* This is a TEMPORARY change until we can pass boot
* command line to multiboot kernels from the boot
* monitor
*
* '\0' separated list of command line options
*/
char cmdline[] = "no_apic=0\0acpi=1";
if (maxsize < sizeof(cmdline) - 1)
panic("cmdline (%d) exceeds maxsize (%d)",
sizeof(cmdline), maxsize);
memcpy(params, cmdline, sizeof(cmdline));
size = sizeof(cmdline);
params[size+1] = '\0';
#endif
phys_copy(seg2phys(mon_ds) + params_offset, vir2phys(params + size),
MIN(maxsize - size, params_size));
phys_copy(seg2phys(mon_ds) + params_offset, vir2phys(params),
MIN(maxsize, params_size));
params[maxsize-1] = '\0';
return OK;
}

View File

@@ -75,6 +75,7 @@ _PROTOTYPE( void exception, (struct exception_frame * frame));
/* klib386.s */
_PROTOTYPE( __dead void monitor, (void) );
_PROTOTYPE( __dead void reset, (void) );
_PROTOTYPE( __dead void x86_triplefault, (void) );
_PROTOTYPE( void int86, (void) );
_PROTOTYPE( reg_t read_cr0, (void) );
_PROTOTYPE( reg_t read_cr2, (void) );

View File

@@ -499,13 +499,13 @@ ENTRY(mem_rdw)
/*===========================================================================*/
/* reset */
/* x86_triplefault */
/*===========================================================================*/
/*
* PUBLIC void reset();
* PUBLIC void x86_triplefault();
* Reset the system by loading IDT with offset 0 and interrupting.
*/
ENTRY(reset)
ENTRY(x86_triplefault)
lidt idt_zero
int $3 /* anything goes, the 386 will not like it */
.data

View File

@@ -316,7 +316,7 @@ PRIVATE void announce(void)
#ifdef _VCS_REVISION
"(" _VCS_REVISION ")\n"
#endif
"Copyright 2010, Vrije Universiteit, Amsterdam, The Netherlands\n",
"Copyright 2012, Vrije Universiteit, Amsterdam, The Netherlands\n",
OS_RELEASE, OS_VERSION);
printf("MINIX is open source software, see http://www.minix3.org\n");
}

View File

@@ -230,6 +230,7 @@ _PROTOTYPE(void disable_fpu_exception, (void));
_PROTOTYPE(void release_fpu, (struct proc * p));
_PROTOTYPE(void arch_pause,(void));
_PROTOTYPE(short cpu_load, (void));
_PROTOTYPE(void busy_delay_ms, (int ms));
/* utility.c */
_PROTOTYPE( void cpu_print_freq, (unsigned cpu));

View File

@@ -5,17 +5,6 @@
#include <assert.h>
#include <stdio.h>
#ifndef __NBSD_LIBC
#include <minix/config.h>
#include <minix/const.h>
#include <minix/sysutil.h>
void __bad_assertion(const char *mess) {
panic("%s", mess);
}
#else /* NBSD_LIBC */
#include <sys/types.h>
#include <stdlib.h>
@@ -24,14 +13,10 @@ __assert13(file, line, function, failedexpr)
const char *file, *function, *failedexpr;
int line;
{
(void)fprintf(stderr,
"assertion \"%s\" failed: file \"%s\", line %d%s%s%s\n",
failedexpr, file, line,
function ? ", function \"" : "",
function ? function : "",
function ? "\"" : "");
abort();
(void)printf("%s:%d: assert \"%s\" failed", file, line, failedexpr);
if(function) printf(", function \"%s\"", function);
printf("\n");
panic("assert failed");
/* NOTREACHED */
}
@@ -44,5 +29,3 @@ __assert(file, line, failedexpr)
__assert13(file, line, NULL, failedexpr);
/* NOTREACHED */
}
#endif /* NBSD_LIBC */

View File

@@ -206,30 +206,13 @@ struct fproc *rfp;
cp = strrchr(resolve->l_path, '/');
if (cp == NULL) {
/* Just an entry in the current working directory */
struct vmnt *vmp;
vmp = find_vmnt(start_dir->v_fs_e);
if (vmp == NULL) {
r = EIO;
res_vp = NULL;
break;
}
r = lock_vmnt(vmp, resolve->l_vmnt_lock);
if (r == EDEADLK) {
res_vp = NULL;
break;
} else if (r == OK)
*resolve->l_vmp = vmp;
lock_vnode(start_dir, resolve->l_vnode_lock);
*resolve->l_vnode = start_dir;
dup_vnode(start_dir);
if (loop_start != NULL) {
unlock_vnode(loop_start);
put_vnode(loop_start);
}
return(start_dir);
/* Just an entry in the current working directory. Prepend
* "./" in front of the path and resolve it.
*/
strncpy(dir_entry, resolve->l_path, NAME_MAX);
dir_entry[NAME_MAX] = '\0';
resolve->l_path[0] = '.';
resolve->l_path[1] = '\0';
} else if (cp[1] == '\0') {
/* Path ends in a slash. The directory entry is '.' */
strcpy(dir_entry, ".");
@@ -271,16 +254,6 @@ struct fproc *rfp;
symlink.l_vmnt_lock = VMNT_READ;
sym_vp = advance(res_vp, &symlink, rfp);
/* Advance caused us to either switch to a different vmnt or we're
* still at the same vmnt. The former might've yielded a new vmnt lock,
* the latter should not have. Verify. */
if (sym_vmp != NULL) {
/* We got a vmnt lock, so the endpoints of the vnodes must
* differ.
*/
assert(sym_vp->v_fs_e != res_vp->v_fs_e);
}
if (sym_vp != NULL && S_ISLNK(sym_vp->v_mode)) {
/* Last component is a symlink, but if we've been asked to not
* resolve it, return now.
@@ -351,6 +324,10 @@ struct fproc *rfp;
/* Copy the directory entry back to user_fullpath */
strncpy(resolve->l_path, dir_entry, NAME_MAX + 1);
/* Turn PATH_RET_SYMLINK flag back on if it was on */
if (ret_on_symlink) resolve->l_flags |= PATH_RET_SYMLINK;
return(res_vp);
}

View File

@@ -298,8 +298,9 @@ common_load_kernel(const char *file, u_long *basemem, u_long *extmem,
close(fd);
/* Now we know the root fs type, load modules for it. */
module_add(fsmod);
if (fsmod2 != NULL && strcmp(fsmod, fsmod2) != 0)
if (fsmod != NULL)
module_add(fsmod);
if (fsmod !=NULL && fsmod2 != NULL && strcmp(fsmod, fsmod2) != 0)
module_add(fsmod2);
/*

View File

@@ -19,7 +19,11 @@ u_char bcea[6] = BA; /* broadcast ethernet address */
char rootpath[FNAME_SIZE]; /* root mount path */
char bootfile[FNAME_SIZE]; /* bootp says to boot this */
char hostname[FNAME_SIZE]; /* our hostname */
#ifdef __minix
char *fsmod = NULL;
#else
char *fsmod = "ffs"; /* guessed file system module name */
#endif
char *fsmod2; /* a requisite module */
struct in_addr myip; /* my ip address */
struct in_addr rootip; /* root ip address */

View File

@@ -41,6 +41,7 @@ nano-
nawk-
ncurses-
neon-
netdrv_tg3-
openssh-
openssl-
p5-Digest-SHA1-

View File

@@ -14,7 +14,7 @@
#include <unistd.h>
#include <getopt.h>
#define BOOTPROG_LOAD_START 0x05000000ULL
#define BOOTPROG_LOAD_START 0x01000000ULL
int nflag = 0;