mirror of
https://github.com/usatiuk/ficus.git
synced 2025-10-29 00:27:52 +01:00
C++ test
This commit is contained in:
@@ -73,10 +73,9 @@ void SerialTty::this_isr() {
|
||||
|
||||
char SerialTty::readchar() {
|
||||
mutex.lock();
|
||||
if (buf.empty()) {
|
||||
while (buf.empty()) {
|
||||
readercv.wait(mutex);
|
||||
}
|
||||
assert(!buf.empty());
|
||||
char ret = buf.pop_back();
|
||||
mutex.unlock();
|
||||
return ret;
|
||||
|
||||
@@ -93,13 +93,12 @@ uint64_t syscall_read(uint64_t fd, char *buf, uint64_t len) {
|
||||
while ((c - buf) < len) {
|
||||
*c = GlobalTtyManager.get_tty(0)->readchar();
|
||||
if (*c == '\r') {
|
||||
*(c) = '\n';
|
||||
*(++c) = '0';
|
||||
*(c++) = '\n';
|
||||
break;
|
||||
}
|
||||
c++;
|
||||
}
|
||||
return (c-buf);
|
||||
return (c - buf);
|
||||
}
|
||||
auto f = FDT::current()->get(fd);
|
||||
if (!f) return -1;
|
||||
@@ -113,6 +112,7 @@ uint64_t syscall_write(uint64_t fd, const char *buf, uint64_t len) {
|
||||
GlobalTtyManager.all_tty_putchar(*c);
|
||||
c++;
|
||||
}
|
||||
return len;
|
||||
}
|
||||
auto f = FDT::current()->get(fd);
|
||||
if (!f) return -1;
|
||||
|
||||
@@ -5,5 +5,5 @@ target_link_libraries(init syscalls_interface)
|
||||
|
||||
target_include_directories(init PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
add_executable(hello2 hello2.c)
|
||||
add_executable(hello2 hello2.cpp)
|
||||
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
#include "stdio.h"
|
||||
|
||||
int main() {
|
||||
printf("Hi!\n");
|
||||
}
|
||||
5
src/test/hello2.cpp
Normal file
5
src/test/hello2.cpp
Normal file
@@ -0,0 +1,5 @@
|
||||
#include <iostream>
|
||||
|
||||
int main() {
|
||||
std::cout << "Hi!" << std::endl;
|
||||
}
|
||||
Reference in New Issue
Block a user