Fix UTM display: remove required framebuffer tag, add serial output, ls app
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
This commit is contained in:
36
apps/ls/ls.c
Normal file
36
apps/ls/ls.c
Normal file
@@ -0,0 +1,36 @@
|
||||
/**
|
||||
* @file ls.c
|
||||
* @brief List directory contents.
|
||||
*
|
||||
* Lists entries in the current working directory (from the CWD
|
||||
* environment variable). Uses the SYS_READDIR syscall to enumerate
|
||||
* directory entries.
|
||||
*/
|
||||
|
||||
#include "syscalls.h"
|
||||
|
||||
int main(void) {
|
||||
/* Get the current working directory */
|
||||
char cwd[128];
|
||||
if (getenv("CWD", cwd, sizeof(cwd)) < 0) {
|
||||
/* Default to root if CWD not set */
|
||||
cwd[0] = '/';
|
||||
cwd[1] = '\0';
|
||||
}
|
||||
|
||||
char name[128];
|
||||
uint32_t idx = 0;
|
||||
int32_t type;
|
||||
|
||||
while ((type = readdir(cwd, idx, name)) >= 0) {
|
||||
puts(name);
|
||||
if (type == 2) {
|
||||
/* Directory: append / indicator */
|
||||
putchar('/');
|
||||
}
|
||||
putchar('\n');
|
||||
idx++;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user