[OSy] pomoooc KoHlTo!!
Vaclav Klecanda
vencax at centrum.cz
Mon Jan 8 20:13:05 CET 2007
Porad se nam nedari prekonat zakladni problem. Porsim o pomoc autory KoHlTo, aby nam poradili.
Vzali sme jejich kernel a jedine co jsme upravili je v kodu (viz. dole)
ocekaval bych, ze se oba thready vytvori, pak se nakopiruje pamet a pak se zacne switchovat mezi vyposavanim 1 nebo 2. threadu. Jenze behem kopirovani se to zastavi... muze mi nekdo z autoru KoHlTa rict proc? Co tedy vlastne thread_create_new_map udela, nebo jestli ho pouzivame spatne?? Diky
/* jedina vec, co jsme zmenili */
#define PROGRAM_BEGIN_ADDRESS 0x00000000
#define CODE_SEGMENT_SIZE (32*1024)
#define EXT_DEVICE_BEGIN 0x90000000
copyProgram( void)
{
int retVal;
uint8_t * src;
uint8_t * dest;
size_t i;
/* adress of code segment begin */
uint8_t *where = (uint8_t *)PROGRAM_BEGIN_ADDRESS;
retVal = vmalloc(&where, CODE_SEGMENT_SIZE,
(VF_VA_USER << VF_VA_SHIFT) | (VF_AT_KUSEG << VF_AT_SHIFT) );
if( retVal != EOK)
{
dprintk("CODE_SEGMENT allocation error!\n");
return retVal;
}
src = (uint8_t *)EXT_DEVICE_BEGIN;
dest = (uint8_t *)PROGRAM_BEGIN_ADDRESS;
for(i = 0; i < (CODE_SEGMENT_SIZE / sizeof(uint8_t)); i++)
{
dest[i] = src[i];
}
return EOK;
}
/* plus v main.c misto:
if (thread_create_new_map(&t, assignment_test, NULL) != EOK) {
panic("Cannot create test thread - Not enough memory.\nSystem halted.\n");
}
je:
if (thread_create_new_map(&t, idle_thread2, NULL) != EOK) {
panic("Cannot create test thread - Not enough memory.\nSystem halted.\n");
}
if( EOK != copyProgram() )
panic("Copy se podelal!\n");
s tim, ze idle_thread2 a idle_thread aktivne vypisuji: "jak sem thred #1"(popr.2)
*/
More information about the NSWI004
mailing list