Skip to content

Commit

Permalink
Cleanup boot code, update ps man page
Browse files Browse the repository at this point in the history
  • Loading branch information
ghaerr committed Feb 18, 2022
1 parent eda0b81 commit 9dc42c2
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 83 deletions.
19 changes: 2 additions & 17 deletions bootblocks/boot_minix.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,11 @@

// Global variables

//extern int sect_max;
//extern int head_max;
//extern int track_max;

// Uninitialized data is not set to zero by default
// as the context is not a user process
// but code loaded in uninitialized memory

byte_t sb_block [BLOCK_SIZE]; // super block block buffer
static byte_t sb_block [BLOCK_SIZE]; // super block block buffer
#define sb_data ((struct super_block *)sb_block)

static int i_now;
Expand Down Expand Up @@ -51,8 +47,7 @@ void puts (const char * s);

int seg_data ();

void disk_read (const int sect, const int count,
const byte_t * buf, const int seg);
void disk_read (const int sect, const int count, const byte_t * buf, const int seg);

void run_prog ();

Expand All @@ -76,16 +71,6 @@ static void load_file ();

void load_prog ()
{
/*
puts ("C=");
word_hex (track_max);
puts (" H=");
word_hex (head_max);
puts (" S=");
word_hex (sect_max);
puts ("\r\n");
*/

load_super ();

i_boot = i_now = 0;
Expand Down
54 changes: 4 additions & 50 deletions bootblocks/boot_sect.S
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
// Japanese NEC PC98

#if defined(CONFIG_IMG_FD1232)
#define BOOTSEGM 0x1FC0
#define BOOTSEG 0x1FC0
#define SECTOR_SIZE 1024
#else
#define BOOTSEGM 0x1FE0
#define BOOTSEG 0x1FE0
#define SECTOR_SIZE 512
#endif
#define MEMTOPSEG 0xA000 // 640K memory
Expand Down Expand Up @@ -107,8 +107,8 @@ entry1:
xor %sp,%sp

xor %di,%di
#ifdef BOOTSEGM
mov $BOOTSEGM,%ax // DS:SI = BOOTSEGM:0
#ifdef BOOTSEG
mov $BOOTSEG,%ax // DS:SI = BOOTSEG:0
mov %ax,%ds
xor %si,%si
#else
Expand Down Expand Up @@ -526,52 +526,6 @@ dr_exit:

run_prog:

/*
static
run_prog()
{
// It all worked, run the loaded executable
#asm
#ifdef HARDDISK
mov dx,[bootpart+2]
xchg dh,dl ! DX => hard drive
push [bootpart] ! CX => partition offset
xor si,si
#else
xor dx,dx ! DX=0 => floppy drive
push dx ! CX=0 => partition offset = 0
mov si,[_n_sectors] ! Save for monitor.out
#endif
mov bx,#LOADSEG
mov ds,bx ! DS = loadaddress
xor di,di ! Zero
mov ax,[di]
cmp ax,#0x0301 ! Right magic ?
jnz binfile ! Yuk ... assume .SYS
inc bx
inc bx ! bx = initial CS
mov ax,[di+2]
and ax,#$20 ! Is it split I/D ?
jz impure ! No ...
mov cl,#4
mov ax,[di+8]
shr ax,cl
impure:
pop cx
add ax,bx
mov ss,ax
mov sp,[di+24] ! Chmem value
mov ds,ax
binfile:
push bx
push di ! jmpi 0,#LOADSEG+2
retf
#endasm
}
*/

mov drive_num,%dl
xor %dh,%dh
mov sect_offset,%cx
Expand Down
2 changes: 1 addition & 1 deletion elks/arch/i86/boot/bootsect.S
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ SETUPSECS = 4 /* nr of setup-sectors */
BOOTSEG = 0x07C0 /* original address of boot-sector */
INITSEG = DEF_INITSEG /* we move boot here - out of the way */
SETUPSEG = DEF_SETUPSEG
SYSSEG = DEF_SYSSEG /* system loaded at 0x10000 (65536). */
SYSSEG = DEF_SYSSEG /* initial kernel load address */
SYSSEGB = DEF_SYSSEG + 2

// ROOT_DEV is now written by "build".
Expand Down
2 changes: 1 addition & 1 deletion elks/arch/i86/boot/setup.S
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
! 0x1f2: ROOTFLAGS word UNUSED
! 0x1f4: syssize word in paragraphs, written by build tool
! 0x1f6: elks_flags byte EF_xxx
! 0x1f7: byte UNUSED
! 0x1f7: byte UNUSED
! 0x1f8: RAMDISK word UNUSED
! 0x1fa: SVGA_MODE word UNUSED
! 0x1fc: root_dev word Either BIOS boot device or actual kdev_t ROOT_DEV
Expand Down
1 change: 0 additions & 1 deletion elks/include/linuxmt/boot.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
#define __LINUXMT_BOOT_H

/* Root flags */

#define RF_NONE 0
#define RF_RO 1

Expand Down
22 changes: 9 additions & 13 deletions elkscmd/sys_utils/ps.1
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,16 @@ ps \- list processes
.SH SYNOPSIS
.B ps
.SH DESCRIPTION
This document describes the ELKS version of
.BR ps .
This version is extremely minimal and should not be used whenever using a
better version is practical. It is also uterly non-portable as it accesses
the kernel task structure directly.
.PP
.BR ps
prints a list of all the processes currently running on the system giving on
a line for each process, its process id, process group, owner, state,
the kernel inode address of the corresponding binary and the name of the
process. The state is given either as R for running, or S for sleeping.
The kernel inode address is included as an aid to debugging the kernel,
and provides no other useful information. The name of the process
is taken from its argv[0] as passed to its main function.
prints a list of all the processes currently running on the system, giving
a line for each process. The process id, process group, tty, user, state,
the kernel code and data segment address of the corresponding binary, the process
heap total and free, overall process memory size, and the process name
and command line are displayed.
.PP
The state is given either as R for running, or S for interruptible sleeping,
s for uninterruptible sleeping, T for stopped, Z for zombie and E for exiting.
The name of the process is taken from its argv[0] as passed to its main function.
.SH EXAMPLES
.IP
ps
Expand Down

0 comments on commit 9dc42c2

Please sign in to comment.