forked from xamidev/pepperOS
comments
This commit is contained in:
@@ -34,7 +34,7 @@ struct spinlock_t term_lock = {0};
|
|||||||
extern int panic_count;
|
extern int panic_count;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* _putchar - Writes a character to terminal
|
* _putchar - Writes a character to terminal (DEPRECATED)
|
||||||
* @character: character to write
|
* @character: character to write
|
||||||
*/
|
*/
|
||||||
void _putchar(char character)
|
void _putchar(char character)
|
||||||
@@ -43,6 +43,14 @@ void _putchar(char character)
|
|||||||
flanterm_write(ft_ctx, &character, 1);
|
flanterm_write(ft_ctx, &character, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* internal_putc - Internal putchar function
|
||||||
|
* @c: char to print
|
||||||
|
* @_: (unused, for nanoprintf)
|
||||||
|
*
|
||||||
|
* Prints a character to the terminal if it's ready,
|
||||||
|
* and also to the serial interface if it's ready.
|
||||||
|
*/
|
||||||
void internal_putc(int c, void *_)
|
void internal_putc(int c, void *_)
|
||||||
{
|
{
|
||||||
(void)_;
|
(void)_;
|
||||||
@@ -58,7 +66,6 @@ void internal_putc(int c, void *_)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (init.serial) {
|
if (init.serial) {
|
||||||
if (ch == '\n') {
|
if (ch == '\n') {
|
||||||
skputc('\r');
|
skputc('\r');
|
||||||
@@ -67,6 +74,16 @@ void internal_putc(int c, void *_)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* printf - Fromatted printing
|
||||||
|
* @fmt: format string
|
||||||
|
* @...: variadic arguments
|
||||||
|
*
|
||||||
|
* Wrapper for nanoprintf
|
||||||
|
*
|
||||||
|
* Return:
|
||||||
|
* <ret> - number of characters sent to the callback
|
||||||
|
*/
|
||||||
int printf(const char* fmt, ...)
|
int printf(const char* fmt, ...)
|
||||||
{
|
{
|
||||||
va_list args;
|
va_list args;
|
||||||
|
|||||||
@@ -9,6 +9,13 @@
|
|||||||
#include "kernel.h"
|
#include "kernel.h"
|
||||||
#include "spinlock.h"
|
#include "spinlock.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* spinlock_acquire - Lock a lock
|
||||||
|
* @lock: pointer to desired spinlock
|
||||||
|
*
|
||||||
|
* Saves the RFLAGS register, then acquires a lock.
|
||||||
|
* Pause instruction is used to ease the CPU.
|
||||||
|
*/
|
||||||
void spinlock_acquire(struct spinlock_t* lock)
|
void spinlock_acquire(struct spinlock_t* lock)
|
||||||
{
|
{
|
||||||
uint64_t rflags;
|
uint64_t rflags;
|
||||||
@@ -21,6 +28,14 @@ void spinlock_acquire(struct spinlock_t* lock)
|
|||||||
lock->rflags = rflags;
|
lock->rflags = rflags;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* spinlock_release - Unlock a lock
|
||||||
|
* @lock: pointer to desired spinlock
|
||||||
|
*
|
||||||
|
* Gets saved RFLAGS register from the lock and
|
||||||
|
* unlocks it (clears locked state).
|
||||||
|
* RFLAGS is then restored.
|
||||||
|
*/
|
||||||
void spinlock_release(struct spinlock_t* lock)
|
void spinlock_release(struct spinlock_t* lock)
|
||||||
{
|
{
|
||||||
uint64_t rflags = lock->rflags;
|
uint64_t rflags = lock->rflags;
|
||||||
|
|||||||
Reference in New Issue
Block a user