forked from Bananymous/banan-os
				
			Kernel: kernel doesn't allocate large blocks of data on stack
We used to allocate 1 KiB blocks on multiple places on stack. This is a problem, since kernel stack shouldn't have to be too big
This commit is contained in:
		
							parent
							
								
									69f13f1896
								
							
						
					
					
						commit
						7010d8614f
					
				| 
						 | 
				
			
			@ -557,7 +557,10 @@ argument_done:
 | 
			
		|||
			int fd = TRY(Process::current()->open(arguments[1], O_RDONLY));
 | 
			
		||||
			BAN::ScopeGuard _([fd] { MUST(Process::current()->close(fd)); });
 | 
			
		||||
 | 
			
		||||
			char buffer[1024] {};
 | 
			
		||||
			char* buffer = new char[1024];
 | 
			
		||||
			BAN::ScopeGuard buffer_guard([buffer] { delete[] buffer; });
 | 
			
		||||
			ASSERT(buffer);
 | 
			
		||||
 | 
			
		||||
			while (size_t n_read = TRY(Process::current()->read(fd, buffer, sizeof(buffer))))
 | 
			
		||||
				TTY_PRINT("{}", BAN::StringView(buffer, n_read));
 | 
			
		||||
			TTY_PRINTLN("");
 | 
			
		||||
| 
						 | 
				
			
			@ -621,7 +624,10 @@ argument_done:
 | 
			
		|||
				return {};
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			uint8_t buffer[1024];
 | 
			
		||||
			uint8_t* buffer = new uint8_t[1024];
 | 
			
		||||
			BAN::ScopeGuard buffer_guard([buffer] { delete[] buffer; });
 | 
			
		||||
			ASSERT(buffer);
 | 
			
		||||
 | 
			
		||||
			for (size_t i = 1; i < arguments.size(); i++)
 | 
			
		||||
			{
 | 
			
		||||
				int fd = TRY(Process::current()->open(arguments[i], O_RDONLY));
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -58,6 +58,10 @@ namespace Kernel
 | 
			
		|||
	{
 | 
			
		||||
		register_bus_irq_handler(this, irq);
 | 
			
		||||
 | 
			
		||||
		uint16_t* identify_buffer = new uint16_t[256];
 | 
			
		||||
		ASSERT(identify_buffer);
 | 
			
		||||
		BAN::ScopeGuard _([identify_buffer] { delete[] identify_buffer; });
 | 
			
		||||
 | 
			
		||||
		for (uint8_t i = 0; i < 2; i++)
 | 
			
		||||
		{
 | 
			
		||||
			m_devices[i] = new ATADevice(this);
 | 
			
		||||
| 
						 | 
				
			
			@ -66,7 +70,7 @@ namespace Kernel
 | 
			
		|||
 | 
			
		||||
			BAN::ScopeGuard guard([this, i] { m_devices[i]->unref(); m_devices[i] = nullptr; });
 | 
			
		||||
 | 
			
		||||
			uint16_t identify_buffer[256];
 | 
			
		||||
			
 | 
			
		||||
			auto type = identify(device, identify_buffer);
 | 
			
		||||
			if (type == DeviceType::None)
 | 
			
		||||
				continue;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -38,8 +38,9 @@ namespace Kernel
 | 
			
		|||
	{
 | 
			
		||||
		m_width = m_terminal_driver->width();
 | 
			
		||||
		m_height = m_terminal_driver->height();
 | 
			
		||||
		
 | 
			
		||||
 | 
			
		||||
		m_buffer = new Cell[m_width * m_height];
 | 
			
		||||
		ASSERT(m_buffer);
 | 
			
		||||
 | 
			
		||||
		if (s_tty == nullptr)
 | 
			
		||||
			s_tty = this;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue