uuid.cを追加して、uuidコマンドを実行すれば、一応取得できるようにしてみた。
@@ -95,7 +95,7 @@ | ||
95 | 95 | { |
96 | 96 | uchar s[128], t[7]; |
97 | 97 | uint i, j; |
98 | - uint tsc[2]; | |
98 | + UUID uuid; | |
99 | 99 | uchar *p; |
100 | 100 | |
101 | 101 | i = 0; |
@@ -133,9 +133,9 @@ | ||
133 | 133 | } |
134 | 134 | } else if(strcmp(cmdline, "reset") == 0){ |
135 | 135 | reset_cpu(); |
136 | - } else if(strcmp(cmdline, "readtsc") == 0){ | |
137 | - read_tsc(tsc); | |
138 | - sprintf(s, "%08u%08u", tsc[0], tsc[1]); | |
136 | + } else if(strcmp(cmdline, "uuid") == 0){ | |
137 | + gen_UUID(&uuid); | |
138 | + sprintf(s, "{%02X%02X%02X%02X-%02X%02X-%02X%02X-%02X%02X-%02X%02X%02X%02X%02X%02X}\r\n", uuid.data[0], uuid.data[1], uuid.data[2], uuid.data[3], uuid.data[4], uuid.data[5], uuid.data[6], uuid.data[7], uuid.data[8], uuid.data[9], uuid.data[10], uuid.data[11], uuid.data[12], uuid.data[13], uuid.data[14], uuid.data[15]); | |
139 | 139 | cons_put_str(cons, s); |
140 | 140 | } else if(strcmp(cmdline, "date") == 0){ |
141 | 141 | readrtc(t); |
@@ -0,0 +1,67 @@ | ||
1 | + | |
2 | +#include "core.h" | |
3 | + | |
4 | +void gen_UUID(UUID *uuid) | |
5 | +{ | |
6 | + uint tsc[2]; | |
7 | + | |
8 | + /*from date*/ | |
9 | + srand((uint)readcmos(0x32)); | |
10 | + uuid->data[0] = (uchar)rand(); | |
11 | + | |
12 | + srand((uint)readcmos(0x09)); | |
13 | + uuid->data[1] = (uchar)rand(); | |
14 | + | |
15 | + srand((uint)readcmos(0x08)); | |
16 | + uuid->data[2] = (uchar)rand(); | |
17 | + | |
18 | + srand((uint)readcmos(0x07)); | |
19 | + uuid->data[3] = (uchar)rand(); | |
20 | + | |
21 | + srand((uint)readcmos(0x04)); | |
22 | + uuid->data[4] = (uchar)rand(); | |
23 | + | |
24 | + srand((uint)readcmos(0x02)); | |
25 | + uuid->data[5] = (uchar)rand(); | |
26 | + | |
27 | + srand((uint)readcmos(0x00)); | |
28 | + uuid->data[6] = (uchar)rand(); | |
29 | + | |
30 | + /*from tsc*/ | |
31 | + read_tsc(tsc); | |
32 | + srand((uint)(tsc[0] & 0x000000ff)); | |
33 | + uuid->data[7] = (uchar)rand(); | |
34 | + | |
35 | + read_tsc(tsc); | |
36 | + srand((uint)(tsc[0] & 0x0000ff00) >> 8); | |
37 | + uuid->data[8] = (uchar)rand(); | |
38 | + | |
39 | + read_tsc(tsc); | |
40 | + srand((uint)(tsc[0] & 0x00ff0000) >> 16); | |
41 | + uuid->data[9] = (uchar)rand(); | |
42 | + | |
43 | + read_tsc(tsc); | |
44 | + srand((uint)(tsc[0] >> 24)); | |
45 | + uuid->data[10] = (uchar)rand(); | |
46 | + | |
47 | + read_tsc(tsc); | |
48 | + srand((uint)(tsc[1] & 0x000000ff)); | |
49 | + uuid->data[11] = (uchar)rand(); | |
50 | + | |
51 | + read_tsc(tsc); | |
52 | + srand((uint)(tsc[1] & 0x0000ff00) >> 8); | |
53 | + uuid->data[12] = (uchar)rand(); | |
54 | + | |
55 | + read_tsc(tsc); | |
56 | + srand((uint)(tsc[1] & 0x00ff0000) >> 16); | |
57 | + uuid->data[13] = (uchar)rand(); | |
58 | + | |
59 | + read_tsc(tsc); | |
60 | + srand((uint)(tsc[1] >> 24)); | |
61 | + uuid->data[14] = (uchar)rand(); | |
62 | + | |
63 | + read_tsc(tsc); | |
64 | + uuid->data[15] = (uchar)(tsc[1] & 0x000000ff); | |
65 | + | |
66 | + return; | |
67 | +} |
@@ -1,6 +1,6 @@ | ||
1 | 1 | |
2 | 2 | #OBJS_BOOTPACK = naskfunc.obj hankaku.obj graphic.obj grap_08.obj grap_16.obj grap_32.obj gdtidt.obj int.obj io.obj fifo.obj keyboard.obj timer.obj mouse.obj memory.obj sheet.obj window.obj system.obj bootpack.obj |
3 | -OBJS_BOOTPACK = naskfunc.obj hankaku.obj gdtidt.obj graphic.obj grap_08.obj grap_16.obj grap_32.obj init.obj intrpt.obj io.obj memory.obj paging.obj sheet.obj fifo.obj mtask.obj timer.obj keyboard.obj mouse.obj window.obj console.obj file.obj bootpack.obj | |
3 | +OBJS_BOOTPACK = naskfunc.obj hankaku.obj gdtidt.obj graphic.obj grap_08.obj grap_16.obj grap_32.obj init.obj intrpt.obj io.obj memory.obj paging.obj sheet.obj fifo.obj mtask.obj timer.obj keyboard.obj mouse.obj window.obj console.obj file.obj uuid.obj bootpack.obj | |
4 | 4 | TOOLPATH = ../../z_tools/ |
5 | 5 | INCPATH = ../../z_tools/CHNOSProject/ |
6 | 6 |
@@ -5,6 +5,10 @@ | ||
5 | 5 | #include <math.h> |
6 | 6 | #include <string.h> |
7 | 7 | |
8 | +int rand(void); | |
9 | +#define srand(seed) (void) (rand_seed = (seed)) | |
10 | +extern unsigned int rand_seed; | |
11 | + | |
8 | 12 | /*definemacros*/ |
9 | 13 | #define RGB16(r,g,b) ((r)<<11|(g)<<5|(b)) |
10 | 14 |
@@ -350,6 +354,11 @@ | ||
350 | 354 | struct POSITION_2D cursor; |
351 | 355 | }; |
352 | 356 | |
357 | +struct _UUID { | |
358 | + uchar data[16]; | |
359 | +}; | |
360 | + | |
361 | + | |
353 | 362 | /*typedef structures*/ |
354 | 363 | typedef struct BOOTINFO DATA_BootInfo; |
355 | 364 | typedef struct VESAINFO DATA_VESAInfo; |
@@ -371,6 +380,7 @@ | ||
371 | 380 | typedef struct WINCTL UI_WindowControl; |
372 | 381 | typedef struct FILEINFO IO_FileInfo; |
373 | 382 | typedef struct SYS_UI_CONSOLES UI_Console; |
383 | +typedef struct _UUID UUID; | |
374 | 384 | |
375 | 385 | /*virtual classes*/ |
376 | 386 | struct SYSTEM { |
@@ -459,6 +469,9 @@ | ||
459 | 469 | void KeyBoardControlTask(void); |
460 | 470 | void MouseControlTask(void); |
461 | 471 | |
472 | +/*uuid.c*/ | |
473 | +void gen_UUID(UUID *uuid); | |
474 | + | |
462 | 475 | /*file.c*/ |
463 | 476 | void decode_fat(ushort *fat, bool backup); |
464 | 477 | void load_file(uint finfo_no, uchar *buf); |