From cb7b403210f13e721739d58dab9000ec51ed2d0a Mon Sep 17 00:00:00 2001 From: Kartik Agaram Date: Mon, 25 Feb 2019 00:26:48 -0800 Subject: 4989 --- html/subx/020syscalls.cc.html | 78 +++++++++++++++++++++---------------------- 1 file changed, 39 insertions(+), 39 deletions(-) (limited to 'html/subx/020syscalls.cc.html') diff --git a/html/subx/020syscalls.cc.html b/html/subx/020syscalls.cc.html index 6da85f80..61932039 100644 --- a/html/subx/020syscalls.cc.html +++ b/html/subx/020syscalls.cc.html @@ -59,15 +59,15 @@ if ('onhashchange' in window) { https://github.com/akkartik/mu/blob/master/subx/020syscalls.cc
   1 :(before "End Initialize Op Names")
-  2 put_new(Name, "cd", "software interrupt (int)");
+  2 put_new(Name, "cd", "software interrupt (int)");
   3 
   4 :(before "End Single-Byte Opcodes")
   5 case 0xcd: {  // int imm8 (software interrupt)
-  6   trace(90, "run") << "syscall" << end();
-  7   uint8_t code = next();
+  6   trace(Callstack_depth+1, "run") << "syscall" << end();
+  7   uint8_t code = next();
   8   if (code != 0x80) {
-  9     raise << "Unimplemented interrupt code " << HEXBYTE << code << '\n' << end();
- 10     raise << "  Only `int 80h` supported for now.\n" << end();
+  9     raise << "Unimplemented interrupt code " << HEXBYTE << code << '\n' << end();
+ 10     raise << "  Only `int 80h` supported for now.\n" << end();
  11     break;
  12   }
  13   process_int80();
@@ -81,70 +81,70 @@ if ('onhashchange' in window) {
  21     exit(/*exit code*/Reg[EBX].u);
  22     break;
  23   case 3:
- 24     trace(91, "run") << "read: " << Reg[EBX].u << ' ' << Reg[ECX].u << ' ' << Reg[EDX].u << end();
+ 24     trace(Callstack_depth+1, "run") << "read: " << Reg[EBX].u << ' ' << Reg[ECX].u << ' ' << Reg[EDX].u << end();
  25     Reg[EAX].i = read(/*file descriptor*/Reg[EBX].u, /*memory buffer*/mem_addr_u8(Reg[ECX].u), /*size*/Reg[EDX].u);
- 26     trace(91, "run") << "result: " << Reg[EAX].i << end();
- 27     if (Reg[EAX].i == -1) raise << strerror(errno) << '\n' << end();
+ 26     trace(Callstack_depth+1, "run") << "result: " << Reg[EAX].i << end();
+ 27     if (Reg[EAX].i == -1) raise << strerror(errno) << '\n' << end();
  28     break;
  29   case 4:
- 30     trace(91, "run") << "write: " << Reg[EBX].u << ' ' << Reg[ECX].u << ' ' << Reg[EDX].u << end();
- 31     trace(91, "run") << Reg[ECX].u << " => " << mem_addr_string(Reg[ECX].u, Reg[EDX].u) << end();
+ 30     trace(Callstack_depth+1, "run") << "write: " << Reg[EBX].u << ' ' << Reg[ECX].u << ' ' << Reg[EDX].u << end();
+ 31     trace(Callstack_depth+1, "run") << Reg[ECX].u << " => " << mem_addr_string(Reg[ECX].u, Reg[EDX].u) << end();
  32     Reg[EAX].i = write(/*file descriptor*/Reg[EBX].u, /*memory buffer*/mem_addr_u8(Reg[ECX].u), /*size*/Reg[EDX].u);
- 33     trace(91, "run") << "result: " << Reg[EAX].i << end();
- 34     if (Reg[EAX].i == -1) raise << strerror(errno) << '\n' << end();
+ 33     trace(Callstack_depth+1, "run") << "result: " << Reg[EAX].i << end();
+ 34     if (Reg[EAX].i == -1) raise << strerror(errno) << '\n' << end();
  35     break;
  36   case 5: {
  37     check_flags(ECX);
  38     check_mode(EDX);
- 39     trace(91, "run") << "open: " << Reg[EBX].u << ' ' << Reg[ECX].u << end();
- 40     trace(91, "run") << Reg[EBX].u << " => " << mem_addr_kernel_string(Reg[EBX].u) << end();
+ 39     trace(Callstack_depth+1, "run") << "open: " << Reg[EBX].u << ' ' << Reg[ECX].u << end();
+ 40     trace(Callstack_depth+1, "run") << Reg[EBX].u << " => " << mem_addr_kernel_string(Reg[EBX].u) << end();
  41     Reg[EAX].i = open(/*filename*/mem_addr_kernel_string(Reg[EBX].u), /*flags*/Reg[ECX].u, /*mode*/0640);
- 42     trace(91, "run") << "result: " << Reg[EAX].i << end();
- 43     if (Reg[EAX].i == -1) raise << strerror(errno) << '\n' << end();
+ 42     trace(Callstack_depth+1, "run") << "result: " << Reg[EAX].i << end();
+ 43     if (Reg[EAX].i == -1) raise << strerror(errno) << '\n' << end();
  44     break;
  45   }
  46   case 6:
- 47     trace(91, "run") << "close: " << Reg[EBX].u << end();
+ 47     trace(Callstack_depth+1, "run") << "close: " << Reg[EBX].u << end();
  48     Reg[EAX].i = close(/*file descriptor*/Reg[EBX].u);
- 49     trace(91, "run") << "result: " << Reg[EAX].i << end();
- 50     if (Reg[EAX].i == -1) raise << strerror(errno) << '\n' << end();
+ 49     trace(Callstack_depth+1, "run") << "result: " << Reg[EAX].i << end();
+ 50     if (Reg[EAX].i == -1) raise << strerror(errno) << '\n' << end();
  51     break;
  52   case 8:
  53     check_mode(ECX);
- 54     trace(91, "run") << "creat: " << Reg[EBX].u << end();
- 55     trace(91, "run") << Reg[EBX].u << " => " << mem_addr_kernel_string(Reg[EBX].u) << end();
+ 54     trace(Callstack_depth+1, "run") << "creat: " << Reg[EBX].u << end();
+ 55     trace(Callstack_depth+1, "run") << Reg[EBX].u << " => " << mem_addr_kernel_string(Reg[EBX].u) << end();
  56     Reg[EAX].i = creat(/*filename*/mem_addr_kernel_string(Reg[EBX].u), /*mode*/0640);
- 57     trace(91, "run") << "result: " << Reg[EAX].i << end();
- 58     if (Reg[EAX].i == -1) raise << strerror(errno) << '\n' << end();
+ 57     trace(Callstack_depth+1, "run") << "result: " << Reg[EAX].i << end();
+ 58     if (Reg[EAX].i == -1) raise << strerror(errno) << '\n' << end();
  59     break;
  60   case 10:
- 61     trace(91, "run") << "unlink: " << Reg[EBX].u << end();
- 62     trace(91, "run") << Reg[EBX].u << " => " << mem_addr_kernel_string(Reg[EBX].u) << end();
+ 61     trace(Callstack_depth+1, "run") << "unlink: " << Reg[EBX].u << end();
+ 62     trace(Callstack_depth+1, "run") << Reg[EBX].u << " => " << mem_addr_kernel_string(Reg[EBX].u) << end();
  63     Reg[EAX].i = unlink(/*filename*/mem_addr_kernel_string(Reg[EBX].u));
- 64     trace(91, "run") << "result: " << Reg[EAX].i << end();
- 65     if (Reg[EAX].i == -1) raise << strerror(errno) << '\n' << end();
+ 64     trace(Callstack_depth+1, "run") << "result: " << Reg[EAX].i << end();
+ 65     if (Reg[EAX].i == -1) raise << strerror(errno) << '\n' << end();
  66     break;
  67   case 38:
- 68     trace(91, "run") << "rename: " << Reg[EBX].u << " -> " << Reg[ECX].u << end();
- 69     trace(91, "run") << Reg[EBX].u << " => " << mem_addr_kernel_string(Reg[EBX].u) << end();
- 70     trace(91, "run") << Reg[ECX].u << " => " << mem_addr_kernel_string(Reg[ECX].u) << end();
+ 68     trace(Callstack_depth+1, "run") << "rename: " << Reg[EBX].u << " -> " << Reg[ECX].u << end();
+ 69     trace(Callstack_depth+1, "run") << Reg[EBX].u << " => " << mem_addr_kernel_string(Reg[EBX].u) << end();
+ 70     trace(Callstack_depth+1, "run") << Reg[ECX].u << " => " << mem_addr_kernel_string(Reg[ECX].u) << end();
  71     Reg[EAX].i = rename(/*old filename*/mem_addr_kernel_string(Reg[EBX].u), /*new filename*/mem_addr_kernel_string(Reg[ECX].u));
- 72     trace(91, "run") << "result: " << Reg[EAX].i << end();
- 73     if (Reg[EAX].i == -1) raise << strerror(errno) << '\n' << end();
+ 72     trace(Callstack_depth+1, "run") << "result: " << Reg[EAX].i << end();
+ 73     if (Reg[EAX].i == -1) raise << strerror(errno) << '\n' << end();
  74     break;
  75   case 45:  // brk: modify size of data segment
- 76     trace(91, "run") << "grow data segment to " << Reg[EBX].u << end();
+ 76     trace(Callstack_depth+1, "run") << "grow data segment to " << Reg[EBX].u << end();
  77     grow_data_segment(/*new end address*/Reg[EBX].u);
  78     break;
  79   case 90:  // mmap: allocate memory outside existing segment allocations
- 80     trace(91, "run") << "mmap: allocate new segment" << end();
+ 80     trace(Callstack_depth+1, "run") << "mmap: allocate new segment" << end();
  81     // Ignore most arguments for now: address hint, protection flags, sharing flags, fd, offset.
  82     // We only support anonymous maps.
  83     Reg[EAX].u = new_segment(/*length*/read_mem_u32(Reg[EBX].u+0x4));
- 84     trace(91, "run") << "result: " << Reg[EAX].u << end();
+ 84     trace(Callstack_depth+1, "run") << "result: " << Reg[EAX].u << end();
  85     break;
  86   default:
- 87     raise << HEXWORD << EIP << ": unimplemented syscall " << Reg[EAX].u << '\n' << end();
+ 87     raise << HEXWORD << EIP << ": unimplemented syscall " << Reg[EAX].u << '\n' << end();
  88   }
  89 }
  90 
@@ -153,18 +153,18 @@ if ('onhashchange' in window) {
  93 void check_flags(int reg) {
  94   uint32_t flags = Reg[reg].u;
  95   if (flags != ((flags & O_RDONLY) | (flags & O_WRONLY))) {
- 96     cerr << HEXWORD << EIP << ": most POSIX flags to the open() syscall are not supported. Just O_RDONLY and O_WRONLY for now. Zero concurrent access support.\n";
+ 96     cerr << HEXWORD << EIP << ": most POSIX flags to the open() syscall are not supported. Just O_RDONLY and O_WRONLY for now. Zero concurrent access support.\n";
  97     exit(1);
  98   }
  99   if ((flags & O_RDONLY) && (flags & O_WRONLY)) {
-100     cerr << HEXWORD << EIP << ": can't open a file for both reading and writing at once. See http://man7.org/linux/man-pages/man2/open.2.html.\n";
+100     cerr << HEXWORD << EIP << ": can't open a file for both reading and writing at once. See http://man7.org/linux/man-pages/man2/open.2.html.\n";
 101     exit(1);
 102   }
 103 }
 104 
 105 void check_mode(int reg) {
 106   if (Reg[reg].u != 0600) {
-107     cerr << HEXWORD << EIP << ": SubX is oblivious to file permissions; register " << reg << " must be 0.\n";
+107     cerr << HEXWORD << EIP << ": SubX is oblivious to file permissions; register " << reg << " must be 0.\n";
 108     exit(1);
 109   }
 110 }
-- 
cgit 1.4.1-2-gfad0