From: Ben Pfaff Date: Mon, 30 Aug 2004 22:58:46 +0000 (+0000) Subject: Filesys stubs no longer wanted. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5d38645b5875cbbb6a5e8d29cfc488987a5daf19;p=pintos-anon Filesys stubs no longer wanted. --- diff --git a/src/filesys/filesys-stub.c b/src/filesys/filesys-stub.c deleted file mode 100644 index edf5de2..0000000 --- a/src/filesys/filesys-stub.c +++ /dev/null @@ -1,125 +0,0 @@ -#include "filesys-stub.h" -#include -#include "backdoor.h" -#include "debug.h" -#include "io.h" -#include "lib.h" -#include "synch.h" - -static struct lock lock; - -void -filesys_stub_init (void) -{ - lock_init (&lock, "filesys-stub"); -} - -void -filesys_stub_lock (void) -{ - lock_acquire (&lock); -} - -void -filesys_stub_unlock (void) -{ - lock_release (&lock); -} - -static void -out_byte (uint8_t byte, void *aux UNUSED) -{ - outb (0x8901, byte); -} - -void -filesys_stub_put_bool (bool b) -{ - backdoor_put_bool (b, out_byte, NULL); -} - -void -filesys_stub_put_bytes (const void *buffer, size_t cnt) -{ - backdoor_put_bytes (buffer, cnt, out_byte, NULL); -} - -void -filesys_stub_put_file (struct file *file) -{ - ASSERT (file != NULL); - filesys_stub_put_int32 ((int32_t) file - 1); -} - -void -filesys_stub_put_int32 (int32_t value) -{ - backdoor_put_int32 (value, out_byte, NULL); -} - -void -filesys_stub_put_string (const char *string) -{ - backdoor_put_string (string, out_byte, NULL); -} - -void -filesys_stub_put_uint32 (uint32_t value) -{ - backdoor_put_uint32 (value, out_byte, NULL); -} - -static uint8_t -in_byte (void *aux UNUSED) -{ - return inb (0x8901); -} - -bool -filesys_stub_get_bool (void) -{ - return backdoor_get_bool (in_byte, NULL); -} - -void -filesys_stub_get_bytes (void *buffer, size_t size) -{ - /* We could use backdoor_get_bytes() but this is significantly - faster. */ - asm ("rep insl; movl %0, %%ecx; rep insb" - : - : "g" (size % 4), "d" (0x8901), "c" (size / 4), "D" (buffer)); -} - -struct file * -filesys_stub_get_file (void) -{ - int32_t fd = filesys_stub_get_int32 (); - return fd < 0 ? NULL : (struct file *) (fd + 1); -} - -int32_t -filesys_stub_get_int32 (void) -{ - return backdoor_get_int32 (in_byte, NULL); -} - -void -filesys_stub_match_string (const char *string) -{ - if (backdoor_get_uint32 (in_byte, NULL) != strlen (string)) - panic ("string match failed"); - while (*string != '\0') - { - uint8_t c = *string++; - if (c != in_byte (NULL)) - panic ("string match failed"); - } -} - -uint32_t -filesys_stub_get_uint32 (void) -{ - return backdoor_get_uint32 (in_byte, NULL); -} - diff --git a/src/filesys/filesys-stub.h b/src/filesys/filesys-stub.h deleted file mode 100644 index da0b22e..0000000 --- a/src/filesys/filesys-stub.h +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef HEADER_FILESYS_STUB_H -#define HEADER_FILESYS_STUB_H 1 - -#include -#include -#include - -struct file; - -void filesys_stub_init (void); -void filesys_stub_lock (void); -void filesys_stub_unlock (void); - -void filesys_stub_put_bool (bool); -void filesys_stub_put_bytes (const void *, size_t); -void filesys_stub_put_file (struct file *); -void filesys_stub_put_int32 (int32_t); -void filesys_stub_put_string (const char *); -void filesys_stub_put_uint32 (uint32_t); - -bool filesys_stub_get_bool (void); -void filesys_stub_get_bytes (void *, size_t); -struct file *filesys_stub_get_file (void); -int32_t filesys_stub_get_int32 (void); -void filesys_stub_match_string (const char *); -uint32_t filesys_stub_get_uint32 (void); - -#endif /* filesys-stub.h */