-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMergePatch1.diff
More file actions
6181 lines (6167 loc) · 173 KB
/
MergePatch1.diff
File metadata and controls
6181 lines (6167 loc) · 173 KB
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
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
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
diff --git a/user.enryo/Mk/l4.build.mk b/user.enryo/Mk/l4.build.mk
index 89015b06..7aa6f952 100644
--- a/user.enryo/Mk/l4.build.mk
+++ b/user.enryo/Mk/l4.build.mk
@@ -43,15 +43,20 @@ MKFILE_DEPS= Makefile \
# Portable way of converting SRCS to OBJS
+_CXX_OBJS= ${filter-out %.c %.S, ${SRCS}}
_CC_OBJS= ${filter-out %.c %.S, ${SRCS}}
_C_OBJS= ${filter-out %.S %cc, ${SRCS}}
_S_OBJS= ${filter-out %.c %cc, ${SRCS}}
-_OBJS= $(_CC_OBJS:.cc=.o) $(_C_OBJS:.c=.o) $(_S_OBJS:.S=.o) \
+_OBJS= $(_CC_OBJS:.cc=.o) $(_CXX_OBJS:.cxx=.o) $(_C_OBJS:.c=.o) $(_S_OBJS:.S=.o) \
${SRCS:C/.(cc|c|S)$/.o/g}
OBJS+= ${filter %crt0.o crt0%, $(_OBJS)} \
${filter-out %crt0.o crt0%, $(_OBJS)} \
${_OBJS:M*crt0*} ${_OBJS:N*crt0*}
+
+.cxx.o: $(MKFILE_DEPS)
+ @$(ECHO_MSG) `echo $< | sed s,^$(top_srcdir)/,,`
+ $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $< -o $@
.cc.o: $(MKFILE_DEPS)
@$(ECHO_MSG) `echo $< | sed s,^$(top_srcdir)/,,`
diff --git a/user.enryo/apps/syslaunch/syslaunch.cc b/user.enryo/apps/syslaunch/syslaunch.cc
deleted file mode 100644
index 25da4465..00000000
--- a/user.enryo/apps/syslaunch/syslaunch.cc
+++ /dev/null
@@ -1,104 +0,0 @@
-#include "syslaunch.h"
-
-#include <drivermgr.h>
-#include <ramfs.h>
-
-#include <sys/sysinfo.h>
-
-SysLaunch::SysLaunch():
- iScreenNbr(0)
-{
- this->VerBanner();
-
- EDebugPrintf("SysLaunch", "Created new instance of SysLaunch...");
- printf("This system uses %d-sized pages\n", (int)l4e_min_pagesize());
- printf("Switching to screen %d\n", iScreenNbr);
-
- /* Set the POSIX UID to root (0) */
- setenv("UID", "0", 1);
- setenv("USER", "syslaunch",1);
-
- printf("Defaulting to user \"%s\" (%s)\n",
- getenv("USER"),
- getenv("UID"));
-
- DriverMgr();
-
- RamFs rfs;
- rfs.Start(1);
-
- rfs.ReadFile("/sys/kip/raw");
-
-
-}
-
-void SysLaunch::VerBanner() {
-
- struct utsname utsName;
- uname(&utsName);
-
- printf("\n Welcome to %s %s.%s! Running on %s.\n", utsName.sysname,
- utsName.release, utsName.version, utsName.nodename);
-}
-
-/* This function will eventually call system(), or an equivalent */
-void SysLaunch::EscalateCmd(char *aCmd) {
-
- if (strcmp(getenv("ACTIVE_CMD"), "uname") == 0) {
- struct utsname utsName;
- uname(&utsName);
-
- printf("%s\n", utsName.sysname);
- }
-
- if (strcmp(getenv("ACTIVE_CMD"), "pwd") == 0) {
- printf("%s\n", getenv("PWD"));
- }
-
- if (strcmp(getenv("ACTIVE_CMD"), "whoami") == 0 ) {
- printf("%s\n", getenv("USER"));
- }
-
-// if (strcmp(getenv("ACTIVE_CMD"), "cpucount") == 0 ) {
-// printf("%d CPUs are installed in this system.\n", get_nprocs());
-// }
-
- if (strcmp(getenv("ACTIVE_CMD"), "yes") == 0 ) {
- while(1) {
- printf("y\n");
- }
- }
-
- else {
- EDebugPrintf("SysLaunch", "No processor is available for this command. Sorry.");
- }
-
-}
-
-void SysLaunch::WaitForCmd() {
-
- struct utsname utsName;
- uname(&utsName);
-
- while(1) {
-
- char *cmd;
- strcpy(cmd, GetPolledKbdLine());
-
- setenv("ACTIVE_CMD", cmd, 1);
- printf("%s@%s:/$ %s\n", getenv("USER"), utsName.nodename, getenv("ACTIVE_CMD"));
- this->EscalateCmd(cmd);
-
- }
-}
-
-int main(void) {
- SysLaunch launch;
-
- printf("The clock says: %d\n", L4_SystemClock().raw);
- malloc(2);
- int *test = new int(1);
-
- launch.WaitForCmd();
- return 0;
-}
diff --git a/user.enryo/config.log b/user.enryo/config.log
index 8c8957f4..2dd45719 100644
--- a/user.enryo/config.log
+++ b/user.enryo/config.log
@@ -422,6 +422,7 @@ on tyson-Lenovo-ideapad-120S-14IAP
config.status:816: creating ./Makefile
config.status:816: creating config.h
config.status:991: config.h is unchanged
+<<<<<<< HEAD
## ---------------------- ##
## Running config.status. ##
@@ -726,3 +727,5 @@ on tyson-Lenovo-ideapad-120S-14IAP
config.status:816: creating ./Makefile
config.status:816: creating config.h
config.status:991: config.h is unchanged
+=======
+>>>>>>> master
diff --git a/user.enryo/lib/io/amd64.cc b/user.enryo/lib/io/amd64.cc
deleted file mode 100644
index c30f7fe7..00000000
--- a/user.enryo/lib/io/amd64.cc
+++ /dev/null
@@ -1,208 +0,0 @@
-/*********************************************************************
- *
- * Copyright (C) 2001-2006, 2010, Karlsruhe University
- *
- * File path: amd64.cc
- * Description: putc() for x86-based PCs, serial and screen
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $Id: ia32-putc.cc,v 1.13 2006/10/07 16:30:25 ud3 Exp $
- *
- ********************************************************************/
-#include <config.h>
-#include <l4/types.h>
-
-#include "amd64.h"
-
-extern "C" void __l4_putc (int c);
-extern "C" void putc (int c) __attribute__ ((weak, alias ("__l4_putc")));
-extern "C" int __l4_getc (void);
-extern "C" int getc (void) __attribute__ ((weak, alias ("__l4_getc")));
-
-
-#if defined(CONFIG_COMPORT)
-
-#if CONFIG_COMPORT == 0
-# define COMPORT 0x3f8
-#elif CONFIG_COMPORT == 1
-# define COMPORT 0x2f8
-#elif CONFIG_COMPORT == 2
-# define COMPORT 0x3e8
-#elif CONFIG_COMPORT == 3
-# define COMPORT 0x2e8
-#else
-#define COMPORT CONFIG_COMPORT
-#endif
-
-static void io_init( void )
-{
- static bool io_initialized = false;
-
- if (io_initialized)
- return;
-
- io_initialized = true;
-
-#define IER (COMPORT+1)
-#define EIR (COMPORT+2)
-#define LCR (COMPORT+3)
-#define MCR (COMPORT+4)
-#define LSR (COMPORT+5)
-#define MSR (COMPORT+6)
-#define DLLO (COMPORT+0)
-#define DLHI (COMPORT+1)
-
- outb(LCR, 0x80); /* select bank 1 */
- for (volatile int i = 10000000; i--; );
- outb(DLLO, (((115200/CONFIG_COMSPEED) >> 0) & 0x00FF));
- outb(DLHI, (((115200/CONFIG_COMSPEED) >> 8) & 0x00FF));
- outb(LCR, 0x03); /* set 8,N,1 */
- outb(IER, 0x00); /* disable interrupts */
- outb(EIR, 0x07); /* enable FIFOs */
- outb(MCR, 0x0b); /* force data terminal ready */
- outb(IER, 0x01); /* enable RX interrupts */
- inb(IER);
- inb(EIR);
- inb(LCR);
- inb(MCR);
- inb(LSR);
- inb(MSR);
-
-
-}
-
-void __l4_putc(int c)
-{
- io_init();
-
- while (!(inb(COMPORT+5) & 0x20));
- outb(COMPORT,c);
- while (!(inb(COMPORT+5) & 0x40));
- if (c == '\n')
- __l4_putc('\r');
-}
-
-int __l4_getc (void)
-{
- while ((inb(COMPORT+5) & 0x01) == 0);
- return inb(COMPORT);
-}
-
-#else /* ! CONFIG_COMPORT */
-
-#define DISPLAY ((char*)0xb8000)
-#define COLOR 7
-#define NUM_LINES 25
-
-#define KBD_STATUS_REG 0x64
-#define KBD_CNTL_REG 0x64
-#define KBD_DATA_REG 0x60
-
-#define KBD_STAT_OBF 0x01 /* Keyboard output buffer full */
-
-#define kbd_read_input() inb(KBD_DATA_REG)
-#define kbd_read_status() inb(KBD_STATUS_REG)
-
-static unsigned char keyb_layout[128] =
- "\000\0331234567890-+\177\t" /* 0x00 - 0x0f */
- "qwertyuiop[]\r\000as" /* 0x10 - 0x1f */
- "dfghjkl;'`\000\\zxcv" /* 0x20 - 0x2f */
- "bnm,./\000*\000 \000\201\202\203\204\205" /* 0x30 - 0x3f */
- "\206\207\210\211\212\000\000789-456+1" /* 0x40 - 0x4f */
- "230\177\000\000\213\214\000\000\000\000\000\000\000\000\000\000" /* 0x50 - 0x5f */
- "\r\000/"; /* 0x60 - 0x6f */
-
-void __l4_putc(int c)
-{
- unsigned int i;
-
- // Shared cursor pointer
- static unsigned __l4_putc_cursor = 160 * (NUM_LINES - 1);
-
- // Create thread-local copy. Using proper locking would be better.
- unsigned __cursor = __l4_putc_cursor;
-
- switch(c) {
- case '\r':
- break;
- case '\n':
- do
- {
- DISPLAY[__cursor++] = ' ';
- DISPLAY[__cursor++] = COLOR;
- }
- while (__cursor % 160 != 0);
- break;
- case '\t':
- do
- {
- DISPLAY[__cursor++] = ' ';
- DISPLAY[__cursor++] = COLOR;
- }
- while (__cursor % 16 != 0);
- break;
- default:
- DISPLAY[__cursor++] = c;
- DISPLAY[__cursor++] = COLOR;
- }
- if (__cursor == (160 * NUM_LINES)) {
- for (i = (160 / sizeof (L4_Word_t));
- i < (160 / sizeof (L4_Word_t)) * NUM_LINES;
- i++)
- ((L4_Word_t *) DISPLAY)[i - 160 / sizeof (L4_Word_t)]
- = ((L4_Word_t *) DISPLAY)[i];
- for (i = 0; i < 160 / sizeof (L4_Word_t); i++)
- ((L4_Word_t *) DISPLAY)[160 / sizeof (L4_Word_t)
- * (NUM_LINES-1) + i] = 0;
- __cursor -= 160;
- }
-
- // Write back thread-local cursor value
- __l4_putc_cursor = __cursor;
-}
-
-/* No SHIFT key support!!! */
-
-int __l4_getc()
-{
- static unsigned char last_key = 0;
- char c;
- while(1) {
- unsigned char status = kbd_read_status();
- while (status & KBD_STAT_OBF) {
- unsigned char scancode;
- scancode = kbd_read_input();
- if (scancode & 0x80)
- last_key = 0;
- else if (last_key != scancode)
- {
- //printf("kbd: %d, %d, %c\n", scancode, last_key, keyb_layout[scancode]);
- last_key = scancode;
- c = keyb_layout[scancode];
- if (c > 0) return c;
- }
- }
- }
-}
-
-#endif
diff --git a/user.enryo/lib/io/cpp_new.cc b/user.enryo/lib/io/cpp_new.cc
deleted file mode 100644
index 1cc35ec8..00000000
--- a/user.enryo/lib/io/cpp_new.cc
+++ /dev/null
@@ -1,23 +0,0 @@
-#include <stddef.h>
-#include <liballoc.h>
-
-
-extern "C" void *operator new(size_t size)
-{
- return malloc(size);
-}
-
-extern "C" void *operator new[](size_t size)
-{
- return malloc(size);
-}
-
-extern "C" void operator delete(void *p)
-{
- free(p);
-}
-
-extern "C" void operator delete[](void *p)
-{
- free(p);
-}
diff --git a/user.enryo/lib/io/debug.cc b/user.enryo/lib/io/debug.cc
deleted file mode 100644
index 0bac0540..00000000
--- a/user.enryo/lib/io/debug.cc
+++ /dev/null
@@ -1,14 +0,0 @@
-#include <stdio.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void EDebugPrintf(const char *aTag, const char *aText) {
- printf("\n\n[%s] : %s\n\n", aTag, aText);
-}
-
-#ifdef __cplusplus
-}
-#endif
-
diff --git a/user.enryo/lib/io/drivermgr.cc b/user.enryo/lib/io/drivermgr.cc
deleted file mode 100644
index 6f87863f..00000000
--- a/user.enryo/lib/io/drivermgr.cc
+++ /dev/null
@@ -1,105 +0,0 @@
-#include "drivermgr.h"
-
-#include <stdio.h>
-
-DriverMgr::DriverMgr():
- iDriverCount(0),
- iPageCount(0)
-{
- EDebugPrintf("DriverMgr","Initialising Driver Manager...");
-}
-
-int DriverMgr::GetDriverCount() {
- return iDriverCount;
-}
-
-int DriverMgr::GetPageCount() {
- return iPageCount;
-}
-
-
-
-char* DriverMgr::GetFriendlyType(int aType) {
-
- char *value;
-
- printf("\n\n[DriverMgr] : Called GetFriendlyType(%d)\n\n", aType);
-
- switch (aType) {
- case EFileSys:
- value = "File System Driver";
- break;
- case EGenericBlock:
- value = "Generic Block Device Driver";
- break;
- case EHardDisk:
- value = "Hard Disk Driver";
- break;
- case ESmBiosZone:
- value = "System Management BIOS Zone Driver";
- break;
- case EGenericPci:
- value = "Generic PCI Driver";
- break;
- case EGenericUsb:
- value = "Generic USB Driver";
- break;
- case EGeneric1394:
- value = "Generic IEEE 1394 Driver";
- break;
- case ESerialUart:
- value = "Serial Port/UART Device Driver";
- break;
- case EAirGuitar:
- value = "Loopback Audio Source (Line In) Driver";
- break;
- case EAnalogueMic:
- value = "Analogue Microphone Driver";
- break;
- case EKeyboard:
- value = "Keyboard Driver";
- break;
- case EMouse:
- value = "Mouse Driver";
- break;
- case ESpeakers:
- value = "Speaker Driver";
- break;
- case EMarshmallowAmp:
- value = "Loopback Audio Sink (Line Out) Driver";
- break;
-
- case EUnknown:
- default:
- value = "Unknown";
- break;
- }
-
- return value;
-
-}
-
-bool DriverMgr::RegName(char *aName,
- int aType,
- char *aSynopsis,
- char *aVersion) {
-
- printf("\n\n[DriverMgr] : Registering device of type %s \n\n", GetFriendlyType(aType));
- printf("\n\n[DriverMgr] : This driver is %s, %s (%s)\n\n", aName, aSynopsis, aVersion);
-
- return 0;
-
-}
-
-
-bool DriverMgr::RegName(char *aName,
- int aType,
- bool (*aHook)(int),
- char *aSynopsis,
- char *aVersion) {
-
- printf("\n\n[DrvrMgr] : Registering device of type %s \n\n", GetFriendlyType(aType));
-
- return 0;
-
-}
diff --git a/user.enryo/lib/io/efile/ramfs.cc b/user.enryo/lib/io/efile/ramfs.cc
deleted file mode 100644
index b3d74d66..00000000
--- a/user.enryo/lib/io/efile/ramfs.cc
+++ /dev/null
@@ -1,43 +0,0 @@
-#include "ramfs.h"
-
-#include <stdio.h>
-#include <drivermgr.h>
-
-RamFs::RamFs():
- iDrvName("RamFs"),
- iDrvSynopsis("A RAM disk driver"),
- iType(EGenericBlock),
- iDrvVersion("0.0.0")
-{
- iDrvName = iDrvName;
-
- EDebugPrintf("RamFs", "Initialised RamFs...");
-
- DriverMgr::RegName(iDrvName, iType,
- /*RamFs::Start(0),*/ iDrvSynopsis, iDrvVersion);
-
-}
-
-int RamFs::Start(int aStatus) {
-
- RamFs *fs = new RamFs();
-
- return aStatus;
-}
-
-bool RamFs::ReadFile(char *aPath) {
-
- EDebugPrintf("RamFs", "Reading files is unimplemented");
-
- printf("RamFs::ReadFile(%d)\n", aPath);
-
- return -1;
-}
-
-bool RamFs::WriteFile(char *aPath) {
- EDebugPrintf("RamFs", "Writing files is unsupported");
-
- printf("RamFs::WriteFile(%d)\n", aPath);
-
- return -1;
-}
diff --git a/user.enryo/lib/io/get_hex.cc b/user.enryo/lib/io/get_hex.cc
deleted file mode 100644
index 9e052f34..00000000
--- a/user.enryo/lib/io/get_hex.cc
+++ /dev/null
@@ -1,68 +0,0 @@
-/*********************************************************************
- *
- * Copyright (C) 2001, 2002, Karlsruhe University
- *
- * File path: get_hex.c
- * Description: generic get_hex() based on putc() and getc()
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $Id: get_hex.cc,v 1.3 2003/09/24 19:06:28 skoglund Exp $
- *
- ********************************************************************/
-#include <l4/types.h>
-#include <l4io.h>
-
-L4_Word_t
-get_hex(void)
-{
- L4_Word_t val = 0;
- char c, t;
- int i = 0;
-
- while ((t = c = getc()) != '\r')
- {
- switch(c)
- {
- case '0' ... '9':
- c -= '0';
- break;
-
- case 'a' ... 'f':
- c -= 'a' - 'A';
- case 'A' ... 'F':
- c = c - 'A' + 10;
- break;
- default:
- continue;
- };
- val <<= 4;
- val += c;
-
- /* let the user see what happened */
- putc(t);
-
- if (++i == 8)
- break;
- };
- return val;
-}
diff --git a/user.enryo/lib/io/memory/liballoc_hooks.cc b/user.enryo/lib/io/memory/liballoc_hooks.cc
deleted file mode 100644
index 07446157..00000000
--- a/user.enryo/lib/io/memory/liballoc_hooks.cc
+++ /dev/null
@@ -1,111 +0,0 @@
-#include <nwmalloc.h>
-#include <l4/space.h>
-
-#include <l4/kip.h>
-#include <l4/thread.h>
-#include <l4io.h>
-#include <config.h>
-
-//#include <arch.h>
-
-//http://www.cse.unsw.edu.au/~cs9242/05/project/l4uman-x2.pdf
-//https://lists.ira.uni-karlsruhe.de/pipermail/l4ka/2008-April/002072.html
-
-/** This function is supposed to lock the memory data structures. It
- * could be as simple as disabling interrupts or acquiring a spinlock.
- * It's up to you to decide.
- *
- * \return 0 if the lock was acquired successfully. Anything else is
- * failure.
- */
-extern int liballoc_lock() {
- return 0;
-}
-
-/** This function unlocks what was previously locked by the liballoc_lock
- * function. If it disabled interrupts, it enables interrupts. If it
- * had acquiried a spinlock, it releases the spinlock. etc.
- *
- * \return 0 if the lock was successfully released.
- */
-extern int liballoc_unlock() {
-return 0;
-}
-
-
-/** This is the hook into the local system which allocates pages. It
- * accepts an integer parameter which is the number of pages
- * required. The page size was set up in the liballoc_init function.
- *
- * \return NULL if the pages were not allocated.
- * \return A pointer to the allocated memory.
- */
-
-L4_Word_t
-do_safe_mem_touch( void *addr )
-{
- volatile L4_Word_t *ptr;
- L4_Word_t copy;
-
- ptr = (L4_Word_t*) addr;
- copy = *ptr;
- *ptr = copy;
-
- return copy;
-}
-
-
-extern void* liballoc_alloc(int aPagesReq) {
-
-#define SCRATCHMEM_START (16*1024*1024)
-
- static char *free_page = (char*) SCRATCHMEM_START;
-
- int touch = aPagesReq;
- void *ret = free_page;
-
- L4_Word_t count = aPagesReq;
-
- free_page += count * NWGetPageSize();
-
-
- /* should we fault the pages in? */
- if( touch != 0 )
- {
- char *addr = (char*) ret;
- L4_Word_t i;
-
- /* touch each page */
- for( i = 0; i < count; i++ )
- {
- do_safe_mem_touch( (void*) addr );
- for (int j=0; j<NWGetPageSize(); j++)
- addr[j] = 0;
-
- addr += NWGetPageSize();
-
- }
- }
-
- return (void*) ret;
-
-
-//return NULL;
-}
-
-/** This frees previously allocated memory. The void* parameter passed
- * to the function is the exact same value returned from a previous
- * liballoc_alloc call.
- *
- * The integer value is the number of pages to free.
- *
- * \return 0 if the memory was successfully freed.
- */
-//L4_INLINE void L4_Unmap (L4_Word_t n, L4_Fpage_t * fpages)
-extern int liballoc_free(void* aPrevCallVal,int aPagesToFree) {
-//L4_Unmap(aPagesToFree,aPrevCallVal);
-L4_Unmap(aPagesToFree);
-
-return 0;
-}
-
diff --git a/user.enryo/lib/io/print.cc b/user.enryo/lib/io/print.cc
deleted file mode 100644
index 834553e6..00000000
--- a/user.enryo/lib/io/print.cc
+++ /dev/null
@@ -1,695 +0,0 @@
-/*********************************************************************
- *
- * Copyright (C) 2001-2004, 2007, 2010 Karlsruhe University
- *
- * File path: print.cc
- * Description: fully featured printf
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $Id: print.cc,v 1.15 2004/09/06 16:20:21 ud3 Exp $
- *
- ********************************************************************/
-#include <l4/types.h>
-#include <stdarg.h>
-#include <l4io.h>
-#include "lib.h"
-#include "stdio/local.h"
-//#include <stdlib.h>
-
-#ifndef NULL
-#define NULL ((void *) 0)
-#endif
-
-/*
- * Make __l4_ prefixes for regular output functions, and create weak
- * symbols that aliases these functions.
- */
-
-extern "C" int __l4_printf (const char *fmt, ...);
-extern "C" int printf (const char *fmt, ...)
- __attribute__ ((weak, alias ("__l4_printf")));
-extern "C" int __l4_snprintf (char *str, L4_Size_t size, const char *fmt, ...);
-extern "C" int snprintf (char *str, L4_Size_t size, const char *fmt, ...)
- __attribute__ ((weak, alias ("__l4_snprintf")));
-extern "C" int __l4_vsnprintf (char *str, L4_Size_t size, const char *fmt, va_list);
-extern "C" int vsnprintf (char *str, L4_Size_t size, const char *fmt, va_list)
- __attribute__ ((weak, alias ("__l4_vsnprintf")));
-extern "C" int __l4_puts (const char * str);
-extern "C" int puts (const char * str)
- __attribute__ ((weak, alias ("__l4_puts")));
-extern "C" int __l4_putchar (int c);
-extern "C" int putchar (int c)
- __attribute__ ((weak, alias ("__l4_putchar")));
-
-static void print_string (const char * s);
-
-int __l4_puts (const char * str)
-{
- print_string (str);
- putc ('\n');
- return strlen (str);
-}
-
-int __l4_putchar (int c)
-{
- putc (c);
- return c;
-}
-
-int __sdidinit = 1;
-
-/*
- * Function print_string (s)
- *
- * Print string `s' to terminal (or some kind of output).
- *
- */
-static void print_string (const char * s)
-{
- while ( *s )
- putc(*s++);
-}
-
-
-/*
- * Function vsnprintf (str, size, fmt, ap)
- *
- * Formated output conversion according to format string `fmt' and
- * argument list `ap'. The formated string is stored in `out'. If
- * the formated string is longer tha `outsize' characters, the
- * string is truncated.
- *
- * The format conversion works as in printf(3), except for the
- * conversions; e, E, g, and G which are not supported.
- *
- */
-int __l4_vsnprintf(char *str, L4_Size_t size, const char *fmt, va_list ap)
-{
- char convert[64];
- int f_left, f_sign, f_space, f_zero, f_alternate;
- int f_long, f_short, f_ldouble;
- int width, precision;
- int i, c, base, sign, signch, numdigits, numpr = 0, someflag;
- unsigned long uval, uval2;
- const char *digits;
- char *string, *p = str;
- L4_ThreadId_t tid;
-
-#define PUTCH(ch) do { \
- if ( size-- <= 0 ) \
- goto Done; \
- *p++ = (ch); \
- } while (0)
-
-#define PUTSTR(st) do { \
- const char *s = (st); \
- while ( *s != '\0' ) { \
- if ( size-- <= 0 ) \
- goto Done; \
- *p++ = *s++; \
- } \
- } while (0)
-
-#define PUTDEC(num) do { \
- uval = num; \
- numdigits = 0; \
- do { \
- convert[ numdigits++ ] = digits[ uval % 10 ]; \
- uval /= 10; \
- } while ( uval > 0 ); \
- while ( numdigits > 0 ) \
- PUTCH( convert[--numdigits] ); \
- } while (0)
-
-#define LEFTPAD(num) do { \
- int cnt = (num); \
- if ( ! f_left && cnt > 0 ) \
- while ( cnt-- > 0 ) \
- PUTCH( f_zero ? '0' : ' ' ); \
- } while (0)
-
-#define RIGHTPAD(num) do { \
- int cnt = (num); \
- if ( f_left && cnt > 0 ) \
- while ( cnt-- > 0 ) \
- PUTCH( ' ' ); \
- } while (0)
-
- /*
- * Make room for null-termination.
- */
- size--;
-
- /*
- * Sanity check on fmt string.
- */
- if ( fmt == NULL ) {
- PUTSTR( "(null fmt string)" );
- goto Done;
- }
-
- while ( size > 0 ) {
- /*
- * Copy characters until we encounter '%'.
- */
- while ( (c = *fmt++) != '%' ) {
- if ( size-- <= 0 || c == '\0' )
- goto Done;
- *p++ = c;
- }
-
- f_left = f_sign = f_space = f_zero = f_alternate = 0;
- someflag = 1;
-
- /*
- * Parse flags.
- */
- while ( someflag ) {
- switch ( *fmt ) {
- case '-': f_left = 1; fmt++; break;
- case '+': f_sign = 1; fmt++; break;
- case ' ': f_space = 1; fmt++; break;
- case '0': f_zero = 1; fmt++; break;
- case '#': f_alternate = 1; fmt++; break;
- default: someflag = 0; break;
- }
- }
-
- /*
- * Parse field width.
- */
- if ( (c = *fmt) == '*' ) {
- width = va_arg( ap, int );
- fmt++;
- } else if ( c >= '0' && c <= '9' ) {
- width = 0;
- while ( (c = *fmt++) >= '0' && c <= '9' ) {
- width *= 10;
- width += c - '0';
- }
- fmt--;
- } else {
- width = -1;
- }
-
- /*
- * Parse precision.
- */
- if ( *fmt == '.' ) {
- if ( (c = *++fmt) == '*' ) {
- precision = va_arg( ap, int );
- fmt++;
- } else if ( c >= '0' && c <= '9' ) {
- precision = 0;
- while ( (c = *fmt++) >= '0' && c <= '9' ) {
- precision *= 10;
- precision += c - '0';