Initial commit
This commit is contained in:
		
							
								
								
									
										3
									
								
								kernel/Makefile.inc
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								kernel/Makefile.inc
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,3 @@ | ||||
| KERNEL_PREFIX = kernel | ||||
|  | ||||
| KOBJS += $(KERNEL_PREFIX)/hello.o | ||||
							
								
								
									
										23
									
								
								kernel/hello.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								kernel/hello.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,23 @@ | ||||
| #define SERIAL_BASE 0x16000000 | ||||
| #define SERIAL_FLAG_REGISTER 0x18 | ||||
| #define SERIAL_BUFFER_FULL (1 << 5) | ||||
|   | ||||
| void putc (char c) | ||||
| { | ||||
|     /* Wait until the serial buffer is empty */ | ||||
|     while (*(volatile unsigned long*)(SERIAL_BASE + SERIAL_FLAG_REGISTER)  | ||||
|                                        & (SERIAL_BUFFER_FULL)); | ||||
|     /* Put our character, c, into the serial buffer */ | ||||
|     *(volatile unsigned long*)SERIAL_BASE = c; | ||||
| } | ||||
|   | ||||
| void puts (const char * str) | ||||
| { | ||||
|     while (*str) putc (*str++); | ||||
| } | ||||
|   | ||||
| int main (void) | ||||
| { | ||||
|     puts ("hello, world!\n"); | ||||
|     return 0; | ||||
| } | ||||
		Reference in New Issue
	
	Block a user