2026-07-16 14:44:08 -05:00
|
|
|
#include "syscall.h"
|
2026-07-08 21:15:30 -05:00
|
|
|
#include <unistd.h>
|
|
|
|
|
|
2026-07-16 14:44:08 -05:00
|
|
|
#include <sys/video.h>
|
|
|
|
|
|
2026-07-12 04:37:46 -05:00
|
|
|
#define VGA_TEXT_W 80
|
|
|
|
|
#define VGA_TEXT_H 25
|
|
|
|
|
|
2026-07-08 21:15:30 -05:00
|
|
|
void term();
|
|
|
|
|
|
|
|
|
|
int ptys;
|
|
|
|
|
int ptym;
|
2026-07-07 00:13:24 -05:00
|
|
|
|
2026-07-16 14:44:08 -05:00
|
|
|
fb_info_t fb_info;
|
|
|
|
|
void* framebuffer_address;
|
|
|
|
|
|
|
|
|
|
int terminal_col = 0;
|
|
|
|
|
int terminal_row = 0;
|
|
|
|
|
|
|
|
|
|
void term_write_char(char c) {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2026-07-07 00:13:24 -05:00
|
|
|
int main(int argc, char *argv[]) {
|
2026-07-08 21:15:30 -05:00
|
|
|
(void)argc;
|
|
|
|
|
(void)argv;
|
|
|
|
|
|
|
|
|
|
ptym = pty(&ptys);
|
|
|
|
|
|
|
|
|
|
if (fork() == 0) {
|
|
|
|
|
close(ptym);
|
|
|
|
|
dup2(ptys, 0);
|
|
|
|
|
dup2(0, 1);
|
|
|
|
|
dup2(0, 2);
|
|
|
|
|
|
2026-07-12 03:56:25 -05:00
|
|
|
exec("/bin/rocksh.elf");
|
2026-07-08 21:15:30 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
close(ptys);
|
|
|
|
|
dup2(ptym, 0);
|
|
|
|
|
dup2(0, 1);
|
|
|
|
|
dup2(0, 2);
|
|
|
|
|
|
2026-07-16 14:44:08 -05:00
|
|
|
int vga_fd = open("/dev/vga");
|
|
|
|
|
if (vga_fd == -1) return 1;
|
2026-07-08 21:15:30 -05:00
|
|
|
|
2026-07-16 14:44:08 -05:00
|
|
|
int kbd_fd = open("/dev/kbd");
|
|
|
|
|
if (kbd_fd == -1) return 1;
|
2026-07-08 21:15:30 -05:00
|
|
|
|
2026-07-16 14:44:08 -05:00
|
|
|
int res = ioctl(vga_fd, FBIOGET_INFO, &fb_info);
|
|
|
|
|
if (!res) {
|
|
|
|
|
return 1;
|
2026-07-12 04:37:46 -05:00
|
|
|
}
|
|
|
|
|
|
2026-07-16 14:44:08 -05:00
|
|
|
framebuffer_address = mmap(vga_fd);
|
2026-07-08 21:15:30 -05:00
|
|
|
|
2026-07-16 14:44:08 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
return 0;
|
2026-07-07 00:13:24 -05:00
|
|
|
}
|