26 lines
531 B
C
26 lines
531 B
C
#include <stdint.h>
|
|
#include <string.h>
|
|
|
|
int main();
|
|
|
|
asm(".section .init \n"
|
|
".global _start \n"
|
|
"_start: \n\t"
|
|
"mov %cs, %ax \n\t"
|
|
"mov %ax, %ds \n\t"
|
|
"mov %ax, %es \n\t"
|
|
"cli \n\t"
|
|
"mov %ax, %ss \n\t"
|
|
"mov $0x1000, %ax \n\t"
|
|
"mov %ax, %sp \n\t"
|
|
"sti \n\t"
|
|
"jmp main");
|
|
|
|
void* memset(void* ptr, int val, size_t len) {
|
|
uint8_t* p = ptr;
|
|
while (len--) {
|
|
*p++ = val;
|
|
}
|
|
return ptr;
|
|
}
|