Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 0 additions & 64 deletions 4_gdt/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,67 +23,3 @@ u16int inw(u16int port)
return ret;
}

// Copy len bytes from src to dest.
void memcpy(u8int *dest, const u8int *src, u32int len)
{
const u8int *sp = (const u8int *)src;
u8int *dp = (u8int *)dest;
for(; len != 0; len--) *dp++ = *sp++;
}

// Write len copies of val into dest.
void memset(u8int *dest, u8int val, u32int len)
{
u8int *temp = (u8int *)dest;
for ( ; len != 0; len--) *temp++ = val;
}

// Compare two strings. Should return -1 if
// str1 < str2, 0 if they are equal or 1 otherwise.
int strcmp(char *str1, char *str2)
{
int i = 0;
int failed = 0;
while(str1[i] != '\0' && str2[i] != '\0')
{
if(str1[i] != str2[i])
{
failed = 1;
break;
}
i++;
}
// why did the loop exit?
if( (str1[i] == '\0' && str2[i] != '\0') || (str1[i] != '\0' && str2[i] == '\0') )
failed = 1;

return failed;
}

// Copy the NULL-terminated string src into dest, and
// return dest.
char *strcpy(char *dest, const char *src)
{
do
{
*dest++ = *src++;
}
while (*src != 0);
}

// Concatenate the NULL-terminated string src onto
// the end of dest, and return dest.
char *strcat(char *dest, const char *src)
{
while (*dest != 0)
{
*dest = *dest++;
}

do
{
*dest++ = *src++;
}
while (*src != 0);
return dest;
}
2 changes: 1 addition & 1 deletion 4_gdt/descriptor_tables.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ static void init_idt()
idt_ptr.limit = sizeof(idt_entry_t) * 256 -1;
idt_ptr.base = (u32int)&idt_entries;

memset(&idt_entries, 0, sizeof(idt_entry_t)*256);
// memset(&idt_entries, 0, sizeof(idt_entry_t)*256);

idt_set_gate( 0, (u32int)isr0 , 0x08, 0x8E);
idt_set_gate( 1, (u32int)isr1 , 0x08, 0x8E);
Expand Down