- Timestamp:
- 2012-04-11T15:37:01Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 49a736e2
- Parents:
- 3a01483 (diff), d11a181 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)links above to see all the changes relative to each parent. - Location:
- kernel
- Files:
-
- 1 added
- 8 edited
-
arch/arm32/Makefile.inc (modified) (2 diffs)
-
arch/arm32/src/eabi.S (added)
-
arch/arm32/src/mach/testarm/testarm.c (modified) (5 diffs)
-
genarch/include/softint/division.h (modified) (1 diff)
-
genarch/include/softint/multiplication.h (modified) (2 diffs)
-
genarch/src/softint/division.c (modified) (12 diffs)
-
genarch/src/softint/multiplication.c (modified) (2 diffs)
-
generic/src/console/console.c (modified) (1 diff)
-
generic/src/lib/str.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/arm32/Makefile.inc
r3a01483 rc127e1c 33 33 ATSIGN = % 34 34 35 GCC_CFLAGS += - fno-zero-initialized-in-bss -mapcs-frame35 GCC_CFLAGS += -march=armv4 36 36 37 37 BITS = 32 … … 41 41 arch/$(KARCH)/src/start.S \ 42 42 arch/$(KARCH)/src/asm.S \ 43 arch/$(KARCH)/src/eabi.S \ 43 44 arch/$(KARCH)/src/exc_handler.S \ 44 45 arch/$(KARCH)/src/arm32.c \ -
kernel/arch/arm32/src/mach/testarm/testarm.c
r3a01483 rc127e1c 121 121 } 122 122 } 123 123 124 124 /* 125 125 * This is the necessary evil until the userspace driver is entirely … … 172 172 clock(); 173 173 spinlock_lock(&irq->lock); 174 174 175 175 /* acknowledge tick */ 176 176 *((uint32_t *) (gxemul_rtc + GXEMUL_RTC_ACK_OFFSET)) … … 181 181 static void gxemul_timer_irq_init(void) 182 182 { 183 irq_initialize(&gxemul_timer_irq);184 gxemul_timer_irq.devno = device_assign_devno();185 gxemul_timer_irq.inr = GXEMUL_TIMER_IRQ;186 gxemul_timer_irq.claim = gxemul_timer_claim;187 gxemul_timer_irq.handler = gxemul_timer_irq_handler;188 189 irq_register(&gxemul_timer_irq);183 irq_initialize(&gxemul_timer_irq); 184 gxemul_timer_irq.devno = device_assign_devno(); 185 gxemul_timer_irq.inr = GXEMUL_TIMER_IRQ; 186 gxemul_timer_irq.claim = gxemul_timer_claim; 187 gxemul_timer_irq.handler = gxemul_timer_irq_handler; 188 189 irq_register(&gxemul_timer_irq); 190 190 } 191 191 … … 198 198 void gxemul_timer_irq_start(void) 199 199 { 200 gxemul_timer_irq_init();201 gxemul_timer_start(GXEMUL_TIMER_FREQ);200 gxemul_timer_irq_init(); 201 gxemul_timer_start(GXEMUL_TIMER_FREQ); 202 202 } 203 203 … … 227 227 uint32_t sources = gxemul_irqc_get_sources(); 228 228 unsigned int i; 229 229 230 230 for (i = 0; i < GXEMUL_IRQ_COUNT; i++) { 231 231 if (sources & (1 << i)) { -
kernel/genarch/include/softint/division.h
r3a01483 rc127e1c 36 36 #define KERN_DIVISION_H_ 37 37 38 /* 32bit integer division */ 39 int __divsi3(int a, int b);38 extern int __divsi3(int, int); 39 extern long long __divdi3(long long, long long); 40 40 41 /* 64bit integer division */ 42 long long __divdi3(long long a, long long b);41 extern unsigned int __udivsi3(unsigned int, unsigned int); 42 extern unsigned long long __udivdi3(unsigned long long, unsigned long long); 43 43 44 /* 32bit unsigned integer division */ 45 unsigned int __udivsi3(unsigned int a, unsigned int b);44 extern int __modsi3(int, int); 45 extern long long __moddi3(long long, long long); 46 46 47 /* 64bit unsigned integer division */ 48 unsigned long long __udivdi3(unsigned long long a, unsigned long long b);47 extern unsigned int __umodsi3(unsigned int, unsigned int); 48 extern unsigned long long __umoddi3(unsigned long long, unsigned long long); 49 49 50 /* 32bit remainder of the signed division */ 51 int __modsi3(int a, int b);50 extern int __divmodsi3(int, int, int *); 51 extern unsigned int __udivmodsi3(unsigned int, unsigned int, unsigned int *); 52 52 53 /* 64bit remainder of the signed division */ 54 long long __moddi3(long long a, long long b); 55 56 /* 32bit remainder of the unsigned division */ 57 unsigned int __umodsi3(unsigned int a, unsigned int b); 58 59 /* 64bit remainder of the unsigned division */ 60 unsigned long long __umoddi3(unsigned long long a, unsigned long long b); 61 62 unsigned long long __udivmoddi3(unsigned long long a, unsigned long long b, unsigned long long *c); 53 extern long long __divmoddi3(long long, long long, long long *); 54 extern unsigned long long __udivmoddi3(unsigned long long, unsigned long long, 55 unsigned long long *); 63 56 64 57 #endif -
kernel/genarch/include/softint/multiplication.h
r3a01483 rc127e1c 29 29 /** @addtogroup genarch 30 30 * @{ 31 */ 31 */ 32 32 /** 33 33 * @file 34 34 */ 35 35 36 #ifndef __SOFTINT_MULTIPLICATION_H__37 #define __SOFTINT_MULTIPLICATION_H__36 #ifndef KERN_MULTIPLICATION_H_ 37 #define KERN_MULTIPLICATION_H_ 38 38 39 39 /* 64 bit multiplication */ 40 long long __muldi3(long long a, long long b);40 extern long long __muldi3(long long, long long); 41 41 42 42 #endif … … 44 44 /** @} 45 45 */ 46 47 -
kernel/genarch/src/softint/division.c
r3a01483 rc127e1c 27 27 */ 28 28 29 /** @addtogroup genarch 29 /** @addtogroup genarch 30 30 * @{ 31 31 */ … … 35 35 #include <genarch/softint/division.h> 36 36 37 #define ABSVAL(x) ((x) > 0 ? (x) : -(x))38 #define SGN(x) ((x) >= 0 ? 1 : 0)39 37 #define ABSVAL(x) ((x) > 0 ? (x) : -(x)) 38 #define SGN(x) ((x) >= 0 ? 1 : 0) 39 40 40 static unsigned int divandmod32(unsigned int a, unsigned int b, 41 41 unsigned int *remainder) … … 56 56 return 0; 57 57 } 58 58 59 59 for (; steps > 0; steps--) { 60 60 /* shift one bit to remainder */ … … 68 68 a <<= 1; 69 69 } 70 70 71 71 return result; 72 72 } 73 74 73 75 74 static unsigned long long divandmod64(unsigned long long a, … … 77 76 { 78 77 unsigned long long result; 79 int steps = sizeof(unsigned long long) * 8; 78 int steps = sizeof(unsigned long long) * 8; 80 79 81 80 *remainder = 0; … … 91 90 return 0; 92 91 } 93 92 94 93 for (; steps > 0; steps--) { 95 94 /* shift one bit to remainder */ … … 103 102 a <<= 1; 104 103 } 105 104 106 105 return result; 107 106 } 108 107 109 108 /* 32bit integer division */ 110 int __divsi3(int a, int b) 111 { 112 unsigned int rem; 113 int result; 114 115 result = (int) divandmod32(ABSVAL(a), ABSVAL(b), &rem); 116 109 int __divsi3(int a, int b) 110 { 111 unsigned int rem; 112 int result = (int) divandmod32(ABSVAL(a), ABSVAL(b), &rem); 113 117 114 if (SGN(a) == SGN(b)) 118 115 return result; 116 119 117 return -result; 120 118 } 121 119 122 120 /* 64bit integer division */ 123 long long __divdi3(long long a, long long b) 124 { 125 unsigned long long rem; 126 long long result; 127 128 result = (long long) divandmod64(ABSVAL(a), ABSVAL(b), &rem); 129 121 long long __divdi3(long long a, long long b) 122 { 123 unsigned long long rem; 124 long long result = (long long) divandmod64(ABSVAL(a), ABSVAL(b), &rem); 125 130 126 if (SGN(a) == SGN(b)) 131 127 return result; 128 132 129 return -result; 133 130 } … … 143 140 unsigned long long __udivdi3(unsigned long long a, unsigned long long b) 144 141 { 145 unsigned long long rem;142 unsigned long long rem; 146 143 return divandmod64(a, b, &rem); 147 144 } … … 154 151 155 152 /* if divident is negative, remainder must be too */ 156 if (!(SGN(a))) {153 if (!(SGN(a))) 157 154 return -((int) rem); 158 }159 155 160 156 return (int) rem; … … 162 158 163 159 /* 64bit remainder of the signed division */ 164 long long __moddi3(long long a, longlong b)160 long long __moddi3(long long a, long long b) 165 161 { 166 162 unsigned long long rem; … … 168 164 169 165 /* if divident is negative, remainder must be too */ 170 if (!(SGN(a))) {166 if (!(SGN(a))) 171 167 return -((long long) rem); 172 }173 168 174 169 return (long long) rem; … … 191 186 } 192 187 188 int __divmodsi3(int a, int b, int *c) 189 { 190 unsigned int rem; 191 int result = (int) divandmod32(ABSVAL(a), ABSVAL(b), &rem); 192 193 if (SGN(a) == SGN(b)) { 194 *c = rem; 195 return result; 196 } 197 198 *c = -rem; 199 return -result; 200 } 201 202 unsigned int __udivmodsi3(unsigned int a, unsigned int b, 203 unsigned int *c) 204 { 205 return divandmod32(a, b, c); 206 } 207 208 long long __divmoddi3(long long a, long long b, long long *c) 209 { 210 unsigned long long rem; 211 long long result = (int) divandmod64(ABSVAL(a), ABSVAL(b), &rem); 212 213 if (SGN(a) == SGN(b)) { 214 *c = rem; 215 return result; 216 } 217 218 *c = -rem; 219 return -result; 220 } 221 193 222 unsigned long long __udivmoddi3(unsigned long long a, unsigned long long b, 194 223 unsigned long long *c) -
kernel/genarch/src/softint/multiplication.c
r3a01483 rc127e1c 29 29 /** @addtogroup genarch 30 30 * @{ 31 */ 31 */ 32 32 /** 33 33 * @file … … 130 130 131 131 return result; 132 } 132 } 133 133 134 134 /** @} -
kernel/generic/src/console/console.c
r3a01483 rc127e1c 57 57 58 58 /** Kernel log cyclic buffer */ 59 static wchar_t klog[KLOG_LENGTH] __attribute__ ((aligned(PAGE_SIZE)));59 wchar_t klog[KLOG_LENGTH] __attribute__((aligned(PAGE_SIZE))); 60 60 61 61 /** Kernel log initialized */ -
kernel/generic/src/lib/str.c
r3a01483 rc127e1c 111 111 #include <debug.h> 112 112 #include <macros.h> 113 114 /** Check the condition if wchar_t is signed */ 115 #ifdef WCHAR_IS_UNSIGNED 116 #define WCHAR_SIGNED_CHECK(cond) (true) 117 #else 118 #define WCHAR_SIGNED_CHECK(cond) (cond) 119 #endif 113 120 114 121 /** Byte mask consisting of lowest @n bits (out of 8) */ … … 206 213 * 207 214 * @return EOK if the character was encoded successfully, EOVERFLOW if there 208 * was not enough space in the output buffer or EINVAL if the character209 * code was invalid.210 */ 211 int chr_encode( wchar_t ch, char *str, size_t *offset, size_t size)215 * was not enough space in the output buffer or EINVAL if the character 216 * code was invalid. 217 */ 218 int chr_encode(const wchar_t ch, char *str, size_t *offset, size_t size) 212 219 { 213 220 if (*offset >= size) … … 427 434 bool ascii_check(wchar_t ch) 428 435 { 429 if ( (ch >= 0) && (ch <= 127))436 if (WCHAR_SIGNED_CHECK(ch >= 0) && (ch <= 127)) 430 437 return true; 431 438 … … 440 447 bool chr_check(wchar_t ch) 441 448 { 442 if ( (ch >= 0) && (ch <= 1114111))449 if (WCHAR_SIGNED_CHECK(ch >= 0) && (ch <= 1114111)) 443 450 return true; 444 451
Note:
See TracChangeset
for help on using the changeset viewer.
