-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.c
68 lines (52 loc) · 1.53 KB
/
test.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#include "test.h"
#include "lib.h"
#include "multiboot.h"
#include "x86_desc.h"
#include "lib.h"
#include "i8259.h"
#include "debug.h"
#include "idt_handler.h"
#include "page.h"
#include "rtc.h"
#include "terminal.h"
#include "file_system.h"
int32_t
test_system_call(int32_t arg1, int32_t *arg2, int32_t arg3, int32_t call_num)
{
int res;
__asm__ volatile(
"int $0x80" /* make the request to the OS */
: "=a" (res) , /* return result in eax ("a") */
"+b" (arg1), /* pass arg1 in ebx ("b") */
"+c" (arg2), /* pass arg2 in ecx ("c") */
"+d" (arg3) /* pass arg3 in edx ("d") */
: "a" (call_num) /* pass system call number in eax ("a") */
: "memory", "cc"); /* announce to the compiler that the memory and condition codes have been modified */
/* The operating system will return a negative value on error;
* wrappers return -1 on error and set the errno global variable */
return res;
}
/* test_dentries
* Description: testing
* Input: N/A
* Output: N/A
* Return value: N/A
* Side effect:testing
*/
void
test_dentries()
{
uint8_t buf[2000];
int i;
dentry_t dentry;
uint8_t name[32] = "frame1.txt";
read_dentry_by_name(name, &dentry);
printf("name is %s \n", dentry.name);
printf("type is %x \n", dentry.type);
printf("index is %x \n", dentry.inode);
read_data( dentry.inode, 0x00, buf, 2000);
for(i = 0; i <strlen((int8_t*)buf); i++ )
{
printf("%c", buf[i]);
}
}