Rev 2952 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2952 | Rev 2954 | ||
---|---|---|---|
Line 33... | Line 33... | ||
33 | /** |
33 | /** |
34 | * @file |
34 | * @file |
35 | */ |
35 | */ |
36 | 36 | ||
37 | #include <stdio.h> |
37 | #include <stdio.h> |
- | 38 | #include <unistd.h> |
|
- | 39 | #include <fcntl.h> |
|
38 | 40 | ||
39 | static void kputint(unsigned i) |
41 | static void kputint(unsigned i) |
40 | { |
42 | { |
41 | unsigned dummy; |
43 | unsigned dummy; |
42 | asm volatile ( |
44 | asm volatile ( |
Line 48... | Line 50... | ||
48 | ); |
50 | ); |
49 | } |
51 | } |
50 | 52 | ||
51 | int z = 42; |
53 | int z = 42; |
52 | 54 | ||
- | 55 | void _putint(int i); |
|
- | 56 | ||
53 | void test_func(void); |
57 | void test_func(void); |
54 | void test_func(void) |
58 | void test_func(void) |
55 | { |
59 | { |
- | 60 | int fd, rc; |
|
- | 61 | char buf[5]; |
|
- | 62 | ||
56 | kputint(-1); |
63 | kputint(-1); |
57 | kputint(z); |
64 | kputint(z); |
58 | printf("Hello, world! (from rtld)\n"); |
65 | printf("Hello, world! (from rtld)\n"); |
- | 66 | ||
- | 67 | fd = open("/test", O_RDONLY); |
|
- | 68 | if (fd < 0) { printf("fd<0 ("); _putint(fd); printf(")\n"); } |
|
- | 69 | fd = 0; |
|
- | 70 | ||
- | 71 | rc = read(fd, &buf, 4); |
|
- | 72 | //printf(" ->%d\n", rc); |
|
- | 73 | buf[4]='\0'; |
|
- | 74 | printf(buf); |
|
59 | getchar(); |
75 | getchar(); |
- | 76 | ||
60 | printf("x\n"); |
77 | printf("x\n"); |
61 | while(1); |
78 | while(1); |
62 | 79 | ||
63 | asm ( |
80 | asm ( |
64 | "movl $253, %%eax;" |
81 | "movl $253, %%eax;" |