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:
parent
792451d1be
commit
996402e8fd
|
@ -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();
|
||||
}
|
||||
|
|
BIN
apps/assort
BIN
apps/assort
Binary file not shown.
BIN
apps/braces
BIN
apps/braces
Binary file not shown.
BIN
apps/calls
BIN
apps/calls
Binary file not shown.
BIN
apps/crenshaw2-1
BIN
apps/crenshaw2-1
Binary file not shown.
Binary file not shown.
BIN
apps/dquotes
BIN
apps/dquotes
Binary file not shown.
BIN
apps/factorial
BIN
apps/factorial
Binary file not shown.
|
@ -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/sigils
BIN
apps/sigils
Binary file not shown.
BIN
apps/survey
BIN
apps/survey
Binary file not shown.
BIN
apps/tests
BIN
apps/tests
Binary file not shown.
|
@ -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
|
||||
}
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue