6604 - new app

https://archive.org/details/akkartik-2min-2020-07-01

In the process I found a bug, added a new syscall, and 'emulated' it.
This commit is contained in:
Kartik Agaram 2020-07-01 16:46:06 -07:00
parent 792451d1be
commit 996402e8fd
30 changed files with 69 additions and 1 deletions

View File

@ -79,6 +79,9 @@ void process_int80() {
Reg[EAX].u = new_segment(/*length*/read_mem_u32(Reg[EBX].u+0x4));
trace(Callstack_depth+1, "run") << "result: " << Reg[EAX].u << end();
break;
case 0xa2: // nanosleep
cerr << "not sleeping\n";
break;
default:
raise << HEXWORD << EIP << ": unimplemented syscall " << Reg[EAX].u << '\n' << end();
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
apps/ex1

Binary file not shown.

BIN
apps/ex10

Binary file not shown.

BIN
apps/ex11

Binary file not shown.

BIN
apps/ex12

Binary file not shown.

BIN
apps/ex13

Binary file not shown.

BIN
apps/ex2

Binary file not shown.

BIN
apps/ex3

Binary file not shown.

BIN
apps/ex4

Binary file not shown.

BIN
apps/ex5

Binary file not shown.

BIN
apps/ex6

Binary file not shown.

BIN
apps/ex7

Binary file not shown.

BIN
apps/ex8

Binary file not shown.

BIN
apps/ex9

Binary file not shown.

Binary file not shown.

BIN
apps/hex

Binary file not shown.

BIN
apps/mu

Binary file not shown.

View File

@ -16782,7 +16782,7 @@ _string_ff_subop_decrement: # (payload array byte)
0x11/imm32/alloc-id:fake:payload
# "ff 1/subop/decrement"
0x14/imm32/size
0x66/f 0x66/f 0x31/1 0x2f/slash 0x73/s 0x75/u 0x62/b 0x6f/o 0x70/p 0x2f/slash 0x64/d 0x65/e 0x63/c 0x72/r 0x65/e 0x6d/m 0x65/e 0x6e/n 0x74/t
0x66/f 0x66/f 0x20/space 0x31/1 0x2f/slash 0x73/s 0x75/u 0x62/b 0x6f/o 0x70/p 0x2f/slash 0x64/d 0x65/e 0x63/c 0x72/r 0x65/e 0x6d/m 0x65/e 0x6e/n 0x74/t
Single-int-var-in-mem: # (payload list var)
0x11/imm32/alloc-id:fake:payload

BIN
apps/pack

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

60
apps/tile.mu Normal file
View File

@ -0,0 +1,60 @@
# little example program: animate a line in text-mode
fn main -> exit-status/ebx: int {
clear-screen
move-cursor-on-screen 5, 5
print-string-to-screen "_________"
enable-keyboard-immediate-mode
var dummy/eax: byte <- read-key
var row/eax: int <- copy 5
{
compare row, 0xe # 15
break-if-=
animate row
row <- increment
sleep 0 0x5f5e100 # 100ms
loop
}
var dummy/eax: byte <- read-key
enable-keyboard-type-mode
clear-screen
exit-status <- copy 0
}
fn animate row: int {
var col/eax: int <- copy 5
{
compare col, 0xe
break-if-=
move-cursor-on-screen row, col
print-string-to-screen " "
increment row
move-cursor-on-screen row, col
print-string-to-screen "_"
decrement row
col <- increment
loop
}
}
type timespec {
tv_sec: int
tv_nsec: int
}
# prototype wrapper around syscall_nanosleep
# nsecs must be less than 999999999 or 0x3b9ac9ff nanoseconds
fn sleep secs: int, nsecs: int {
var t: timespec
# initialize t
var tmp/eax: (addr int) <- get t, tv_sec
var tmp2/ecx: int <- copy secs
copy-to *tmp, tmp2
tmp <- get t, tv_nsec
tmp2 <- copy nsecs
copy-to *tmp, tmp2
# perform the syscall
var t-addr/ebx: (addr timespec) <- address t
var rem-addr/ecx: (addr timespec) <- copy 0
syscall_nanosleep
}

View File

@ -72,3 +72,8 @@ syscall_ioctl: # fd/ebx: int, cmd/ecx: int, arg/edx: (addr _)
b8/copy-to-eax 0x36/imm32
cd/syscall 0x80/imm8
c3/return
syscall_nanosleep:
b8/copy-to-eax 0xa2/imm32 # 162
cd/syscall 0x80/imm8
c3/return