-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuser.c
59 lines (48 loc) · 1.04 KB
/
user.c
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
#include <libc.h>
char buff[24];
int pid;
extern int zeos_ticks;
int add(int par1, int par2){
__asm__("movl 0x8(%ebp), %eax");
__asm__("addl 0xc(%ebp), %eax");
}
long inner(long n)
{
int i;
long suma;
suma = 0;
for (i = 0; i < n; ++i) suma = add(suma,i);
return suma;
}
long outer(long n)
{
int i;
long acum;
acum = 0;
for (i = 0; i < n; ++i) acum = add(acum,inner(i));
return acum;
}
extern int zeos_ticks = 0;
int __attribute__ ((__section__(".text.main")))
main()
{
/* Next line, tries to move value 0 to CR3 register. This register is a privileged one, and so it will raise an exception */
/* __asm__ __volatile__ ("mov %0, %%cr3"::"r" (0) ); */
char buff[24];
int b[42];
//itoa(res,b);
//write(1,b,20);
//read(0,buff,24);
runjp();
//READ tot OK
//runjp_rank(4,4);
//runjp_rank(15,15);
//Pasem 26 tests, en fallem 6
//clone(15,1000);
while(1) {
//int res = read(0,buff,1);
//itoa(res,b);
//write(1,buff,1);
}
return 0;
}