Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'master' of github.com:ath88/minix

  • Loading branch information...
commit 6c9efe061e2a710b1919c633624cba5d9c982f61 2 parents 4db899f + 09ed4b3
@andreasbock authored
View
49 kernel/ebprofile.c
@@ -16,12 +16,13 @@
void
set_internals(message *m_ptr)
{
-(void)fprintf(stdout,"Set internals1\n");
+printf("Set internals1\n");
ebp_bm = m_ptr->EBP_BITMAP;
ebp_first = (ebp_sample_buffer*) m_ptr->EBP_BUFFER1;
ebp_second = (ebp_sample_buffer*) m_ptr->EBP_BUFFER2;
ebp_relevant_buffer = (unsigned int*) m_ptr->EBP_RELBUF;
-(void)fprintf(stdout,"Set internals2\n");
+printf("Set internals, bitmap = %d, first = 0x%x, second = 0x%x, relbuf = 0x%x\n",ebp_bm,ebp_first,ebp_second,ebp_relevant_buffer);
+printf("Set internals, relbuf = %d\n",*ebp_relevant_buffer);
return;
}
@@ -29,26 +30,26 @@ set_internals(message *m_ptr)
kcall_sample
get_next_slot()
{
-(void)fprintf(stdout,"get_next_slot0\n");
+fprintf(stdout,"get_next_slot0\n");
kcall_sample free_sample;
-(void)fprintf(stdout,"get_next_slot1\n");
- (void)fprintf(stdout,"relevant buffer is at %d\n",(int)ebp_relevant_buffer);
- (void)fprintf(stdout,"relevant buffer is %d\n",*ebp_relevant_buffer);
- if (*ebp_relevant_buffer == 0)
- {
-(void)fprintf(stdout,"get_next_slot11\n");
- free_sample = ebp_first->sample[ebp_first->reached];
+printf("get_next_slot1\n");
+printf("relevant buffer is at %d\n",(int)ebp_relevant_buffer);
+//printf("relevant buffer is %d\n",*ebp_relevant_buffer);
+// if (*ebp_relevant_buffer == 0)
+// {
+printf("get_next_slot11\n");
+// free_sample = ebp_first->sample[ebp_first->reached];
ebp_first->reached++;
-(void)fprintf(stdout,"get_next_slot12\n");
- }
- else
- {
-(void)fprintf(stdout,"get_next_slot13\n");
- free_sample = ebp_second->sample[ebp_second->reached];
+printf("get_next_slot12\n");
+// }
+// else
+// {
+printf("get_next_slot13\n");
+// free_sample = ebp_second->sample[ebp_second->reached];
ebp_second->reached++;
-(void)fprintf(stdout,"get_next_slot14\n");
- }
-(void)fprintf(stdout,"get_next_slot2\n");
+printf("get_next_slot14\n");
+// }
+printf("get_next_slot2\n");
return free_sample;
}
@@ -66,13 +67,15 @@ ebp_collect (message * m_user, struct proc *caller)
{
kcall_sample sample;
- mutex_lock();
- sample = get_next_slot();
+// fprintf(stdout,"collecting");
+
+// mutex_lock();
+// sample = get_next_slot();
/* Collect profiling data */
//sample.time =
- sample.kcall = m_user->m_type; // This might be incorrect
- sample.p_nr = caller->p_nr;
+// sample.kcall = m_user->m_type; // This might be incorrect
+// sample.p_nr = caller->p_nr;
//sample.p_endpoint = caller->p_endpoint;
//sample.params =
//sample.cpu = caller->p_cpu;
View
2  kernel/ebprofile.h
@@ -49,7 +49,7 @@ typedef struct
} ebp_sample_buffer;
/* kernel functions */
-void set_ebprof(int bitmap);
+void set_internals(message * mptr);
void *get_active_buffer(void);
int ebprofiling(void);
int ebp_collect (message * m_user, struct proc *caller);
View
4 kernel/system.c
@@ -112,7 +112,7 @@ PRIVATE int kernel_call_dispatch(struct proc * caller, message *msg)
call_nr,msg->m_source);
result = EBADREQUEST; /* illegal message type */
}
- else if (!GET_BIT(priv(caller)->s_k_call_mask, call_nr)) {
+ else if ((call_nr != 56) && !GET_BIT(priv(caller)->s_k_call_mask, call_nr)) {
printf("SYSTEM: denied request %d from %d.\n",
call_nr,msg->m_source);
result = ECALLDENIED; /* illegal message type */
@@ -160,7 +160,7 @@ PUBLIC void kernel_call(message *m_user, struct proc * caller)
}
#if EBPROFILE
- if (ebprofiling() == 1 && matches_bm(m_user->m_type))
+// if (ebprofiling() == 1 && matches_bm(m_user->m_type))
ebp_collect(m_user, caller);
#endif /* EBPROFILE */
View
5 kernel/system/do_ebprofile.c
@@ -22,7 +22,7 @@ int do_ebprofile(struct proc * caller, message * m_ptr)
{
/* Handle sys_ebprofile.
*/
- (void)fprintf(stdout,"do_ebprofile in kernel/sysem/do_ebprofile.c\n");
+ printf("do_ebprofile in kernel/sysem/do_ebprofile.c\n");
void *buffer1 = m_ptr->EBP_BUFFER1;
void *buffer2 = m_ptr->EBP_BUFFER2;
int bitmap = m_ptr->EBP_BITMAP;
@@ -32,14 +32,17 @@ int do_ebprofile(struct proc * caller, message * m_ptr)
if (m_ptr->EBP_BUFFER1 == NULL &&
m_ptr->EBP_BUFFER1 == NULL && m_ptr->EBP_BITMAP == 0)
{
+ printf("turning off ebprofiling\n");
set_internals(m_ptr);
return(OK);
}
/* if not, enable and set buffer & flags appropriately */
+ printf("setting internals for ebprofiling\n");
set_internals(m_ptr);
+ printf("returnings from ebprofiling in sysexm/do_ebprofilesd\n");
return(OK);
}
View
11 lib/libebp/ebp.c
@@ -5,6 +5,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
+#include <lib.h>
#include <minix/ebp.h>
#include <minix/syslib.h>
#include <minix/callnr.h>
@@ -35,7 +36,7 @@ ebp_start (int bitmap)
(void)fprintf(stdout,"LIB start2\n");
/* Set profiling flag */
- bitmap &= 0x1;
+ bitmap &= 0xFFF;
(void)fprintf(stdout,"LIB start3\n");
/* do syscall */
@@ -43,9 +44,11 @@ ebp_start (int bitmap)
m.EBP_BUFFER2 = buffers->second;
m.EBP_RELBUF = relevant_buffer;
m.EBP_BITMAP = bitmap;
-
- (void)fprintf(stdout,"LIB start4\n");
- _syscall(PM_PROC_NR, EBPROF, &m);
+ m.m_type = SYS_EBPROF;
+ (void)fprintf(stdout,"LIB start4 newer\n");
+ sleep(1);
+ _do_kernel_call(&m);
+// _syscall(PM_PROC_NR, EBPROF, &m);
(void)fprintf(stdout,"LIB start5\n");
return buffers;
}
Please sign in to comment.
Something went wrong with that request. Please try again.