From 0314dff3c6c60d352c6251118f88081e1b4bb637 Mon Sep 17 00:00:00 2001 From: Warren Toomey Date: Thu, 3 Mar 2016 11:09:55 +1000 Subject: [PATCH] Added getuid and setuid syscalls to a7out. --- tools/a7out | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/tools/a7out b/tools/a7out index 724e73e..9ce0775 100755 --- a/tools/a7out +++ b/tools/a7out @@ -526,19 +526,34 @@ sub cal { # Syscalls that we can simulate my %Syscallist = ( + # 1: save + 2 => \&sys_getuid, 3 => \&sys_open, 4 => \&sys_read, 5 => \&sys_write, 6 => \&sys_creat, + # 7 seek + # 8 tell 9 => \&sys_close, + # 10 link 11 => \&sys_unlink, + 12 => \&sys_setuid, + # 13 rename 14 => \&sys_exit, + # 15 time 16 => \&sys_intrp, 17 => \&sys_chdir, 18 => \&sys_chmod, 19 => \&sys_chown, - 28 => \&sys_rmes, + # 20 badcal + # 21 syslog + # 22 badcal + # 23 capt + # 24 rele + # 25 status + # 26 badcal 27 => \&sys_smes, + 28 => \&sys_rmes, 29 => \&sys_fork, ); @@ -557,6 +572,22 @@ sub sys_exit { exit(0); } +# Getuid system call +sub sys_getuid { + $AC= $< & MAXINT; + dprintf("getuid system call, uid %06o\n", $AC); + $PC += 1; + return; +} + +# Setuid system call +sub sys_setuid { + # For now, do nothing + dprint("setuid system call\n"); + $PC += 1; + return; +} + # Intrp system call sub sys_intrp { # For now, do nothing