Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
116fcea5be | ||
|
|
d991abdd34 | ||
|
|
dd9c147444 | ||
|
|
60a4f87b0b | ||
|
|
16a468ccec | ||
|
|
f55f1f3e52 | ||
|
|
47627954a0 | ||
|
|
72cab7a281 | ||
|
|
93a8d9f260 | ||
|
|
665ce9d4e1 | ||
|
|
3b3ea9dc32 |
@@ -29,6 +29,10 @@ BINDIR= /usr/bin
|
|||||||
LINKS+= ${BINDIR}/elvis ${BINDIR}/vi
|
LINKS+= ${BINDIR}/elvis ${BINDIR}/vi
|
||||||
.endif
|
.endif
|
||||||
|
|
||||||
|
.if !exists(${BINDIR}/ex)
|
||||||
|
LINKS+= ${BINDIR}/elvis ${BINDIR}/ex
|
||||||
|
.endif
|
||||||
|
|
||||||
MAN.elvis=
|
MAN.elvis=
|
||||||
MAN.ctags=
|
MAN.ctags=
|
||||||
MAN.ref=
|
MAN.ref=
|
||||||
|
|||||||
@@ -364,3 +364,13 @@ PUBLIC short cpu_load(void)
|
|||||||
*last_idle = *current_idle;
|
*last_idle = *current_idle;
|
||||||
return load;
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -63,6 +63,62 @@ PUBLIC __dead void arch_monitor(void)
|
|||||||
monitor();
|
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)
|
PRIVATE __dead void arch_bios_poweroff(void)
|
||||||
{
|
{
|
||||||
u32_t cr0;
|
u32_t cr0;
|
||||||
@@ -609,31 +665,9 @@ u32_t params_size, params_offset, mon_ds;
|
|||||||
|
|
||||||
PUBLIC int arch_get_params(char *params, int maxsize)
|
PUBLIC int arch_get_params(char *params, int maxsize)
|
||||||
{
|
{
|
||||||
int size = 0;
|
phys_copy(seg2phys(mon_ds) + params_offset, vir2phys(params),
|
||||||
|
MIN(maxsize, params_size));
|
||||||
#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));
|
|
||||||
params[maxsize-1] = '\0';
|
params[maxsize-1] = '\0';
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -75,6 +75,7 @@ _PROTOTYPE( void exception, (struct exception_frame * frame));
|
|||||||
/* klib386.s */
|
/* klib386.s */
|
||||||
_PROTOTYPE( __dead void monitor, (void) );
|
_PROTOTYPE( __dead void monitor, (void) );
|
||||||
_PROTOTYPE( __dead void reset, (void) );
|
_PROTOTYPE( __dead void reset, (void) );
|
||||||
|
_PROTOTYPE( __dead void x86_triplefault, (void) );
|
||||||
_PROTOTYPE( void int86, (void) );
|
_PROTOTYPE( void int86, (void) );
|
||||||
_PROTOTYPE( reg_t read_cr0, (void) );
|
_PROTOTYPE( reg_t read_cr0, (void) );
|
||||||
_PROTOTYPE( reg_t read_cr2, (void) );
|
_PROTOTYPE( reg_t read_cr2, (void) );
|
||||||
|
|||||||
@@ -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.
|
* Reset the system by loading IDT with offset 0 and interrupting.
|
||||||
*/
|
*/
|
||||||
ENTRY(reset)
|
ENTRY(x86_triplefault)
|
||||||
lidt idt_zero
|
lidt idt_zero
|
||||||
int $3 /* anything goes, the 386 will not like it */
|
int $3 /* anything goes, the 386 will not like it */
|
||||||
.data
|
.data
|
||||||
|
|||||||
@@ -316,7 +316,7 @@ PRIVATE void announce(void)
|
|||||||
#ifdef _VCS_REVISION
|
#ifdef _VCS_REVISION
|
||||||
"(" _VCS_REVISION ")\n"
|
"(" _VCS_REVISION ")\n"
|
||||||
#endif
|
#endif
|
||||||
"Copyright 2010, Vrije Universiteit, Amsterdam, The Netherlands\n",
|
"Copyright 2012, Vrije Universiteit, Amsterdam, The Netherlands\n",
|
||||||
OS_RELEASE, OS_VERSION);
|
OS_RELEASE, OS_VERSION);
|
||||||
printf("MINIX is open source software, see http://www.minix3.org\n");
|
printf("MINIX is open source software, see http://www.minix3.org\n");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -230,6 +230,7 @@ _PROTOTYPE(void disable_fpu_exception, (void));
|
|||||||
_PROTOTYPE(void release_fpu, (struct proc * p));
|
_PROTOTYPE(void release_fpu, (struct proc * p));
|
||||||
_PROTOTYPE(void arch_pause,(void));
|
_PROTOTYPE(void arch_pause,(void));
|
||||||
_PROTOTYPE(short cpu_load, (void));
|
_PROTOTYPE(short cpu_load, (void));
|
||||||
|
_PROTOTYPE(void busy_delay_ms, (int ms));
|
||||||
|
|
||||||
/* utility.c */
|
/* utility.c */
|
||||||
_PROTOTYPE( void cpu_print_freq, (unsigned cpu));
|
_PROTOTYPE( void cpu_print_freq, (unsigned cpu));
|
||||||
|
|||||||
@@ -5,17 +5,6 @@
|
|||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <stdio.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 <sys/types.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
@@ -24,14 +13,10 @@ __assert13(file, line, function, failedexpr)
|
|||||||
const char *file, *function, *failedexpr;
|
const char *file, *function, *failedexpr;
|
||||||
int line;
|
int line;
|
||||||
{
|
{
|
||||||
|
(void)printf("%s:%d: assert \"%s\" failed", file, line, failedexpr);
|
||||||
(void)fprintf(stderr,
|
if(function) printf(", function \"%s\"", function);
|
||||||
"assertion \"%s\" failed: file \"%s\", line %d%s%s%s\n",
|
printf("\n");
|
||||||
failedexpr, file, line,
|
panic("assert failed");
|
||||||
function ? ", function \"" : "",
|
|
||||||
function ? function : "",
|
|
||||||
function ? "\"" : "");
|
|
||||||
abort();
|
|
||||||
/* NOTREACHED */
|
/* NOTREACHED */
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -44,5 +29,3 @@ __assert(file, line, failedexpr)
|
|||||||
__assert13(file, line, NULL, failedexpr);
|
__assert13(file, line, NULL, failedexpr);
|
||||||
/* NOTREACHED */
|
/* NOTREACHED */
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* NBSD_LIBC */
|
|
||||||
|
|||||||
@@ -206,30 +206,13 @@ struct fproc *rfp;
|
|||||||
|
|
||||||
cp = strrchr(resolve->l_path, '/');
|
cp = strrchr(resolve->l_path, '/');
|
||||||
if (cp == NULL) {
|
if (cp == NULL) {
|
||||||
/* Just an entry in the current working directory */
|
/* Just an entry in the current working directory. Prepend
|
||||||
struct vmnt *vmp;
|
* "./" in front of the path and resolve it.
|
||||||
|
*/
|
||||||
vmp = find_vmnt(start_dir->v_fs_e);
|
strncpy(dir_entry, resolve->l_path, NAME_MAX);
|
||||||
if (vmp == NULL) {
|
dir_entry[NAME_MAX] = '\0';
|
||||||
r = EIO;
|
resolve->l_path[0] = '.';
|
||||||
res_vp = NULL;
|
resolve->l_path[1] = '\0';
|
||||||
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);
|
|
||||||
} else if (cp[1] == '\0') {
|
} else if (cp[1] == '\0') {
|
||||||
/* Path ends in a slash. The directory entry is '.' */
|
/* Path ends in a slash. The directory entry is '.' */
|
||||||
strcpy(dir_entry, ".");
|
strcpy(dir_entry, ".");
|
||||||
@@ -271,16 +254,6 @@ struct fproc *rfp;
|
|||||||
symlink.l_vmnt_lock = VMNT_READ;
|
symlink.l_vmnt_lock = VMNT_READ;
|
||||||
sym_vp = advance(res_vp, &symlink, rfp);
|
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)) {
|
if (sym_vp != NULL && S_ISLNK(sym_vp->v_mode)) {
|
||||||
/* Last component is a symlink, but if we've been asked to not
|
/* Last component is a symlink, but if we've been asked to not
|
||||||
* resolve it, return now.
|
* resolve it, return now.
|
||||||
@@ -351,6 +324,10 @@ struct fproc *rfp;
|
|||||||
|
|
||||||
/* Copy the directory entry back to user_fullpath */
|
/* Copy the directory entry back to user_fullpath */
|
||||||
strncpy(resolve->l_path, dir_entry, NAME_MAX + 1);
|
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);
|
return(res_vp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -298,8 +298,9 @@ common_load_kernel(const char *file, u_long *basemem, u_long *extmem,
|
|||||||
close(fd);
|
close(fd);
|
||||||
|
|
||||||
/* Now we know the root fs type, load modules for it. */
|
/* Now we know the root fs type, load modules for it. */
|
||||||
module_add(fsmod);
|
if (fsmod != NULL)
|
||||||
if (fsmod2 != NULL && strcmp(fsmod, fsmod2) != 0)
|
module_add(fsmod);
|
||||||
|
if (fsmod !=NULL && fsmod2 != NULL && strcmp(fsmod, fsmod2) != 0)
|
||||||
module_add(fsmod2);
|
module_add(fsmod2);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -19,7 +19,11 @@ u_char bcea[6] = BA; /* broadcast ethernet address */
|
|||||||
char rootpath[FNAME_SIZE]; /* root mount path */
|
char rootpath[FNAME_SIZE]; /* root mount path */
|
||||||
char bootfile[FNAME_SIZE]; /* bootp says to boot this */
|
char bootfile[FNAME_SIZE]; /* bootp says to boot this */
|
||||||
char hostname[FNAME_SIZE]; /* our hostname */
|
char hostname[FNAME_SIZE]; /* our hostname */
|
||||||
|
#ifdef __minix
|
||||||
|
char *fsmod = NULL;
|
||||||
|
#else
|
||||||
char *fsmod = "ffs"; /* guessed file system module name */
|
char *fsmod = "ffs"; /* guessed file system module name */
|
||||||
|
#endif
|
||||||
char *fsmod2; /* a requisite module */
|
char *fsmod2; /* a requisite module */
|
||||||
struct in_addr myip; /* my ip address */
|
struct in_addr myip; /* my ip address */
|
||||||
struct in_addr rootip; /* root ip address */
|
struct in_addr rootip; /* root ip address */
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ nano-
|
|||||||
nawk-
|
nawk-
|
||||||
ncurses-
|
ncurses-
|
||||||
neon-
|
neon-
|
||||||
|
netdrv_tg3-
|
||||||
openssh-
|
openssh-
|
||||||
openssl-
|
openssl-
|
||||||
p5-Digest-SHA1-
|
p5-Digest-SHA1-
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <getopt.h>
|
#include <getopt.h>
|
||||||
|
|
||||||
#define BOOTPROG_LOAD_START 0x05000000ULL
|
#define BOOTPROG_LOAD_START 0x01000000ULL
|
||||||
|
|
||||||
int nflag = 0;
|
int nflag = 0;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user