Check-in [42fe01316b]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:[FIXED] ub due to bad variable names
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:42fe01316b06cb482f2e325f25c9c592a20d82fa
User & Date: maxi 2018-11-07 19:30:02
Context
2018-11-11
12:03
Removed unnessecary files from standard library extension check-in: 115fecab42 user: maxi tags: trunk
2018-11-07
19:30
[FIXED] ub due to bad variable names check-in: 42fe01316b user: maxi tags: trunk
18:40
[FIXED] ticket 34d4a564b263df721ccfeeb10d6f95fe0e33eafd -> SMP check-in: ec5e46be6a user: maxi tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to include/acpi/acpi_utils.hpp.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
..
58
59
60
61
62
63
64
65
66
#pragma once
#include "structures.h"
#include "libk/string.h"
#include "buffers/string_view"

namespace ACPI
{
namespace __UTILS
{
template <class T>
inline bool correct_table_checksum(T *ptr)
{
    uint8_t check = 0;
    uint8_t *bptr = reinterpret_cast<uint8_t *>(ptr);
    for (int i = 0; i < sizeof(T); ++i, ++bptr)
................................................................................
        return ptr1;
    SDT::RSDP *ptr2 = find_upper_rsdp();
    if (ptr2 != nullptr)
        return ptr2;
    return nullptr;
}

} // namespace __UTILS
} // namespace ACPI






|







 







|

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
..
58
59
60
61
62
63
64
65
66
#pragma once
#include "structures.h"
#include "libk/string.h"
#include "buffers/string_view"

namespace ACPI
{
namespace UTILS
{
template <class T>
inline bool correct_table_checksum(T *ptr)
{
    uint8_t check = 0;
    uint8_t *bptr = reinterpret_cast<uint8_t *>(ptr);
    for (int i = 0; i < sizeof(T); ++i, ++bptr)
................................................................................
        return ptr1;
    SDT::RSDP *ptr2 = find_upper_rsdp();
    if (ptr2 != nullptr)
        return ptr2;
    return nullptr;
}

} // namespace UTILS
} // namespace ACPI

Changes to include/buffers/buffer.hpp.

1
2
3
4
5
6
7
8
9
10
11
12
..
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
...
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
#pragma once
#include <stddef.h>
#include "buffers/container.hpp"

namespace __internals
{

template <typename T>
T &ref(T &n)
{
	return n;
}
................................................................................
		return (rhs.it < it);
	}
	auto operator>(const r_op_iterator &rhs)
	{
		return (rhs.it > it);
	}
};
} // namespace __internals

namespace ksdk
{
template <typename T>
class buffer
{
  protected:
................................................................................
	}

	T *end()
	{
		return _buffer + _size;
	}

	__internals::r_op_iterator<T> rbegin()
	{
		return __internals::r_op_iterator<T>(_buffer - 1 + _size);
	}

	__internals::r_op_iterator<T> rend()
	{
		return __internals::r_op_iterator<T>(_buffer - 1);
	}

	T &operator[](size_t idx)
	{
		return _buffer[idx];
	}
};
} // namespace ksdk



|







 







|







 







|

|


|

|








1
2
3
4
5
6
7
8
9
10
11
12
..
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
...
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
#pragma once
#include <stddef.h>
#include "buffers/container.hpp"

namespace internals
{

template <typename T>
T &ref(T &n)
{
	return n;
}
................................................................................
		return (rhs.it < it);
	}
	auto operator>(const r_op_iterator &rhs)
	{
		return (rhs.it > it);
	}
};
} // namespace internals

namespace ksdk
{
template <typename T>
class buffer
{
  protected:
................................................................................
	}

	T *end()
	{
		return _buffer + _size;
	}

	internals::r_op_iterator<T> rbegin()
	{
		return internals::r_op_iterator<T>(_buffer - 1 + _size);
	}

	internals::r_op_iterator<T> rend()
	{
		return internals::r_op_iterator<T>(_buffer - 1);
	}

	T &operator[](size_t idx)
	{
		return _buffer[idx];
	}
};
} // namespace ksdk

Changes to include/buffers/sosa_tree.hpp.

4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
..
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
...
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
#include "libk/string.h"
#include "kstd/utility.hpp"
#include "kstd/algorithm.hpp"
#include "kstd/functional.hpp"

namespace ksdk
{
namespace __internals
{
template <class T>
bool less(T lhs, T rhs)
{
	return lhs < rhs;
}
template <class T>
................................................................................
}
template <class T>
bool max(T lhs, T rhs)
{
	return lhs < rhs ? rhs : lhs;
}

} // namespace __internals

