mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-22 21:32:31 +00:00
Fix metal bugs so deathstar.com runs in qemu (#20)
- Remove XD bit in page tables - Fix cylinder+head+sector arithmetic - Implement fstat() for serial file descriptors on metal Here's how to boot an Actually Portable Executable in QEMU: make -j12 o//tool/viz/deathstar.com qemu-system-x86_64 -serial stdio -fda o//tool/viz/deathstar.com Here's a screenshot of DEATHSTAR.COM booted in QEMU: https://justine.lol/cosmopolitan/cosmo-metal-qemu.png Thus metal support is in much better shape now, but still incomplete. Only a few system calls have been polyfilled. To figure out which ones your program needs, simply boot it in the blinkenlights emulator with a breakpoint, and press CTRL-C to continue to the system call breakpoint. If it doesn't break then you should be good. (Note: to emulate normally you can press 'c' and use CTRL-T and ALT-T to tune the speed.) m=tiny make -j12 SILENT=0 MODE=$m \ o/$m/tool/build/blinkenlights.com \ o/$m/tool/viz/deathstar.com o/$m/tool/build/blinkenlights.com \ -r -t -b systemfive.linux \ o/$m/tool/viz/deathstar.com Thank @Theldus for the bug report that made this change possible. Fixes #20 which explains this change further.
This commit is contained in:
parent
58d9659d53
commit
f0600a898c
13 changed files with 182 additions and 119 deletions
|
@ -11,6 +11,7 @@
|
|||
#include "libc/calls/struct/stat.h"
|
||||
#include "libc/errno.h"
|
||||
#include "libc/fmt/fmt.h"
|
||||
#include "libc/log/check.h"
|
||||
#include "libc/runtime/gc.h"
|
||||
#include "libc/stdio/stdio.h"
|
||||
#include "libc/x/x.h"
|
||||
|
@ -23,32 +24,29 @@
|
|||
|
||||
void PrintFileMetadata(const char *pathname, struct stat *st) {
|
||||
printf("\n%s:", pathname);
|
||||
if (stat(pathname, st) != -1) {
|
||||
printf(
|
||||
"\n"
|
||||
"%-32s%,ld\n"
|
||||
"%-32s%,ld\n"
|
||||
"%-32s%#lx\n"
|
||||
"%-32s%#lx\n"
|
||||
"%-32s%ld\n"
|
||||
"%-32s%#o\n"
|
||||
"%-32s%d\n"
|
||||
"%-32s%d\n"
|
||||
"%-32s%d\n"
|
||||
"%-32s%ld\n"
|
||||
"%-32s%s\n"
|
||||
"%-32s%s\n"
|
||||
"%-32s%s\n",
|
||||
"bytes in file", st->st_size, "physical bytes", st->st_blocks * 512,
|
||||
"device id w/ file", st->st_dev, "inode", st->st_ino, "hard link count",
|
||||
st->st_nlink, "mode / permissions", st->st_mode, "owner id", st->st_uid,
|
||||
"group id", st->st_gid, "device id (if special)", st->st_rdev,
|
||||
"block size", st->st_blksize, "access time", gc(xiso8601(&st->st_atim)),
|
||||
"modified time", gc(xiso8601(&st->st_mtim)), "c[omplicated]time",
|
||||
gc(xiso8601(&st->st_ctim)));
|
||||
} else {
|
||||
printf(" %s\n", strerror(errno));
|
||||
}
|
||||
CHECK_NE(-1, stat(pathname, st));
|
||||
printf("\n"
|
||||
"%-32s%,ld\n"
|
||||
"%-32s%,ld\n"
|
||||
"%-32s%#lx\n"
|
||||
"%-32s%#lx\n"
|
||||
"%-32s%ld\n"
|
||||
"%-32s%#o\n"
|
||||
"%-32s%d\n"
|
||||
"%-32s%d\n"
|
||||
"%-32s%d\n"
|
||||
"%-32s%ld\n"
|
||||
"%-32s%s\n"
|
||||
"%-32s%s\n"
|
||||
"%-32s%s\n",
|
||||
"bytes in file", st->st_size, "physical bytes", st->st_blocks * 512,
|
||||
"device id w/ file", st->st_dev, "inode", st->st_ino,
|
||||
"hard link count", st->st_nlink, "mode / permissions", st->st_mode,
|
||||
"owner id", st->st_uid, "group id", st->st_gid,
|
||||
"device id (if special)", st->st_rdev, "block size", st->st_blksize,
|
||||
"access time", gc(xiso8601(&st->st_atim)), "modified time",
|
||||
gc(xiso8601(&st->st_mtim)), "c[omplicated]time",
|
||||
gc(xiso8601(&st->st_ctim)));
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue