Basic VM and other minor improvements.
Not complete, probably not fully debugged or optimized.
This commit is contained in:
20
boot/boot.c
20
boot/boot.c
@@ -18,6 +18,7 @@ char version[]= "2.20";
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <ibm/partition.h>
|
||||
#include <ibm/bios.h>
|
||||
#include <minix/config.h>
|
||||
#include <minix/type.h>
|
||||
#include <minix/com.h>
|
||||
@@ -28,6 +29,7 @@ char version[]= "2.20";
|
||||
#if BIOS
|
||||
#include <kernel/const.h>
|
||||
#include <kernel/type.h>
|
||||
#include <sys/video.h>
|
||||
#endif
|
||||
#if UNIX
|
||||
#include <stdio.h>
|
||||
@@ -46,6 +48,10 @@ char version[]= "2.20";
|
||||
#define arraylimit(a) ((a) + arraysize(a))
|
||||
#define between(a, c, z) ((unsigned) ((c) - (a)) <= ((z) - (a)))
|
||||
|
||||
u16_t vid_port; /* Video i/o port. */
|
||||
u32_t vid_mem_base; /* Video memory base address. */
|
||||
u32_t vid_mem_size; /* Video memory size. */
|
||||
|
||||
int fsok= -1; /* File system state. Initially unknown. */
|
||||
|
||||
static int block_size;
|
||||
@@ -590,6 +596,19 @@ void initialize(void)
|
||||
bootdev.name[5] += bootdev.secondary;
|
||||
}
|
||||
|
||||
/* Find out about the video hardware. */
|
||||
raw_copy(mon2abs(&vid_port), VDU_CRT_BASE_ADDR, sizeof(vid_port));
|
||||
if(vid_port == C_6845) {
|
||||
vid_mem_base = COLOR_BASE;
|
||||
vid_mem_size = COLOR_SIZE;
|
||||
} else {
|
||||
vid_mem_base = MONO_BASE;
|
||||
vid_mem_size = MONO_SIZE;
|
||||
}
|
||||
|
||||
if(get_video() >= 3)
|
||||
vid_mem_size = EGA_SIZE;
|
||||
|
||||
#else /* DOS */
|
||||
/* Take the monitor out of the memory map if we have memory to spare,
|
||||
* note that only half our PSP is needed at the new place, the first
|
||||
@@ -1959,3 +1978,4 @@ void main(int argc, char **argv)
|
||||
/*
|
||||
* $PchId: boot.c,v 1.14 2002/02/27 19:46:14 philip Exp $
|
||||
*/
|
||||
|
||||
|
||||
@@ -18,6 +18,8 @@
|
||||
#include <minix/const.h>
|
||||
#include <minix/type.h>
|
||||
#include <minix/syslib.h>
|
||||
#include <minix/tty.h>
|
||||
#include <sys/video.h>
|
||||
#include <kernel/const.h>
|
||||
#include <kernel/type.h>
|
||||
#include <ibm/partition.h>
|
||||
@@ -27,6 +29,10 @@
|
||||
|
||||
static int block_size = 0;
|
||||
|
||||
extern u16_t vid_port; /* Video i/o port. */
|
||||
extern u32_t vid_mem_base; /* Video memory base address. */
|
||||
extern u32_t vid_mem_size; /* Video memory size. */
|
||||
|
||||
#define click_shift clck_shft /* 7 char clash with click_size. */
|
||||
|
||||
/* Some kernels have extra features: */
|
||||
@@ -376,6 +382,42 @@ int get_segment(u32_t *vsec, long *size, u32_t *addr, u32_t limit)
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void restore_screen(void)
|
||||
{
|
||||
struct boot_tty_info boot_tty_info;
|
||||
u32_t info_location;
|
||||
#define LINES 25
|
||||
#define CHARS 80
|
||||
static u16_t consolescreen[LINES][CHARS];
|
||||
|
||||
/* Try and find out what the main console was displaying
|
||||
* by looking into video memory.
|
||||
*/
|
||||
|
||||
info_location = vid_mem_base+vid_mem_size-sizeof(boot_tty_info);
|
||||
raw_copy(mon2abs(&boot_tty_info), info_location,
|
||||
sizeof(boot_tty_info));
|
||||
|
||||
if(boot_tty_info.magic == TTYMAGIC) {
|
||||
if(boot_tty_info.flags & (BTIF_CONSORIGIN|BTIF_CONSCURSOR) ==
|
||||
(BTIF_CONSORIGIN|BTIF_CONSCURSOR)) {
|
||||
int line;
|
||||
raw_copy(mon2abs(consolescreen),
|
||||
vid_mem_base + boot_tty_info.consorigin,
|
||||
sizeof(consolescreen));
|
||||
clear_screen();
|
||||
for(line = 0; line < LINES; line++) {
|
||||
int ch;
|
||||
for(ch = 0; ch < CHARS; ch++) {
|
||||
u16_t newch = consolescreen[line][ch] & BYTE;
|
||||
if(newch < ' ') newch = ' ';
|
||||
putch(newch);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void exec_image(char *image)
|
||||
/* Get a Minix image into core, patch it up and execute. */
|
||||
{
|
||||
@@ -607,8 +649,13 @@ void exec_image(char *image)
|
||||
|
||||
/* Read leftover character, if any. */
|
||||
scan_keyboard();
|
||||
|
||||
/* Restore screen contents. */
|
||||
restore_screen();
|
||||
}
|
||||
|
||||
|
||||
|
||||
ino_t latest_version(char *version, struct stat *stp)
|
||||
/* Recursively read the current directory, selecting the newest image on
|
||||
* the way up. (One can't use r_stat while reading a directory.)
|
||||
|
||||
18
boot/rawfs.c
18
boot/rawfs.c
@@ -61,7 +61,7 @@ static char dirbuf[_MAX_BLOCK_SIZE]; /* Scratch/Directory block. */
|
||||
static block_t a_indir, a_dindir; /* Addresses of the indirects. */
|
||||
static off_t dirpos; /* Reading pos in a dir. */
|
||||
|
||||
#define fsbuf(b) (* (struct buf *) (b))
|
||||
#define fsbuf(b) (* (union fsdata_u *) (b))
|
||||
|
||||
#define zone_shift (super.s_log_zone_size) /* zone to block ratio */
|
||||
|
||||
@@ -110,6 +110,7 @@ void r_stat(Ino_t inum, struct stat *stp)
|
||||
block_t block;
|
||||
block_t ino_block;
|
||||
ino_t ino_offset;
|
||||
union fsdata_u *blockbuf;
|
||||
|
||||
/* Calculate start of i-list */
|
||||
block = START_BLOCK + super.s_imap_blocks + super.s_zmap_blocks;
|
||||
@@ -120,13 +121,14 @@ void r_stat(Ino_t inum, struct stat *stp)
|
||||
block += ino_block;
|
||||
|
||||
/* Fetch the block */
|
||||
readblock(block, scratch, block_size);
|
||||
blockbuf = (union fsdata_u *) scratch;
|
||||
readblock(block, blockbuf, block_size);
|
||||
|
||||
if (super.s_magic == SUPER_V2 || super.s_magic == SUPER_V3) {
|
||||
d2_inode *dip;
|
||||
int i;
|
||||
|
||||
dip= &fsbuf(scratch).b_v2_ino[ino_offset];
|
||||
dip= &blockbuf->b__v2_ino[ino_offset];
|
||||
|
||||
curfil.i_mode= dip->d2_mode;
|
||||
curfil.i_nlinks= dip->d2_nlinks;
|
||||
@@ -142,7 +144,7 @@ void r_stat(Ino_t inum, struct stat *stp)
|
||||
d1_inode *dip;
|
||||
int i;
|
||||
|
||||
dip= &fsbuf(scratch).b_v1_ino[ino_offset];
|
||||
dip= &blockbuf->b__v1_ino[ino_offset];
|
||||
|
||||
curfil.i_mode= dip->d1_mode;
|
||||
curfil.i_nlinks= dip->d1_nlinks;
|
||||
@@ -263,8 +265,8 @@ off_t r_vir2abs(off_t virblk)
|
||||
|
||||
i = zone / (zone_t) nr_indirects;
|
||||
ind_zone = (super.s_magic == SUPER_V2 || super.s_magic == SUPER_V3)
|
||||
? fsbuf(dindir).b_v2_ind[i]
|
||||
: fsbuf(dindir).b_v1_ind[i];
|
||||
? fsbuf(dindir).b__v2_ind[i]
|
||||
: fsbuf(dindir).b__v1_ind[i];
|
||||
zone %= (zone_t) nr_indirects;
|
||||
}
|
||||
if (ind_zone == 0) return 0;
|
||||
@@ -276,8 +278,8 @@ off_t r_vir2abs(off_t virblk)
|
||||
a_indir= z;
|
||||
}
|
||||
zone = (super.s_magic == SUPER_V2 || super.s_magic == SUPER_V3)
|
||||
? fsbuf(indir).b_v2_ind[(int) zone]
|
||||
: fsbuf(indir).b_v1_ind[(int) zone];
|
||||
? fsbuf(indir).b__v2_ind[(int) zone]
|
||||
: fsbuf(indir).b__v1_ind[(int) zone];
|
||||
|
||||
/* Calculate absolute datablock number */
|
||||
z = ((block_t) zone << zone_shift) + zone_index;
|
||||
|
||||
Reference in New Issue
Block a user