mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-08 20:28:30 +00:00
Add syscalls to Blinkenlights and fix bugs
This commit is contained in:
parent
f6df29cc3d
commit
578cb21591
25 changed files with 187 additions and 108 deletions
|
@ -344,6 +344,7 @@ static noasan inline void *Mmap(void *addr, size_t size, int prot, int flags,
|
|||
return MAP_FAILED;
|
||||
}
|
||||
f |= MAP_STACK_openbsd;
|
||||
needguard = true;
|
||||
} else if (IsLinux()) {
|
||||
// by default MAP_GROWSDOWN will auto-allocate 10mb of pages. it's
|
||||
// supposed to stop growing if an adjacent allocation exists, to
|
||||
|
|
|
@ -36,7 +36,8 @@ void __paginate(int fd, const char *s) {
|
|||
((args[0] = commandv("less", progpath, sizeof(progpath))) ||
|
||||
(args[0] = commandv("more", progpath, sizeof(progpath))))) {
|
||||
snprintf(tmppath, sizeof(tmppath), "%s%s-%s-%d.txt", kTmpPath,
|
||||
program_invocation_short_name, "paginate", getpid());
|
||||
firstnonnull(program_invocation_short_name, "unknown"), "paginate",
|
||||
getpid());
|
||||
if ((tfd = open(tmppath, O_WRONLY | O_CREAT | O_TRUNC, 0644)) != -1) {
|
||||
write(tfd, s, strlen(s));
|
||||
close(tfd);
|
||||
|
|
|
@ -155,15 +155,18 @@
|
|||
││ ││ │││ │ │ ││ ││││││││││
|
||||
6666555555555544444444443333333333222222222211111111110000000000
|
||||
3210987654321098765432109876543210987654321098765432109876543210*/
|
||||
#define PAGE_V /* */ 0b000000001
|
||||
#define PAGE_RW /* */ 0b000000010
|
||||
#define PAGE_U /* */ 0b000000100
|
||||
#define PAGE_4KB /* */ 0b010000000
|
||||
#define PAGE_2MB /* */ 0b110000000
|
||||
#define PAGE_1GB /* */ 0b110000000
|
||||
#define PAGE_TA 0x00007ffffffff000
|
||||
#define PAGE_PA2 0x00007fffffe00000
|
||||
#define PAGE_XD 0x8000000000000000
|
||||
#define PAGE_V /* */ 0b000000000001
|
||||
#define PAGE_RW /* */ 0b000000000010
|
||||
#define PAGE_U /* */ 0b000000000100
|
||||
#define PAGE_4KB /* */ 0b000010000000
|
||||
#define PAGE_2MB /* */ 0b000110000000
|
||||
#define PAGE_1GB /* */ 0b000110000000
|
||||
#define PAGE_IGN1 /* */ 0b111000000000
|
||||
#define PAGE_RSRV /* blinkenlights reservation */ 0b001000000000
|
||||
#define PAGE_GROD /* blinkenlights MAP_GROWSDOWN */ 0b010000000000
|
||||
#define PAGE_TA 0x00007ffffffff000
|
||||
#define PAGE_PA2 0x00007fffffe00000
|
||||
#define PAGE_XD 0x8000000000000000
|
||||
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
|
||||
|
|
|
@ -18,8 +18,13 @@
|
|||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/macros.internal.h"
|
||||
|
||||
// Supplies basename(argv[0]) The GNU Way.
|
||||
.initbss 400,_init_program_invocation_short_name
|
||||
// Supplies basename(argv[0]) The GNU Way.
|
||||
//
|
||||
// If argv[0] isn't supplied, this value will be null.
|
||||
//
|
||||
// @see GetProgramExecutableName()
|
||||
// @see program_invocation_name
|
||||
program_invocation_short_name:
|
||||
.quad 0
|
||||
.endobj program_invocation_short_name,globl
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue