This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

small bugfixes

Ivan Ilak (Apr 20, 2023, 10:07 PM +0200) 32c8b686 caaed6b8

+12 -32
+3
os/include/kernel/atag.h
··· 1 + // All implementation details have been taken from here 2 + // http://www.simtec.co.uk/products/SWLINUX/files/booting_article.html#appendix_tag_reference 3 + 1 4 #include <stdint.h> 2 5 3 6 #ifndef ATAG_H
-1
os/src/common/stdlib.c
··· 3 3 4 4 #include <stdint.h> 5 5 6 - // raspi model 1 does not have division instruction, so we need to define our own 7 6 __inline__ uint32_t div(uint32_t dividend, uint32_t divisor) 8 7 { 9 8 #if MODEL_0 || MODEL_1
+2 -31
os/src/kernel/atag.c
··· 15 15 return 0; 16 16 } 17 17 18 - char *tohex(unsigned int value, unsigned int size) 19 - { 20 - static char buffer[9]; 21 - 22 - unsigned int offset; 23 - unsigned char ch; 24 - 25 - if(size != 1 && size != 2 && size != 4) 26 - return "error"; 27 - 28 - offset = size * 2; 29 - 30 - buffer[offset] = 0; 31 - 32 - while(offset--) 33 - { 34 - ch = 48 + (value & 15); 35 - if(ch >= 58) 36 - ch += 7; 37 - 38 - buffer[offset] = ch; 39 - value = value >> 4; 40 - } 41 - 42 - return buffer; 43 - } 44 - 45 18 void print_atag_core(atag_t *atags) 46 19 { 47 20 printf(" Flags: %d\n", atags->core.flags); ··· 72 45 do 73 46 { 74 47 tag = atags->header.tag_type; 75 - puts(" ATAG at address 0x"); 76 - puts(tohex((unsigned int)atags, 4)); 77 - puts(" is "); 78 - puts(tohex(tag, 4)); 48 + printf(" ATAG at address %s", itoa((uint32_t)atags, 16)); 49 + printf(" is %s", itoa(tag, 16)); 79 50 80 51 switch(tag) 81 52 {
+7
tests/src/test_stdlib.c
··· 4 4 5 5 void test_div(void **state) 6 6 { 7 + (void)state; 7 8 assert_int_equal(0, div(1, 2)); 8 9 assert_int_equal(46, div(234, 5)); 9 10 } 10 11 11 12 void test_divmod(void **state) 12 13 { 14 + (void)state; 13 15 divmod_t res = divmod(234, 5); 14 16 assert_int_equal(res.div, 46); 15 17 assert_int_equal(res.mod, 4); ··· 17 19 18 20 void test_itoa(void **state) 19 21 { 22 + (void)state; 20 23 assert_string_equal("26", itoa(26, 10)); 21 24 assert_string_equal("-26", itoa(-26, 10)); 22 25 assert_string_equal("0b11010", itoa(26, 2)); ··· 26 29 27 30 void test_atoi(void **state) 28 31 { 32 + (void)state; 29 33 assert_int_equal(26, atoi("26")); 30 34 assert_int_equal(-26, atoi("-26")); 31 35 } 32 36 33 37 void test_memset(void **state) 34 38 { 39 + (void)state; 35 40 char str[50] = "I need a sentence to test this!"; 36 41 memset(str + 5, '.', 8); 37 42 assert_string_equal(str, "I nee........ence to test this!"); ··· 46 51 47 52 void test_bzero(void **state) 48 53 { 54 + (void)state; 49 55 int32_t arr[10]; 50 56 for(int32_t i = 0; i < 10; i++) 51 57 arr[i] = 1; ··· 58 64 59 65 void test_memcpy(void **state) 60 66 { 67 + (void)state; 61 68 int32_t arr[10]; 62 69 for(int32_t i = 0; i < 10; i++) 63 70 arr[i] = 1;