Display fixes for UTM/Mac black screen issue:
- Remove MULTIBOOT_HEADER_TAG_FRAMEBUFFER from multiboot2 header (was required,
requesting text mode depth=0 which confused GRUB on some platforms)
- Add COM1 serial port (0x3F8) output alongside debugcon for UTM serial capture
- Change VGA background from black to dark blue for diagnostics
- Add early canary write to 0xB8000 ('COS' in magenta) before subsystem init
- print_hex now outputs to both debugcon and COM1
New ls command and SYS_READDIR syscall:
- SYS_READDIR (10): reads directory entries via VFS
- VFS root listing: vfs_readdir handles '/' by iterating mount table
- apps/ls: lists CWD contents, appends '/' for directories
- apps/libc/syscalls.h: readdir() wrapper
46 lines
1.5 KiB
C
46 lines
1.5 KiB
C
/**
|
|
* @file syscall.h
|
|
* @brief System call interface.
|
|
*
|
|
* Defines system call numbers and the kernel-side handler. User-mode
|
|
* processes invoke system calls via INT 0x80 with the call number in EAX
|
|
* and arguments in EBX, ECX, EDX, ESI, EDI.
|
|
*/
|
|
|
|
#ifndef SYSCALL_H
|
|
#define SYSCALL_H
|
|
|
|
#include <stdint.h>
|
|
#include "isr.h"
|
|
|
|
/** System call numbers. */
|
|
#define SYS_EXIT 0 /**< Exit the process. Arg: exit code in EBX. */
|
|
#define SYS_WRITE 1 /**< Write to a file descriptor. fd=EBX, buf=ECX, len=EDX. */
|
|
#define SYS_READ 2 /**< Read from a file descriptor. fd=EBX, buf=ECX, len=EDX. */
|
|
#define SYS_FORK 3 /**< Fork the current process. */
|
|
#define SYS_GETPID 4 /**< Get current process ID. */
|
|
#define SYS_YIELD 5 /**< Yield the CPU. */
|
|
#define SYS_WAITPID 6 /**< Wait for a child process. pid=EBX. */
|
|
#define SYS_EXEC 7 /**< Execute a program. path=EBX, argv=ECX. */
|
|
#define SYS_GETENV 8 /**< Get environment variable. key=EBX, buf=ECX, bufsize=EDX. */
|
|
#define SYS_SETENV 9 /**< Set environment variable. key=EBX, value=ECX. */
|
|
#define SYS_READDIR 10 /**< Read directory entry. path=EBX, idx=ECX, buf=EDX. Returns type or -1. */
|
|
|
|
/** Total number of system calls. */
|
|
#define NUM_SYSCALLS 11
|
|
|
|
/**
|
|
* Initialize the system call handler.
|
|
* Installs INT 0x80 in the IDT.
|
|
*/
|
|
void init_syscalls(void);
|
|
|
|
/**
|
|
* System call dispatcher (called from the INT 0x80 handler).
|
|
*
|
|
* @param regs Register state at the time of the interrupt.
|
|
*/
|
|
void syscall_handler(registers_t *regs);
|
|
|
|
#endif /* SYSCALL_H */
|