Changeset bd1deed in mainline for kernel/generic
- Timestamp:
- 2007-02-11T20:04:08Z (18 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- c993e45
- Parents:
- ce8aed1
- Location:
- kernel/generic
- Files:
-
- 2 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/include/memstr.h
rce8aed1 rbd1deed 45 45 extern void _memsetb(uintptr_t dst, size_t cnt, uint8_t x); 46 46 extern void _memsetw(uintptr_t dst, size_t cnt, uint16_t x); 47 extern char *strcpy(char *dest, const char *src); 47 48 48 49 #endif -
kernel/generic/include/mm/as.h
rce8aed1 rbd1deed 80 80 /** The page fault was caused by memcpy_from_uspace() or memcpy_to_uspace(). */ 81 81 #define AS_PF_DEFER 2 82 83 #ifdef __OBJC__ 84 @interface as_t { 85 @public 86 /** Protected by asidlock. */ 87 link_t inactive_as_with_asid_link; 88 89 mutex_t lock; 90 91 /** Number of references (i.e tasks that reference this as). */ 92 count_t refcount; 93 94 /** Number of processors on wich is this address space active. */ 95 count_t cpu_refcount; 96 97 /** B+tree of address space areas. */ 98 btree_t as_area_btree; 99 100 /** 101 * Address space identifier. 102 * Constant on architectures that do not support ASIDs. 103 */ 104 asid_t asid; 105 106 /** Non-generic content. */ 107 as_genarch_t genarch; 108 109 /** Architecture specific content. */ 110 as_arch_t arch; 111 } 112 + (pte_t *) page_table_create: (int) flags; 113 + (void) page_table_destroy: (pte_t *) page_table; 114 - (void) page_table_lock: (bool) _lock; 115 - (void) page_table_unlock: (bool) unlock; 116 @end 117 118 #else 82 119 83 120 /** Address space structure. … … 122 159 void (* page_table_unlock)(as_t *as, bool unlock); 123 160 } as_operations_t; 161 #endif 124 162 125 163 /** … … 202 240 203 241 extern as_t *AS_KERNEL; 242 243 #ifndef __OBJC__ 204 244 extern as_operations_t *as_operations; 245 #endif 205 246 206 247 SPINLOCK_EXTERN(inactive_as_with_asid_lock); -
kernel/generic/include/print.h
rce8aed1 rbd1deed 45 45 #define EOF (-1) 46 46 47 extern int puts(const char *s); 47 48 extern int printf(const char *fmt, ...); 48 49 extern int sprintf(char *str, const char *fmt, ...); -
kernel/generic/src/lib/memstr.c
rce8aed1 rbd1deed 75 75 } 76 76 77 return (char *) src;77 return (char *) src; 78 78 } 79 79 … … 93 93 uint8_t *p = (uint8_t *) dst; 94 94 95 for (i=0; i<cnt; i++)95 for (i = 0; i < cnt; i++) 96 96 p[i] = x; 97 97 } … … 112 112 uint16_t *p = (uint16_t *) dst; 113 113 114 for (i=0; i<cnt; i++)114 for (i = 0; i < cnt; i++) 115 115 p[i] = x; 116 } 117 118 /** Copy string 119 * 120 * Copy string from src address to dst address. 121 * The copying is done char-by-char until the null 122 * character. The source and destination memory areas 123 * cannot overlap. 124 * 125 * @param src Origin string to copy from. 126 * @param dst Origin string to copy to. 127 * 128 */ 129 char *strcpy(char *dest, const char *src) 130 { 131 char *orig = dest; 132 133 while ((*(dest++) = *(src++))); 134 return orig; 116 135 } 117 136 -
kernel/generic/src/mm/as.c
rce8aed1 rbd1deed 82 82 #endif /* CONFIG_VIRT_IDX_DCACHE */ 83 83 84 #ifndef __OBJC__ 84 85 /** 85 86 * Each architecture decides what functions will be used to carry out … … 87 88 */ 88 89 as_operations_t *as_operations = NULL; 90 #endif 89 91 90 92 /** … … 993 995 pte_t *page_table_create(int flags) 994 996 { 995 ASSERT(as_operations); 996 ASSERT(as_operations->page_table_create); 997 998 return as_operations->page_table_create(flags); 997 #ifdef __OBJC__ 998 return [as_t page_table_create: flags]; 999 #else 1000 ASSERT(as_operations); 1001 ASSERT(as_operations->page_table_create); 1002 1003 return as_operations->page_table_create(flags); 1004 #endif 999 1005 } 1000 1006 … … 1007 1013 void page_table_destroy(pte_t *page_table) 1008 1014 { 1009 ASSERT(as_operations); 1010 ASSERT(as_operations->page_table_destroy); 1011 1012 as_operations->page_table_destroy(page_table); 1015 #ifdef __OBJC__ 1016 return [as_t page_table_destroy: page_table]; 1017 #else 1018 ASSERT(as_operations); 1019 ASSERT(as_operations->page_table_destroy); 1020 1021 as_operations->page_table_destroy(page_table); 1022 #endif 1013 1023 } 1014 1024 … … 1027 1037 void page_table_lock(as_t *as, bool lock) 1028 1038 { 1039 #ifdef __OBJC__ 1040 [as page_table_lock: lock]; 1041 #else 1029 1042 ASSERT(as_operations); 1030 1043 ASSERT(as_operations->page_table_lock); 1031 1044 1032 1045 as_operations->page_table_lock(as, lock); 1046 #endif 1033 1047 } 1034 1048 … … 1040 1054 void page_table_unlock(as_t *as, bool unlock) 1041 1055 { 1056 #ifdef __OBJC__ 1057 [as page_table_unlock: unlock]; 1058 #else 1042 1059 ASSERT(as_operations); 1043 1060 ASSERT(as_operations->page_table_unlock); 1044 1061 1045 1062 as_operations->page_table_unlock(as, unlock); 1063 #endif 1046 1064 } 1047 1065 -
kernel/generic/src/printf/vprintf.c
rce8aed1 rbd1deed 37 37 #include <putchar.h> 38 38 39 int vprintf_write(const char *str, size_t count, void *unused); 39 static int vprintf_write(const char *str, size_t count, void *unused) 40 { 41 size_t i; 42 for (i = 0; i < count; i++) 43 putchar(str[i]); 44 return i; 45 } 40 46 41 int vprintf_write(const char *str, size_t count, void *unused)47 int puts(const char *s) 42 48 { 43 size_t i = 0;44 for ( ; i < count; i++)45 putchar(s tr[i]);49 size_t i; 50 for (i = 0; s[i] != 0; i++) 51 putchar(s[i]); 46 52 return i; 47 53 } … … 49 55 int vprintf(const char *fmt, va_list ap) 50 56 { 51 struct printf_spec ps = {(int(*)(void *, size_t, void *)) vprintf_write, NULL};57 struct printf_spec ps = {(int(*)(void *, size_t, void *)) vprintf_write, NULL}; 52 58 return printf_core(fmt, &ps, ap); 53 59
Note:
See TracChangeset
for help on using the changeset viewer.