template <class T, bool(less)(const T, const T) = __internals::less, bool(equ)(const T, const T) = __internals::equals>
class sosa_tree
{
  public:
	template <class _T>
	struct node
	{
		int balance;
................................................................................
		}
		else
		{
			int l, r;
			l = update_balance(pos_to_left(pos));
			r = update_balance(pos_to_right(pos));
			data[pos - 1].balance = r - l;
			return __internals::max(l, r);
		}
	}

	void rotate_l(const size_t pos)
	{
		shift_drop_l(pos);
		shift_lift_r(pos);






|







 







|

|







 







|







4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
..
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
...
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
#include "libk/string.h"
#include "kstd/utility.hpp"
#include "kstd/algorithm.hpp"
#include "kstd/functional.hpp"

namespace ksdk
{
namespace internals
{
template <class T>
bool less(T lhs, T rhs)
{
	return lhs < rhs;
}
template <class T>
................................................................................
}
template <class T>
bool max(T lhs, T rhs)
{
	return lhs < rhs ? rhs : lhs;
}

} // namespace internals

template <class T, bool(less)(const T, const T) = internals::less, bool(equ)(const T, const T) = internals::equals>
class sosa_tree
{
  public:
	template <class _T>
	struct node
	{
		int balance;
................................................................................
		}
		else
		{
			int l, r;
			l = update_balance(pos_to_left(pos));
			r = update_balance(pos_to_right(pos));
			data[pos - 1].balance = r - l;
			return internals::max(l, r);
		}
	}

	void rotate_l(const size_t pos)
	{
		shift_drop_l(pos);
		shift_lift_r(pos);

Changes to include/interrupts/global_descriptor_table.h.

2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
..
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include "asm_shims/shims.h"

namespace INT
{
namespace __GDT
{
struct GDT_ENTRY
{
    uint16_t limit;
    unsigned int base : 24;
    uint8_t access_byte;
    unsigned int limit_2 : 4;
................................................................................

GDT_ENTRY construct_tss();
GDT_ENTRY construct_dpl();
GDT_ENTRY construct_ldt();
GDT_ENTRY construct_empty_descriptor();
GDT_ENTRY construct_gdt_entry(uint32_t base, uint32_t limit, uint8_t flags, uint8_t access_byte);

} // namespace __GDT

class gdt_wrapper
{
    __GDT::GDT *table;
    bool is_loaded;

  public:
    gdt_wrapper();
    void load_gdt();
    __GDT::GDT_ENTRY *add_entry(__GDT::GDT_ENTRY entry);
    gdt_wrapper operator<<(__GDT ::GDT_ENTRY entry);
    __GDT::gdt_iterator begin();
    __GDT::gdt_iterator end();
};

} // namespace INT






|







 







|



|





|
|
|
|



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
..
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include "asm_shims/shims.h"

namespace INT
{
namespace GDT
{
struct GDT_ENTRY
{
    uint16_t limit;
    unsigned int base : 24;
    uint8_t access_byte;
    unsigned int limit_2 : 4;
................................................................................

GDT_ENTRY construct_tss();
GDT_ENTRY construct_dpl();
GDT_ENTRY construct_ldt();
GDT_ENTRY construct_empty_descriptor();
GDT_ENTRY construct_gdt_entry(uint32_t base, uint32_t limit, uint8_t flags, uint8_t access_byte);

} // namespace GDT

class gdt_wrapper
{
    GDT::GDT *table;
    bool is_loaded;

  public:
    gdt_wrapper();
    void load_gdt();
    GDT::GDT_ENTRY *add_entry(GDT::GDT_ENTRY entry);
    gdt_wrapper operator<<(GDT ::GDT_ENTRY entry);
    GDT::gdt_iterator begin();
    GDT::gdt_iterator end();
};

} // namespace INT

Changes to include/interrupts/pic_wrapper.h.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#pragma once

#include "kstd/utility.hpp"
#include "asm_shims/shims.h"

namespace INT
{ //not to be confused with the datatype int lol
namespace __PICS
{

struct PIC_PORTS
{
  uint16_t command;
  uint16_t data;
}; // namespace __INT_COMPstructPIC_PORTS

class PIC_8259
{
public:
  PIC_8259(bool, int);
  void disable();
  void remap();
  void end_interrupt();

private:
  bool type; //slave or master
  PIC_PORTS ports;
};
} // namespace __PICS

class pic_wrapper
{
public:
  pic_wrapper(int, int);

  //kstd::pair<__PICS::PIC_8259, __PICS::PIC_8259> pics;
};
} // namespace INT






|






|













|






|


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#pragma once

#include "kstd/utility.hpp"
#include "asm_shims/shims.h"

namespace INT
{ //not to be confused with the datatype int lol
namespace PICS
{

struct PIC_PORTS
{
  uint16_t command;
  uint16_t data;
}; // namespace INT_COMPstructPIC_PORTS

class PIC_8259
{
public:
  PIC_8259(bool, int);
  void disable();
  void remap();
  void end_interrupt();

private:
  bool type; //slave or master
  PIC_PORTS ports;
};
} // namespace PICS

class pic_wrapper
{
public:
  pic_wrapper(int, int);

  //kstd::pair<PICS::PIC_8259, PICS::PIC_8259> pics;
};
} // namespace INT

Changes to include/kstd/ext/rangeit.hpp.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
..
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#pragma once
#include "kstd/iterator.hpp"

namespace kstd
{
namespace ext
{
namespace __NUMIT
{

template <class T>
class iterator
{
  public:
    typedef iterator<T> self_type;
................................................................................
            return false;
        }
        return true;
    }
    T position;
    int increment;
};
} // namespace __NUMIT

template <class T>
class range_iterator
{
  public:
    typedef __NUMIT::iterator<T> iterator_type;

    range_iterator(T _start, T _end, T _increment = 0)
    {
        range_start = _start;
        range_end = _end;
        increment = _increment;
    }






|







 







|





|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
..
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#pragma once
#include "kstd/iterator.hpp"

namespace kstd
{
namespace ext
{
namespace NUMIT
{

template <class T>
class iterator
{
  public:
    typedef iterator<T> self_type;
................................................................................
            return false;
        }
        return true;
    }
    T position;
    int increment;
};
} // namespace NUMIT

template <class T>
class range_iterator
{
  public:
    typedef NUMIT::iterator<T> iterator_type;

    range_iterator(T _start, T _end, T _increment = 0)
    {
        range_start = _start;
        range_end = _end;
        increment = _increment;
    }

Changes to include/kstd/type_traits.hpp.

738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
{
};

template <typename _From, typename _To>
struct is_convertible_base
{
  private:
    typedef char __one;
    typedef struct
    {
        char __arr[2];
    } __two;
    static __one __test(_To);
    static __two __test(...);
    static _From __makeFrom();

  public:
    static const bool __value = sizeof(__test(__makeFrom())) == 1;
};

template <class T, class U>
struct is_convertible : integral_constant<bool, is_convertible_base<T, U>::__value>
{
};

template <class T, class U>
struct is_base_of : integral_constant<bool, __is_base_of(T, U)>
{
};






|


|
|
|
|
|


|



|







738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
{
};

template <typename _From, typename _To>
struct is_convertible_base
{
  private:
    typedef char one;
    typedef struct
    {
        char arr[2];
    } two;
    static one test(_To);
    static two test(...);
    static _From makeFrom();

  public:
    static const bool value = sizeof(test(makeFrom())) == 1;
};

template <class T, class U>
struct is_convertible : integral_constant<bool, is_convertible_base<T, U>::value>
{
};

template <class T, class U>
struct is_base_of : integral_constant<bool, __is_base_of(T, U)>
{
};

Changes to include/kstd/utility.hpp.

5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
struct pair
{
	typedef _T1 first_type;
	typedef _T2 second_type;
	_T1 first;
	_T2 second;
	pair() : first(), second() {}
	pair(const _T1 &__a, const _T2 &__b) : first(__a), second(__b) {}
	template <class _U1, class _U2>
	pair(const pair<_U1, _U2> &__p) : first(__p.first), second(__p.second) {}
};

template <typename T, typename U>
pair<T, U> make_pair(T a, U b)
{
	pair<T, U> ret;
	ret.first = a;






|

|







5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
struct pair
{
	typedef _T1 first_type;
	typedef _T2 second_type;
	_T1 first;
	_T2 second;
	pair() : first(), second() {}
	pair(const _T1 &a, const _T2 &b) : first(a), second(b) {}
	template <class _U1, class _U2>
	pair(const pair<_U1, _U2> &p) : first(p.first), second(p.second) {}
};

template <typename T, typename U>
pair<T, U> make_pair(T a, U b)
{
	pair<T, U> ret;
	ret.first = a;

Changes to include/kstd/vector.hpp.

6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
...
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
...
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
#include "type_traits.hpp"

namespace kstd
{
template <class T, class A = allocator<T>>
class vector;

namespace __VEC_IT
{ //iterators for kstd::vector

template <class T>
class iterator : public kstd::iterator<kstd::forward_iterator_tag, T>
{
  public:
	typedef kstd::__VEC_IT::iterator<T> self_type;
	typedef T value_type;
	typedef T &reference;
	typedef T *pointer;
	typedef kstd::forward_iterator_tag iterator_category;
	typedef int difference_type;

	iterator()
................................................................................
	bool operator!=(const self_type &rhs)
	{
		return !(*this == rhs);
	}
	size_t position;
	value_type *ptr_;
};
} // namespace __VEC_IT

template <class T, class A>
bool operator==(const vector<T, A> &lhs, const vector<T, A> &rhs)
{
	return (lhs.size() == rhs.size() && equal(lhs.begin(), lhs.end(), rhs.begin()));
}

................................................................................
  public:
	typedef A allocator_type;
	typedef typename A::pointer pointer;
	typedef typename A::const_pointer const_pointer;
	typedef typename A::reference reference;
	typedef typename A::const_reference const_reference;
	typedef typename A::value_type value_type;
	typedef __VEC_IT::iterator<T> iterator;
	typedef __VEC_IT::const_iterator<T> const_iterator;
	typedef size_t size_type;
	typedef int difference_type;
	typedef const kstd::reverse_iterator<const_iterator> const_reverse_iterator;
	typedef kstd::reverse_iterator<iterator> reverse_iterator;

	vector()
	{






|






|







 







|







 







|
|







6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
...
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
...
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
#include "type_traits.hpp"

namespace kstd
{
template <class T, class A = allocator<T>>
class vector;

namespace VEC_IT
{ //iterators for kstd::vector

template <class T>
class iterator : public kstd::iterator<kstd::forward_iterator_tag, T>
{
  public:
	typedef kstd::VEC_IT::iterator<T> self_type;
	typedef T value_type;
	typedef T &reference;
	typedef T *pointer;
	typedef kstd::forward_iterator_tag iterator_category;
	typedef int difference_type;

	iterator()
................................................................................
	bool operator!=(const self_type &rhs)
	{
		return !(*this == rhs);
	}
	size_t position;
	value_type *ptr_;
};
} // namespace VEC_IT

template <class T, class A>
bool operator==(const vector<T, A> &lhs, const vector<T, A> &rhs)
{
	return (lhs.size() == rhs.size() && equal(lhs.begin(), lhs.end(), rhs.begin()));
}

................................................................................
  public:
	typedef A allocator_type;
	typedef typename A::pointer pointer;
	typedef typename A::const_pointer const_pointer;
	typedef typename A::reference reference;
	typedef typename A::const_reference const_reference;
	typedef typename A::value_type value_type;
	typedef VEC_IT::iterator<T> iterator;
	typedef VEC_IT::const_iterator<T> const_iterator;
	typedef size_t size_type;
	typedef int difference_type;
	typedef const kstd::reverse_iterator<const_iterator> const_reverse_iterator;
	typedef kstd::reverse_iterator<iterator> reverse_iterator;

	vector()
	{

Changes to include/tests/acpi_tests/wrapper_test.hpp.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
..
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#pragma once
#include "acpi/wrappers.h"
#include "tests/test_utils.hpp"

namespace TH
{
namespace __ACPI_TEST
{
extern test_result tr;

struct TEST_WRAPPERS
{
    void test_get_rsdp()
    {
        char *sig = (char *)ACPI::__UTILS::find_rsdp();
        if (sig == nullptr)
            return;
        tr.assert(memcmp(sig, "RSD PTR ", 8) == 0, "test_get_rsdp");
    }
    void test_correct_table_checksum()
    {
        struct test_struct
................................................................................
        {
            uint8_t a = 254;
            uint8_t b = 1;
            uint8_t c = 1;
            uint8_t d = 0;
        } __attribute__((packed));
        test_struct object;
        tr.assert(ACPI::__UTILS::correct_table_checksum(&object),
                  "test_correct_table_checksum");
    }
    void test_check_for_correct_rsdp()
    {
        ACPI::SDT::RSDP *temporary = ACPI::__UTILS::find_rsdp();
        if (!ACPI::__UTILS::correct_table_checksum(temporary))
            return;
        tr.assert(ACPI::__UTILS::check_for_correct_rsdp((ACPI::sign_8_type *)temporary), "test_check_for_correct_rsdp");
    }
    TEST_WRAPPERS()
    {
        test_get_rsdp();
        test_correct_table_checksum();
        test_check_for_correct_rsdp();
    }
};
} // namespace __ACPI_TEST
} // namespace TH





|







|







 







|




|
|

|








|

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
..
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#pragma once
#include "acpi/wrappers.h"
#include "tests/test_utils.hpp"

namespace TH
{
namespace ACPI_TEST
{
extern test_result tr;

struct TEST_WRAPPERS
{
    void test_get_rsdp()
    {
        char *sig = (char *)ACPI::UTILS::find_rsdp();
        if (sig == nullptr)
            return;
        tr.assert(memcmp(sig, "RSD PTR ", 8) == 0, "test_get_rsdp");
    }
    void test_correct_table_checksum()
    {
        struct test_struct
................................................................................
        {
            uint8_t a = 254;
            uint8_t b = 1;
            uint8_t c = 1;
            uint8_t d = 0;
        } __attribute__((packed));
        test_struct object;
        tr.assert(ACPI::UTILS::correct_table_checksum(&object),
                  "test_correct_table_checksum");
    }
    void test_check_for_correct_rsdp()
    {
        ACPI::SDT::RSDP *temporary = ACPI::UTILS::find_rsdp();
        if (!ACPI::UTILS::correct_table_checksum(temporary))
            return;
        tr.assert(ACPI::UTILS::check_for_correct_rsdp((ACPI::sign_8_type *)temporary), "test_check_for_correct_rsdp");
    }
    TEST_WRAPPERS()
    {
        test_get_rsdp();
        test_correct_table_checksum();
        test_check_for_correct_rsdp();
    }
};
} // namespace ACPI_TEST
} // namespace TH

Changes to include/tests/ksdk_tests/buffer_test.hpp.

1
2
3
4
5
6
7
8
9
10
11
..
14
15
16
17
18
19
20
21
#pragma once
#include "tests/test_utils.hpp"

namespace TH::__KSDK_TEST
{
extern test_result tr;
class BUFFER_TEST
{
  public:
    BUFFER_TEST()
    {
................................................................................
        tr.assert(test_buffer.size() == 20, "BUFFER_TEST 1");
        for (auto &i : test_buffer)
            i = 10;
        for (const auto &i : test_buffer)
            tr.assert(i == 10, "BUFFER_TEST 2");
    }
};
} // namespace TH::__KSDK_TEST


|







 







|
1
2
3
4
5
6
7
8
9
10
11
..
14
15
16
17
18
19
20
21
#pragma once
#include "tests/test_utils.hpp"

namespace TH::KSDK_TEST
{
extern test_result tr;
class BUFFER_TEST
{
  public:
    BUFFER_TEST()
    {
................................................................................
        tr.assert(test_buffer.size() == 20, "BUFFER_TEST 1");
        for (auto &i : test_buffer)
            i = 10;
        for (const auto &i : test_buffer)
            tr.assert(i == 10, "BUFFER_TEST 2");
    }
};
} // namespace TH::KSDK_TEST

Changes to include/tests/ksdk_tests/memory_test.hpp.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
#pragma once
#include "tests/test_utils.hpp"

namespace TH::__KSDK_TEST
{
extern test_result tr;
class MEMORY_TEST
{
  public:
    MEMORY_TEST()
    {
    }
};
} // namespace TH::__KSDK_TEST


|









|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#pragma once
#include "tests/test_utils.hpp"

namespace TH::KSDK_TEST
{
extern test_result tr;
class MEMORY_TEST
{
  public:
    MEMORY_TEST()
    {
    }
};
} // namespace TH::KSDK_TEST

Changes to include/tests/ksdk_tests/sosa_tree_tests.hpp.

1
2
3
4
5
6
7
8
9
10
11
12
13
..
43
44
45
46
47
48
49
50
#pragma once
#include "buffers/sosa_tree.hpp"
#include "termutils/terminal.h"
#include "tests/test_utils.hpp"

namespace TH::__KSDK_TEST
{

extern test_result tr;

void dump_sosa_tree(ksdk::sosa_tree<int> tree)
{
    for (auto i : tree.buffer())
................................................................................
    tree.remove(it.pos);
    it = tree.find(4);
    ++it;
    tr.assert(*it == 6, "SOSA_TREE_TEST 3");

    tr.execute_if_failed(dump_sosa_tree, tree);
}
} // namespace TH::__KSDK_TEST




|







 







|
1
2
3
4
5
6
7
8
9
10
11
12
13
..
43
44
45
46
47
48
49
50
#pragma once
#include "buffers/sosa_tree.hpp"
#include "termutils/terminal.h"
#include "tests/test_utils.hpp"

namespace TH::KSDK_TEST
{

extern test_result tr;

void dump_sosa_tree(ksdk::sosa_tree<int> tree)
{
    for (auto i : tree.buffer())
................................................................................
    tree.remove(it.pos);
    it = tree.find(4);
    ++it;
    tr.assert(*it == 6, "SOSA_TREE_TEST 3");

    tr.execute_if_failed(dump_sosa_tree, tree);
}
} // namespace TH::KSDK_TEST

Changes to include/tests/stl_tests/type_trait_tests.hpp.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
...
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
...
745
746
747
748
749
750
751
752
#pragma once
#include "kstd/type_traits.hpp"

namespace TH::__KSTD_TEST
{

extern test_result tr;

class __TYPE_TRAITS_TEST
{

    void test_integral_contants()
    {
        kstd::integral_constant<int, 0xC0FFEE> a;
        tr.assert(a.value == 0xC0FFEE, "Correct Value");
    }
................................................................................
        };
        tr.assert(kstd::is_base_of<a, b>::value == true, "test_is_base_of");
        tr.assert(kstd::is_base_of<a, c>::value == false, "test_is_base_of");
        tr.assert(kstd::is_base_of<b, c>::value == false, "test_is_base_of");
    }

  public:
    __TYPE_TRAITS_TEST()
    {
        test_integral_contants();
        test_is_void();
        test_remove_const();
        test_remove_volatile();
        test_remove_cv();
        test_add_const();
................................................................................
        test_alignment_of();
        test_rank();
        test_extent();
        test_is_convertible();
        test_is_base_of();
    }
};
} // namespace TH::__KSTD_TEST


|




|







 







|







 







|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
...
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
...
745
746
747
748
749
750
751
752
#pragma once
#include "kstd/type_traits.hpp"

namespace TH::KSTD_TEST
{

extern test_result tr;

class TYPE_TRAITS_TEST
{

    void test_integral_contants()
    {
        kstd::integral_constant<int, 0xC0FFEE> a;
        tr.assert(a.value == 0xC0FFEE, "Correct Value");
    }
................................................................................
        };
        tr.assert(kstd::is_base_of<a, b>::value == true, "test_is_base_of");
        tr.assert(kstd::is_base_of<a, c>::value == false, "test_is_base_of");
        tr.assert(kstd::is_base_of<b, c>::value == false, "test_is_base_of");
    }

  public:
    TYPE_TRAITS_TEST()
    {
        test_integral_contants();
        test_is_void();
        test_remove_const();
        test_remove_volatile();
        test_remove_cv();
        test_add_const();
................................................................................
        test_alignment_of();
        test_rank();
        test_extent();
        test_is_convertible();
        test_is_base_of();
    }
};
} // namespace TH::KSTD_TEST

Changes to include/tests/stl_tests/vector_iterator_tests.hpp.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#pragma once
#include "tests/test_utils.hpp"
#include "kstd/vector.hpp"

namespace TH::__KSTD_TEST
{

extern test_result tr;

class __VECTOR_ITERATOR_TEST
{

  public:
	__VECTOR_ITERATOR_TEST()
	{
	}
}; // namespace TH::__KSTD_TEST
} // namespace TH::__KSTD_TEST



|




|



|


|
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#pragma once
#include "tests/test_utils.hpp"
#include "kstd/vector.hpp"

namespace TH::KSTD_TEST
{

extern test_result tr;

class VECTOR_ITERATOR_TEST
{

  public:
	VECTOR_ITERATOR_TEST()
	{
	}
}; // namespace TH::KSTD_TEST
} // namespace TH::KSTD_TEST

Changes to include/tests/stl_tests/vector_tests.hpp.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
...
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
#pragma once
#include "tests/test_utils.hpp"
#include "kstd/vector.hpp"

namespace TH::__KSTD_TEST
{

extern test_result tr;

class __VECTOR_TEST
{
	struct test_empty_constructor : public kstd::vector<int>
	{
		test_empty_constructor()
		{
			require_correct_preallocation_size();
		}
................................................................................
		test_vector_full.push_back(4);

		tr.assert(test_vector_empty.empty() == true, "Test_vector_empty 1");
		tr.assert(test_vector_full.empty() == false, "Test_vector_full 2");
	}

  public:
	__VECTOR_TEST()
	{
		test_vector_iterators();
		test_empty_constructor();
		test_size_on_init();
		test_push_back_and_size();
		test_capacity();
		test_constructor_and_amount_of_elem();
		test_vector_fill_constructor();
		test_reserve();
		test_vector_const_iterators();
		test_empty();
	}
}; // namespace TH::__KSTD_TEST
} // namespace TH::__KSTD_TEST



|




|







 







|












|
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
...
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
#pragma once
#include "tests/test_utils.hpp"
#include "kstd/vector.hpp"

namespace TH::KSTD_TEST
{

extern test_result tr;

class VECTOR_TEST
{
	struct test_empty_constructor : public kstd::vector<int>
	{
		test_empty_constructor()
		{
			require_correct_preallocation_size();
		}
................................................................................
		test_vector_full.push_back(4);

		tr.assert(test_vector_empty.empty() == true, "Test_vector_empty 1");
		tr.assert(test_vector_full.empty() == false, "Test_vector_full 2");
	}

  public:
	VECTOR_TEST()
	{
		test_vector_iterators();
		test_empty_constructor();
		test_size_on_init();
		test_push_back_and_size();
		test_capacity();
		test_constructor_and_amount_of_elem();
		test_vector_fill_constructor();
		test_reserve();
		test_vector_const_iterators();
		test_empty();
	}
}; // namespace TH::KSTD_TEST
} // namespace TH::KSTD_TEST

Changes to planning/interrupts.xmi.

299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
           <UML:BehavioralFeature.parameter>
            <UML:Parameter kind="return" xmi.id="uPjihbkSQNl8d" type="ujwvUWP0iUnTM"/>
            <UML:Parameter isSpecification="false" name="bit" value="" xmi.id="uBiffmajSeFso" comment="Selects the bit of the features - see enum &#xa;" type="uI56Hn2PdY4eQ" visibility="private"/>
           </UML:BehavioralFeature.parameter>
          </UML:Operation>
         </UML:Classifier.feature>
        </UML:Class>
        <UML:Package isSpecification="false" name="__SYSINF" isAbstract="false" namespace="uz8PHle70dFuD" xmi.id="unZEsm3srHZfM" isRoot="false" isLeaf="false" visibility="public">
         <UML:Namespace.ownedElement>
          <UML:Enumeration isSpecification="false" name="cpu_features" isAbstract="false" namespace="unZEsm3srHZfM" xmi.id="uFofC1U8Rqo0k" comment="i'm too lazy to copy this into it:&#xa;&#xa;enum {&#xa;    CPUID_FEAT_ECX_SSE3         = 1 &lt;&lt; 0, &#xa;    CPUID_FEAT_ECX_PCLMUL       = 1 &lt;&lt; 1,&#xa;    CPUID_FEAT_ECX_DTES64       = 1 &lt;&lt; 2,&#xa;    CPUID_FEAT_ECX_MONITOR      = 1 &lt;&lt; 3,  &#xa;    CPUID_FEAT_ECX_DS_CPL       = 1 &lt;&lt; 4,  &#xa;    CPUID_FEAT_ECX_VMX          = 1 &lt;&lt; 5,  &#xa;    CPUID_FEAT_ECX_SMX          = 1 &lt;&lt; 6,  &#xa;    CPUID_FEAT_ECX_EST          = 1 &lt;&lt; 7,  &#xa;    CPUID_FEAT_ECX_TM2          = 1 &lt;&lt; 8,  &#xa;    CPUID_FEAT_ECX_SSSE3        = 1 &lt;&lt; 9,  &#xa;    CPUID_FEAT_ECX_CID          = 1 &lt;&lt; 10,&#xa;    CPUID_FEAT_ECX_FMA          = 1 &lt;&lt; 12,&#xa;    CPUID_FEAT_ECX_CX16         = 1 &lt;&lt; 13, &#xa;    CPUID_FEAT_ECX_ETPRD        = 1 &lt;&lt; 14, &#xa;    CPUID_FEAT_ECX_PDCM         = 1 &lt;&lt; 15, &#xa;    CPUID_FEAT_ECX_PCIDE        = 1 &lt;&lt; 17, &#xa;    CPUID_FEAT_ECX_DCA          = 1 &lt;&lt; 18, &#xa;    CPUID_FEAT_ECX_SSE4_1       = 1 &lt;&lt; 19, &#xa;    CPUID_FEAT_ECX_SSE4_2       = 1 &lt;&lt; 20, &#xa;    CPUID_FEAT_ECX_x2APIC       = 1 &lt;&lt; 21, &#xa;    CPUID_FEAT_ECX_MOVBE        = 1 &lt;&lt; 22, &#xa;    CPUID_FEAT_ECX_POPCNT       = 1 &lt;&lt; 23, &#xa;    CPUID_FEAT_ECX_AES          = 1 &lt;&lt; 25, &#xa;    CPUID_FEAT_ECX_XSAVE        = 1 &lt;&lt; 26, &#xa;    CPUID_FEAT_ECX_OSXSAVE      = 1 &lt;&lt; 27, &#xa;    CPUID_FEAT_ECX_AVX          = 1 &lt;&lt; 28,&#xa; &#xa;    CPUID_FEAT_EDX_FPU          = 1 &lt;&lt; 0,  &#xa;    CPUID_FEAT_EDX_VME          = 1 &lt;&lt; 1,  &#xa;    CPUID_FEAT_EDX_DE           = 1 &lt;&lt; 2,  &#xa;    CPUID_FEAT_EDX_PSE          = 1 &lt;&lt; 3,  &#xa;    CPUID_FEAT_EDX_TSC          = 1 &lt;&lt; 4,  &#xa;    CPUID_FEAT_EDX_MSR          = 1 &lt;&lt; 5,  &#xa;    CPUID_FEAT_EDX_PAE          = 1 &lt;&lt; 6,  &#xa;    CPUID_FEAT_EDX_MCE          = 1 &lt;&lt; 7,  &#xa;    CPUID_FEAT_EDX_CX8          = 1 &lt;&lt; 8,  &#xa;    CPUID_FEAT_EDX_APIC         = 1 &lt;&lt; 9,  &#xa;    CPUID_FEAT_EDX_SEP          = 1 &lt;&lt; 11, &#xa;    CPUID_FEAT_EDX_MTRR         = 1 &lt;&lt; 12, &#xa;    CPUID_FEAT_EDX_PGE          = 1 &lt;&lt; 13, &#xa;    CPUID_FEAT_EDX_MCA          = 1 &lt;&lt; 14, &#xa;    CPUID_FEAT_EDX_CMOV         = 1 &lt;&lt; 15, &#xa;    CPUID_FEAT_EDX_PAT          = 1 &lt;&lt; 16, &#xa;    CPUID_FEAT_EDX_PSE36        = 1 &lt;&lt; 17, &#xa;    CPUID_FEAT_EDX_PSN          = 1 &lt;&lt; 18, &#xa;    CPUID_FEAT_EDX_CLF          = 1 &lt;&lt; 19, &#xa;    CPUID_FEAT_EDX_DTES         = 1 &lt;&lt; 21, &#xa;    CPUID_FEAT_EDX_ACPI         = 1 &lt;&lt; 22, &#xa;    CPUID_FEAT_EDX_MMX          = 1 &lt;&lt; 23, &#xa;    CPUID_FEAT_EDX_FXSR         = 1 &lt;&lt; 24, &#xa;    CPUID_FEAT_EDX_SSE          = 1 &lt;&lt; 25, &#xa;    CPUID_FEAT_EDX_SSE2         = 1 &lt;&lt; 26, &#xa;    CPUID_FEAT_EDX_SS           = 1 &lt;&lt; 27, &#xa;    CPUID_FEAT_EDX_HTT          = 1 &lt;&lt; 28, &#xa;    CPUID_FEAT_EDX_TM1          = 1 &lt;&lt; 29, &#xa;    CPUID_FEAT_EDX_IA64         = 1 &lt;&lt; 30,&#xa;    CPUID_FEAT_EDX_PBE          = 1 &lt;&lt; 31&#xa;};" isRoot="false" stereotype="enum" isLeaf="false" visibility="public">
           <UML:Enumeration.literal/>
          </UML:Enumeration>
          <UML:Enumeration isSpecification="false" name="cpu_vendor_ids" isAbstract="false" namespace="unZEsm3srHZfM" xmi.id="urWJEgmUWdWr3" isRoot="false" stereotype="enum" isLeaf="false" visibility="public">
           <UML:Enumeration.literal>
            <UML:EnumerationLiteral isSpecification="false" name="CPUID_VENDOR_OLDAMD" value="&quot;AMDisbetter!&quot;" isAbstract="false" namespace="urWJEgmUWdWr3" xmi.id="ubGDzGif6QzZ8" isRoot="false" isLeaf="false" visibility="public"/>






|







299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
           <UML:BehavioralFeature.parameter>
            <UML:Parameter kind="return" xmi.id="uPjihbkSQNl8d" type="ujwvUWP0iUnTM"/>
            <UML:Parameter isSpecification="false" name="bit" value="" xmi.id="uBiffmajSeFso" comment="Selects the bit of the features - see enum &#xa;" type="uI56Hn2PdY4eQ" visibility="private"/>
           </UML:BehavioralFeature.parameter>
          </UML:Operation>
         </UML:Classifier.feature>
        </UML:Class>
        <UML:Package isSpecification="false" name="SYSINF" isAbstract="false" namespace="uz8PHle70dFuD" xmi.id="unZEsm3srHZfM" isRoot="false" isLeaf="false" visibility="public">
         <UML:Namespace.ownedElement>
          <UML:Enumeration isSpecification="false" name="cpu_features" isAbstract="false" namespace="unZEsm3srHZfM" xmi.id="uFofC1U8Rqo0k" comment="i'm too lazy to copy this into it:&#xa;&#xa;enum {&#xa;    CPUID_FEAT_ECX_SSE3         = 1 &lt;&lt; 0, &#xa;    CPUID_FEAT_ECX_PCLMUL       = 1 &lt;&lt; 1,&#xa;    CPUID_FEAT_ECX_DTES64       = 1 &lt;&lt; 2,&#xa;    CPUID_FEAT_ECX_MONITOR      = 1 &lt;&lt; 3,  &#xa;    CPUID_FEAT_ECX_DS_CPL       = 1 &lt;&lt; 4,  &#xa;    CPUID_FEAT_ECX_VMX          = 1 &lt;&lt; 5,  &#xa;    CPUID_FEAT_ECX_SMX          = 1 &lt;&lt; 6,  &#xa;    CPUID_FEAT_ECX_EST          = 1 &lt;&lt; 7,  &#xa;    CPUID_FEAT_ECX_TM2          = 1 &lt;&lt; 8,  &#xa;    CPUID_FEAT_ECX_SSSE3        = 1 &lt;&lt; 9,  &#xa;    CPUID_FEAT_ECX_CID          = 1 &lt;&lt; 10,&#xa;    CPUID_FEAT_ECX_FMA          = 1 &lt;&lt; 12,&#xa;    CPUID_FEAT_ECX_CX16         = 1 &lt;&lt; 13, &#xa;    CPUID_FEAT_ECX_ETPRD        = 1 &lt;&lt; 14, &#xa;    CPUID_FEAT_ECX_PDCM         = 1 &lt;&lt; 15, &#xa;    CPUID_FEAT_ECX_PCIDE        = 1 &lt;&lt; 17, &#xa;    CPUID_FEAT_ECX_DCA          = 1 &lt;&lt; 18, &#xa;    CPUID_FEAT_ECX_SSE4_1       = 1 &lt;&lt; 19, &#xa;    CPUID_FEAT_ECX_SSE4_2       = 1 &lt;&lt; 20, &#xa;    CPUID_FEAT_ECX_x2APIC       = 1 &lt;&lt; 21, &#xa;    CPUID_FEAT_ECX_MOVBE        = 1 &lt;&lt; 22, &#xa;    CPUID_FEAT_ECX_POPCNT       = 1 &lt;&lt; 23, &#xa;    CPUID_FEAT_ECX_AES          = 1 &lt;&lt; 25, &#xa;    CPUID_FEAT_ECX_XSAVE        = 1 &lt;&lt; 26, &#xa;    CPUID_FEAT_ECX_OSXSAVE      = 1 &lt;&lt; 27, &#xa;    CPUID_FEAT_ECX_AVX          = 1 &lt;&lt; 28,&#xa; &#xa;    CPUID_FEAT_EDX_FPU          = 1 &lt;&lt; 0,  &#xa;    CPUID_FEAT_EDX_VME          = 1 &lt;&lt; 1,  &#xa;    CPUID_FEAT_EDX_DE           = 1 &lt;&lt; 2,  &#xa;    CPUID_FEAT_EDX_PSE          = 1 &lt;&lt; 3,  &#xa;    CPUID_FEAT_EDX_TSC          = 1 &lt;&lt; 4,  &#xa;    CPUID_FEAT_EDX_MSR          = 1 &lt;&lt; 5,  &#xa;    CPUID_FEAT_EDX_PAE          = 1 &lt;&lt; 6,  &#xa;    CPUID_FEAT_EDX_MCE          = 1 &lt;&lt; 7,  &#xa;    CPUID_FEAT_EDX_CX8          = 1 &lt;&lt; 8,  &#xa;    CPUID_FEAT_EDX_APIC         = 1 &lt;&lt; 9,  &#xa;    CPUID_FEAT_EDX_SEP          = 1 &lt;&lt; 11, &#xa;    CPUID_FEAT_EDX_MTRR         = 1 &lt;&lt; 12, &#xa;    CPUID_FEAT_EDX_PGE          = 1 &lt;&lt; 13, &#xa;    CPUID_FEAT_EDX_MCA          = 1 &lt;&lt; 14, &#xa;    CPUID_FEAT_EDX_CMOV         = 1 &lt;&lt; 15, &#xa;    CPUID_FEAT_EDX_PAT          = 1 &lt;&lt; 16, &#xa;    CPUID_FEAT_EDX_PSE36        = 1 &lt;&lt; 17, &#xa;    CPUID_FEAT_EDX_PSN          = 1 &lt;&lt; 18, &#xa;    CPUID_FEAT_EDX_CLF          = 1 &lt;&lt; 19, &#xa;    CPUID_FEAT_EDX_DTES         = 1 &lt;&lt; 21, &#xa;    CPUID_FEAT_EDX_ACPI         = 1 &lt;&lt; 22, &#xa;    CPUID_FEAT_EDX_MMX          = 1 &lt;&lt; 23, &#xa;    CPUID_FEAT_EDX_FXSR         = 1 &lt;&lt; 24, &#xa;    CPUID_FEAT_EDX_SSE          = 1 &lt;&lt; 25, &#xa;    CPUID_FEAT_EDX_SSE2         = 1 &lt;&lt; 26, &#xa;    CPUID_FEAT_EDX_SS           = 1 &lt;&lt; 27, &#xa;    CPUID_FEAT_EDX_HTT          = 1 &lt;&lt; 28, &#xa;    CPUID_FEAT_EDX_TM1          = 1 &lt;&lt; 29, &#xa;    CPUID_FEAT_EDX_IA64         = 1 &lt;&lt; 30,&#xa;    CPUID_FEAT_EDX_PBE          = 1 &lt;&lt; 31&#xa;};" isRoot="false" stereotype="enum" isLeaf="false" visibility="public">
           <UML:Enumeration.literal/>
          </UML:Enumeration>
          <UML:Enumeration isSpecification="false" name="cpu_vendor_ids" isAbstract="false" namespace="unZEsm3srHZfM" xmi.id="urWJEgmUWdWr3" isRoot="false" stereotype="enum" isLeaf="false" visibility="public">
           <UML:Enumeration.literal>
            <UML:EnumerationLiteral isSpecification="false" name="CPUID_VENDOR_OLDAMD" value="&quot;AMDisbetter!&quot;" isAbstract="false" namespace="urWJEgmUWdWr3" xmi.id="ubGDzGif6QzZ8" isRoot="false" isLeaf="false" visibility="public"/>

Changes to src/acpi/wrappers.cpp.

54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
..
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
void madt_wrapper::reset_entry_pointer() { offset = 0; }

inline void sdt_wrapper::set_rsdp(void *ptr)
{
    SDT::RSDP *rsdpptr = (SDT::RSDP *)ptr;
    acpi_version = rsdpptr->Revision;
    if (__UTILS::is_rsdp_v2(rsdpptr->Revision))
    {
        rsdp_20_ptr = (SDT::RSDP20 *)ptr;
        rsdp_ptr = rsdpptr;
    }
    else
    {
        rsdp_20_ptr = NULL;
................................................................................
{
    if (acpi_version > 1)
        xsdt_ptr = (SDT::XSDT *)ptr;
}

sdt_wrapper::sdt_wrapper()
{
    rsdp_ptr = __UTILS::find_rsdp();
    if (rsdp_ptr == nullptr)
        Exception::kernel_panic("ACPI: no rsdp found, initialization of ACPI not "
                                "possible. Please run CLINL on a device that "
                                "supports ACPI!");
    number_tables = get_number_of_tables();
    set_rsdt(rsdp_ptr->RsdtAddress);
    set_xsdt(rsdp_20_ptr->XsdtAddress);






|







 







|







54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
..
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
void madt_wrapper::reset_entry_pointer() { offset = 0; }

inline void sdt_wrapper::set_rsdp(void *ptr)
{
    SDT::RSDP *rsdpptr = (SDT::RSDP *)ptr;
    acpi_version = rsdpptr->Revision;
    if (UTILS::is_rsdp_v2(rsdpptr->Revision))
    {
        rsdp_20_ptr = (SDT::RSDP20 *)ptr;
        rsdp_ptr = rsdpptr;
    }
    else
    {
        rsdp_20_ptr = NULL;
................................................................................
{
    if (acpi_version > 1)
        xsdt_ptr = (SDT::XSDT *)ptr;
}

sdt_wrapper::sdt_wrapper()
{
    rsdp_ptr = UTILS::find_rsdp();
    if (rsdp_ptr == nullptr)
        Exception::kernel_panic("ACPI: no rsdp found, initialization of ACPI not "
                                "possible. Please run CLINL on a device that "
                                "supports ACPI!");
    number_tables = get_number_of_tables();
    set_rsdt(rsdp_ptr->RsdtAddress);
    set_xsdt(rsdp_20_ptr->XsdtAddress);

Changes to src/interrupts/global_descriptor_table.cpp.

1
2
3
4
5
6
7
8
9
10
11
12
..
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#include "interrupts/global_descriptor_table.h"

namespace INT
{
namespace __GDT
{
gdt_iterator::gdt_iterator(GDT_ENTRY *_table, size_t pos, size_t max)
{
    max_size = max;
    position = pos;
    table = table;
}
................................................................................
#pragma message "@qneko thats your task ;)"
}

GDT_ENTRY construct_empty_descriptor()
{
    return construct_gdt_entry(0, 0, 0, 0);
}
} // namespace __GDT

gdt_wrapper::gdt_wrapper()
{
}
void gdt_wrapper::load_gdt()
{
    lgdt(table);
}

} // namespace INT



|







 







|










1
2
3
4
5
6
7
8
9
10
11
12
..
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#include "interrupts/global_descriptor_table.h"

namespace INT
{
namespace GDT
{
gdt_iterator::gdt_iterator(GDT_ENTRY *_table, size_t pos, size_t max)
{
    max_size = max;
    position = pos;
    table = table;
}
................................................................................
#pragma message "@qneko thats your task ;)"
}

GDT_ENTRY construct_empty_descriptor()
{
    return construct_gdt_entry(0, 0, 0, 0);
}
} // namespace GDT

gdt_wrapper::gdt_wrapper()
{
}
void gdt_wrapper::load_gdt()
{
    lgdt(table);
}

} // namespace INT

Changes to src/interrupts/pic_wrapper.cpp.

1
2
3
4
5
6
7
8
9
10
11
12
13
..
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#include "interrupts/pic_wrapper.h"

namespace INT
{

namespace __PICS
{

PIC_8259::PIC_8259(bool _type, int offset)
{
    type = _type; // true ^= master, false ^= slave
    uint8_t ICW4_BUF;
    uint8_t ident;
................................................................................
} // namespace INT

void PIC_8259::disable()
{
    outb(ports.command, 0xFF);
}

} // namespace __PICS

pic_wrapper::pic_wrapper(int vec1, int vec2)
{
    //pics = kstd::make_pair<__PICS::PIC_8259, __PICS::PIC_8259>(__PICS::PIC_8259(true, vec1), __PICS::PIC_8259(false, vec2));
}
} // namespace INT




|







 







|



|


1
2
3
4
5
6
7
8
9
10
11
12
13
..
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#include "interrupts/pic_wrapper.h"

namespace INT
{

namespace PICS
{

PIC_8259::PIC_8259(bool _type, int offset)
{
    type = _type; // true ^= master, false ^= slave
    uint8_t ICW4_BUF;
    uint8_t ident;
................................................................................
} // namespace INT

void PIC_8259::disable()
{
    outb(ports.command, 0xFF);
}

} // namespace PICS

pic_wrapper::pic_wrapper(int vec1, int vec2)
{
    //pics = kstd::make_pair<PICS::PIC_8259, PICS::PIC_8259>(PICS::PIC_8259(true, vec1), PICS::PIC_8259(false, vec2));
}
} // namespace INT

Changes to src/libk/mem_funcs.cpp.

31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
	void *memmove(void *dest, const void *src, size_t len)
	{
		ksdk::buffer<char> source((char *)src, len);
		if (dest < src)
			copy(source.begin(), source.end(), (char *)dest);
		else
			copy(source.rbegin(), source.rend(), __internals::r_op_iterator<char>((char *)dest));
		return dest;
	}

	void *memset(void *dest, int v, size_t len)
	{
		auto begin = (char *)dest;
		auto end = begin + len;






|







31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
	void *memmove(void *dest, const void *src, size_t len)
	{
		ksdk::buffer<char> source((char *)src, len);
		if (dest < src)
			copy(source.begin(), source.end(), (char *)dest);
		else
			copy(source.rbegin(), source.rend(), internals::r_op_iterator<char>((char *)dest));
		return dest;
	}

	void *memset(void *dest, int v, size_t len)
	{
		auto begin = (char *)dest;
		auto end = begin + len;

Changes to src/tests/acpi_test.cpp.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include "tests/test_utils.hpp"
#include "tests/acpi_tests/wrapper_test.hpp"
namespace TH
{
namespace __ACPI_TEST
{
test_result tr;
}

test_result acpi_test()
{
	__ACPI_TEST::TEST_WRAPPERS();
	return __ACPI_TEST::tr;
}
} // namespace TH



|






|
|


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include "tests/test_utils.hpp"
#include "tests/acpi_tests/wrapper_test.hpp"
namespace TH
{
namespace ACPI_TEST
{
test_result tr;
}

test_result acpi_test()
{
	ACPI_TEST::TEST_WRAPPERS();
	return ACPI_TEST::tr;
}
} // namespace TH

Changes to src/tests/ksdk_test.cpp.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include "tests/test_utils.hpp"
#include "tests/ksdk_tests/sosa_tree_tests.hpp"
#include "tests/ksdk_tests/buffer_test.hpp"
#include "libk/memory.h"

namespace TH
{
namespace __KSDK_TEST
{
test_result tr;
} // namespace __KSDK_TEST

test_result ksdk_test()
{
    __KSDK_TEST::SOSA_TREE_TEST();
    __KSDK_TEST::BUFFER_TEST();

    return __KSDK_TEST::tr;
}
} // namespace TH






|


|



|
|

|


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include "tests/test_utils.hpp"
#include "tests/ksdk_tests/sosa_tree_tests.hpp"
#include "tests/ksdk_tests/buffer_test.hpp"
#include "libk/memory.h"

namespace TH
{
namespace KSDK_TEST
{
test_result tr;
} // namespace KSDK_TEST

test_result ksdk_test()
{
    KSDK_TEST::SOSA_TREE_TEST();
    KSDK_TEST::BUFFER_TEST();

    return KSDK_TEST::tr;
}
} // namespace TH

Changes to src/tests/stl_test.cpp.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include "tests/stl_tests/vector_tests.hpp"
#include "tests/stl_tests/type_trait_tests.hpp"
#include "tests/stl_tests/vector_iterator_tests.hpp"

namespace TH
{
namespace __KSTD_TEST
{
test_result tr;
} // namespace __KSTD_TEST

test_result stl_test()
{
    __KSTD_TEST::__VECTOR_TEST{};
    __KSTD_TEST::__TYPE_TRAITS_TEST{};
    __KSTD_TEST::__VECTOR_ITERATOR_TEST{};

    return __KSTD_TEST::tr;
}
} // namespace TH





|


|



|
|
|

|


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include "tests/stl_tests/vector_tests.hpp"
#include "tests/stl_tests/type_trait_tests.hpp"
#include "tests/stl_tests/vector_iterator_tests.hpp"

namespace TH
{
namespace KSTD_TEST
{
test_result tr;
} // namespace KSTD_TEST

test_result stl_test()
{
    KSTD_TEST::VECTOR_TEST{};
    KSTD_TEST::TYPE_TRAITS_TEST{};
    KSTD_TEST::VECTOR_ITERATOR_TEST{};

    return KSTD_TEST::tr;
}
} // namespace TH