feat: e100e Ethernet driver, ramdisk reorganization, shell rewrite, web server/client, and more
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
.TH DHCP 1
|
||||
.SH NAME
|
||||
dhcp - obtain network configuration via DHCP
|
||||
|
||||
.SH SYNOPSIS
|
||||
dhcp
|
||||
|
||||
.SH DESCRIPTION
|
||||
The DHCP client automatically obtains an IP address, subnet mask,
|
||||
default gateway, and other network parameters from a DHCP server
|
||||
on the local network using the Dynamic Host Configuration Protocol
|
||||
(RFC 2131).
|
||||
|
||||
On success the network configuration is applied immediately via
|
||||
set_netcfg(). On failure the original configuration is restored.
|
||||
|
||||
The client is run automatically by the init system at boot, but
|
||||
may also be invoked manually from the shell.
|
||||
|
||||
.SH PROTOCOL
|
||||
The client performs the standard four-message DHCP exchange:
|
||||
|
||||
1. DHCPDISCOVER Broadcast to 255.255.255.255:67
|
||||
2. DHCPOFFER Server offers an IP address
|
||||
3. DHCPREQUEST Client accepts the offered address
|
||||
4. DHCPACK Server confirms the lease
|
||||
|
||||
The BROADCAST flag (0x8000) is set so that server replies are
|
||||
sent to the broadcast address, since the client has no IP yet.
|
||||
|
||||
Each step has a 10-second timeout. If no response is received
|
||||
the client exits with an error and restores the previous config.
|
||||
|
||||
.SH OUTPUT
|
||||
On success the client prints the assigned configuration:
|
||||
|
||||
IP Address, Subnet Mask, Gateway, DNS Server, Lease Time
|
||||
|
||||
.SH OPTIONS
|
||||
The DHCP client requests the following options from the server:
|
||||
|
||||
1 Subnet Mask
|
||||
3 Router (default gateway)
|
||||
6 DNS Server
|
||||
51 Lease Time
|
||||
|
||||
.SH SEE ALSO
|
||||
ifconfig(1), shell(1), syscalls(2)
|
||||
@@ -0,0 +1,51 @@
|
||||
.TH EDIT 1
|
||||
.SH NAME
|
||||
edit - text editor for ZenithOS
|
||||
|
||||
.SH SYNOPSIS
|
||||
edit [filename]
|
||||
|
||||
.SH DESCRIPTION
|
||||
edit is an interactive text editor. When invoked with a filename,
|
||||
it opens the file for editing. If the file does not exist, a new
|
||||
empty buffer is created and will be saved to that path on write.
|
||||
|
||||
When invoked without arguments, edit opens an empty buffer. You
|
||||
will be prompted for a filename when saving.
|
||||
|
||||
.SH KEYBOARD SHORTCUTS
|
||||
|
||||
.SS Navigation
|
||||
Arrow Keys Move cursor up/down/left/right
|
||||
Home Move to start of line
|
||||
End Move to end of line
|
||||
Page Up Scroll up one page
|
||||
Page Down Scroll down one page
|
||||
|
||||
.SS Editing
|
||||
Backspace Delete character before cursor
|
||||
Delete Delete character at cursor
|
||||
Enter Insert new line
|
||||
Tab Insert 4 spaces
|
||||
|
||||
.SS Commands
|
||||
Ctrl+S Save file
|
||||
Ctrl+Q Quit (warns if unsaved changes)
|
||||
Ctrl+F Search for text
|
||||
Ctrl+G Find next occurrence
|
||||
|
||||
.SH DISPLAY
|
||||
The top line shows the filename, a modified indicator [+],
|
||||
and the current cursor position (Ln, Col).
|
||||
|
||||
The bottom line shows keyboard shortcuts or status messages.
|
||||
|
||||
Line numbers are displayed in a gutter on the left side.
|
||||
Lines past the end of the file are marked with ~.
|
||||
|
||||
.SH EXAMPLES
|
||||
edit intro.1 Edit a file
|
||||
edit Open a new empty buffer
|
||||
|
||||
.SH SEE ALSO
|
||||
cat(1), shell(1)
|
||||
+6
-4
@@ -12,13 +12,13 @@
|
||||
.SH DESCRIPTION
|
||||
ZenithOS provides a simple read-only Virtual File System (VFS)
|
||||
backed by the boot ramdisk. Files are accessed via paths in the
|
||||
format "<drive>:/<name>", where drive 0 is the ramdisk.
|
||||
format "<drive>:/<path>", where drive 0 is the ramdisk.
|
||||
|
||||
.SS open
|
||||
Opens a file and returns a non-negative handle on success, or a
|
||||
negative value on error (file not found, no free handles).
|
||||
|
||||
int h = zenith::open("0:/shell.elf");
|
||||
int h = zenith::open("0:/os/hello.elf");
|
||||
|
||||
.SS read
|
||||
Reads up to 'size' bytes starting at 'offset' into 'buf'.
|
||||
@@ -42,15 +42,17 @@
|
||||
.SS readdir
|
||||
Lists entries in a directory. Up to 'max' entry names (max 64)
|
||||
are written to the 'names' array. The kernel allocates a user-
|
||||
accessible page for the string data automatically.
|
||||
accessible page for the string data automatically. Directory
|
||||
entries are returned with a trailing slash.
|
||||
|
||||
const char* entries[64];
|
||||
int count = zenith::readdir("0:/", entries, 64);
|
||||
// entries: "os/", "games/", "man/", "www/", "home/"
|
||||
|
||||
.SH READING PATTERN
|
||||
The standard pattern for reading a file:
|
||||
|
||||
int h = zenith::open("0:/myfile.txt");
|
||||
int h = zenith::open("0:/man/intro.1");
|
||||
uint64_t size = zenith::getsize(h);
|
||||
uint8_t buf[512];
|
||||
uint64_t off = 0;
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
.TH INIT 1
|
||||
.SH NAME
|
||||
init - ZenithOS init system
|
||||
|
||||
.SH SYNOPSIS
|
||||
Spawned automatically by the kernel as PID 0.
|
||||
|
||||
.SH DESCRIPTION
|
||||
init is the first userspace process started by the ZenithOS
|
||||
kernel. It chains system services in sequence, then launches
|
||||
the interactive shell.
|
||||
|
||||
Each service is spawned as a child process. init waits for it
|
||||
to exit before starting the next one. If a service fails to
|
||||
spawn, init logs an error and continues to the next stage.
|
||||
|
||||
Log output is timestamped and color-coded:
|
||||
|
||||
HH:MM:SS INFO init Starting dhcp
|
||||
HH:MM:SS OK init dhcp finished (pid 1)
|
||||
|
||||
.SH BOOT SEQUENCE
|
||||
The following services are started in order:
|
||||
|
||||
1. 0:/os/dhcp.elf Obtain network configuration via DHCP
|
||||
2. 0:/os/shell.elf Launch the interactive shell
|
||||
|
||||
After the shell exits, init enters an idle loop.
|
||||
|
||||
.SH LOG LEVELS
|
||||
init uses four log levels, each with a distinct color:
|
||||
|
||||
OK Green Service completed successfully
|
||||
INFO Cyan Informational (service starting, etc.)
|
||||
WARN Yellow Non-fatal warning
|
||||
FAIL Red Service failed to start
|
||||
|
||||
.SH SEE ALSO
|
||||
dhcp(1), shell(1), syscalls(2)
|
||||
+22
-6
@@ -19,26 +19,42 @@
|
||||
|
||||
extern "C" void _start() { ... }
|
||||
|
||||
There is no argc/argv. Include <zenith/syscall.h> for the full
|
||||
typed syscall API. Include <zenith/heap.h> for malloc/mfree.
|
||||
There is no argc/argv. Use zenith::getargs() to retrieve any
|
||||
arguments passed by the parent process. Include <zenith/syscall.h>
|
||||
for the full typed syscall API.
|
||||
|
||||
Build with:
|
||||
|
||||
cd programs && make
|
||||
|
||||
The resulting ELF binary appears in programs/bin/.
|
||||
The resulting ELF binary appears in programs/bin/os/.
|
||||
|
||||
.SH RAMDISK LAYOUT
|
||||
The boot ramdisk is mounted as drive 0 with the following
|
||||
directory structure:
|
||||
|
||||
0:/os/ System binaries (shell, init, man, etc.)
|
||||
0:/games/ Games (doom)
|
||||
0:/man/ Manual pages
|
||||
0:/www/ Web server content
|
||||
0:/home/ User home directory
|
||||
|
||||
.SH SHELL
|
||||
The built-in shell is the primary way to interact with ZenithOS.
|
||||
Type 'help' at the shell prompt for a list of commands. Use
|
||||
'man shell' for detailed shell documentation.
|
||||
The interactive shell is the primary way to interact with
|
||||
ZenithOS. Commands are resolved by searching the PATH
|
||||
directories (0:/os/, 0:/games/) for matching .elf binaries.
|
||||
Type 'help' at the shell prompt for a list of commands.
|
||||
Use 'man shell' for detailed shell documentation.
|
||||
|
||||
.SH MAN PAGES
|
||||
The following man pages are available:
|
||||
|
||||
intro(1) This page
|
||||
shell(1) Shell commands reference
|
||||
init(1) Init system
|
||||
dhcp(1) DHCP client
|
||||
man(1) The man command itself
|
||||
legal(7) Copyright and legal information
|
||||
syscalls(2) Overview of all syscalls
|
||||
spawn(2) Process spawning
|
||||
file(2) File I/O syscalls
|
||||
|
||||
+4
-2
@@ -11,7 +11,7 @@
|
||||
fullscreen pager. Pages are stored as plain text files with
|
||||
simple formatting directives.
|
||||
|
||||
If no section is specified, sections 1, 2, and 3 are searched
|
||||
If no section is specified, sections 1 through 7 are searched
|
||||
in order. If a section number is given, only that section is
|
||||
checked.
|
||||
|
||||
@@ -27,9 +27,10 @@
|
||||
q Quit
|
||||
|
||||
.SH SECTIONS
|
||||
1 User commands (shell built-ins)
|
||||
1 User commands and programs
|
||||
2 System calls (kernel interface)
|
||||
3 Library functions (userspace libraries)
|
||||
7 Miscellaneous (legal, conventions)
|
||||
|
||||
.SH FILES
|
||||
Man pages are stored on the ramdisk at:
|
||||
@@ -42,6 +43,7 @@
|
||||
man intro View the introduction
|
||||
man 2 syscalls View syscall overview (section 2)
|
||||
man malloc View malloc documentation
|
||||
man legal View copyright information
|
||||
|
||||
.SH SEE ALSO
|
||||
intro(1), shell(1), syscalls(2)
|
||||
|
||||
+77
-42
@@ -3,66 +3,101 @@
|
||||
shell - ZenithOS interactive command shell
|
||||
|
||||
.SH DESCRIPTION
|
||||
The ZenithOS shell is a simple command interpreter that runs as
|
||||
the first userspace process. It provides basic file inspection,
|
||||
process management, networking, and documentation access.
|
||||
The ZenithOS shell is a command interpreter launched by init
|
||||
after system services have started. It provides command
|
||||
execution, file navigation, and command history.
|
||||
|
||||
.SH COMMANDS
|
||||
Commands are either shell builtins or external programs. When
|
||||
a command is not a builtin, the shell searches for a matching
|
||||
ELF binary and executes it as a child process.
|
||||
|
||||
.SH COMMAND RESOLUTION
|
||||
When a non-builtin command is entered, the shell searches for
|
||||
a matching binary in the following order:
|
||||
|
||||
1. 0:/os/<command>.elf
|
||||
2. 0:/games/<command>.elf
|
||||
3. 0:/<cwd>/<command>.elf (if cwd is set)
|
||||
4. 0:/<command>.elf
|
||||
|
||||
The first match is spawned and the shell waits for it to exit.
|
||||
If no match is found, the shell prints:
|
||||
|
||||
<command>: command not found
|
||||
|
||||
Arguments after the command name are passed to the spawned
|
||||
process. File path arguments are resolved against the current
|
||||
working directory before being passed to external programs.
|
||||
|
||||
.SH BUILTINS
|
||||
|
||||
.SS help
|
||||
Display a list of available commands.
|
||||
|
||||
.SS info
|
||||
Show the OS name, version, and syscall API version number.
|
||||
|
||||
.SS man <topic>
|
||||
Open a manual page in the fullscreen pager. See man(1).
|
||||
Display a categorized list of available commands.
|
||||
|
||||
.SS ls [dir]
|
||||
List files in the current directory, or in the specified
|
||||
directory. When a directory argument is given, the output
|
||||
shows only the entries inside that directory with the
|
||||
directory prefix stripped.
|
||||
Examples: ls, ls man
|
||||
directory prefix stripped. Directory entries are shown
|
||||
with a trailing slash.
|
||||
Examples: ls, ls man, ls os
|
||||
|
||||
.SS cd [dir]
|
||||
Change the working directory. With no argument or with /,
|
||||
returns to the root (0:/). Use cd .. to go up one level.
|
||||
Trailing slashes on directory names are stripped.
|
||||
The shell prompt reflects the current directory.
|
||||
Examples: cd man, cd .., cd
|
||||
|
||||
.SS cat <file>
|
||||
Print the contents of a file to the terminal. The file
|
||||
path is resolved relative to the current directory.
|
||||
Example: cat hello.elf
|
||||
|
||||
.SS run <file>
|
||||
Spawn a new process from an ELF binary and wait for it to
|
||||
exit. The file path is resolved relative to the current
|
||||
directory. The shell blocks until the child process terminates.
|
||||
Example: run hello.elf
|
||||
|
||||
.SS ping <ip>
|
||||
Send 4 ICMP echo requests to the given IP address and display
|
||||
round-trip times. Timeout is 3 seconds per request.
|
||||
Example: ping 10.0.2.2
|
||||
|
||||
.SS date
|
||||
Display the current date and time in UTC.
|
||||
|
||||
.SS uptime
|
||||
Display the system uptime in minutes, seconds, and milliseconds.
|
||||
|
||||
.SS clear
|
||||
Clear the terminal screen.
|
||||
Examples: cd os, cd .., cd
|
||||
|
||||
.SS exit
|
||||
Terminate the shell process.
|
||||
|
||||
.SH EXTERNAL COMMANDS
|
||||
|
||||
.SS System commands (0:/os/)
|
||||
man <topic> View manual pages
|
||||
cat <file> Display file contents
|
||||
info Show system information
|
||||
date Show current date and time
|
||||
uptime Show system uptime
|
||||
clear Clear the screen and framebuffer
|
||||
reset Reboot the system
|
||||
shutdown Shut down the system
|
||||
|
||||
.SS Network commands (0:/os/)
|
||||
ping <ip> Send ICMP echo requests
|
||||
ifconfig Show/set network configuration
|
||||
tcpconnect <ip> <port> Interactive TCP client
|
||||
irc IRC client
|
||||
dhcp DHCP client
|
||||
fetch HTTP client
|
||||
httpd HTTP server
|
||||
|
||||
.SS Games (0:/games/)
|
||||
doom DOOM
|
||||
|
||||
.SH INPUT
|
||||
The shell reads input character by character using SYS_GETCHAR.
|
||||
Backspace is supported. Lines are limited to 255 characters.
|
||||
There is no command history or tab completion.
|
||||
The shell uses non-blocking keyboard input via SYS_GETKEY to
|
||||
support arrow key detection. Lines are limited to 255
|
||||
characters.
|
||||
|
||||
.SS Editing
|
||||
Backspace Delete character before cursor
|
||||
Enter Execute command
|
||||
|
||||
.SS History
|
||||
The shell stores the last 32 unique commands. Duplicate
|
||||
consecutive entries are suppressed.
|
||||
|
||||
Up Arrow Recall previous command
|
||||
Down Arrow Recall next command (or clear line)
|
||||
|
||||
.SH PROMPT
|
||||
The prompt displays the current working directory:
|
||||
|
||||
0:/> _ (at root)
|
||||
0:/os> _ (in os/ directory)
|
||||
0:/man> _ (in man/ directory)
|
||||
|
||||
.SH SEE ALSO
|
||||
man(1), intro(1), syscalls(2)
|
||||
|
||||
@@ -13,11 +13,11 @@
|
||||
Loads the ELF64 binary at the given VFS path and creates a new
|
||||
process. The path must include the drive prefix, for example:
|
||||
|
||||
int pid = zenith::spawn("0:/hello.elf");
|
||||
int pid = zenith::spawn("0:/os/hello.elf");
|
||||
|
||||
An optional second argument passes a string to the child:
|
||||
|
||||
int pid = zenith::spawn("0:/man.elf", "intro");
|
||||
int pid = zenith::spawn("0:/os/man.elf", "intro");
|
||||
|
||||
The new process gets its own PML4 page table, a 16 KiB stack
|
||||
(at 0x7FFFFEF000-0x7FFFFFF000), and begins executing at the
|
||||
@@ -40,7 +40,7 @@
|
||||
.SH EXAMPLES
|
||||
Spawn a program and wait for it:
|
||||
|
||||
int pid = zenith::spawn("0:/hello.elf");
|
||||
int pid = zenith::spawn("0:/os/hello.elf");
|
||||
if (pid < 0) {
|
||||
zenith::print("spawn failed\n");
|
||||
} else {
|
||||
|
||||
+23
-3
@@ -3,7 +3,7 @@
|
||||
syscalls - overview of ZenithOS system calls
|
||||
|
||||
.SH DESCRIPTION
|
||||
ZenithOS provides 37 system calls (numbers 0-36) for userspace
|
||||
ZenithOS provides 41 system calls (numbers 0-40) for userspace
|
||||
programs. Syscalls use the x86-64 SYSCALL instruction with the
|
||||
following register convention:
|
||||
|
||||
@@ -120,8 +120,18 @@
|
||||
Send an ICMP echo request and wait for reply.
|
||||
int32_t zenith::ping(uint32_t ip, uint32_t timeoutMs);
|
||||
|
||||
.B SYS_GETNETCFG (37)
|
||||
Get the current network configuration (IP, mask, gateway, MAC).
|
||||
void zenith::get_netcfg(Zenith::NetCfg* out);
|
||||
|
||||
.B SYS_SETNETCFG (38)
|
||||
Set the network configuration (IP, mask, gateway).
|
||||
int zenith::set_netcfg(const Zenith::NetCfg* cfg);
|
||||
|
||||
.SH SOCKETS
|
||||
.B SYS_SOCKET (29)
|
||||
Create a socket. type=SOCK_TCP (1). Returns fd or -1.
|
||||
Create a socket. type=SOCK_TCP (1) or SOCK_UDP (2).
|
||||
Returns fd or -1.
|
||||
int zenith::socket(int type);
|
||||
|
||||
.B SYS_CONNECT (30)
|
||||
@@ -147,13 +157,23 @@
|
||||
|
||||
.B SYS_RECV (35)
|
||||
Receive data from a connected socket. Returns bytes
|
||||
received, 0 on connection close, or -1 on error.
|
||||
received, 0 if no data available, or -1 on close/error.
|
||||
int zenith::recv(int fd, void* buf, uint32_t maxLen);
|
||||
|
||||
.B SYS_CLOSESOCK (36)
|
||||
Close a socket and release its resources.
|
||||
int zenith::closesocket(int fd);
|
||||
|
||||
.B SYS_SENDTO (39)
|
||||
Send a UDP datagram to a specific destination.
|
||||
int zenith::sendto(int fd, const void* data, uint32_t len,
|
||||
uint32_t destIp, uint16_t destPort);
|
||||
|
||||
.B SYS_RECVFROM (40)
|
||||
Receive a UDP datagram. Returns the source address.
|
||||
int zenith::recvfrom(int fd, void* buf, uint32_t maxLen,
|
||||
uint32_t* srcIp, uint16_t* srcPort);
|
||||
|
||||
.SH FRAMEBUFFER
|
||||
.B SYS_FBINFO (21)
|
||||
Get framebuffer dimensions and format.
|
||||
|
||||
Reference in New Issue
Block a user