Rev 2954 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2954 | Rev 2959 | ||
---|---|---|---|
Line 36... | Line 36... | ||
36 | 36 | ||
37 | #include <stdio.h> |
37 | #include <stdio.h> |
38 | #include <unistd.h> |
38 | #include <unistd.h> |
39 | #include <fcntl.h> |
39 | #include <fcntl.h> |
40 | 40 | ||
- | 41 | #include "../../app/iloader/pcb.h" |
|
- | 42 | ||
41 | static void kputint(unsigned i) |
43 | static void kputint(unsigned i) |
42 | { |
44 | { |
43 | unsigned dummy; |
45 | unsigned dummy; |
44 | asm volatile ( |
46 | asm volatile ( |
45 | "movl $30, %%eax;" |
47 | "movl $30, %%eax;" |
Line 58... | Line 60... | ||
58 | void test_func(void) |
60 | void test_func(void) |
59 | { |
61 | { |
60 | int fd, rc; |
62 | int fd, rc; |
61 | char buf[5]; |
63 | char buf[5]; |
62 | 64 | ||
63 | kputint(-1); |
- | |
64 | kputint(z); |
- | |
65 | printf("Hello, world! (from rtld)\n"); |
65 | printf("Hello, world! (from rtld)\n"); |
66 | 66 | ||
67 | fd = open("/test", O_RDONLY); |
67 | fd = open("/tetris", O_RDONLY); |
68 | if (fd < 0) { printf("fd<0 ("); _putint(fd); printf(")\n"); } |
68 | if (fd < 0) { printf("fd<0 ("); _putint(fd); printf(")\n"); } |
69 | fd = 0; |
69 | fd = 0; |
70 | 70 | ||
71 | rc = read(fd, &buf, 4); |
71 | rc = read(fd, &buf, 4); |
72 | //printf(" ->%d\n", rc); |
72 | //printf(" ->%d\n", rc); |
Line 74... | Line 74... | ||
74 | printf(buf); |
74 | printf(buf); |
75 | getchar(); |
75 | getchar(); |
76 | 76 | ||
77 | printf("x\n"); |
77 | printf("x\n"); |
78 | while(1); |
78 | while(1); |
79 | - | ||
80 | asm ( |
- | |
81 | "movl $253, %%eax;" |
- | |
82 | "int $0x30" |
- | |
83 | : /* output */ |
- | |
84 | : /* input */ |
- | |
85 | : "%eax","%ecx","%edx" /* all scratch registers clobbered */ |
- | |
86 | ); |
- | |
87 | } |
79 | } |
88 | 80 | ||
89 | 81 | ||
90 | void _rtld_main(void) |
82 | void _rtld_main(void) |
91 | { |
83 | { |
92 | kputint(-1); |
84 | // test_func(); |
93 | 85 | ||
94 | kputint(32); |
86 | pcb_t *pcb; |
95 | 87 | ||
- | 88 | printf("Hello, world! (from rtld)\n"); |
|
96 | test_func(); |
89 | getchar(); |
- | 90 | printf("Run program..\n"); |
|
97 | 91 | ||
- | 92 | pcb = (pcb_t *)PCB_ADDRESS; |
|
98 | kputint(46); |
93 | pcb->entry(); |
99 | } |
94 | } |
100 | 95 | ||
101 | /** @} |
96 | /** @} |
102 | */ |
97 | */ |